diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index 8cfaaafb66..8e86a185ff 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -5,7 +5,8 @@ " Contributors: Riley Bruins ('commentstring') " @Konfekt " @tpope (s:Help()) -" Last Change: 2026 May 31 +" @lacygoill +" Last Change: 2026 Jun 27 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -103,7 +104,7 @@ command! -buffer -nargs=1 VimKeywordPrg :exe 'help' s:Help() setlocal keywordprg=:VimKeywordPrg " Comments starts with # in Vim9 script. We have to guess which one to use. -if "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>' +if "\n" .. getline(1, 32)->join("\n") =~# '\nvim9s\%[cript]\>' setlocal commentstring=#\ %s " Set 'comments' to format dashed lists in comments, for Vim9 script. setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#\\\ ,:# diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index e4cf94b744..b20ba7280d 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -17,7 +17,8 @@ set cpo&vim " Feature testing {{{1 -let s:vim9script = "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>' +" NOTE: vimsyn_force_vim9 for internal use only +let s:vim9script = get(b:, "vimsyn_force_vim9", v:false) || "\n" .. getline(1, 32)->join("\n") =~# '\nvim9s\%[cript]\>' function s:has(feature) return has(a:feature) || index(get(g:, "vimsyn_vim_features", []), a:feature) != -1