I often escape insert mode only to change the current line's indent by pressing >> or << and then immediately go back to writing. I wanted to make this easier, so I included these lines on my config:

inoremap <tab> <esc>>>a
inoremap <S-tab> <esc><<a

But, for some reason, whenever you << or >>, Vim moves the cursor to the start of the line as if you had pressed ^. Is there a way to prevent this?

2 Answers 2


This behavior is determined by the 'startofline' option. Set it to off, if you don't want that.


Found it! <C-t> and <C-d> are used to indent and outdent from insert mode.

This snippet creates the behavior I was looking for:

inoremap <tab> <C-t>
inoremap <S-tab> <C-d>
  • 1
    Thanks @exvx, add those lines to your .vimrc file. That did it for me.
    – Y.Luktuke
    Jun 6, 2020 at 15:45

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.