johngreen
johngreen

Reputation: 2744

Vim- Change background color of certain portion of code

I usually spend a lot of time tinkering with existing code. I need to focus on only a small portion of the file, for which I would like to grey out the background for the rest of the file, so that the portion that I'm interested in stands out distinctively. This should increase my productivity immensely. Does anyone know how can I change background for only certain part of the file?

Upvotes: 1

Views: 508

Answers (2)

Oliver G.
Oliver G.

Reputation: 227

Try the limelight plugin for Vim. This Plugin Highlights the current code block and dimme the other code before and afterwards.

You can find it here:

https://github.com/junegunn/limelight.vim

Upvotes: 2

Christian Brabandt
Christian Brabandt

Reputation: 8248

Try my NrrwRgn plugin. That opens a selected part of the code in a new window. Whenever you write your changes, the will be taken back to the original buffer.

You could of course use syntax highlighting or even the sign column (my BackgroundColor plugin does this) to distinct highlight a certain region, but this will be awkward and will get out of sync soon if you add lines or remove lines.

Upvotes: 4

Related Questions