1

Windows 10, Emacs 25.1, Dired+, Dired-K

Here my test folder:

dired

If I want to go folder test2 I press M-x and then C-s (I-search). Here result:

search

OK. It's work.

But... I think it's slow. It would be good if I can go to folder/file only by one letter. E.g. If I press s then I go to file searchview.png. If I quickly press st then go to file step1.png. And so on.

Is it possible in Emacs?

1

You say "I press M-x and then C-s". That can't be right. There is no reason to use M-x here. Just use C-s.

C-s s gives you what you want - it moves to file searchview.png. But if you want to be sure to search only file names (none of the other text in the buffer, then use M-s f C-s, which is bound to command dired-isearch-filenames.

If you want to use only a single key to initiate such a search, bind dired-isearch-filenames to an unused single key. For example:

(define-key dired-mode-map (kbd "<f12>") 'dired-isearch-filenames)

Then <f12> s takes you directly to file searchview.png and <f12> st takes you to file step1.png.

If you don't like using a function key, such as <f12>, and if there is some other single key available or whose current binding you don't care about, then bind that key. For example, if you never use a, which is bound by default to dired-find-alternate-file, then bind a to dired-isearch-filenames instead. Then you can just use a s to get where you want.

If you want to be sure to match your search pattern only at the beginning of a file name (not in the middle) then start the pattern with a space char.

You can also use regexp matching, with M-s f C-M-s (command dired-isearch-filenames-regexp).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.