6

How to map i to start editing on visual block mode?

I want the same behavior for <shift>-i and i.

1 Answer 1

8

You can use :h map-expression to determine which version of visual mode you are in, and change the behaviour accordingly. Visual mode mapping

vnoremap <expr> i mode()=~'\cv' ? 'i' : 'I'

will make i act as i in visual and linewise-visual modes, and as I otherwise, i.e. in blockwise visual mode.

1
  • You can add <nowait> (<expr><nowait>) to make it quicker (won't wait for a timeout)
    – awvalenti
    Feb 19 at 15:37

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.