如何更改目录上的emacs helm-find-file默认操作,使其进入目录而不是直接打开? [英] How can I change emacs helm-find-file default action on directory to be go inside the directory instead of open in in dired?
问题描述
我正在使用emacs前奏.
I am using emacs prelude.
我最近决定从ido转向掌舵.
I recently decided to switch to helm from ido.
所以我在emacs前奏中启用了helm
和helm-everywhere
,
So I enabled helm
and helm-everywhere
in emacs prelude,
一切正常,除了helm-find-file
在Ido中,我可以按ret
进入所选目录,但是我必须亲自按right
或c-j
.
同样,helm-find-files
将在每个目录的最顶部列出.
和..
.
这意味着在ido中,如果路径上没有很多目录,我可以按ret
ret
ret
直到到达最终目的地.
In Ido, I could hit ret
to go down the selected directory, but I have to hit right
or c-j
in helm.
Also, helm-find-files
would list .
and ..
at the very top for every directory.
This means in ido, I can just hit ret
ret
ret
until I get to the final destination if there aren't many directories along the path.
但是在掌舵中,我必须键入一些字符,按c-j
键入至少1个字符,再按c-j
,依此类推.
我什至不能连续打c-j
.
But in helm, I had to type some chars, hit c-j
type at least 1 char, hit c-j
and so on.
I cannot even hit c-j
continuously.
我不想切换回ido,因为我真的很喜欢find文件中的helm的grep功能.
I don't want to switch back to ido because I really love helm's grep feature in find-file.
无论如何,我是否可以更改默认顺序以使它可能在底部列出.
和..
,并在ret
中输入目录而不是打开目录?
Is there anyway I can change the default order to have it maybe list .
and ..
at the bottom and ret
to enter directory instead of open dired?
推荐答案
您要查找的功能是(helm-execute-persistent-action),默认情况下绑定到C-z.有些人喜欢使用标签切换此设置:
The function you're looking for is (helm-execute-persistent-action), which is bound to C-z by default. Some people like to switch this with tab:
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z") 'helm-select-action)
如果愿意,您可以将其绑定到ret,但是它不会按照您期望的方式打开文件.
You can bind it to ret if you like, but it won't open files the way you expect it to.
关于您的其他问题,我不知道头盔是否可以设置默认选择位置,但是要从顶部选择第一项,您可以执行以下操作:
As for your other question, I don't know if helm has a way to set the default selection position, but to select the first item from the top you could do something like this:
(define-key helm-map (kbd "C-j")
(lambda ()
(interactive)
(helm-move-selection-common :where 'edge :direction 'previous)
(helm-move-selection-common :where 'line :direction 'next)
(helm-move-selection-common :where 'line :direction 'next)
(helm-execute-persistent-action)))
这篇关于如何更改目录上的emacs helm-find-file默认操作,使其进入目录而不是直接打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!