1

I have remapped the EasyMotion commands ,,w and ,,b with the following:

imap ,w <ESC><leader><leader>w

imap ,b <ESC><leader><leader>b

This way i'm able to use EasyMotion in Insert mode and navigate quickly without entering Normal mode.

Though, after the move, Vim stays in Normal mode (naturally). How can I specify that after EasyMotion's employment, Vim should enter Insert mode, in order to continue typing without delay?

Thanx!

  • Doesn't appending `a` (or `i`) after the mappings work for you? – Ingo Karkat Sep 25 '14 at 09:28
  • Nope. when I press `,w` the EasyMotion is applied (that is the intention of the mapping), but after moving (through the EasyMotion) i result in Normal mode. I guess I have to manipulate EasyMotion itself, but don't know how. – Manos Tsardoulias Sep 25 '14 at 09:39
  • Just came up to mind: perhaps using `i_CTRL-o` (execute one command, return to insert mode) can be helpful. Although I'm not sure this is the proper way of doing it, with `:inoremap ,, ::normal! fs` you can move the cursor to the nearest `s` in insert mode by pressing `,,`(I'm not familiar with easymotion, so I replaced that with the motion with `f`). – Yosh Sep 25 '14 at 10:53
  • 1
    I feel like this goes against the Vim Way. Why avoid normal mode? I understand you are trying to avoid keystrokes, which is a commendable goal, but where does this imap-ing stop? Are you going to want to do undo's/page motions/case transforms/jumps/deletions/... while in insert mode? The advantage of normal mode is that you spend most of your time in it a it provides you wonderful language to do movements and operations on your text. It be a key stroke or so, but I believe that avoiding normal mode will create some bad habits and will be like swimming upstream – Peter Rincker Sep 25 '14 at 14:01

1 Answers1

5

You can use <C-o> to execute one normal mode command from insert mode. Once this command has been executed, you will be returned to insert mode:

imap ,w <C-o><leader><leader>w
imap ,b <C-o><leader><leader>b
Zach
  • 4,652
  • 18
  • 22
  • Depending on the application it may also be worth adding `u` to break up an undo block. e.g. `imap ,w uw`. See `:h undo-blocks` and `:h i_ctrl-g_u` for mor information. – Peter Rincker Sep 25 '14 at 14:12
  • very handy. Also for going into insertmode after movement in normal mode: `nmap i i(easymotion-overwin-f)i` – DZet May 16 '20 at 15:37