Im on mac and I have my terminal cursor set to the vertical bar option. However in vim command mode the cursor is the vertical bar but it wont let me use hjkl to go to the end o
In case you're using iTerm2, there's a little trick: You can automatically switch your cursor depending on your mode. This works better if your default cursor is the block cursor, and you only want a vertical bar in insert mode, but I'll show it nevertheless:
let &t_EI = "\]50;CursorShape=0\x7"
let &t_SI = "\]50;CursorShape=1\x7"
This instructs vim to print those strings when entering (&t_SI
) and exiting (&t_EI
) insert mode. iTerm2 has a bunch of proprietary escape codes that interpret the strings as instructions to change the cursor shape.
All you then would need to do is somehow print "\
when starting vim and "\
when exiting it. For that, you can use autocmds:
autocmd BufEnter * execute 'silent !echo -ne "' . &t_EI . '"'
autocmd VimLeave * execute '!echo -ne "' . &t_SI . '"'
This automatically changes your cursor shape to a box when entering vim, and then restores it to a vertical bar when exiting.