diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index d5e7554cbe..4e12d8fe00 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1296,8 +1296,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 6a31dbea25..824aeb7cc7 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3402,8 +3402,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 ae31a0ea3b..0c458f06a0 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3269,8 +3269,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 2527fdc889..57922d53cc 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -4431,8 +4431,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