Vim syntax highlighting puzzle
#97 Henry, Monday, 28 March 2011 8:39 AM (Category: UNIX Tools)
(Tags: vim syntax)

A little while ago, I noticed a change in Vim behaviour with syntax highlighting.

First, let me set the stage. I use Vim in text mode. Not gvim. On Linux.

If I edit a file, Vim will display the first screen of the file, and syntax highlighting is applied. The cursor is on the first column of the first line (my choice in the .vimrc). If I move the cursor down one line, the screen is refreshed and the syntax highlighting changes subtly. The colour of keywords changes slightly. I don't know what this is or why. I have to assume that it's in my .vimrc settings somewhere. It's going to take some time for me to work this out, but I have to work this out.

It's disconcerting. When I move the cursor down one, and things below it change below my focus, it's like a lurch on top of a cliff. I get startled by it and then I get irritated by it.

Here is my .vimrc file, and the first snapshot shows the cursor at the top line, and the keyword set on subsequent lines is yellow. In the second snapshot, I have moved the cursor down one line, and the keyword set has changed to a brown colour.

Vim on first lineVim on second line