Multi-Highlight is a Visual Studio Code extension for highlighting multiple words with different and customisable colours. It's designed to help keep track of multiple variables while auditing or understanding code.
Install through the Visual Studio Code Marketplace: https://marketplace.visualstudio.com/items?itemName=chrisjdavies.multi-highlight
See the following screenshot in which I've highlighted three different words to help clarify their use in the function being analysed:
Multi-Highlight adds the following commands to the command palette:
- Multi-Highlight: Add Highlight
- Multi-Highlight: Remove Highlight
- Multi-Highlight: Clear Highlights
- Multi-Highlight: Fresh Highlight
- Multi-Highlight: Toggle Highlight
Add, Remove and Toggle operate on the word currently under the cursor.
To configure the highlight colours, edit the multi-highlight.colours
string.
This is a comma-separated list of background/foreground pairs.
The default list of colours is:
- yellow:black
- blue:white
- red:white
- green:white
- purple:white
- orange:white
Colours can be specified by name or using HTML syntax: #d0d0d0
.
Multi-Highlight doesn't come with default key bindings, but I personally use the
following in my settings.json
with
VSCodeVim to mimic
vim-highlighter:
{
"vim.normalModeKeyBindings": [
{
"before": ["g", "<cr>"],
"commands": ["multi-highlight.addHighlight"]
},
{
"before": ["g", "<bs>"],
"commands": ["multi-highlight.removeHighlight"]
},
{
"before": ["g", "<C-l>"],
"commands": ["multi-highlight.clearHighlights"]
},
{
"before": ["g", "<space>"],
"commands": ["multi-highlight.freshHighlight"]
}
]
}
- Thanks to chasonyu for implementing the Toggle Highlight feature.
- Thanks to vim-highlighter for the inspiration. I use this a lot in vim.
- Thanks to DALL-E 3 for generating the icon/logo.