Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created 2002 · complexity basic · author HughSasse · version 6.0
When scrolling or searching through a large file it is easy to lose sight of the cursor. A simple way to locate the cursor is to type
zz (which scrolls the cursor line to the middle of the window), or to quickly type
jk (which moves the cursor down then up; the movement shows where the cursor is). This tip shows other ways to find the cursor with highlighting.
Highlighting text near the cursorEdit
The script below can highlight the word containing the cursor to make it easily visible: in normal mode, press Ctrl-K to toggle the highlight on or off.
Put this script in your vimrc:
nnoremap <C-K> :call HighlightNearCursor()<CR> function HighlightNearCursor() if !exists("s:highlightcursor") match Todo /\k*\%#\k*/ let s:highlightcursor=1 else match None unlet s:highlightcursor endif endfunction
The match uses the
Todo highlight group.
- Highlight current line
- Highlight cursor line after cursor jump
- Keep your cursor centered vertically on the screen