Macos – Customize vim cursor style under Mac OS X Terminal

macosterminalvim

I want to customize the vim cursor to be a blinking rectangle block. I tried this and this and many other similar stuffs after some searches, but none of them works as expected.

Currently my cursor is an non-blinking underline in grey (i.e. the underline below character "e" in the last line below), which is pretty hard to recognize.

underline cursor

When the cursor is over a parenthesis character, it becomes a block. (Actually I believe this is a change in background color) What I want is to have this block all the time, and blinking.

block cursor

I have nothing related to cursor style in my .vimrc file. I am using Mac OS X 10.9, Terminal Version 2.4 (326), and oh-my-zsh. In Terminal settings, I use Pro theme and set cursor to underline. I can change this to block so the cursor in vim changes as well, but I need the underline cursor in a normal Terminal.

terminal settings

Best Answer

You can try this one in your .vimrc:

let &t_SI="\033[4 q" " start insert mode
let &t_EI="\033[1 q" " end insert mode

This will set under line for inset mode and block for normal. More details: http://vt100.net/docs/vt510-rm/DECSCUSR

Also it's possible to play with this command in terminal, where is X can be 0, 1, 2, 3 or 4.

printf '\033[X q'
Related Question