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
).