]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(nohlsearch): include the the simple nohlsearch package
authorMaxim Kim <habamax@gmail.com>
Tue, 18 Jun 2024 17:32:39 +0000 (19:32 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 18 Jun 2024 17:32:39 +0000 (19:32 +0200)
fixes: #15039
closes: #15042

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/MAINTAINERS
Filelist
runtime/doc/pattern.txt
runtime/doc/tags
runtime/doc/usr_05.txt
runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim [new file with mode: 0644]

index 1254782e367380db3078ff42ac8b3de9a4956de3..ea8e560d0154b74fc51795067a75215208b5a367 100644 (file)
@@ -343,6 +343,7 @@ runtime/lang/menu_ru_ru.utf-8.vim   @RestorerZ
 runtime/pack/dist/opt/cfilter/plugin/cfilter.vim       @yegappan
 runtime/pack/dist/opt/comment/ @habamax
 runtime/pack/dist/opt/matchit/         @chrisbra
+runtime/pack/dist/opt/nohlsearch/              @habamax
 runtime/plugin/manpager.vim            @Konfekt
 runtime/syntax/shared/hgcommitDiff.vim @vegerot
 runtime/syntax/abaqus.vim              @costerwi
index 20c19f762348758995f0d15b6bbfcbd991f6b7eb..ab4b1ebaae2401d5b7ad1d6828cca8bf91d7fa31 100644 (file)
--- a/Filelist
+++ b/Filelist
@@ -782,6 +782,7 @@ RT_ALL =    \
                runtime/pack/dist/opt/matchit/doc/matchit.txt \
                runtime/pack/dist/opt/matchit/doc/tags \
                runtime/pack/dist/opt/matchit/autoload/*.vim \
+               runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim \
                runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim \
                runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim \
                runtime/pack/dist/opt/termdebug/plugin/termdebug.vim \
index 183806a968ef894f44c70404503ba845db624c9a..4351944df92a1185a6958dbdc7820f84e0d7ef77 100644 (file)
@@ -1,4 +1,4 @@
-*pattern.txt*   For Vim version 9.1.  Last change: 2024 Jun 03
+*pattern.txt*   For Vim version 9.1.  Last change: 2024 Jun 18
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -151,13 +151,17 @@ CTRL-C                    Interrupt current (search) command.  Use CTRL-Break on
                        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: >
index 794fa0c71ba544ea72f7fb5ecb4925b8b1702aa6..56385a8442c5b3be522e8345ab713f824f978282 100644 (file)
@@ -9178,6 +9178,8 @@ no_buffers_menu   gui.txt /*no_buffers_menu*
 no_mail_maps   filetype.txt    /*no_mail_maps*
 no_plugin_maps filetype.txt    /*no_plugin_maps*
 nocombine      syntax.txt      /*nocombine*
+nohlsearch-auto        pattern.txt     /*nohlsearch-auto*
+nohlsearch-install     usr_05.txt      /*nohlsearch-install*
 non-greedy     pattern.txt     /*non-greedy*
 non-zero-arg   eval.txt        /*non-zero-arg*
 none-function_argument userfunc.txt    /*none-function_argument*
index a9e8fb9c311e5338d567096a0564a9d73d72d41d..5065e4583c8fa8677d2c6c5648e59854fdf1d6a6 100644 (file)
@@ -1,4 +1,4 @@
-*usr_05.txt*   For Vim version 9.1.  Last change: 2024 May 17
+*usr_05.txt*   For Vim version 9.1.  Last change: 2024 Jun 18
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -440,7 +440,7 @@ After restarting your Vim, the plugin is active and you can read about it at: >
 Adding comment package                                 *comment-install*
 
 Load the plugin with this command: >
-    packadd comment
+       packadd comment
 <
 This way you can use the plugin with the default key bindings `gc` and similar
 for commenting (which is a well-established mapping in the Vim community).
@@ -449,6 +449,21 @@ If you add this line to your vimrc file, then you need to restart Vim to have
 the package loaded. Once the package is loaded, read about it at: >
        :h comment.txt
 
+
+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 (file)
index 0000000..6cfe813
--- /dev/null
@@ -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