aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-06-18 19:44:46 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-06-18 23:59:39 +0200
commit2791fd4e1722fd45fa0f4261879046e8d397645a (patch)
tree05cffe3e28cf3af00a68add133b1999c11a0c691
parent4e8ec4900eb9fdc2a864e65d3de73c51e963abd0 (diff)
downloadrneovim-2791fd4e1722fd45fa0f4261879046e8d397645a.tar.gz
rneovim-2791fd4e1722fd45fa0f4261879046e8d397645a.tar.bz2
rneovim-2791fd4e1722fd45fa0f4261879046e8d397645a.zip
vim-patch:26de90c: runtime(nohlsearch): include the the simple nohlsearch package
fixes: vim/vim#15039 closes: vim/vim#15042 https://github.com/vim/vim/commit/26de90c6312cf16d7a4f2b6942befb4e1f14b960 Co-authored-by: Maxim Kim <habamax@gmail.com>
-rw-r--r--runtime/doc/pattern.txt6
-rw-r--r--runtime/doc/usr_05.txt15
-rw-r--r--runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim14
3 files changed, 34 insertions, 1 deletions
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 67ef769203..8ec02276cc 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -141,13 +141,17 @@ CTRL-C Interrupt current (search) command.
executing autocommands |autocmd-searchpat|.
Same thing for when invoking a user function.
+
While typing the search pattern the current match will be shown if the
'incsearch' option is on. Remember that you still have to finish the search
command with <CR> to actually position the cursor at the displayed match. Or
use <Esc> to abandon the search.
+ *nohlsearch-auto*
All matches for the last used search pattern will be highlighted if you set
-the 'hlsearch' option. This can be suspended with the |:nohlsearch| command.
+the 'hlsearch' option. This can be suspended with the |:nohlsearch| command
+or auto suspended with nohlsearch plugin. See |nohlsearch-install|.
+
When 'shortmess' does not include the "S" flag, Vim will automatically show an
index, on which the cursor is. This can look like this: >
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index 076a50c582..f6324a12d5 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -234,6 +234,21 @@ an archive or as a repository. For an archive you can follow these steps:
Here "fancytext" is the name of the package, it can be anything
else.
+
+Adding nohlsearch package *nohlsearch-install*
+
+Load the plugin with this command: >
+ packadd nohlsearch
+<
+Automatically execute |:nohlsearch| after 'updatetime' or getting into |Insert| mode.
+Thus assuming default updatetime, hlsearch would be suspended/turned off after
+4 seconds of idle time.
+
+To disable the effect of the plugin after is has been loaded: >
+ au! nohlsearch
+<
+
+
More information about packages can be found here: |packages|.
==============================================================================
diff --git a/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
new file mode 100644
index 0000000000..6cfe813cfa
--- /dev/null
+++ b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
@@ -0,0 +1,14 @@
+" nohlsearch.vim: Auto turn off hlsearch
+" Last Change: 2024-06-18
+" Maintainer: Maxim Kim <habamax@gmail.com>
+"
+" turn off hlsearch after:
+" - doing nothing for 'updatetime'
+" - getting into insert mode
+augroup nohlsearch
+ au!
+ noremap <Plug>(nohlsearch) <cmd>nohlsearch<cr>
+ noremap! <expr> <Plug>(nohlsearch) execute('nohlsearch')[-1]
+ au CursorHold * call feedkeys("\<Plug>(nohlsearch)", 'm')
+ au InsertEnter * call feedkeys("\<Plug>(nohlsearch)", 'm')
+augroup END