Skip to content

Commit

Permalink
Use invhlsearch instead of nohlsearch
Browse files Browse the repository at this point in the history
This command toggles the highlight state, allowing the user to turn it off and
on as desired without it automatically turning back on.

I found it very annoying that some random command would set the search pattern
to something common like `\s\+` and suddenly my entire Vim session would be
highlighted. `<leader>/` turned if off but any kind of search related motion (or
running the command again, for example) would turn it back on again.

If the user turns off search highlighting, they probably don't want it to
immediately turn back on. If they do, it's as easy as `<leader>/` again.
  • Loading branch information
johntyree committed Dec 22, 2012
1 parent 0834355 commit a8d74e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .vimrc
Expand Up @@ -241,8 +241,8 @@
nmap <leader>f8 :set foldlevel=8<CR> nmap <leader>f8 :set foldlevel=8<CR>
nmap <leader>f9 :set foldlevel=9<CR> nmap <leader>f9 :set foldlevel=9<CR>
"clearing highlighted search " Toggle search highlighting
nmap <silent> <leader>/ :nohlsearch<CR> nmap <silent> <leader>/ :set invhlsearch<CR>
" Shortcuts " Shortcuts
" Change Working Directory to that of the current file " Change Working Directory to that of the current file
Expand Down

0 comments on commit a8d74e9

Please sign in to comment.