sponsor Vim development Vim logo Vim Book Ad

SelX : A Rainbow of Vim selection/highlighting & search

 script karma  Rating 7/3, Downloaded by 404  Comments, bugs, improvements  Vim wiki

created by
Richard Bentley-Green
script type

SelX provides additional selection/highlighting/search functions that operate in a very similar way to the standard '*' (and similar) key mappings and the standard '/' (and similar) command line search operations; the difference is that multiple, multi-coloured highlights are supported, operating on a per-tab basis

The selection/highlight selections can also (optionally) be saved as part of a vim session. This is also supported by my SessX plugin - vimscript #5874

SelX is intended to complement rather then replace the standard vim selection/search highlight facility

NOTE: This may well work for vim versions prior to 7 - I haven't tried it though


In order to keep track of which selections/highlights are set, a Highlight Usage Map is automatically displayed on the in-focus window's status line. This Highlight Usage Map looks something like the following;-

  [ 1 | 2 | 3 |   |   | 6 |^  |   |   ]

The Map has an entry for each of the available SelX highlight colours (in reality, the map entries are appropriately coloured)

If a particular highlight is not set then it is shown with just its colour (for example, numbers 4 and 5)

If a particular highlight is set then it is shown with its number (for example, numbers 1, 2 and 3)

The '^' is always displayed and points to the next highlight that will be used when the auto-selection command is used


There are several mappings/commands for selecting/highlighting and searching for a specific selection which mirror the normal '*' (and other) mappings and command line '/' and '?' commands

There are also some optional mappings that enhance (depending on your point of view) the standard vim highlight/search operation

install details
Un-tar into ~/.vim/bundle/ as usual and read the README file for setup and config options

Note that there is some initial setup required to integrate this into your vim installation

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
selx.tar.gz 24/11/20 2020-11-25 7.0 Richard Bentley-Green - Improved feedback for 'full word/arbitrary' selection toggle operation
- Added search success/failure feedback; printed to command line
- Minor comment corrections
selx.tar.gz 27/10/2020 2020-11-21 7.0 Richard Bentley-Green - Modified visual selection version of '*' so that it does not immediately jump to next occurrence; ie - works like the 'normal' version
- Modified list of suggested highlight colours
selx.tar.gz 01/05/20 2020-05-01 7.0 Richard Bentley-Green Added :SelXList command to print details of active selections/highlights
selx.tar.gz 27/04/20 2020-04-28 7.0 Richard Bentley-Green Added 'default' to setting StatusMsg colour. Without this, colour override would be hit-and-miss
Removed a stray mapping for '*' from autoload/selx.vim - oops!
selx.tar.gz 26/04/20 2020-04-27 7.0 Richard Bentley-Green Documentation improvements.
Minor functional changes - nothing serious, but worth having
See version information at bottom of README for full details
selx.tar.gz 25/04/20 2020-04-25 7.0 Richard Bentley-Green Documentation improvements. Improved control over mappings. Corrected one use of 'normal' to 'normal!'
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.