Column Highlighting


Whether writing prose or writing software, sometimes it can be handy to see how text is aligned vertically inside your file. This is useful when trying to track matching indents in a software project, especially for languages like python or haml where blocks are are opened and closed with indentation level alone.

Vim has a feature for this called cursorcolumn. You can enable and disable it with a command:

  • :set cursorcolumn – Enable column highlighting
    :set cuc – Alias for the same
  • :set nocursorcolumn – Disable column highlighting
    :set nocuc – Alias for the same
  • :hi CursorColumn ctermbg=3 – Change the color to yellow
    Try different numbers for different colors

Check out the brief gif showing some of these in action:

How useful was this tip?

Average rating 3.9 / 5. Vote count: 375

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Andy Libby

36 Posts

Rider of bicycles. Writer of code. User of Vim.
View all posts