runtime(vim): Update ftplugin - comment motions (#13412)
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>
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index e25054b..1d340e4 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -85,8 +85,8 @@
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