aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin/vim.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-05-01 22:09:13 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-05-01 23:19:57 -0400
commitdd2bc06411a69917c6f4a47d0b6832104efa98e4 (patch)
tree45224b63ba9c145f7cef7bb74a0081d467017eca /runtime/ftplugin/vim.vim
parentc1dd4e83b494d19a5ebcb7ffb936cb4649f11637 (diff)
downloadrneovim-dd2bc06411a69917c6f4a47d0b6832104efa98e4.tar.gz
rneovim-dd2bc06411a69917c6f4a47d0b6832104efa98e4.tar.bz2
rneovim-dd2bc06411a69917c6f4a47d0b6832104efa98e4.zip
vim-patch:82be4849eed0
Update runtime files. https://github.com/vim/vim/commit/82be4849eed0b8fbee45bc8da99b685ec89af59a
Diffstat (limited to 'runtime/ftplugin/vim.vim')
-rw-r--r--runtime/ftplugin/vim.vim20
1 files changed, 13 insertions, 7 deletions
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 4df0d4b59b..6759951daf 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2020 Aug 14
+" Last Change: 2021 Jan 05
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -48,18 +48,24 @@ setlocal isk+=#
" Use :help to lookup the keyword under the cursor with K.
setlocal keywordprg=:help
-" Set 'comments' to format dashed lists in comments
-" Avoid that #{} starts a comment.
-setlocal com=sO:\"\ -,mO:\"\ \ ,sO:#\ -,mO:#\ \ ,eO:##,:\",b:#
+" if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
+if "\n" .. join(getline(1, 10), "\n") =~# '\n\s*vim9\%[script]\>'
+ " Set 'comments' to format dashed lists in comments
+ setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#
+ " Comments start with a double quote in a legacy script;
+ " with # in a Vim9 script
+ setlocal commentstring=\"%s
+else
+ setlocal com=sO:\"\ -,mO:\"\ \ ,:\"
+ setlocal commentstring=#%s
+endif
+
" Format comments to be up to 78 characters long
if &tw == 0
setlocal tw=78
endif
-" Comments start with a double quote; in Vim9 script # would also work
-setlocal commentstring=\"%s
-
" Prefer Vim help instead of manpages.
setlocal keywordprg=:help