Toggling and Shortening
There are a number of options / settings in Vim, of course, and sometimes they’re not so easy to set. There are also a lot of things we tend to do over and over that take more than a couple of characters to write and you want to do them faster. This is where mappings come in:
" Toggle paste mode
nmap
" Turn off that stupid highlight search
nmap
" Set text wrapping toggles
nmap
" Set up retabbing on a source file
nmap
" cd to the directory containing the file in the buffer
nmap
" Make the directory that contains the file in the current buffer.
" This is useful when you edit a file in a directory that doesn't
" (yet) exist
nmap
Nikos Aggelidis:
August 22nd, 2009 at 3:37 pm
To “Turn off that stupid highlight search” i use the space bar!
Seth Milliken:
September 2nd, 2009 at 3:39 pm
Here?s one that piggybacks on the already familiar to Unix folk, :
nnoremap <silent> <c-l> {your preferred hls off/toggle command here}<cr><c-l>
Anton Chikin:
September 7th, 2009 at 3:00 am
nmap <silent> ,n :set invhls<cr>:set hls?<cr>
Anton Chikin:
September 7th, 2009 at 3:03 am
HTML eating that <cr> tags. Look in source code of page for proper commands.
Crazor:
November 17th, 2010 at 3:37 am
Mapped ,n to :nohl. This gets rid of the highlight, but doesn’t toggle ‘hlsearch’.
happypeter:
June 28th, 2012 at 1:16 am
Thank you so much, @derek, this is useful.
” Toggle paste mode
nmap ,p :set invpaste:set paste?