Text Highlighter
No description provided
Details
Installs
- Total 4K
- Win 3K
- Mac 943
- Linux 591
| Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 1 | 4 | 1 | 7 | 5 | 3 | 2 | 0 | 4 | 0 | 0 | 1 | 2 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 0 | 0 | 16 | 0 | 2 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 3 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 6 | 1 | 0 | 1 | 0 | 0 | 0 | 6 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 2 | 1 | 3 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Readme
- Source
- raw.githubusercontent.com
TextHighlighter

Requires Sublime Text 3.1 or later. Sublime Text 3.1 added the View.style_for_scope API used to compare highlight colors.
How to install
- Type
Add Repositoryinto command palette Install Package- Choose
Text Highlighter
Keybinding
with NeoVintageous https://github.com/NeoVintageous/NeoVintageous
vnoremap <leader>j :TextHighlighterToggle<CR>
snoremap <leader>j :TextHighlighterToggle<CR>
nnoremap <leader>j :TextHighlighterToggle<CR>
nnoremap <leader>c :TextHighlighterClearAll<CR>
normal keymap
Put settings like below to your keybinding file.
{ "keys": ["ctrl+super+j"], "command": "text_highlighter_toggle" }
// use specific color as below
{ "keys": ["ctrl+super+j"], "command": "text_highlighter_toggle", "args": { "color": "markup.changed.git_gutter"} }
{ "keys": ["ctrl+super+h"], "command": "text_highlighter_clear_all" }
Default scope candidates
[ markup.changed.git_gutter, support.class, markup.deleted.git_gutter, markup.inserted.git_gutter, constant.numeric, constant.character.escape, variable, string, comment, keyword, entity.name.function, entity.name.tag, markup.heading ]
The active color schemes determine how many distinct highlight colors these scopes provide. Scope assignments are shared across windows. Automatic allocation checks scopes in the listed order. It skips occupied scopes and scopes whose foreground matches an existing highlight in any open view across all windows. TextHighlighter compares each pair of scopes within the same view.
The original nine scopes keep their order. keyword, entity.name.function, entity.name.tag, and markup.heading provide more candidates when the color scheme gives them distinct foregrounds.
Add more highlight colors
Use extra_scopes and color scheme rules to add arbitrary highlight colors. Choose foregrounds that differ from the colors of other highlights in each view.
- Open Preferences > Browse Packages.
- Create
User/TextHighlighter.sublime-settingswith the following settings.
{
"extra_scopes": [
"text_highlighter.cyan",
"text_highlighter.magenta"
]
}
- For an active
.sublime-color-scheme, open the command palette and run UI: Customize Color Scheme. - Add the following entries to the user override's
rulesarray. Keep any existing rules.
{
"rules": [
{
"scope": "text_highlighter.cyan",
"foreground": "#00BCD4"
},
{
"scope": "text_highlighter.magenta",
"foreground": "#E040FB"
}
]
}
- Save both files and restart Sublime Text.
If the customization command is unavailable, create a .sublime-color-scheme file in Packages/User with the active scheme's filename. Sublime merges the user file's rules with the active scheme. See color scheme customization.
Custom scopes follow the default candidates. Their allocation order depends on which candidates provide distinct colors in every open view across all windows. Add more scope names and color scheme rules for more colors. Changes to extra_scopes take effect after restarting Sublime Text.
add_regions uses a scope's foreground color to draw highlights. Set foreground to the desired highlight color. Different scope names can display the same color if their scheme rules resolve to the same foreground. Scopes without matching rules can also share the scheme's default foreground. TextHighlighter compares the resolved colors with style_for_scope before allocating a scope.
To select an added scope explicitly, use the existing color argument.
{ "keys": ["ctrl+super+j"], "command": "text_highlighter_toggle", "args": { "color": "text_highlighter.cyan" } }
Each configured scope supports one simultaneously highlighted string. The number of available distinct colors can be smaller than the number of configured scopes. Toggling a highlighted string frees its scope, regardless of the supplied color argument.
When adding a new string, an unknown or occupied explicit scope displays a status message and keeps existing highlights. TextHighlighter also refuses an explicit scope if its foreground matches an existing highlight in any open view across all windows. When no distinct colors remain, clear a highlight or add scopes with distinct foregrounds and restart.
Each allocation reads the current color schemes. A scheme change or a newly opened view does not reassign existing highlights. If existing highlights share a color after a scheme change or in a new view, clear the highlights and apply them again.
extra_scopes must be a list of nonempty scope strings. Duplicate names count once and retain their first position. Invalid settings display a status message and use the default candidates.
Inspired
Inspired by https://github.com/ryu1kn/vscode-text-marker