Notepad++ 自动添加一个 shell 快捷方式,这样当您在 Windows 资源管理器中时,您可以右键单击一个文件并选择“使用 Notepad++ 编辑”。我怎样才能对 emacs 做同样的事情?我正在使用适用于 Windows 的 GNU Emacs 22.3。
最佳答案
这就是我所拥有的 - 类似于其他一些答案。在某处创建一个名为 emacs-conextmenu.reg(或任何你想要的.reg)的新文本文件并将以下内容粘贴到:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
@="&Edit with Emacs"
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
@="Absolute\\Path\\to\\your\\emacs\\bin\\emacsclientw.exe -n \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@="Edit &with Emacs"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@="Absolute\\Path\\to\\your\\emacs\\bin\\emacsclientw.exe -n \"%1\""
将路径更改为您的 emacs 安装路径;记得转义“\”(只要有\,请将其更改为\\)。
现在您需要做的就是在资源管理器中双击这个 *.reg 文件,您将有一个针对任何文件和任何目录的 emacs 上下文菜单条目(如果您是铁杆粉丝!)。
请注意,要使其正常工作,必须启动 emacs 并且还必须启动 emacs-server (M-x server-start)。我建议使用 Windows 启动 emacs 并将 (server-start) 放入您的 .emacs 文件中。
作为奖励,当您在 Windows 资源管理器中按 ctrl-shift-enter 键时,以下 autohotkey (http://www.autohotkey.com/) 片段将启动在 emacs 中选择的文件。如果您在 emacs 中编辑大量文件但不一定要导航到 emacs 本身中的文件,这可能会更方便。
#IfWinActive ahk_class CabinetWClass
^+Enter::
GetText(tmpvar)
If (tmpvar != "")
Run, d:/path/to/your/emacs/bin/dir/emacsclientw.exe -n "%tmpvar%"
Return
Return
关于windows - 如何创建右键单击上下文 shell 快捷方式 "edit with Emacs"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/455077/