Move to beginning and end of a search in Emacs

How can you get a point at the beginning or end of a search string when accepting a search?

So say you make Cs "foobar", I would like my cursor to be at the end of the found line when I press RET and at the beginning if I press C-RET.

thank

+4
source share
1 answer

Try the following:

(defun my-isearch-exit-other-end ()
  "Exit isearch at the other end"
  (interactive)
  (when isearch-forward (goto-char isearch-other-end))
  (isearch-exit))

(define-key isearch-mode-map (kbd "<C-return>") 'my-isearch-exit-other-end)
+2
source

All Articles