I no longer use this plugin (nor Vim, often), and am no longer maintaining this repository. If you're interested in my adding a link to a fork here in the readme, let me know.
This plugin will automatically highlight the word currently under the cursor in the current window. This allows you to more easily see where words are being used, (eg. variable usages, etc.)
If you don't have a preferred installation method, I recommend using Vundle.
Assuming you've got Vundle installed and configured, add the following line to
your .vimrc
:
Plugin 'lygaret/autohighlight.vim'
Auto-highlighting is triggered by the CursorHold
event, which is itself triggered
when the cursor hasn't moved for updatetime
milliseconds. You can reduce this time
from the default 4000 (4 seconds), like so:
:set updatetime=500 " only be idle on a word for 1/2 second.
By default, current matches are simply underlined. You can change that by changing
the highlight group CursorAutoHighlight
, like so:
:highlight CursorAutoHighlight guibg=red
Autoclearing can be turned on for 2 events.
To turn on autoclear when cursor is moved, enable the following option.
g:AutoHighlight_ClearOnCursorMoved = 1
To turn on autoclear when exiting a window, enable the following option.
g:AutoHighlight_ClearOnWindowExit = 1
In some buffers, AutoHighlight may not work, especially if the buffers are created by another plugin. To disable auto highlight for some buffers, first find out the name of the buffer created by the other plugin.
To find out the name of the buffer, enter the buffer/window that the other plugin created, and type
echo @%
This will print out the name of the buffer, for example "ControlP" if run the command inside the ControlP buffer.
This will echo out the name of the buffer. Add the name of the buffer, into the following global option.
let g:AutoHighlight_DisabledBuffers = "ControlP"
Multiple values can be added, by separating them with a comma.
This plugin is released under the GPLv3 license. See LICENSE.