Emacs dired and Isearch mode

I recently discovered some features and ease of use of Emacs standby mode. But in Krusader, I just start pressing the first letter (folder) of the folder / file and press Enter, and so I go deeper, then look for another folder, focus, press enter until I find the file that should open.

How am I doing it now:

  • press Ctrl + S for isearch
  • click letters to search folder
  • press the enter key (or some other combination) once to exit I-search
  • press enter to enter the folder or open the file (to open the file, I know that I have other letters)

I really need to make it easier. So the main thing I want is when I click once to:

  • escape issearch
  • enter the folder (or open the file)

Of course, the second main thing will be BE by default in some kind of isearch mode with firmware, just to navigate, typing, and only when you press ESC in order to be in this mode, where there are single letters, command values. I am not sure that this second main thing is easy or recommended for training. But most importantly, I believe that this is doable with a few clever Lisp lines, which I don’t know :)

Thanks guys,

Stephen

+4
source share
3 answers

Here is one way to do the main thing :

(add-hook 'isearch-mode-end-hook (lambda () (when (and (eq major-mode 'dired-mode) (not isearch-mode-end-hook-quit)) (dired-find-file)))) 
+3
source

For the second main:

 (defadvice dired (after activate) (isearch-forward)) (ad-activate 'dired) (defadvice dired-find-file (after activate) (isearch-forward)) (ad-activate 'dired-find-file) (defadvice dired-up-directory (after activate) (isearch-forward)) (ad-activate 'dired-up-directory) 
+1
source

Mobility on the madala answers, you can approach the second main, combining fighters:

 (add-hook 'isearch-mode-end-hook (lambda () (when (and (eq major-mode 'dired-mode) (not isearch-mode-end-hook-quit)) (dired-find-file) (isearch-forward-regexp)))) 
0
source

Source: https://habr.com/ru/post/1332516/


All Articles