移动到Emacs中搜索查找的开始和结束



接受搜索时,如何将点放在搜索字符串的开头或结尾?

假设你做的是C-"foobar",当我按下RET时,我希望光标位于找到的字符串的末尾,如果我按下C-RET,则光标位于字符串的开头。

感谢

试试这个:

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

最新更新