From 47588e81201656b2892048aa8795cb5efd04fa6b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 5 Dec 2019 01:40:05 +0100 Subject: Idea for a command to 'nohlsearch' after searching Came up with this in 2016, but at the time didn't see a way to get it working. Committing what I had for reference. --- Info.txt | 5 +++++ nohlslash.vim | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Info.txt create mode 100644 nohlslash.vim diff --git a/Info.txt b/Info.txt new file mode 100644 index 0000000..7e2c7b3 --- /dev/null +++ b/Info.txt @@ -0,0 +1,5 @@ +vim-nohlslash + +Invoke search (`/`) and automatically :nohlsearch after executing it. There's +no autocmd for "after search", though, so the current method isn't going to +work. diff --git a/nohlslash.vim b/nohlslash.vim new file mode 100644 index 0000000..9088cd1 --- /dev/null +++ b/nohlslash.vim @@ -0,0 +1,17 @@ +let s:nohlslash = 0 + +function! s:setup_nohlslash() + let s:nohlslash = !s:nohlslash +endfunction + +nnoremap a :call setup_nohlslash() + + +augroup nohlslash + autocmd! + autocmd CmdwinLeave * + \ if s:nohlslash | + \ echom 'test' + \ nohlsearch + \ endif +augroup END -- cgit v1.2.3