Skip to content

Highlight the current line in Vim

To highlight the current line in Vim, you have to set the cursorline setting.

   :set cursorline
   :set cul

These two are the same. This can also be set in your _vimrc file, you don’t need the colon then.

Here’s an extract from my vimrc file:

  set nowrap
  set ic                       " Ignore case
  set ai                       " autoindent
  set tabstop=4
  set shiftwidth=4
  set expandtab
  set cul                      " Cursor highlight

  map  ^hhxxj0
  map  ^i  j0

The last 2 entries add mappings for F1 and F2, to dedent and indent the current line. Map is one of the most useful Vim commands, well worth learning.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*