开发者

Vim: Different line-number color in the different modes

开发者 https://www.devze.com 2023-02-04 13:49 出处:网络
I\'ve just started using Vim and I find myself being confused on which mode I\'m curr开发者_开发百科ently in.I was wondering if it\'s possible to change the line number color (which I have displayed b

I've just started using Vim and I find myself being confused on which mode I'm curr开发者_开发百科ently in. I was wondering if it's possible to change the line number color (which I have displayed by default) in the different modes (command, visual, and insert) so that I can easily identify it.


Vim has an option called showmode that will put a message on the last line if you are not in normal mode. See :help 'showmode' for more info.

If you really want to change the background of the number column while in insert mode, you could do something like the following:

autocmd InsertEnter * highlight LineNr ctermbg=red   guibg=red
autocmd InsertLeave * highlight LineNr ctermbg=black guibg=black

Note that this method will break if you are bad and use C-c to exit insert mode instead of <Esc> or <C-[.

Relevant :help tags: autocmd, autocmd-events, highlight, highlight-groups

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号