I know how to search for text in visual mode in Vim/Neovim. However, I find it unnecessary when I am in insert mode to have to exit it, search and then come back to insert mode.

Is there a way to conduct search in the insert mode (without exiting it)?

  • Please try to get used to a modal editor and its concepts. Dec 26, 2023 at 15:03

1 Answer 1


While is insert mode you can use the Ctrl o to escape for one action and automatically come back to insert mode right after.

Ctrl o/fooEnter move the cursor to the next occurrence of foo but stay in insert mode.

Ctrl on move the cursor to the next occurrence of the previous search.

You can add insert mode mapping to ease the access to the trick:

" Ctrl-f to search for the next occurrence
inoremap <C-f> <C-o>/
" Ctrl-r to search for the previous occurrence
inoremap <C-r> <C-o>?

Remark: It is probably not very wise to override Ctrl r since Ctrl r* is used to paste the system clipboard (the * register) in insert mode (:help i_CTRL-R).

Remark: Ctrl f is used in insert mode to re-indent the line in insert mode (:help i_CTRL-F)

  • 1
    Thanks! So, perhaps, it should be possible to tie this to a single key stroke (such as Ctrl-F in insert mode to the search for a string?) Also, the reverse search could be done with Ctrl-R? Dec 26, 2023 at 14:05
  • 1
    @user3236841 you could, but then you lose the useful default functionality of those keys in Insert mode. I recommend trying to get used to being in Normal mode most of the time.
    – D. Ben Knoble
    Dec 26, 2023 at 14:33
  • 1
    I'd suggest to try to use Vim like it was meant to be used, e.g. make use of different modes and don't try to convert it to something totally different. Ctrl-F and Ctrl-R in insert mode already have a meaning, which you will lose if you map to it. Dec 26, 2023 at 15:01
  • 1
    thanks, @VivianDeSmedt! Nice demo. Dec 26, 2023 at 15:47
  • 1
    @D.BenKnoble, thanks! OK, I did not realize that these were already mapped. I will try something else. Though I also feel that one of the key efficiencies is by having some common keybindings across applications, especailly for long-time users of something else like me. I don't feel dogmatic about things, as long as clarity can be maintained. Dec 26, 2023 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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