Modifying the Cursor


You want to make the cursor easier to see.

For example, you're using visually “busy” syntax highlighting, and sometimes lose the cursor. Or, you're working with columnar data, and need the entire column that the cursor is over to be highlighted.


To change the cursor colour in Gvim redefine the Cursor highlighting groupThe Creating Highlight Groups recipe explains how to redefine highlight groups, but in standard Vim the terminal defines the cursor colour..

Another approach is to highlight the line the cursor is on. You do this by executing :set cursorline. Again, to change the colours modify the CursorLine highlighting group.

Similarly, you can highlight the current column the cursor is in with :set cursorcolumn. The highlight group is, predictably, called CursorColumn.

If you want your terminal to resemble a sniper's sights, you can combine both line and column highlighting to create a cross-hair effect, as shown below.


Gvim allows you to customise every conceivable aspect of the cursor display with the command :set guicursor. This allows you to change the cursor's appearance based on the mode (i.e. one colour for Insert mode, another for Normal), its height, and control whether it blinks… This is achieved by providing a format string as the value for guicursor. Here are some examples:

The above examples should be adaptable for your uses. For the gritty detail of the supported syntax look at :help guicursor.