In VIM there is a command for char search: f
. After first use it can be repeated with ;
. I like to navigate in line with it. You see that you need to go to bracket in a middle of a line - you press f(
and one-two ;
and you are there. There's no such command in Emacs, so I had to write my own. I've managed even to implement repetition with ;
.
(setq last-search-forward-char nil)
(defun search-forward-char-continue ()
(interactive)
(if (and last-search-forward-char (or (eq (symbol-function last-command) (symbol-function 'search-forward-char))
(eq last-command this-command)))
(search-forward-char last-search-forward-char)
(progn
(insert ";")
(setq last-search-forward-char nil))))
(global-set-key (kbd "M-s") 'search-forward-char)
(global-set-key (kbd ";") 'search-forward-char-continue)
Key word here is last-command
. Using the same principle other commands also can be assigned to same key.