The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Disable (Or Toggle) Text Search Result Highlights In Vim and Neovim

TODO: Pull subtitle into page object

## Turning Highlights Off

Neovim/Vim highlights all the matching results when you do a text search in a file buffer. You can hide the highlights after the search with `:noh` but that's a pain to do every time. To disable them full time, add this to your `~/.config/nvim/init.vim` or `~/.vimrc` config file:

code_start_default_section code_end_default_section

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Disable (Or Toggle) Text Search Result Highlights In Vim and Neovim

-- p

## Turning Highlights Off

-- p

Neovim/Vim highlights all the matching results when you do a text search in a file buffer. You can hide the highlights after the search with `:noh` but that's a pain to do every time. To disable them full time, add this to your `~/.config/nvim/init.vim` or `~/.vimrc` config file:

-- code/

set nohlsearch

-- /code

-- p

## Toggling Highlights

-- p

Another option is to toggle the highlights on and off. Instead of using `set nohlsearch`, this can be done by adding the following to your config file:

-- code/

set hlsearch!
nnoremap <F5> :set hlsearch!<CR>

-- /code

-- p

With that in place, hitting `F5` will switch showing highlights on and off.

-- p

## One File Only

-- p

You can also run those commands directly in a single file buffer (prepended by a `:`) to apply to just that buffer. That is:

-- code/

:set nohlsearch

-- /code

-- p

and

-- code/

set hlsearch!
nnoremap <F5> :set hlsearch!<CR>

-- /code


-- categories
-- Neovim

-- metadata
-- date: 2022-01-22 13:48:09
-- id: 24460d1m
-- status: published
-- type: post
-- SCRUBBED_NEO: false
-- site: aws