]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vim): Update ftplugin - comment motions (#13412)
authordkearns <dougkearns@gmail.com>
Mon, 23 Oct 2023 16:16:44 +0000 (03:16 +1100)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 16:16:44 +0000 (18:16 +0200)
Fix the pattern used by comment-motion mappings to match the start of a
block comment.

Block-comment start lines were being ignored if the previous line
contained a double-quote character anywhere in the line.  Line comments
should only be ignored if the previous line is a full-line comment and,
therefore, part of the current block comment.

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/ftplugin/vim.vim

index e25054ba89f95cbfb6273aba50d634fede8c7bed..1d340e475ba463a8dbc968a6ba1dba66168a0107 100644 (file)
@@ -85,8 +85,8 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps")
   vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "W")<CR>
 
   " Move around comments
-  nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
-  vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
+  nnoremap <silent><buffer> ]" :call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR>
+  vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR>
   nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
   vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
 endif