10

I am using emacs prelude.

I recently decided to switch to helm from ido.

So I enabled helm and helm-everywhere in emacs prelude,

Everything works perfectly, except the default behavior of helm-find-file

In Ido, I could hit retto 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.

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.

I don't want to switch back to ido because I really love helm's grep feature in find-file.

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?

Community
  • 1
  • 1
LoveProgramming
  • 2,121
  • 3
  • 18
  • 25

1 Answers1

10

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)

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)))
nivekuil
  • 300
  • 2
  • 10
  • Thanks! The first one works great, but the second one always open the third item in list. Also, I tried helm-adaptive-mode but it does't seem to work with helm-find-file – LoveProgramming Dec 26 '14 at 07:45
  • 1
    By first item I meant the first item that isn't /. or /.. Is that what you meant by getting to the final destination with ret ret ret? – nivekuil Dec 26 '14 at 09:12
  • @nivekuil would you be able to help with: http://stackoverflow.com/questions/28175154/emacs-ow-can-i-helm-find-with-default-directory-pre-specified ? – Leo Ufimtsev Jan 27 '15 at 16:25
  • 1
    See here http://emacs.stackexchange.com/questions/3798/how-do-i-make-pressing-ret-in-helm-find-files-open-the-directory/7896#7896 – f00860 Feb 02 '15 at 20:29
  • To make TAB work in a terminal you also need `(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)`. See: http://tuhdo.github.io/helm-intro.html – Marcus Junius Brutus Dec 14 '15 at 16:35