一千萬個為什麽

搜索

有沒有辦法縮進和突出線而不移動光標?

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  >>a
inoremap  <

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?

最佳答案

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

轉載註明原文: 有沒有辦法縮進和突出線而不移動光標?