3

I am trying to configure Emacs to not only use CUA, but also for control-f to search exactly like control-s does in the standard configuration.

What I have achieved is that I can key in control-f and search for something and find it. However, when I press control-f twice, I do not find the next occurrence of the search string. (Like what happens when I in the original configuration press control-s twice.

Also, with control-s control-w I could mark a word and then search for it. This does not work either with control-f.

My configuration:

(global-set-key [(control f)] 'isearch-forward)

I am on Windows, if that matters. But ideally I would like to apply this to Mac and Linux too so I get the same keybindings on all my computers.

  • What C-s does in the standard configuration is not search-forward but isearch-forward. – Omar Jul 12 '18 at 18:14
  • @Omar, thanks - I accidentally wrote search-forward here, I meant isearch-forward. I manually typed the question instead of copying verbatim from the config file. – Prof. Falken Jul 12 '18 at 19:06
3

Apparently, we need not only (global-set-key [(control f)] 'isearch-forward) but also:

; isearch requires some customization to work with none default keys,
; since it uses its own keymap during a search.  These changes are *always*
; active, and not toggled with touchstream mode!  Luckly for us, the keys are
; we need are not used by isearch so there are no conflicts.
(define-key isearch-mode-map [(control f)] 'isearch-repeat-forward)

Source: http://fingerfans.dreamhosters.com/archive/attachments/5023_cnewcombe_emacs_like_windows.txt

  • 1
    I presume the two [(control f)] bindings are the only ones you need for your question as stated? – phils Jul 13 '18 at 9:06
  • @phils, yes. I removed the others from my block quote. – Prof. Falken Jul 13 '18 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.