sponsor Vim development Vim logo Vim Book Ad

Dynamic Keyword Highlighting : Color-highlighted multi-search trail

 script karma  Rating 17/13, Downloaded by 1473  Comments, bugs, improvements  Vim wiki

created by
eiji kumiai
 
script type
utility
 
description
When inspecting text, often highlighting the current search keyword isn't enough.
This script allows you to highlight keywords and search patterns in different colors.
There are a few ways to use this functionality.

1) visual mode keyword selection
Use visual mode to select text and press <CTRL>h
The next available color will be used to highlight the keyword.
<CTRL>h without a visual mode highlight releases the last highlight.

2) search pattern selection
Perform a regular "/" search, and the press <CTRL>j
The next available color will be used to highlight matches.
<CTRL>h without a visual mode highlight releases the last highlight.

3) search pattern backtracking
The last highlighted word is set as the current search pattern.
This allows you to backtrack searches easily. For example,
- search "keyword"
/keyword
- remember search
<CTRL>j
- search "pattern"
/pattern
- remember search
<CTRL>j
- At this point, repeating search with just "/" will search "pattern".
   Use <CTRL>h without any visual highlight to backtrack.
  Repeating search with just "/" will now search "keyword".
 
install details
Copy code into your .vimrc
 

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
dysyn_vimrc.txt 1.9 2016-11-29 7.0 eiji kumiai - revised color scheme so that text can be seen clearly
- increased number of highlights from 26 to 35
dysyn_vimrc.txt 1.8 2010-01-22 7.0 eiji kumiai New feature : search backtracking
_vimrc 1.5 2009-10-27 7.0 eiji kumiai - <ctrl-j> highlights current search pattern.
  perform normal search and use <ctrl> to do multiple regex patterns.
- cterm colors now supported
- up to 25 search items now supported
- highlight across buffers
- <ctrl-h> on regex characters escaped
dynamicsyntax.vim 1.0 2005-07-29 6.0 eiji kumiai Initial upload
ip used for rating: 18.118.171.20

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.
   
Vim at Github