从emacs中调用vim或TextMate

4

我已经使用vi很长一段时间了,有时候在Mac上我会用TextMate,最后,我发现了emacs的伟大之处。而且,很可能我会在emacs上定居。

问题是,有时候我需要另一个(vi / TextMate)编辑器来做某些事情。不是emacs没有这个功能,只是我现在需要这个功能,而且我知道如何在“其他”编辑器中实现它。同样的道理也适用于另一个编辑器。

我的问题是如何从一个编辑器启动另一个编辑器。这不仅仅是启动应用程序,而是启动正在编辑的文件的应用程序。

  • 我如何从emacs启动vi或TextMate(mate)?
  • 我如何从vi启动emacs或mate?
  • 我如何从TextMate启动vi或emacs?

添加

在Jérôme Radix的答案之后,我想出了以下命令。

(defun runmate ()
  (interactive)
  (runeditor "/Users/smcho/bin/mate"))
(defun runeditor (editor) (let (filename (file-truename buffer-file-name)) (setq cmd (format "%s %s" editor (file-truename buffer-file-name))) (save-window-excursion (async-shell-command cmd))))
1个回答

4
我该如何在emacs中启动vi或TextMate(mate)?
(async-shell-command "vi")  ;; From Emacs 23.2

(shell-command "vi &")  ;; Before Emacs 23.2

要启动TextMate,您需要安装TextMate的命令行工具,然后从emacs中运行以下命令(感谢Chetan):

(async-shell-command "mate") ;; From Emacs 23.2 

(shell-command "mate &") ;; Before Emacs 23.2

但最好的做法是同时打开这三个编辑器并在它们之间切换。


1
要启动TextMate,您需要安装TextMate的命令行工具,然后从emacs中执行以下操作: (async-shell-command "mate") ;; 对于Emacs 23.2 或者 (shell-command "mate &") ;; 在Emacs 23.2之前 - Chetan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接