如何在iTerm2中的vim中使光标在插入模式下显示为垂直线,在普通模式下显示为块状?

3
如何在vim中将光标在插入模式下更改为竖线,在正常模式下更改为块,iterm2,mac osx?
我尝试了一些在线上找到的其他配置,但它们都没有起作用。我尝试过这个链接Vertical vim cursor in command mode中提到的方法:
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
let &t_SI = "\<Esc>]50;CursorShape=1\x7"

我也尝试过这个来自网站https://hamberg.no/erlend/posts/2014-03-09-change-vim-cursor-in-iterm.html的方法。
if $TERM_PROGRAM =~ "iTerm"
    let &t_SI = "\<Esc>]50;CursorShape=1\x7" 
    let &t_EI = "\<Esc>]50;CursorShape=0\x7" 
endif

似乎什么都不起作用,光标在插入模式和正常模式下仍然是一个块。还有其他我可以尝试的吗?
1个回答

4

这个指南中,你可以了解到所有与光标形状有关的内容。

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

如果您使用tmux
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接