- Use Regular Expressions to add highlights (see
:help highlight) to text. - Persistent across different sessions because everything is stored as Json files.
- Assign any highlight group to the text you want to highlight
- Use automatically created highlight groups that provide a good contrast.
- Assign highlights to different buffers based on their
filetypes(see:help filetype)
The first command will be HiReg that allows to highlight regexes.
HiReg <regex> [highlight_group] [file_types]
<regex>is required define the text that should be highlighted. The regex is Vim-based.- It should be written without any spaces. If spaces are necessary you can use
\sto define a single space, it is part of standard vim regex syntax (see:help regexp).
- It should be written without any spaces. If spaces are necessary you can use
highlight_groupis optional and allows to provided a name of the highlight group you want to use for highlighting of the text.- If it is not present, a new highlight group will be created (or reused if it wasn't created before) out of a set of default colors (see
:help gui-colors). The colors are organized in a way to provided the highest contrast when they are added asguifgandguibgrandomly.
[!NOTE] Because the colors are basic it shouldn't matter if
termguicolorsis enabled or not.- If it is not present, a new highlight group will be created (or reused if it wasn't created before) out of a set of default colors (see
[file_types]is optional and allows to set whichfiletypeof a buffer can the highlight be applied to.- If present, several
filetypescan be separated by a comma without any spaces (i.e.lua,js,c- A special value as
""(two double quotes) can be used to define a buffer with no filetype set (i.e.lua,"",c)
- A special value as
- if not present, the highlight is applied to the current buffer.
- If present, several
- Highlights are unique based on the regular expression provided (might be changed in the future with support cwd based highlights)
- Each regex will be pre-pended with
\vmaking it avery magicregular expression (see:help \v). So writing something liketestwill be stored as\vtest. In future it can be changed.
In order to see the list of all the created highlights you can use HiRegListRegs command.
HiRegListRegs [regex]