aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/health/nvim.vim6
-rw-r--r--runtime/compiler/zsh.vim23
-rw-r--r--runtime/doc/eval.txt1
-rw-r--r--runtime/doc/options.txt23
-rw-r--r--runtime/ftplugin/zsh.vim23
-rw-r--r--runtime/lua/vim/lsp/util.lua2
-rw-r--r--runtime/lua/vim/treesitter/language.lua4
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua22
-rw-r--r--runtime/lua/vim/treesitter/query.lua18
-rw-r--r--runtime/syntax/zsh.vim89
10 files changed, 153 insertions, 58 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 8b734bbb6f..0bb343e198 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -42,7 +42,7 @@ function! s:check_config() abort
endif
let writeable = v:true
- let shadafile = substitute(matchstr(
+ let shadafile = empty(&shada) ? &shada : substitute(matchstr(
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
let shadafile = empty(&shadafile) ? empty(shadafile) ?
\ stdpath('data').'/shada/main.shada' : expand(shadafile)
@@ -247,6 +247,10 @@ function! s:check_terminal() abort
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
if v:shell_error
+ \ && (!has('win32')
+ \ || empty(matchstr(out,
+ \ 'infocmp: couldn''t open terminfo file .\+'
+ \ ..'\%(conemu\|vtpcon\|win32con\)')))
call health#report_error('command failed: '.cmd."\n".out)
else
call health#report_info('key_backspace (kbs) terminfo entry: '
diff --git a/runtime/compiler/zsh.vim b/runtime/compiler/zsh.vim
new file mode 100644
index 0000000000..5703c1fc44
--- /dev/null
+++ b/runtime/compiler/zsh.vim
@@ -0,0 +1,23 @@
+" Vim compiler file
+" Compiler: Zsh
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2020 Sep 6
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "zsh"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=zsh\ -n\ --\ %:S
+CompilerSet errorformat=%f:\ line\ %l:\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 384bdd63a4..0343998fe8 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5607,7 +5607,6 @@ jobstart({cmd}[, {opts}]) *jobstart()*
before invoking `on_stderr`. |channel-buffered|
stdout_buffered: (boolean) Collect data until EOF (stream
closed) before invoking `on_stdout`. |channel-buffered|
- TERM: (string) Sets the `pty` $TERM environment variable.
width: (number) Width of the `pty` terminal.
{opts} is passed as |self| dictionary to the callback; the
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index a497efa47e..98e2d50f1d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -6289,6 +6289,29 @@ A jump table for the options with a short description can be found at |Q_op|.
attributes instead of "cterm" attributes. |highlight-guifg|
Requires an ISO-8613-3 compatible terminal.
+ *'termpastefilter'* *'tpf'*
+'termpastefilter' 'tpf' string (default: "BS,HT,ESC,DEL")
+ global
+ A comma separated list of options for specifying control characters
+ to be removed from the text pasted into the terminal window. The
+ supported values are:
+
+ BS Backspace
+
+ HT TAB
+
+ FF Form feed
+
+ ESC Escape
+
+ DEL DEL
+
+ C0 Other control characters, excluding Line feed and
+ Carriage return < ' '
+
+ C1 Control characters 0x80...0x9F
+
+
*'terse'* *'noterse'*
'terse' boolean (default off)
global
diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim
index fe8efc59ab..53ce1417dd 100644
--- a/runtime/ftplugin/zsh.vim
+++ b/runtime/ftplugin/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2017-11-22
+" Latest Revision: 2020-09-01
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -14,11 +14,26 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-let b:undo_ftplugin = "setl com< cms< fo<"
-
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
-let b:match_words = ',\<if\>:\<elif\>:\<else\>:\<fi\>'
+let b:undo_ftplugin = "setl com< cms< fo< "
+
+if executable('zsh')
+ if !has('gui_running') && executable('less')
+ command! -buffer -nargs=1 RunHelp silent exe '!MANPAGER= zsh -ic "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw!
+ elseif has('terminal')
+ command! -buffer -nargs=1 RunHelp silent exe ':term zsh -ic "autoload -Uz run-help; run-help <args>"'
+ else
+ command! -buffer -nargs=1 RunHelp echo system('zsh -ic "autoload -Uz run-help; run-help <args> 2>/dev/null"')
+ endif
+ if !exists('current_compiler')
+ compiler zsh
+ endif
+ setlocal keywordprg=:RunHelp
+ let b:undo_ftplugin .= 'keywordprg<'
+endif
+
+let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>'
\ . ',\<case\>:^\s*([^)]*):\<esac\>'
\ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>'
let b:match_skip = 's:comment\|string\|heredoc\|subst'
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index e33e0109b6..00bdeecef3 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -726,7 +726,7 @@ function M.focusable_float(unique_name, fn)
local bufnr = api.nvim_get_current_buf()
do
local win = find_window_by_var(unique_name, bufnr)
- if win and api.nvim_win_is_valid(win) and not vim.fn.pumvisible() then
+ if win and api.nvim_win_is_valid(win) and vim.fn.pumvisible() == 0 then
api.nvim_set_current_win(win)
api.nvim_command("stopinsert")
return
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index d60cd2d0c7..eed28e0e41 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -2,12 +2,12 @@ local a = vim.api
local M = {}
---- Asserts that the provided language is installed, and optionnaly provide a path for the parser
+--- Asserts that the provided language is installed, and optionally provide a path for the parser
--
-- Parsers are searched in the `parser` runtime directory.
--
-- @param lang The language the parser should parse
--- @param path Optionnal path the parser is located at
+-- @param path Optional path the parser is located at
-- @param silent Don't throw an error if language not found
function M.require_language(lang, path, silent)
if vim._ts_has_language(lang) then
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index c864fe5878..6d47ed8365 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -6,14 +6,14 @@ local LanguageTree = {}
LanguageTree.__index = LanguageTree
-- Represents a single treesitter parser for a language.
--- The language can contain child languages with in it's range,
+-- The language can contain child languages with in its range,
-- hence the tree.
--
-- @param source Can be a bufnr or a string of text to parse
-- @param lang The language this tree represents
-- @param opts Options table
--- @param opts.queries A table of language to injection query strings
--- This is useful for overridding the built in runtime file
+-- @param opts.queries A table of language to injection query strings.
+-- This is useful for overriding the built-in runtime file
-- searching for the injection language query per language.
function LanguageTree.new(source, lang, opts)
language.require_language(lang)
@@ -21,8 +21,8 @@ function LanguageTree.new(source, lang, opts)
local custom_queries = opts.queries or {}
local self = setmetatable({
- _source=source,
- _lang=lang,
+ _source = source,
+ _lang = lang,
_children = {},
_regions = {},
_trees = {},
@@ -44,7 +44,7 @@ function LanguageTree.new(source, lang, opts)
return self
end
--- Invalidates this parser and all it's children
+-- Invalidates this parser and all its children
function LanguageTree:invalidate()
self._valid = false
@@ -97,7 +97,7 @@ function LanguageTree:parse()
self._trees = {}
-- If there are no ranges, set to an empty list
- -- so the included ranges in the parser ar cleared.
+ -- so the included ranges in the parser are cleared.
if self._regions and #self._regions > 0 then
for i, ranges in ipairs(self._regions) do
local old_tree = old_trees[i]
@@ -214,7 +214,7 @@ function LanguageTree:remove_child(lang)
end
end
--- Destroys this language tree and all it's children.
+-- Destroys this language tree and all its children.
-- Any cleanup logic should be performed here.
-- Note, this DOES NOT remove this tree from a parent.
-- `remove_child` must be called on the parent to remove it.
@@ -241,7 +241,7 @@ end
--
-- Note, this call invalidates the tree and requires it to be parsed again.
--
--- @param regions A list of regions this tree should manange and parse.
+-- @param regions A list of regions this tree should manage and parse.
function LanguageTree:set_included_regions(regions)
-- Transform the tables from 4 element long to 6 element long (with byte offset)
for _, region in ipairs(regions) do
@@ -400,11 +400,11 @@ end
--- Registers callbacks for the parser
-- @param cbs An `nvim_buf_attach`-like table argument with the following keys :
-- `on_bytes` : see `nvim_buf_attach`, but this will be called _after_ the parsers callback.
--- `on_changedtree` : a callback that will be called everytime the tree has syntactical changes.
+-- `on_changedtree` : a callback that will be called every time the tree has syntactical changes.
-- it will only be passed one argument, that is a table of the ranges (as node ranges) that
-- changed.
-- `on_child_added` : emitted when a child is added to the tree.
--- `on_child_removed` : emitted when a child is remvoed from the tree.
+-- `on_child_removed` : emitted when a child is removed from the tree.
function LanguageTree:register_cbs(cbs)
if not cbs then return end
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index e49f54681d..8b94348994 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -111,7 +111,7 @@ end
--- Gets the text corresponding to a given node
-- @param node the node
--- @param bufnr the buffer from which the node in extracted.
+-- @param bufnr the buffer from which the node is extracted.
function M.get_node_text(node, source)
local start_row, start_col, start_byte = node:start()
local end_row, end_col, end_byte = node:end_()
@@ -215,10 +215,10 @@ predicate_handlers["vim-match?"] = predicate_handlers["match?"]
local directive_handlers = {
["set!"] = function(_, _, _, pred, metadata)
if #pred == 4 then
- -- (set! @capture "key" "value")
+ -- (#set! @capture "key" "value")
metadata[pred[2]][pred[3]] = pred[4]
else
- -- (set! "key" "value")
+ -- (#set! "key" "value")
metadata[pred[2]] = pred[3]
end
end,
@@ -245,7 +245,7 @@ local directive_handlers = {
end
}
---- Adds a new predicates to be used in queries
+--- Adds a new predicate to be used in queries
--
-- @param name the name of the predicate, without leading #
-- @param handler the handler function to be used
@@ -355,10 +355,10 @@ end
--- Iterates of the captures of self on a given range.
--
--- @param node The node under witch the search will occur
+-- @param node The node under which the search will occur
-- @param buffer The source buffer to search
-- @param start The starting line of the search
--- @param stop The stoping line of the search (end-exclusive)
+-- @param stop The stopping line of the search (end-exclusive)
--
-- @returns The matching capture id
-- @returns The captured node
@@ -388,12 +388,12 @@ function Query:iter_captures(node, source, start, stop)
return iter
end
---- Iterates of the matches of self on a given range.
+--- Iterates the matches of self on a given range.
--
--- @param node The node under witch the search will occur
+-- @param node The node under which the search will occur
-- @param buffer The source buffer to search
-- @param start The starting line of the search
--- @param stop The stoping line of the search (end-exclusive)
+-- @param stop The stopping line of the search (end-exclusive)
--
-- @returns The matching pattern id
-- @returns The matching match
diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim
index 3eba438aa7..819c419228 100644
--- a/runtime/syntax/zsh.vim
+++ b/runtime/syntax/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2018-05-12
+" Latest Revision: 2020-11-21
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -13,32 +13,44 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-if v:version > 704 || (v:version == 704 && has("patch1142"))
- syn iskeyword @,48-57,_,192-255,#,-
-else
- setlocal iskeyword+=-
-endif
+function! s:ContainedGroup()
+ " needs 7.4.2008 for execute() function
+ let result='TOP'
+ " vim-pandoc syntax defines the @langname cluster for embedded syntax languages
+ " However, if no syntax is defined yet, `syn list @zsh` will return
+ " "No syntax items defined", so make sure the result is actually a valid syn cluster
+ for cluster in ['markdownHighlightzsh', 'zsh']
+ try
+ " markdown syntax defines embedded clusters as @markdownhighlight<lang>,
+ " pandoc just uses @<lang>, so check both for both clusters
+ let a=split(execute('syn list @'. cluster), "\n")
+ if len(a) == 2 && a[0] =~# '^---' && a[1] =~? cluster
+ return '@'. cluster
+ endif
+ catch /E392/
+ " ignore
+ endtry
+ endfor
+ return result
+endfunction
+
+let s:contained=s:ContainedGroup()
+
+syn iskeyword @,48-57,_,192-255,#,-
if get(g:, 'zsh_fold_enable', 0)
setlocal foldmethod=syntax
endif
-syn keyword zshTodo contained TODO FIXME XXX NOTE
-
-syn region zshComment oneline start='\%(^\|\s\+\)#' end='$'
- \ contains=zshTodo,@Spell fold
-
-syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!'
- \ contains=zshTodo,@Spell fold
-
-syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
-
+syn match zshPOSIXQuoted '\\[xX][0-9a-fA-F]\{1,2}'
+syn match zshPOSIXQuoted '\\[0-7]\{1,3}'
+syn match zshPOSIXQuoted '\\u[0-9a-fA-F]\{1,4}'
+syn match zshPOSIXQuoted '\\U[1-9a-fA-F]\{1,8}'
syn match zshQuoted '\\.'
syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+
\ contains=zshQuoted,@zshDerefs,@zshSubst fold
syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold
-" XXX: This should probably be more precise, but Zsh seems a bit confused about it itself
syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+
- \ end=+'+ contains=zshQuoted
+ \ skip=+\\[\\']+ end=+'+ contains=zshPOSIXQuoted,zshQuoted
syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)'
syn keyword zshPrecommand noglob nocorrect exec command builtin - time
@@ -112,7 +124,7 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd
\ enable eval exec exit export false fc fg
\ functions getcap getln getopts hash history
\ jobs kill let limit log logout popd print
- \ printf pushd pushln pwd r read readonly
+ \ printf pushd pushln pwd r read
\ rehash return sched set setcap shift
\ source stat suspend test times trap true
\ ttyctl type ulimit umask unalias unfunction
@@ -125,7 +137,7 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd
" Create a list of option names from zsh source dir:
" #!/bin/zsh
" topdir=/path/to/zsh-xxx
-" grep '^pindex([A-Za-z_]*)$' $topdir/Src/Doc/Zsh/optionsyo |
+" grep '^pindex([A-Za-z_]*)$' $topdir/Doc/Zsh/options.yo |
" while read opt
" do
" echo ${${(L)opt#pindex\(}%\)}
@@ -136,6 +148,7 @@ syn case ignore
syn match zshOptStart /^\s*\%(\%(\%(un\)\?setopt\)\|set\s+[-+]o\)/ nextgroup=zshOption skipwhite
syn match zshOption /
\ \%(\%(\<no_\?\)\?aliases\>\)\|
+ \ \%(\%(\<no_\?\)\?aliasfuncdef\>\)\|\%(\%(no_\?\)\?alias_func_def\>\)\|
\ \%(\%(\<no_\?\)\?allexport\>\)\|\%(\%(no_\?\)\?all_export\>\)\|
\ \%(\%(\<no_\?\)\?alwayslastprompt\>\)\|\%(\%(no_\?\)\?always_last_prompt\>\)\|\%(\%(no_\?\)\?always_lastprompt\>\)\|
\ \%(\%(\<no_\?\)\?alwaystoend\>\)\|\%(\%(no_\?\)\?always_to_end\>\)\|
@@ -165,10 +178,13 @@ syn match zshOption /
\ \%(\%(\<no_\?\)\?casematch\>\)\|\%(\%(no_\?\)\?case_match\>\)\|
\ \%(\%(\<no_\?\)\?cbases\>\)\|\%(\%(no_\?\)\?c_bases\>\)\|
\ \%(\%(\<no_\?\)\?cdablevars\>\)\|\%(\%(no_\?\)\?cdable_vars\>\)\|\%(\%(no_\?\)\?cd_able_vars\>\)\|
+ \ \%(\%(\<no_\?\)\?cdsilent\>\)\|\%(\%(no_\?\)\?cd_silent\>\)\|\%(\%(no_\?\)\?cd_silent\>\)\|
\ \%(\%(\<no_\?\)\?chasedots\>\)\|\%(\%(no_\?\)\?chase_dots\>\)\|
\ \%(\%(\<no_\?\)\?chaselinks\>\)\|\%(\%(no_\?\)\?chase_links\>\)\|
\ \%(\%(\<no_\?\)\?checkjobs\>\)\|\%(\%(no_\?\)\?check_jobs\>\)\|
+ \ \%(\%(\<no_\?\)\?checkrunningjobs\>\)\|\%(\%(no_\?\)\?check_running_jobs\>\)\|
\ \%(\%(\<no_\?\)\?clobber\>\)\|
+ \ \%(\%(\<no_\?\)\?clobberempty\>\)\|\%(\%(no_\?\)\?clobber_empty\>\)\|
\ \%(\%(\<no_\?\)\?combiningchars\>\)\|\%(\%(no_\?\)\?combining_chars\>\)\|
\ \%(\%(\<no_\?\)\?completealiases\>\)\|\%(\%(no_\?\)\?complete_aliases\>\)\|
\ \%(\%(\<no_\?\)\?completeinword\>\)\|\%(\%(no_\?\)\?complete_in_word\>\)\|
@@ -188,7 +204,7 @@ syn match zshOption /
\ \%(\%(\<no_\?\)\?equals\>\)\|
\ \%(\%(\<no_\?\)\?errexit\>\)\|\%(\%(no_\?\)\?err_exit\>\)\|
\ \%(\%(\<no_\?\)\?errreturn\>\)\|\%(\%(no_\?\)\?err_return\>\)\|
- \ \%(\%(\<no_\?\)\?evallineno_\?\)\|\%(\%(no_\?\)\?eval_lineno_\?\)\|
+ \ \%(\%(\<no_\?\)\?evallineno\>\)\|\%(\%(no_\?\)\?eval_lineno\>\)\|
\ \%(\%(\<no_\?\)\?exec\>\)\|
\ \%(\%(\<no_\?\)\?extendedglob\>\)\|\%(\%(no_\?\)\?extended_glob\>\)\|
\ \%(\%(\<no_\?\)\?extendedhistory\>\)\|\%(\%(no_\?\)\?extended_history\>\)\|
@@ -309,6 +325,7 @@ syn match zshOption /
\ \%(\%(\<no_\?\)\?shnullcmd\>\)\|\%(\%(no_\?\)\?sh_nullcmd\>\)\|
\ \%(\%(\<no_\?\)\?shoptionletters\>\)\|\%(\%(no_\?\)\?sh_option_letters\>\)\|
\ \%(\%(\<no_\?\)\?shortloops\>\)\|\%(\%(no_\?\)\?short_loops\>\)\|
+ \ \%(\%(\<no_\?\)\?shortrepeat\>\)\|\%(\%(no_\?\)\?short_repeat\>\)\|
\ \%(\%(\<no_\?\)\?shwordsplit\>\)\|\%(\%(no_\?\)\?sh_word_split\>\)\|
\ \%(\%(\<no_\?\)\?singlecommand\>\)\|\%(\%(no_\?\)\?single_command\>\)\|
\ \%(\%(\<no_\?\)\?singlelinezle\>\)\|\%(\%(no_\?\)\?single_line_zle\>\)\|
@@ -322,10 +339,13 @@ syn match zshOption /
\ \%(\%(\<no_\?\)\?unset\>\)\|
\ \%(\%(\<no_\?\)\?verbose\>\)\|
\ \%(\%(\<no_\?\)\?vi\>\)\|
+ \ \%(\%(\<no_\?\)\?warnnestedvar\>\)\|\%(\%(no_\?\)\?warn_nested_var\>\)\|
\ \%(\%(\<no_\?\)\?warncreateglobal\>\)\|\%(\%(no_\?\)\?warn_create_global\>\)\|
\ \%(\%(\<no_\?\)\?xtrace\>\)\|
\ \%(\%(\<no_\?\)\?zle\>\)/ nextgroup=zshOption,zshComment skipwhite contained
+syn case match
+
syn keyword zshTypes float integer local typeset declare private readonly
" XXX: this may be too much
@@ -339,31 +359,42 @@ syn match zshNumber '[+-]\=\d\+\.\d\+\>'
" TODO: $[...] is the same as $((...)), so add that as well.
syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst
-syn region zshSubst matchgroup=zshSubstDelim transparent
- \ start='\$(' skip='\\)' end=')' contains=TOP fold
+exe 'syn region zshSubst matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold'
syn region zshParentheses transparent start='(' skip='\\)' end=')' fold
syn region zshGlob start='(#' end=')'
syn region zshMathSubst matchgroup=zshSubstDelim transparent
- \ start='\$((' skip='\\)' end='))'
+ \ start='\%(\$\?\)[<=>]\@<!((' skip='\\)' end='))'
\ contains=zshParentheses,@zshSubst,zshNumber,
\ @zshDerefs,zshString keepend fold
-syn region zshBrackets contained transparent start='{' skip='\\}'
+" The ms=s+1 prevents matching zshBrackets several times on opening brackets
+" (see https://github.com/chrisbra/vim-zsh/issues/21#issuecomment-576330348)
+syn region zshBrackets contained transparent start='{'ms=s+1 skip='\\}'
\ end='}' fold
-syn region zshBrackets transparent start='{' skip='\\}'
- \ end='}' contains=TOP fold
+exe 'syn region zshBrackets transparent start=/{/ms=s+1 skip=/\\}/ end=/}/ contains='.s:contained. ' fold'
+
syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}'
\ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold
-syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+
- \ end=+`+ contains=TOP,zshOldSubst fold
+exe 'syn region zshOldSubst matchgroup=zshSubstDelim start=/`/ skip=/\\[\\`]/ end=/`/ contains='.s:contained. ',zshOldSubst fold'
syn sync minlines=50 maxlines=90
syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)'
syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>'
+syn keyword zshTodo contained TODO FIXME XXX NOTE
+
+syn region zshComment oneline start='\%(^\|\s\+\)#' end='$'
+ \ contains=zshTodo,@Spell fold
+
+syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!'
+ \ contains=zshTodo,@Spell fold
+
+syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
+
hi def link zshTodo Todo
hi def link zshComment Comment
hi def link zshPreProc PreProc
hi def link zshQuoted SpecialChar
+hi def link zshPOSIXQuoted SpecialChar
hi def link zshString String
hi def link zshStringDelimiter zshString
hi def link zshPOSIXString zshString