I write code mostly on my laptop for portability. It's a small monitor, so plugins that use the "sign column" tend to take up too much space. For example, I have my Syntastic plugin configured to highlight lines with syntax errors in red and show a message at the bottom, rather than indicating errors in the signcolumn.

Is there a plugin for navigation between marks, for which I can do something similar -- just highlight the entire line in one or two colors? Generally, I won't be using more than a couple marks in an entire file because I won't remember where they are, and I can navigate lines that fit on the screen with simple j/k commands.

Maybe I can insert a few lines into my .vimrc myself -- for example, trigger a special syntax coloring wherever "mark A" is?


1 Answer 1


There is a pretty quick and dirty way using \%'a:

for c in map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)')
    call matchadd('Search', '^.*\%'."'".c.'.*$')

Replace Search with an appropriate highlighting group. You can also replace the map(range(...)) with any set of marks you want, e.g., ['A', 'B'].

A few caveats:

  • Only highlights behind characters, not to the end of the screen.
  • Updates only when cursor is moved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.