如何在目录内更改emacs helm-find-file默认操作而不是在dired中打开?

Lov*_*ing 8 emacs emacs-prelude emacs-helm

我正在使用emacs前奏曲.

我最近决定从ido切换到头盔.

所以我启用helmhelm-everywhere在emacs前奏中,

一切都很完美,除了默认行为 helm-find-file

在Ido,我可以点击ret选定目录,但我必须击中rightc-j掌舵.此外,helm-find-files将列出...在每个目录的最顶部.这意味着在ido中,ret ret ret如果沿路径的目录不多,我可以直到达到最终目的地.

但掌舵,我不得不输入一些字符,c-j打字类型至少1个字符,点击c-j等等.我甚至不能c-j连续打.

我不想切换回ido,因为我真的很喜欢find-file中的helm的grep功能.

无论如何我可以更改默认顺序,让它可能列表.,..在底部,并ret输入目录而不是打开直接?

niv*_*uil 9

您正在寻找的函数是(helm-execute-persistent-action),默认情况下绑定到Cz.有些人喜欢用tab切换它:

(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z") 'helm-select-action)
Run Code Online (Sandbox Code Playgroud)

如果您愿意,可以将其绑定到ret,但它不会按照您期望的方式打开文件.

至于你的另一个问题,我不知道helm是否有办法设置默认选择位置,但是从顶部选择第一项你可以这样做:

(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)))
Run Code Online (Sandbox Code Playgroud)