How to show cursorline only in active window of Vim

I find it very useful to have the cursorline enabled in Vim. However, if you are using split windows, the cursorlines of multiple windows can get distracting. Also, this makes it difficult to know which is the active window.

One solution to these problems is to display the cursorline only in the active window. To do that add this to your vimrc:

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

Advertisements

2 thoughts on “How to show cursorline only in active window of Vim

  1. Found having multiple windows each with their own cursorline distracting as well. Tried your solution and it worked perfectly. Thanks! — Jim
    (Vim 8.0 and Cygwin 2.7.0)

    Like

  2. Kudos! I was looking for a way to change the colors of my non-active cursorlines but I like this solution much better! Works great with Vim 8.0 on Ubuntu 18.04 via iterm2!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.