Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: deb
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (37 sloc) 2.237 kb
<h3 id="modifying-cursor">Modifying the Cursor</h3>
<h4>Problem</h4>
<p>You want to make the cursor easier to see.</p>
<p>For example, you're using visually &#x201C;busy&#x201D; 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.</p>
<h4>Solution</h4>
<p>To change the cursor colour in Gvim redefine the <i>Cursor</i> highlighting
group<span class="fn">The <a href="#defining-highlight-group">Creating
Highlight Groups</a> recipe explains how to redefine highlight groups, but
in standard Vim the terminal defines the cursor colour.</span>.</p>
<p>Another approach is to highlight the line the cursor is on. You do this by
executing <tt>:set cursorline</tt>. Again, to change the colours modify the
<i>CursorLine</i> highlighting group.</p>
<p>Similarly, you can highlight the current column the cursor is in with
<tt>:set cursorcolumn</tt>. The highlight group is, predictably, called
<i>CursorColumn</i>.</p>
<p>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.</p>
<h4>Discussion</h4>
<p>Gvim allows you to customise every conceivable aspect of the cursor display
with the command <tt>:set guicursor</tt>. 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&#x2026; This is
achieved by providing a <i>format string</i> as the value for
<tt>guioptions</tt>. Here are some examples:</p>
<ul>
<li><tt>n-c-v:ver50-ncvCursor</tt> - In Normal, Command, and Insert mode set
the cursor to a vertical bar 50% of the current character's width. Highlight
it with the <i>ncvCursor</i> group.</li>
<li><tt>i:block-iCursor-blinkon0,v:block-vCursor</tt> - In Insert mode use a
non-blinking block cursor highlighted with the <i>iCursor</i> highlighting
group. In Visual mode also use a block cursor, but highlight it with
<i>vCursor</i>.</li>
</ul>
<p>The above examples should be adaptable for your uses. For the gritty detail
of the supported syntax look at <tt>:help guicursor</tt>.</p>
Jump to Line
Something went wrong with that request. Please try again.