2

I know that you can navigate between empty lines with { and } on Normal and Visual mode, but there is a way to do this on Insert mode ?

Thanks!

1 Answer 1

1

The vim way to do this would be to type this in insert mode: ctrl-o + {. It tells vim that you want to execute a normal command and then be immediately returned to insert mode. You'll notice that it isn't much faster than just doing Esc + { and then going back into insert mode...

The reason that these { and } type motions exist in normal mode without such counterparts in insert mode is that the design of vim is fundamentally about dissociating 'navigating/editing existing text' from 'inserting new text' and thus has the normal mode and insert mode.

Since movement falls into the 'navigating/editing' category (where it usefully combines with the 'delete', 'change', yank' operators etc. to give so much power), there aren't so many movement commands available in insert mode - insert mode is for inserting text, not moving around the document.

The best way is to learn to hit Esc, move, and drop back into insert mode. If you're using the Esc key at the top left of the keyboard to switch modes, I understand that it must be tempting to go against the grain of vim and look to duplicate normal mode movements without leaving insert mode. That's why so many vim users remap some more convenient key to act as Esc (such as Capslock), or make dedicated insert mode mappings like jj or jk to move from insert mode to normal mode.

As a last pitch for just switching from insert to normal mode: even if you did have the { and } like motions in insert mode (or made an insert mode mapping to do it...), think of all the other motions you're training yourself not to use since you don't have them available in insert mode (0, ^, $, %, f/F, t/T)!

1
  • Thanks! It worked right away
    – Ulises
    Apr 27, 2021 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .