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/foo
Enter 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
)