diff runtime/ftplugin/vim.vim @ 23573:e2e2cc5d0856

Update runtime files. Commit: https://github.com/vim/vim/commit/82be4849eed0b8fbee45bc8da99b685ec89af59a Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 11 19:40:15 2021 +0100 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Mon, 11 Jan 2021 19:45:05 +0100
parents 0db0640e16e0
children 96206643bd9f
line wrap: on
line diff
--- 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,23 @@ 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]\>'
+  " 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
-
 if !exists("no_plugin_maps") && !exists("no_vim_maps")
   let b:did_add_maps = 1