开发者

Vim change block cursor when in insert mode

开发者 https://www.devze.com 2023-02-06 02:40 出处:网络
Not sure what the terminology is for 开发者_运维技巧it but on Vim the \'cursor\' is always like an insert/replace cursor instead of the blinking line cursor I\'m used to in other gui editors. Is there

Not sure what the terminology is for 开发者_运维技巧it but on Vim the 'cursor' is always like an insert/replace cursor instead of the blinking line cursor I'm used to in other gui editors. Is there any way to change this when in insert mode?


I know this is an old question but hopefully this will help anyone else facing the same scenario.

Actually I'm using iTerm2 and using Vim inside my terminal on Mac. And when entering to insert mode, the cursor still being a block and is kind of confusing when you are at insert mode or normal mode.

I wanted to show a thin line as cursor when in insert mode and back to block when in normal mode as MacVim does. And to do so it's pretty simple, just added this to my .vimrc file as described here:

let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"

Vim change block cursor when in insert mode

But as you can see there was a delay when hitting ESC to exit insert mode back to normal mode and show the block as cursor again. So to fix it I found this:

set ttimeout
set ttimeoutlen=1
set listchars=tab:>-,trail:~,extends:>,precedes:<,space:.
set ttyfast

And now it works pretty fine as you can see:

Vim change block cursor when in insert mode

I hope it could help any one else!

0

精彩评论

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

关注公众号