I've also used ido-mode
a lot and trained my muscle memory :) I think the ido
style is more intuitive than the helm
approach. I search for stuff (typing in some characters) and commit to the find (hit RET
), just like the search/address bar of my web browser. If the selection is a directory, I enter this directory and start searching again in this directory. This seems natural for me, so I've written a small advice around helm-execute-persistent-action
to force this mechanic.
(require 'helm)
(defun fu/helm-find-files-navigate-forward (orig-fun &rest args)
(if (and (equal "Find Files" (assoc-default 'name (helm-get-current-source)))
(equal args nil)
(stringp (helm-get-selection))
(not (file-directory-p (helm-get-selection))))
(helm-maybe-exit-minibuffer)
(apply orig-fun args)))
(advice-add 'helm-execute-persistent-action :around #'fu/helm-find-files-navigate-forward)
(define-key helm-find-files-map (kbd "<return>") 'helm-execute-persistent-action)
I've also optimize the backspace
key slightly. If I type something and want to do a correction, I hit backspace. This will delete one character. If I am on the beginning of the directory and hit backspace again, I navigate one level up. This speeds up the navigation dramatically!
(defun fu/helm-find-files-navigate-back (orig-fun &rest args)
(if (= (length helm-pattern) (length (helm-find-files-initial-input)))
(helm-find-files-up-one-level 1)
(apply orig-fun args)))
(advice-add 'helm-ff-delete-char-backward :around #'fu/helm-find-files-navigate-back)
To remove the useless .
and ..
at the very beginning, you can add it to the helm-boring-file-regexp-list
configuration variable.
ido-mode
, where pressing<RET>
selects the folder to find files inside it. I think this is the most consistent behavior when trying to find a file -- what you want to do when you've found the file is open it; what you want to do when you've found a folder is go inside it so you can find the file.<RET>
both autocompletes and selects. You don't have to hit<tab>
to finish completing the filename. But we're arguing over preferences -- I just want "enter" to mean "select the thing at point". And for me, that doesn't mean "open dired". If I was in a shell, I expect different behavior.