How to bind 'search' and 'search-repeat' to C-f in Emacs?

后端 未结 2 1953
暗喜
暗喜 2020-12-17 09:36

How can I to remap incremental search (C-s) to C-f in Emacs?

I try to do (global-set-key (kbd \"C-f\") \'isearch-forward) but the

相关标签:
2条回答
  • 2020-12-17 10:15

    (define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)

    0 讨论(0)
  • 2020-12-17 10:26

    isearch-repeat-forward is defined in the isearch-mode-map

    To resolve your problem do the following :

    (global-set-key (kbd "C-f") 'isearch-forward)
    
    (add-hook 'isearch-mode-hook
     (lambda ()
     (define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
     )
    )
    

    EDIT: actually, you don't need to add a hook. The accepted answer by Ross Patterson is correct.

    0 讨论(0)
提交回复
热议问题