sponsor Vim development Vim logo Vim Book Ad

BOOKMARKS: Mark & Highlight Full Lines : Easily Highlight Lines with Marks, and Add/Remove Marks

 script karma  Rating 13/9, Downloaded by 1701  Comments, bugs, improvements  Vim wiki

created by
Ignacio Nunez
script type
Inspired by Kate 'bookmarks' and other scripts in this site, I devised a new way to mark full lines and highlight them.

The idea is to mark lines and then jump from one to the other, in an easier way than the one Vim provides.

Lines with markers are highlighted, which is convenient to visually spot where the mark is.

One does not need to remember which markers are already in use and which are free anymore, just add marks and remove marks, and the script will manage where to store them or free them.

<F1>            Turn on/update highlighting for all lines with markers
<F2>            Turn off highlighting for lines with markers
<SHIFT-F2> Erase all markers [a-z]
<F5>             Add a mark on the current line (and highlight)
<SHIFT-F5> Remove the mark on the current line

Then, just jump from one mark to the next using the classic [' and ]' jumps

Try it! it's nice!

Of course, the highlight group I define ("Marks") should be tweaked to one's taste, and the same applies to the keyboard mappings.

The classic marking method (ie. typing 'ma', 'mb', 'mc'...) can be used in combination with this one, but one has to be careful not to overwrite an existing mark. Check with the :marks command. HINT: the code marks from the 'a' to the 'z', so if there are not too many marks, one can safely assume that the last ones ('z 'x 'y 'w ...) are safe to use.

install details

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
markHL.vim 2.03 2014-03-13 7.0 Ignacio Nunez Fix terminal bg color
markHL.vim 2.02 2011-01-30 7.0 Ignacio Nunez Added <silent> mode for the mappings
markHL.vim 2.01 2011-01-18 7.0 Ignacio Nunez Added color highlighting for GUI
markHL.vim 2 2011-01-09 7.0 Ignacio Nunez Now, the code can handle normal marking and my own method simultaneously.
markHL.vim 1 2011-01-08 7.0 Ignacio Nunez Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.