The following command will list all active highlights (group names and patterns):Īfter using \m to enable the keypad mappings, you can press 1.9 on the keypad to highlight the visual selection (if any), or the current word. The last example highlights th occurring at the beginning of a word, not case sensitive. The second example is the same as placing the cursor on "hello" then pressing 5 on the numeric keypad. The following examples use different colors to highlight various patterns: Depending on your system, you may be able to use the abbreviation :Hi rather than :Highlight. The script defines a :Highlight n pattern command where n is a number (1.99) and pattern is the text you want highlighted. Now you can press the normal search keys n or N to find the next or previous occurrence. This has no effect on search highlighting or history.Īlternatively, type \n or \N to search forwards or backwards. Type \f to find the next match, or \F to find backwards. Patterns highlighted with the :match or :2match commands are also found. Switch to the other window and press * to apply the highlights from the first window.Īfter using \m to enable mappings, you can search for the next or previous occurrence of highlighted text.Press - to remove all highlights in the first window.In the first window, apply the wanted highlighting.
#Windows shortcut to highlight a word windows
Press * to restore the highlighting when - was last used in any window.įor example, suppose you are displaying two windows and you want the same highlighting in each window.
Press + to restore the highlighting when - was last used in the current window.Press - to remove all highlights in the current window.With the mappings enabled, you could use the keypad to: All occurrences of the visually selected text will be highlighted, including the "rain" in "rainbow".Įach window has its own set of highlights: if you use :split to show two windows, you can have one set of highlights in the top window, and a different set in the other window.
No highlighting will occur in words like "rainbow".Īlternatively, place the cursor on "rain" and press viw to select the word, then 4.