sponsor Vim development Vim logo Vim Book Ad

simple_highlighting : Easily highlight multiple words in all buffers and search through them

 script karma  Rating 16/4, Downloaded by 220    Comments, bugs, improvements  Vim wiki

created by
Pev Hall
script type
Script is designed to be easy and quick to use and satisfy the following functionality:
1. Highlight multiple different words in multiple different highlighting styles.
2. Keep the highlights between buffers.
3. Change search pattern to a highlighted style

Brief example of usage:
  * Place your cursor on a word and use \h to highlight it.
  * Running \h while cursor over another word will add it to the default (0) highlight slot.
  * 2\h will highlight a new word in 2 highlight slot.
  * Change buffer or open new window and highlights will remain the same
  * :Hc 2 will clear all the of slots 2's highlights.
  * :Hs to changes the search pattern to all the current highlighted word
  * :Hc will clear all highlights.

Detailed description of use:

<leader> default is \

[<number>] <Leader> h   -> to highlight the whole word under the cursor, highlighted colour is determined by the preceding number, if no number is given 0 is used

numbers can be between 0 to 7 default is 0. More highlight numbers/slots can be added and there representative colour's changed at the start of the script.

:Hc [0,2...] <return>  -> HighlightClear: clears the highlighted patterns listed or all if no number(s) passed

:Hs [0,2...] <return>  -> HighlightSearch: changes the search pattern to the highlighted patterns listed or all if no number(s) passed

:call HighlightAdd(number, pattern)  -> add the pattern to the given number's highlight slot. Useful if you want to highlight more then a simple word (regular expression).


No known bugs.

<http://vim.wikia.com/wiki/Highlight_multiple_words > is a very good alternative to this script. This script is designed to have less functionality and be easier to use.

<http://www.vim.org/scripts/script.php?script_id=2666 > is a much more compressive and complex script then this one.
install details
Copy contents of script and past into your _vimrc/.vimrc file.

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
simple_highlighting.vimrc 1.0.0 2013-12-17 7.2 Pev Hall Major fix: Removed conflicts when multiple windows are editing same buffer.
simple_highlighting 0.9.1 2013-08-11 7.2 Pev Hall Missed some dependent functions in previous commit.
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.
SourceForge.net Logo