aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-10-17 08:19:48 +0200
committerGitHub <noreply@github.com>2022-10-17 08:19:48 +0200
commit9701c9dc9f157c4d09d1783aab9913d05b0d73b1 (patch)
treedd9b7d788960d5a481e14fb720235f456e691636
parentd44f088834081ee404db4459fdcfba82d14ef157 (diff)
downloadrneovim-9701c9dc9f157c4d09d1783aab9913d05b0d73b1.tar.gz
rneovim-9701c9dc9f157c4d09d1783aab9913d05b0d73b1.tar.bz2
rneovim-9701c9dc9f157c4d09d1783aab9913d05b0d73b1.zip
vim-patch:3c053a1a5ad2 (#20679)
Update runtime files https://github.com/vim/vim/commit/3c053a1a5ad2a3c924929e11f2b9af20a8b901e2
-rw-r--r--runtime/autoload/netrw.vim14
-rw-r--r--runtime/doc/indent.txt9
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/repeat.txt7
-rw-r--r--runtime/doc/syntax.txt15
-rw-r--r--runtime/doc/userfunc.txt4
-rw-r--r--runtime/filetype.vim2
-rw-r--r--runtime/ftplugin/abaqus.vim43
-rw-r--r--runtime/ftplugin/lua.vim7
-rw-r--r--runtime/ftplugin/markdown.vim36
-rw-r--r--runtime/ftplugin/poefilter.vim13
-rw-r--r--runtime/ftplugin/ssa.vim13
-rw-r--r--runtime/optwin.vim4
-rw-r--r--runtime/synmenu.vim2
-rw-r--r--runtime/syntax/c.vim2
-rw-r--r--runtime/syntax/markdown.vim89
-rw-r--r--runtime/syntax/poefilter.vim167
-rw-r--r--runtime/syntax/sed.vim105
-rw-r--r--runtime/syntax/ssa.vim63
-rw-r--r--test/functional/plugin/health_spec.lua2
21 files changed, 484 insertions, 116 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index ef0282848f..24d2cfc460 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1751,8 +1751,10 @@ fun! s:NetrwOptionsRestore(vt)
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
if !exists("{a:vt}netrw_optionsave")
" call Decho("case ".a:vt."netrw_optionsave : doesn't exist",'~'.expand("<slnum>"))
-" call Decho("..doing filetype detect anyway")
- filetype detect
+ if !isdirectory(expand('%'))
+" call Decho("..doing filetype detect anyway")
+ filetype detect
+ endif
" call Decho("..settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
" call Decho("..ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
" call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist")
@@ -1859,9 +1861,11 @@ fun! s:NetrwOptionsRestore(vt)
" were having their filetype detect-generated settings overwritten by
" NetrwOptionRestore.
if &ft != "netrw"
-" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
- filetype detect
-" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
+ if !isdirectory(expand('%'))
+" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
+ filetype detect
+" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
+ endif
endif
" call Decho("(s:NetrwOptionsRestore) lines=".&lines)
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index 5473c7566c..2b86300e7f 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -978,9 +978,12 @@ indentation: >
PYTHON *ft-python-indent*
-The amount of indent can be set for the following situations. The examples
-given are the defaults. Note that the dictionary values are set to an
-expression, so that you can change the value of 'shiftwidth' later.
+The amount of indent can be set with the `g:python_indent` |Dictionary|, which
+needs to be created before adding the items: >
+ let g:python_indent = {}
+The examples given are the defaults. Note that the dictionary values are set
+to an expression, so that you can change the value of 'shiftwidth' later
+without having to update these values.
Indent after an open paren: >
let g:python_indent.open_paren = 'shiftwidth() * 2'
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 3e056ffc28..184a9aeea4 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5949,7 +5949,7 @@ A jump table for the options with a short description can be found at |Q_op|.
For the "screen" and "topline" values, the cursor position will be
changed when necessary. In this case, the jumplist will be populated
with the previous cursor position. For "screen", the text cannot always
- be kept on the same screen line when 'wrap' is enabled.
+ be kept on the same screen line when 'wrap' is enabled.
*'splitright'* *'spr'* *'nosplitright'* *'nospr'*
'splitright' 'spr' boolean (default off)
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index f1261b18ff..f1294a18ba 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -772,6 +772,7 @@ Short explanation of each option: *option-list*
'lines' number of lines in the display
'linespace' 'lsp' number of pixel lines to use between characters
'lisp' automatic indenting for Lisp
+'lispoptions' 'lop' changes how Lisp indenting is done
'lispwords' 'lw' words that change how lisp indenting works
'list' show <Tab> and <EOL>
'listchars' 'lcs' characters for displaying in list mode
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 21945dc499..6a1b8b05a7 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -289,7 +289,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
how this can be useful.
This is normally done automatically during startup,
- after loading your .vimrc file. With this command it
+ after loading your |vimrc| file. With this command it
can be done earlier.
Packages will be loaded only once. Using
@@ -540,6 +540,11 @@ You would now have these files under ~/.local/share/nvim/site:
On startup after processing your |config|, Nvim scans all directories in
'packpath' for plugins in "pack/*/start/*", then loads the plugins.
+To allow for calling into package functionality while parsing your |vimrc|,
+|:colorscheme| and |autoload| will both automatically search under 'packpath'
+as well in addition to 'runtimepath'. See the documentation for each for
+details.
+
In the example Nvim will find "pack/foo/start/foobar/plugin/foo.vim" and load
it.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index f9ca919ddb..48301f3083 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -2986,16 +2986,25 @@ satisfied with it for my own projects.
SED *sed.vim* *ft-sed-syntax*
To make tabs stand out from regular blanks (accomplished by using Todo
-highlighting on the tabs), define "highlight_sedtabs" by putting >
-
- :let highlight_sedtabs = 1
+highlighting on the tabs), define "g:sed_highlight_tabs" by putting >
+ :let g:sed_highlight_tabs = 1
+<
in the vimrc file. (This special highlighting only applies for tabs
inside search patterns, replacement texts, addresses or text included
by an Append/Change/Insert command.) If you enable this option, it is
also a good idea to set the tab width to one character; by doing that,
you can easily count the number of tabs in a string.
+GNU sed allows comments after text on the same line. BSD sed only allows
+comments where "#" is the first character of the line. To enforce BSD-style
+comments, i.e. mark end-of-line comments as errors, use: >
+
+ :let g:sed_dialect = "bsd"
+<
+Note that there are other differences between GNU sed and BSD sed which are
+not (yet) affected by this setting.
+
Bugs:
The transform command (y) is treated exactly like the substitute
diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt
index 5462fa952c..641c95b06e 100644
--- a/runtime/doc/userfunc.txt
+++ b/runtime/doc/userfunc.txt
@@ -388,6 +388,10 @@ file should then define the function like this: >
echo "Done!"
endfunction
+If the file doesn't exist, Vim will also search in 'packpath' (under "start")
+to allow calling packages' functions from your |vimrc| when the packages have
+not been added to 'runtimepath' yet (see |packages|).
+
The file name and the name used before the # in the function must match
exactly, and the defined function must have the name exactly as it will be
called.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 8dfecfbdcc..c2f5ab0ee0 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Sep 27
+" Last Change: 2022 Oct 12
" Only run this if enabled
if !exists("do_legacy_filetype")
diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim
index 3faeff621a..5931cd921d 100644
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Abaqus finite element input file (www.abaqus.com)
" Maintainer: Carl Osterwisch <costerwi@gmail.com>
-" Last Change: 2022 Aug 03
+" Last Change: 2022 Oct 08
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -66,25 +66,44 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if !exists("no_plugin_maps") && !exists("no_abaqus_maps")
- " Define keys used to move [count] keywords backward or forward.
- noremap <silent><buffer> [[ ?^\*\a<CR>:nohlsearch<CR>
- noremap <silent><buffer> ]] /^\*\a<CR>:nohlsearch<CR>
+ " Map [[ and ]] keys to move [count] keywords backward or forward
+ nnoremap <silent><buffer> ]] :call <SID>Abaqus_NextKeyword(1)<CR>
+ nnoremap <silent><buffer> [[ :call <SID>Abaqus_NextKeyword(-1)<CR>
+ function! <SID>Abaqus_NextKeyword(direction)
+ .mark '
+ if a:direction < 0
+ let flags = 'b'
+ else
+ let flags = ''
+ endif
+ let l:count = abs(a:direction) * v:count1
+ while l:count > 0 && search("^\\*\\a", flags)
+ let l:count -= 1
+ endwhile
+ endfunction
- " Define key to toggle commenting of the current line or range
+ " Map \\ to toggle commenting of the current line or range
noremap <silent><buffer> <LocalLeader><LocalLeader>
\ :call <SID>Abaqus_ToggleComment()<CR>j
function! <SID>Abaqus_ToggleComment() range
- if strpart(getline(a:firstline), 0, 2) == "**"
- " Un-comment all lines in range
- silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'
- else
- " Comment all lines in range
- silent execute a:firstline . ',' . a:lastline . 's/^/**/'
- endif
+ if strpart(getline(a:firstline), 0, 2) == "**"
+ " Un-comment all lines in range
+ silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'
+ else
+ " Comment all lines in range
+ silent execute a:firstline . ',' . a:lastline . 's/^/**/'
+ endif
+ endfunction
+
+ " Map \s to swap first two comma separated fields
+ noremap <silent><buffer> <LocalLeader>s :call <SID>Abaqus_Swap()<CR>
+ function! <SID>Abaqus_Swap() range
+ silent execute a:firstline . ',' . a:lastline . 's/\([^*,]*\),\([^,]*\)/\2,\1/'
endfunction
let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"
\ . "|unmap <buffer> <LocalLeader><LocalLeader>"
+ \ . "|unmap <buffer> <LocalLeader>s"
endif
" Undo must be done in nocompatible mode for <LocalLeader>.
diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim
index aaa61f71d9..c28b8aecf8 100644
--- a/runtime/ftplugin/lua.vim
+++ b/runtime/ftplugin/lua.vim
@@ -3,7 +3,8 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Max Ischenko <mfi@ukr.net>
" Contributor: Dorai Sitaram <ds26@gte.com>
-" Last Change: 2022 Sep 05
+" C.D. MacEachern <craig.daniel.maceachern@gmail.com>
+" Last Change: 2022 Oct 15
if exists("b:did_ftplugin")
finish
@@ -19,9 +20,11 @@ setlocal formatoptions-=t formatoptions+=croql
let &l:define = '\<function\|\<local\%(\s\+function\)\='
+" TODO: handle init.lua
+setlocal includeexpr=substitute(v:fname,'\\.','/','g')
setlocal suffixesadd=.lua
-let b:undo_ftplugin = "setlocal cms< com< def< fo< sua<"
+let b:undo_ftplugin = "setlocal cms< com< def< fo< inex< sua<"
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index fc1d9e068b..2b963f139d 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
-" Language: Markdown
-" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2019 Dec 05
+" Language: Markdown
+" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
+" Last Change: 2022 Oct 13
if exists("b:did_ftplugin")
finish
@@ -9,18 +9,33 @@ endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
+let s:keepcpo= &cpo
+set cpo&vim
+
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
-setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
+setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
if exists('b:undo_ftplugin')
- let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
+ let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<"
else
- let b:undo_ftplugin = "setl cms< com< fo< flp<"
+ let b:undo_ftplugin = "setl cms< com< fo< flp< et< ts< sts< sw<"
+endif
+
+if get(g:, 'markdown_recommended_style', 1)
+ setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4
+endif
+
+if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps")
+ nnoremap <silent><buffer> [[ :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
+ nnoremap <silent><buffer> ]] :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
+ xnoremap <silent><buffer> [[ :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
+ xnoremap <silent><buffer> ]] :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
+ let b:undo_ftplugin .= '|sil! nunmap <buffer> [[|sil! nunmap <buffer> ]]|sil! xunmap <buffer> [[|sil! xunmap <buffer> ]]'
endif
function! s:NotCodeBlock(lnum) abort
- return synIDattr(synID(v:lnum, 1, 1), 'name') !=# 'markdownCode'
+ return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCode'
endfunction
function! MarkdownFold() abort
@@ -64,11 +79,14 @@ function! MarkdownFoldText() abort
return hash_indent.' '.title.' '.linecount
endfunction
-if has("folding") && exists("g:markdown_folding")
+if has("folding") && get(g:, "markdown_folding", 0)
setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr
setlocal foldtext=MarkdownFoldText()
- let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
+ let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
endif
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
" vim:set sw=2:
diff --git a/runtime/ftplugin/poefilter.vim b/runtime/ftplugin/poefilter.vim
new file mode 100644
index 0000000000..92c2def630
--- /dev/null
+++ b/runtime/ftplugin/poefilter.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: PoE item filter
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Oct 07
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/ssa.vim b/runtime/ftplugin/ssa.vim
new file mode 100644
index 0000000000..04cc7a9bde
--- /dev/null
+++ b/runtime/ftplugin/ssa.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: SubStation Alpha
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Oct 10
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:;,:!: commentstring=;\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 382322cfe2..4db5e20921 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Oct 02
+" Last Change: 2022 Oct 15
" If there already is an option window, jump to that one.
let buf = bufnr('option-window')
@@ -874,6 +874,8 @@ if has("lispindent")
call <SID>BinOptionL("lisp")
call append("$", "lispwords\twords that change how lisp indenting works")
call <SID>OptionL("lw")
+ call <SID>AddOption("lispoptions", "options for Lisp indenting")
+ call <SID>OptionL("lop")
endif
diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim
index ba9e6a198d..a664e7689d 100644
--- a/runtime/synmenu.vim
+++ b/runtime/synmenu.vim
@@ -2,7 +2,7 @@
" This file is normally sourced from menu.vim.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2017 Oct 28
+" Last Change: 2022 Oct 04
" Define the SetSyn function, used for the Syntax menu entries.
" Set 'filetype' and also 'syntax' if it is manually selected.
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 890e9ae1a7..50878a78ea 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Apr 24
+" Last Change: 2022 Oct 05
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/markdown.vim b/runtime/syntax/markdown.vim
index 17b61c2fa4..44187ff18c 100644
--- a/runtime/syntax/markdown.vim
+++ b/runtime/syntax/markdown.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Markdown
-" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
" Filenames: *.markdown
-" Last Change: 2020 Jan 14
+" Last Change: 2022 Oct 13
if exists("b:current_syntax")
finish
@@ -12,6 +12,12 @@ if !exists('main_syntax')
let main_syntax = 'markdown'
endif
+if has('folding')
+ let s:foldmethod = &l:foldmethod
+ let s:foldtext = &l:foldtext
+endif
+let s:iskeyword = &l:iskeyword
+
runtime! syntax/html.vim
unlet! b:current_syntax
@@ -26,17 +32,33 @@ for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")')
if s:type =~ '\.'
let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*')
endif
- exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim'
+ syn case match
+ exe 'syn include @markdownHighlight_'.tr(s:type,'.','_').' syntax/'.matchstr(s:type,'[^.]*').'.vim'
unlet! b:current_syntax
let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
unlet! s:done_include
+syn spell toplevel
+if exists('s:foldmethod') && s:foldmethod !=# &l:foldmethod
+ let &l:foldmethod = s:foldmethod
+ unlet s:foldmethod
+endif
+if exists('s:foldtext') && s:foldtext !=# &l:foldtext
+ let &l:foldtext = s:foldtext
+ unlet s:foldtext
+endif
+if s:iskeyword !=# &l:iskeyword
+ let &l:iskeyword = s:iskeyword
+endif
+unlet s:iskeyword
+
if !exists('g:markdown_minlines')
let g:markdown_minlines = 50
endif
execute 'syn sync minlines=' . g:markdown_minlines
+syn sync linebreaks=1
syn case ignore
syn match markdownValid '[<>]\c[a-z/$!]\@!' transparent contains=NONE
@@ -52,16 +74,16 @@ syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHea
syn match markdownHeadingRule "^[=-]\+$" contained
-syn region markdownH1 matchgroup=markdownH1Delimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH2 matchgroup=markdownH2Delimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH3 matchgroup=markdownH3Delimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH4 matchgroup=markdownH4Delimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH5 matchgroup=markdownH5Delimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
-syn region markdownH6 matchgroup=markdownH6Delimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH1 matchgroup=markdownH1Delimiter start=" \{,3}#\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH2 matchgroup=markdownH2Delimiter start=" \{,3}##\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH3 matchgroup=markdownH3Delimiter start=" \{,3}###\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH4 matchgroup=markdownH4Delimiter start=" \{,3}####\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH5 matchgroup=markdownH5Delimiter start=" \{,3}#####\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
+syn region markdownH6 matchgroup=markdownH6Delimiter start=" \{,3}######\s" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
-syn region markdownCodeBlock start=" \|\t" end="$" contained
+syn region markdownCodeBlock start="^\n\( \{4,}\|\t\)" end="^\ze \{,3}\S.*$" keepend
" TODO: real nesting
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
@@ -79,7 +101,7 @@ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
-syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
+syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^][]*\%(\[\_[^][]*\]\_[^][]*\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
@@ -88,31 +110,38 @@ let s:concealends = ''
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
let s:concealends = ' concealends'
endif
-exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
-exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\w\@<!_\S\@=" end="\S\@<=_\w\@!" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
-exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" skip="\\\*" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
-exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@<!__\S\@=" end="\S\@<=__\w\@!" skip="\\_" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
-exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
-exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\w\@<!___\S\@=" end="\S\@<=___\w\@!" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\*\S\@=" end="\S\@<=\*\|^$" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\w\@<!_\S\@=" end="\S\@<=_\w\@!\|^$" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\*\*\S\@=" end="\S\@<=\*\*\|^$" skip="\\\*" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
+exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\w\@<!__\S\@=" end="\S\@<=__\w\@!\|^$" skip="\\_" contains=markdownLineStart,markdownItalic,@Spell' . s:concealends
+exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\*\*\*\S\@=" end="\S\@<=\*\*\*\|^$" skip="\\\*" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\w\@<!___\S\@=" end="\S\@<=___\w\@!\|^$" skip="\\_" contains=markdownLineStart,@Spell' . s:concealends
+exe 'syn region markdownStrike matchgroup=markdownStrikeDelimiter start="\~\~\S\@=" end="\S\@<=\~\~\|^$" contains=markdownLineStart,@Spell' . s:concealends
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
-syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend
+syn region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
+syn region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\).*$" end="^\s*\z1\ze\s*$" keepend
syn match markdownFootnote "\[^[^\]]\+\]"
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
-if main_syntax ==# 'markdown'
- let s:done_include = {}
- for s:type in g:markdown_fenced_languages
- if has_key(s:done_include, matchstr(s:type,'[^.]*'))
- continue
- endif
- exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*````*\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*````*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') . s:concealends
- let s:done_include[matchstr(s:type,'[^.]*')] = 1
- endfor
- unlet! s:type
- unlet! s:done_include
+let s:done_include = {}
+for s:type in g:markdown_fenced_languages
+ if has_key(s:done_include, matchstr(s:type,'[^.]*'))
+ continue
+ endif
+ exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
+ exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
+ let s:done_include[matchstr(s:type,'[^.]*')] = 1
+endfor
+unlet! s:type
+unlet! s:done_include
+
+if get(b:, 'markdown_yaml_head', get(g:, 'markdown_yaml_head', main_syntax ==# 'markdown'))
+ syn include @markdownYamlTop syntax/yaml.vim
+ unlet! b:current_syntax
+ syn region markdownYamlHead start="\%^---$" end="^\%(---\|\.\.\.\)\s*$" keepend contains=@markdownYamlTop,@Spell
endif
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
@@ -156,6 +185,8 @@ hi def link markdownBold htmlBold
hi def link markdownBoldDelimiter markdownBold
hi def link markdownBoldItalic htmlBoldItalic
hi def link markdownBoldItalicDelimiter markdownBoldItalic
+hi def link markdownStrike htmlStrike
+hi def link markdownStrikeDelimiter markdownStrike
hi def link markdownCodeDelimiter Delimiter
hi def link markdownEscape Special
diff --git a/runtime/syntax/poefilter.vim b/runtime/syntax/poefilter.vim
new file mode 100644
index 0000000000..f7e92034ee
--- /dev/null
+++ b/runtime/syntax/poefilter.vim
@@ -0,0 +1,167 @@
+" Vim syntax file
+" Language: PoE item filter
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: *.filter
+" Last Change: 2022 Oct 07
+
+if exists('b:current_syntax')
+ finish
+endif
+
+let s:cpo_save = &cpoptions
+set cpoptions&vim
+
+" Comment
+syn keyword poefilterTodo TODO NOTE XXX contained
+syn match poefilterCommentTag /\[[0-9A-Z\[\]]\+\]/ contained
+syn match poefilterComment /#.*$/ contains=poefilterTodo,poefilterCommentTag,@Spell
+
+" Blocks
+syn keyword poefilterBlock Show Hide
+
+" Conditions
+syn keyword poefilterCondition
+ \ AlternateQuality
+ \ AnyEnchantment
+ \ BlightedMap
+ \ Corrupted
+ \ ElderItem
+ \ ElderMap
+ \ FracturedItem
+ \ Identified
+ \ Mirrored
+ \ Replica
+ \ Scourged
+ \ ShapedMap
+ \ ShaperItem
+ \ SynthesisedItem
+ \ UberBlightedMap
+ \ skipwhite nextgroup=poefilterBoolean
+syn keyword poefilterCondition
+ \ ArchnemesisMod
+ \ BaseType
+ \ Class
+ \ EnchantmentPassiveNode
+ \ HasEnchantment
+ \ HasExplicitMod
+ \ ItemLevel
+ \ SocketGroup
+ \ Sockets
+ \ skipwhite nextgroup=poefilterOperator,poefilterString
+syn keyword poefilterCondition
+ \ AreaLevel
+ \ BaseArmour
+ \ BaseDefencePercentile
+ \ BaseEnergyShield
+ \ BaseEvasion
+ \ BaseWard
+ \ CorruptedMods
+ \ DropLevel
+ \ EnchantmentPassiveNum
+ \ GemLevel
+ \ HasEaterOfWorldsImplicit
+ \ HasSearingExarchImplicit
+ \ Height
+ \ LinkedSockets
+ \ MapTier
+ \ Quality
+ \ StackSize
+ \ Width
+ \ skipwhite nextgroup=poefilterOperator,poefilterNumber
+syn keyword poefilterCondition
+ \ GemQualityType
+ \ skipwhite nextgroup=poefilterString,poefilterQuality
+syn keyword poefilterCondition
+ \ HasInfluence
+ \ skipwhite nextgroup=poefilterString,poefilterInfluence
+syn keyword poefilterCondition
+ \ Rarity
+ \ skipwhite nextgroup=poefilterString,poefilterRarity
+
+" Actions
+syn keyword poefilterAction
+ \ PlayAlertSound
+ \ PlayAlertSoundPositional
+ \ skipwhite nextgroup=poefilterNumber,poefilterDisable
+syn keyword poefilterAction
+ \ CustomAlertSound
+ \ CustomAlertSoundOptional
+ \ skipwhite nextgroup=poefilterString
+syn keyword poefilterAction
+ \ DisableDropSound
+ \ EnableDropSound
+ \ DisableDropSoundIfAlertSound
+ \ EnableDropSoundIfAlertSound
+ \ skipwhite nextgroup=poefilterBoolean
+syn keyword poefilterAction
+ \ MinimapIcon
+ \ SetBackgroundColor
+ \ SetBorderColor
+ \ SetFontSize
+ \ SetTextColor
+ \ skipwhite nextgroup=poefilterNumber
+syn keyword poefilterAction
+ \ PlayEffect
+ \ skipwhite nextgroup=poefilterColour
+
+" Operators
+syn match poefilterOperator /!\|[<>=]=\?/ contained
+ \ skipwhite nextgroup=poefilterString,poefilterNumber,
+ \ poefilterQuality,poefilterRarity,poefilterInfluence
+
+" Arguments
+syn match poefilterString /[-a-zA-Z0-9:,']/ contained contains=@Spell
+ \ skipwhite nextgroup=poefilterString,poefilterNumber,
+ \ poefilterQuality,poefilterRarity,poefilterInfluence
+syn region poefilterString matchgroup=poefilterQuote keepend
+ \ start=/"/ end=/"/ concealends contained contains=@Spell
+ \ skipwhite nextgroup=poefilterString,poefilterNumber,
+ \ poefilterQuality,poefilterRarity,poefilterInfluence
+syn match poefilterNumber /-1\|0\|[1-9][0-9]*/ contained
+ \ skipwhite nextgroup=poefilterString,poefilterNumber,
+ \ poefilterQuality,poefilterRarity,poefilterInfluence,poefilterColour
+syn keyword poefilterBoolean True False contained
+
+" Special arguments (conditions)
+syn keyword poefilterQuality Superior Divergent Anomalous Phantasmal
+ \ contained skipwhite nextgroup=poefilterString,poefilterQuality
+syn keyword poefilterRarity Normal Magic Rare Unique
+ \ contained skipwhite nextgroup=poefilterString,poefilterRarity
+syn keyword poefilterInfluence Shaper Elder
+ \ Crusader Hunter Redeemer Warlord None
+ \ contained skipwhite nextgroup=poefilterString,poefilterInfluence
+
+" Special arguments (actions)
+syn keyword poefilterColour Red Green Blue Brown
+ \ White Yellow Cyan Grey Orange Pink Purple
+ \ contained skipwhite nextgroup=poefilterShape,poefilterTemp
+syn keyword poefilterShape Circle Diamond Hecagon Square Star Triangle
+ \ Cross Moon Raindrop Kite Pentagon UpsideDownHouse contained
+syn keyword poefilterDisable None contained
+syn keyword poefilterTemp Temp contained
+
+" Colours
+
+hi def link poefilterAction Statement
+hi def link poefilterBlock Structure
+hi def link poefilterBoolean Boolean
+hi def link poefilterColour Special
+hi def link poefilterComment Comment
+hi def link poefilterCommentTag SpecialComment
+hi def link poefilterCondition Conditional
+hi def link poefilterDisable Constant
+hi def link poefilterInfluence Special
+hi def link poefilterNumber Number
+hi def link poefilterOperator Operator
+hi def link poefilterQuality Special
+hi def link poefilterQuote Delimiter
+hi def link poefilterRarity Special
+hi def link poefilterShape Special
+hi def link poefilterString String
+hi def link poefilterTemp StorageClass
+hi def link poefilterTodo Todo
+
+let b:current_syntax = 'poefilter'
+
+let &cpoptions = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/syntax/sed.vim b/runtime/syntax/sed.vim
index 63b39db81f..d1f631df4b 100644
--- a/runtime/syntax/sed.vim
+++ b/runtime/syntax/sed.vim
@@ -1,30 +1,42 @@
" Vim syntax file
-" Language: sed
-" Maintainer: Haakon Riiser <hakonrk@fys.uio.no>
-" URL: http://folk.uio.no/hakonrk/vim/syntax/sed.vim
-" Last Change: 2010 May 29
+" Language: sed
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Haakon Riiser <hakonrk@fys.uio.no>
+" Contributor: Jack Haden-Enneking
+" Last Change: 2022 Oct 15
" quit when a syntax file was already loaded
if exists("b:current_syntax")
- finish
+ finish
endif
+syn keyword sedTodo contained TODO FIXME XXX
+
syn match sedError "\S"
syn match sedWhitespace "\s\+" contained
syn match sedSemicolon ";"
syn match sedAddress "[[:digit:]$]"
syn match sedAddress "\d\+\~\d\+"
-syn region sedAddress matchgroup=Special start="[{,;]\s*/\(\\/\)\="lc=1 skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
-syn region sedAddress matchgroup=Special start="^\s*/\(\\/\)\=" skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
-syn match sedComment "^\s*#.*$"
-syn match sedFunction "[dDgGhHlnNpPqQx=]\s*\($\|;\)" contains=sedSemicolon,sedWhitespace
+syn region sedAddress matchgroup=Special start="[{,;]\s*/\%(\\/\)\="lc=1 skip="[^\\]\%(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
+syn region sedAddress matchgroup=Special start="^\s*/\%(\\/\)\=" skip="[^\\]\%(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta
+syn match sedFunction "[dDgGhHlnNpPqQx=]\s*\%($\|;\)" contains=sedSemicolon,sedWhitespace
+if exists("g:sed_dialect") && g:sed_dialect ==? "bsd"
+ syn match sedComment "^\s*#.*$" contains=sedTodo
+else
+ syn match sedFunction "[dDgGhHlnNpPqQx=]\s*\ze#" contains=sedSemicolon,sedWhitespace
+ syn match sedComment "#.*$" contains=sedTodo
+endif
syn match sedLabel ":[^;]*"
-syn match sedLineCont "^\(\\\\\)*\\$" contained
-syn match sedLineCont "[^\\]\(\\\\\)*\\$"ms=e contained
+syn match sedLineCont "^\%(\\\\\)*\\$" contained
+syn match sedLineCont "[^\\]\%(\\\\\)*\\$"ms=e contained
syn match sedSpecial "[{},!]"
-if exists("highlight_sedtabs")
- syn match sedTab "\t" contained
+
+" continue to silently support the old name
+let s:highlight_tabs = v:false
+if exists("g:highlight_sedtabs") || get(g:, "sed_highlight_tabs", 0)
+ let s:highlight_tabs = v:true
+ syn match sedTab "\t" contained
endif
" Append/Change/Insert
@@ -34,39 +46,39 @@ syn region sedBranch matchgroup=sedFunction start="[bt]" matchgroup=sedSemicolon
syn region sedRW matchgroup=sedFunction start="[rw]" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace
" Substitution/transform with various delimiters
-syn region sedFlagwrite matchgroup=sedFlag start="w" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace contained
-syn match sedFlag "[[:digit:]gpI]*w\=" contains=sedFlagwrite contained
+syn region sedFlagWrite matchgroup=sedFlag start="w" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace contained
+syn match sedFlag "[[:digit:]gpI]*w\=" contains=sedFlagWrite contained
syn match sedRegexpMeta "[.*^$]" contained
syn match sedRegexpMeta "\\." contains=sedTab contained
syn match sedRegexpMeta "\[.\{-}\]" contains=sedTab contained
syn match sedRegexpMeta "\\{\d\*,\d*\\}" contained
-syn match sedRegexpMeta "\\(.\{-}\\)" contains=sedTab contained
-syn match sedReplaceMeta "&\|\\\($\|.\)" contains=sedTab contained
+syn match sedRegexpMeta "\\%(.\{-}\\)" contains=sedTab contained
+syn match sedReplaceMeta "&\|\\\%($\|.\)" contains=sedTab contained
" Metacharacters: $ * . \ ^ [ ~
" @ is used as delimiter and treated on its own below
-let __at = char2nr("@")
-let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64
+let s:at = char2nr("@")
+let s:i = char2nr(" ") " ASCII: 32, EBCDIC: 64
if has("ebcdic")
- let __sed_last = 255
+ let s:last = 255
else
- let __sed_last = 126
+ let s:last = 126
endif
-let __sed_metacharacters = '$*.\^[~'
-while __sed_i <= __sed_last
- let __sed_delimiter = escape(nr2char(__sed_i), __sed_metacharacters)
- if __sed_i != __at
- exe 'syn region sedAddress matchgroup=Special start=@\\'.__sed_delimiter.'\(\\'.__sed_delimiter.'\)\=@ skip=@[^\\]\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'I\=@ contains=sedTab'
- exe 'syn region sedRegexp'.__sed_i 'matchgroup=Special start=@'.__sed_delimiter.'\(\\\\\|\\'.__sed_delimiter.'\)*@ skip=@[^\\'.__sed_delimiter.']\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'@me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement'.__sed_i
- exe 'syn region sedReplacement'.__sed_i 'matchgroup=Special start=@'.__sed_delimiter.'\(\\\\\|\\'.__sed_delimiter.'\)*@ skip=@[^\\'.__sed_delimiter.']\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'@ contains=sedTab,sedReplaceMeta keepend contained nextgroup=sedFlag'
- endif
- let __sed_i = __sed_i + 1
+let s:metacharacters = '$*.\^[~'
+while s:i <= s:last
+ let s:delimiter = escape(nr2char(s:i), s:metacharacters)
+ if s:i != s:at
+ exe 'syn region sedAddress matchgroup=Special start=@\\'.s:delimiter.'\%(\\'.s:delimiter.'\)\=@ skip=@[^\\]\%(\\\\\)*\\'.s:delimiter.'@ end=@'.s:delimiter.'[IM]\=@ contains=sedTab'
+ exe 'syn region sedRegexp'.s:i 'matchgroup=Special start=@'.s:delimiter.'\%(\\\\\|\\'.s:delimiter.'\)*@ skip=@[^\\'.s:delimiter.']\%(\\\\\)*\\'.s:delimiter.'@ end=@'.s:delimiter.'@me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement'.s:i
+ exe 'syn region sedReplacement'.s:i 'matchgroup=Special start=@'.s:delimiter.'\%(\\\\\|\\'.s:delimiter.'\)*@ skip=@[^\\'.s:delimiter.']\%(\\\\\)*\\'.s:delimiter.'@ end=@'.s:delimiter.'@ contains=sedTab,sedReplaceMeta keepend contained nextgroup=@sedFlags'
+ endif
+ let s:i = s:i + 1
endwhile
-syn region sedAddress matchgroup=Special start=+\\@\(\\@\)\=+ skip=+[^\\]\(\\\\\)*\\@+ end=+@I\=+ contains=sedTab,sedRegexpMeta
-syn region sedRegexp64 matchgroup=Special start=+@\(\\\\\|\\@\)*+ skip=+[^\\@]\(\\\\\)*\\@+ end=+@+me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement64
-syn region sedReplacement64 matchgroup=Special start=+@\(\\\\\|\\@\)*+ skip=+[^\\@]\(\\\\\)*\\@+ end=+@+ contains=sedTab,sedReplaceMeta keepend contained nextgroup=sedFlag
+syn region sedAddress matchgroup=Special start=+\\@\%(\\@\)\=+ skip=+[^\\]\%(\\\\\)*\\@+ end=+@I\=+ contains=sedTab,sedRegexpMeta
+syn region sedRegexp64 matchgroup=Special start=+@\%(\\\\\|\\@\)*+ skip=+[^\\@]\%(\\\\\)*\\@+ end=+@+me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement64
+syn region sedReplacement64 matchgroup=Special start=+@\%(\\\\\|\\@\)*+ skip=+[^\\@]\%(\\\\\)*\\@+ end=+@+ contains=sedTab,sedReplaceMeta keepend contained nextgroup=sedFlag
-" Since the syntax for the substituion command is very similar to the
+" Since the syntax for the substitution command is very similar to the
" syntax for the transform command, I use the same pattern matching
" for both commands. There is one problem -- the transform command
" (y) does not allow any flags. To save memory, I ignore this problem.
@@ -80,7 +92,7 @@ hi def link sedComment Comment
hi def link sedDelete Function
hi def link sedError Error
hi def link sedFlag Type
-hi def link sedFlagwrite Constant
+hi def link sedFlagWrite Constant
hi def link sedFunction Function
hi def link sedLabel Label
hi def link sedLineCont Special
@@ -88,23 +100,24 @@ hi def link sedPutHoldspc Function
hi def link sedReplaceMeta Special
hi def link sedRegexpMeta Special
hi def link sedRW Constant
-hi def link sedSemicolon Special
+hi def link sedSemicolon Special
hi def link sedST Function
hi def link sedSpecial Special
+hi def link sedTodo Todo
hi def link sedWhitespace NONE
-if exists("highlight_sedtabs")
-hi def link sedTab Todo
+if s:highlight_tabs
+ hi def link sedTab Todo
endif
-let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64
-while __sed_i <= __sed_last
-exe "hi def link sedRegexp".__sed_i "Macro"
-exe "hi def link sedReplacement".__sed_i "NONE"
-let __sed_i = __sed_i + 1
+let s:i = char2nr(" ") " ASCII: 32, EBCDIC: 64
+while s:i <= s:last
+ exe "hi def link sedRegexp".s:i "Macro"
+ exe "hi def link sedReplacement".s:i "NONE"
+ let s:i = s:i + 1
endwhile
-
-unlet __sed_i __sed_last __sed_delimiter __sed_metacharacters
+unlet s:i s:last s:delimiter s:metacharacters s:at
+unlet s:highlight_tabs
let b:current_syntax = "sed"
-" vim: sts=4 sw=4 ts=8
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/syntax/ssa.vim b/runtime/syntax/ssa.vim
new file mode 100644
index 0000000000..a5dbf37c30
--- /dev/null
+++ b/runtime/syntax/ssa.vim
@@ -0,0 +1,63 @@
+" Vim syntax file
+" Language: SubStation Alpha
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: *.ass,*.ssa
+" Last Change: 2022 Oct 10
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" Comments
+syn keyword ssaTodo TODO FIXME NOTE XXX contained
+syn match ssaComment /^\(;\|!:\).*$/ contains=ssaTodo,@Spell
+syn match ssaTextComment /{[^}]*}/ contained contains=@Spell
+
+" Sections
+syn match ssaSection /^\[[a-zA-Z0-9+ ]\+\]$/
+
+" Headers
+syn match ssaHeader /^[^;!:]\+:/ skipwhite nextgroup=ssaField
+
+" Fields
+syn match ssaField /[^,]*/ contained skipwhite nextgroup=ssaDelimiter
+
+" Time
+syn match ssaTime /\d:\d\d:\d\d\.\d\d/ contained skipwhite nextgroup=ssaDelimiter
+
+" Delimiter
+syn match ssaDelimiter /,/ contained skipwhite nextgroup=ssaField,ssaTime,ssaText
+
+" Text
+syn match ssaText /\(^Dialogue:\(.*,\)\{9}\)\@<=.*$/ contained contains=@ssaTags,@Spell
+syn cluster ssaTags contains=ssaOverrideTag,ssaEscapeChar,ssaTextComment,ssaItalics,ssaBold,ssaUnderline,ssaStrikeout
+
+" Override tags
+syn match ssaOverrideTag /{\\[^}]\+}/ contained contains=@NoSpell
+
+" Special characters
+syn match ssaEscapeChar /\\[nNh{}]/ contained contains=@NoSpell
+
+" Markup
+syn region ssaItalics start=/{\\i1}/ end=/{\\i0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
+syn region ssaBold start=/{\\b1}/ end=/{\\b0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
+syn region ssaUnderline start=/{\\u1}/ end=/{\\u0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
+syn region ssaStrikeout start=/{\\s1}/ end=/{\\s0}/ matchgroup=ssaOverrideTag keepend oneline contained contains=@ssaTags,@Spell
+
+hi def link ssaDelimiter Delimiter
+hi def link ssaComment Comment
+hi def link ssaEscapeChar SpecialChar
+hi def link ssaField String
+hi def link ssaHeader Label
+hi def link ssaSection StorageClass
+hi def link ssaOverrideTag Special
+hi def link ssaTextComment Comment
+hi def link ssaTime Number
+hi def link ssaTodo Todo
+
+hi ssaBold cterm=bold gui=bold
+hi ssaItalics cterm=italic gui=italic
+hi ssaStrikeout cterm=strikethrough gui=strikethrough
+hi ssaUnderline cterm=underline gui=underline
+
+let b:current_syntax = 'srt'
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua
index ba66117fb1..e5a60f5cb1 100644
--- a/test/functional/plugin/health_spec.lua
+++ b/test/functional/plugin/health_spec.lua
@@ -227,7 +227,7 @@ describe('health.vim', function()
|
{Heading:success1: health#success1#check} |
{Bar:========================================================================}|
- {Heading2:##}{Heading: report 1} |
+ {Heading2:## }{Heading:report 1} |
{Bullet: -} {Ok:OK}: everything is fine |
|
]]}