缓冲区菜单,在Emacs中选择一组文件名 [英] Buffer menu to select a set of filenames in Emacs
问题描述
我有一个目录a
与一组模板,例如
code> $ ls a
b bcc cc ccdd
我想实现一个Emacs中的键盘快捷键将显示具有模板名称的缓冲区,与 dired
或缓冲区菜单
类似,然后能够使用箭头键或鼠标选择模板名称。然后将所选模板插入到当前缓冲区中。
如何做?
insert-file
,绑定到 Cx i
默认情况下,可以插入一个文件你的缓冲区在点,但它不给你一个不错的菜单。 helm
和 ido
增强了这种行为。
helm
不附带Emacs,但可以通过MELPA安装。当 helm-mode
有效时, insert-file
使用Helm的缩小功能。一旦您进入 a
目录,上下键可用于选择文件, Enter 将插入。 Emacs附带的p>
ido
当 ido-mode
有效时, Cx i
反弹到 ido-insert-file
。一旦您进入 a
目录,左键和右键可用于选择文件, Enter 将插入。 p>
这两种工具都非常出色,可以在许多其他情况下使用,同时提供有效的过滤和导航。尝试一个或两个,并使用您喜欢的。
I have a directory "a"
with a set of templates, for instance
$ ls a
b bcc cc ccdd
I would like to implement a keyboard shortcut in Emacs that will show a buffer with the template names, similar to dired
or buffer-menu
and then be able to select a template name by using arrow keys or mouse. Then insert the selected template into the current buffer at point.
How can this be done?
insert-file
, bound to C-x i
by default, can insert a file into your buffer at point, but it doesn't give you a nice menu. Both helm
and ido
enhance this behaviour.
helm
does not come with Emacs, but it can be installed via MELPA. When helm-mode
is active, insert-file
uses Helm's narrowing features. Once you're in the a
directory, the up and down keys may be used to select a file, and Enter will insert it.
ido
is shipped with Emacs. When ido-mode
is active, C-x i
is rebound to ido-insert-file
. Once you're in the a
directory, the left and right keys may be used to select a file, and Enter will insert it.
Both tools are excellent, both can be used in many other situations, and both offer effective filtering and navigation. Try one or both and use whichever you prefer.
这篇关于缓冲区菜单,在Emacs中选择一组文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!