From c06f0970b0807360c4b9d24abd10a264b5ea892f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Sep 2025 07:08:02 +0800 Subject: [PATCH] vim-patch:a0f37db: runtime(doc): use a single pattern in :h 'incsearch' example (#35721) related: https://github.com/vim/vim/pull/18262#issuecomment-3277008408 closes: vim/vim#18270 https://github.com/vim/vim/commit/a0f37dbbf413537815656fb0752a8eb926acb05c --- runtime/doc/autocmd.txt | 5 +++-- runtime/doc/options.txt | 4 ++-- runtime/lua/vim/_meta/options.lua | 4 ++-- src/nvim/options.lua | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index b0e9530f31..674c034017 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1341,8 +1341,9 @@ The pattern is interpreted like mostly used in file names: [^ch] match any character but 'c' and 'h' Note that for all systems the '/' character is used for path separator (even -Windows). This was done because the backslash is difficult to use in a pattern -and to make the autocommands portable across different systems. +for MS-Windows). This was done because the backslash is difficult to use in a +pattern and to make the autocommands portable across different systems. To +only match a '/' on all platforms (e.g. in a non-file pattern), use "\/". It is possible to use |pattern| items, but they may not work as expected, because of the translation done for the above. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 988113b819..a262e09b43 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3668,8 +3668,8 @@ A jump table for the options with a short description can be found at |Q_op|. autocmd. Example: >vim augroup vimrc-incsearch-highlight autocmd! - autocmd CmdlineEnter /,\? :set hlsearch - autocmd CmdlineLeave /,\? :set nohlsearch + autocmd CmdlineEnter [\/\?] :set hlsearch + autocmd CmdlineLeave [\/\?] :set nohlsearch augroup END < CTRL-L can be used to add one character from after the current match diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 2b051e4223..1eb03dad36 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3564,8 +3564,8 @@ vim.bo.inex = vim.bo.includeexpr --- ```vim --- augroup vimrc-incsearch-highlight --- autocmd! ---- autocmd CmdlineEnter /,\? :set hlsearch ---- autocmd CmdlineLeave /,\? :set nohlsearch +--- autocmd CmdlineEnter [\/\?] :set hlsearch +--- autocmd CmdlineLeave [\/\?] :set nohlsearch --- augroup END --- ``` --- diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 00392dcfc1..4c10557541 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -4700,8 +4700,8 @@ local options = { autocmd. Example: >vim augroup vimrc-incsearch-highlight autocmd! - autocmd CmdlineEnter /,\? :set hlsearch - autocmd CmdlineLeave /,\? :set nohlsearch + autocmd CmdlineEnter [\/\?] :set hlsearch + autocmd CmdlineLeave [\/\?] :set nohlsearch augroup END < CTRL-L can be used to add one character from after the current match