- this extension is inspired by vim quick scope
-
For people who use vim with vscode. the find command is pretty useful to go quickly to a specific word by typing
f [some character in the word]
in normal mode. -
this becomes a problem when there are multiple words in the line that contain the same characters that you use with the find command.
<cursorPos> const name = "tsr"
Note that you can only reach the string"tsr"
with one jump by using the commandf r
.
-
The main goal of the extension is to highlight a character in every word such that when using this character with the find command, you reach the word with as minimal jumps as possible.
-
This isn't always possible if the line contains repeated words. the extension can be configured to color the character with another color to indicate that the word cannot be reached with only one jump
- Example of such case:
<cursorPos> test test
- In this case the extension would highlight the character that enables you to go to the second
test
as quickly as possible. Here the charactere
will be highlighted (you need 2 jumps) instead oft
(you need 3 jumps).
- Example of such case:
-
The configuration is simple
-
Go to
settings.json
and set the following-
"vimFindHighlight.charPrimaryColor": "green" // the color that will be used if the word can be reached with one jump
-
"vimFindHighlight.charSecondaryColor": "red" // the color that will be used if the word can not be reached with one jump
-
"vimFindHighlight.charFontWeight": "600" // font weight of the highlighted character
-
"vimFindHighlight.enableUnderline": true // underline the highlighted characters
-
"vimFindHighlight.enableAutoHighlight": true // highlight characters automatically
-
This extension exposes two commands (accessible through the command palette):
Vim Find Highlight: Toggle Auto Highlight
: Enables or disables the autohighlight setting described above.- When remapping a shortcut to the command, use
vimFindHighlight.toggleAutoHighlight
- When remapping a shortcut to the command, use
Vim Find Highlight: Highlight Characters
: Force a highlight of jumpable characters. Useful when paired withvimFindHighlight.enableAutoHighlight: false
.- When remapping a shortcut to the command, use
vimFindHighlight.highlightCharacters
- When remapping a shortcut to the command, use
You can remap the Highlight Characters
command either using VSCode native keyword shortcuts, or vscode vim KeyBindings.