日常在Terminal中使用vim,insert模式的光标是块状的,不利于区分,如何修改呢,(注意改gursursor是没用的,那是gvim的设置 如果和我一样,用的是gnome-terminal,则添加以下内容到~/.vimrc
if has("autocmd")
au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
au InsertEnter,InsertChange *
\ if v:insertmode == 'i' |
\ silent execute '!echo -ne "\e[6 q"' | redraw! |
\ elseif v:insertmode == 'r' |
\ silent execute '!echo -ne "\e[4 q"' | redraw! |
\ endif
au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
endif
不同的终端不同,具体见如下 https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
最终效果 normal模式 insert模式 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20201208201428121.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NIQU9TX09SREVS,size_16,color_FFFFFF,t_70)
|