Contents
Is there a way to highlight search matches in Vim?
Highlighting can be enabled on Vim startup, when reading the viminfo file. Add the following to your vimrc if you want Vim to start with no search highlighting: It can be useful to highlight the word under the cursor like *, but without jumping to the next match. Then you can see the search highlights on the current screen, without any scrolling.
Is there a way to disable highlighting in Vim?
If you want to be able to enable/disable highlighting quickly, you can map a key to toggle the hlsearch option : Or, press return to temporarily get out of the highlighted search. Highlighting can be enabled on Vim startup, when reading the viminfo file.
What does the mapping of expr IN Vim mean?
The mapping (see :help :map- ) means that the text returned by Highlighting () is executed as a command. That is necessary because commands that affect the current search highlighting are ignored when executed inside a function.
What does the global variable g mean in Vim?
The global variable g:highlighting is used to track whether highlighting is active as there appears to be no way to detect that using Vim script.
How can I get rid of the highlighting in vimrc?
To disable the highlighting temporarily, enter (this is a command, not an option): :nohlsearch. This command (which can be abbreviated to :noh) removes the highlighting for the current search. The highlighting returns for the next search. If you do this often, put a mapping in your vimrc, like this:
Is there a way to highlight the word under cursor?
I use the mark.vim -plugin for this. It can handle many interesting words at the same time and allows to jump between highlighted words. Here’s how you do this automatically after keeping your cursor still for a short time: By default, this will highlight the word under the cursor after 4s of inactivity.