This commit is contained in:
Adam Stankiewicz
2020-05-20 16:59:09 +02:00
parent 0a7c62b3b2
commit a688c66a04
30 changed files with 276 additions and 152 deletions

View File

@@ -2346,7 +2346,7 @@ fu! csv#ColumnWidth()
endfu endfu
fu! csv#Map(map, name, definition, ...) "{{{3 fu! csv#Map(map, name, definition, ...) "{{{3
let keyname = substitute(a:name, '[<>]', '', 'g') let keyname = substitute(substitute(a:name, '[<>]', '', 'g'), '-', '_', 'g')
let expr = (exists("a:1") && a:1 == 'expr' ? '<expr>' : '') let expr = (exists("a:1") && a:1 == 'expr' ? '<expr>' : '')
if !get(g:, "csv_nomap_". tolower(keyname), 0) if !get(g:, "csv_nomap_". tolower(keyname), 0)
" All mappings are buffer local " All mappings are buffer local

View File

@@ -69,12 +69,6 @@ function! s:check_plugin_clash() abort " {{{1
call health#report_warn('Conflicting plugin detected: LaTeX-Box') call health#report_warn('Conflicting plugin detected: LaTeX-Box')
call health#report_info('vimtex does not work as expected when LaTeX-Box is installed!') call health#report_info('vimtex does not work as expected when LaTeX-Box is installed!')
call health#report_info('Please disable or remove it to use vimtex!') call health#report_info('Please disable or remove it to use vimtex!')
let l:polyglot = !empty(filter(copy(l:scriptnames), "v:val =~# 'polyglot'"))
if l:polyglot
call health#report_info('LaTeX-Box is included with vim-polyglot and may be disabled with:')
call health#report_info('let g:polyglot_disabled = [''latex'']')
endif
endif endif
endfunction endfunction

View File

@@ -247,6 +247,7 @@ function! vimtex#init_options() abort " {{{1
\ ], \ ],
\ } \ }
\}) \})
call s:init_option('vimtex_syntax_autoload_packages', ['amsmath'])
call s:init_option('vimtex_texcount_custom_arg', '') call s:init_option('vimtex_texcount_custom_arg', '')
@@ -257,7 +258,10 @@ function! vimtex#init_options() abort " {{{1
call s:init_option('vimtex_toc_enabled', 1) call s:init_option('vimtex_toc_enabled', 1)
call s:init_option('vimtex_toc_custom_matchers', []) call s:init_option('vimtex_toc_custom_matchers', [])
call s:init_option('vimtex_toc_show_preamble', 1) call s:init_option('vimtex_toc_show_preamble', 1)
call s:init_option('vimtex_toc_todo_keywords', ['TODO', 'FIXME']) call s:init_option('vimtex_toc_todo_labels', {
\ 'TODO': 'TODO: ',
\ 'FIXME': 'FIXME: '
\})
call s:init_option('vimtex_toc_config', { call s:init_option('vimtex_toc_config', {
\ 'name' : 'Table of contents (vimtex)', \ 'name' : 'Table of contents (vimtex)',
\ 'mode' : 1, \ 'mode' : 1,
@@ -324,6 +328,7 @@ function! vimtex#init_options() abort " {{{1
call s:init_option('vimtex_view_skim_activate', 0) call s:init_option('vimtex_view_skim_activate', 0)
call s:init_option('vimtex_view_skim_reading_bar', 1) call s:init_option('vimtex_view_skim_reading_bar', 1)
call s:init_option('vimtex_view_zathura_options', '') call s:init_option('vimtex_view_zathura_options', '')
call s:init_option('vimtex_view_zathura_check_libsynctex', 1)
endfunction endfunction
" }}}1 " }}}1
@@ -332,18 +337,11 @@ function! vimtex#check_plugin_clash() abort " {{{1
let l:latexbox = !empty(filter(copy(l:scriptnames), "v:val =~# 'latex-box'")) let l:latexbox = !empty(filter(copy(l:scriptnames), "v:val =~# 'latex-box'"))
if l:latexbox if l:latexbox
let l:polyglot = !empty(filter(copy(l:scriptnames), "v:val =~# 'polyglot'"))
call vimtex#log#warning([ call vimtex#log#warning([
\ 'Conflicting plugin detected: LaTeX-Box', \ 'Conflicting plugin detected: LaTeX-Box',
\ 'vimtex does not work as expected when LaTeX-Box is installed!', \ 'vimtex does not work as expected when LaTeX-Box is installed!',
\ 'Please disable or remove it to use vimtex!', \ 'Please disable or remove it to use vimtex!',
\]) \])
if l:polyglot
call vimtex#log#warning([
\ 'LaTeX-Box is included with vim-polyglot and may be disabled with:',
\ 'let g:polyglot_disabled = [''latex'']',
\])
endif
endif endif
endfunction endfunction

View File

@@ -274,7 +274,7 @@ endfunction
function! s:get_frac_cmd() abort " {{{1 function! s:get_frac_cmd() abort " {{{1
let l:save_pos = vimtex#pos#get_cursor() let l:save_pos = vimtex#pos#get_cursor()
while v:true while 1
let l:cmd = s:get_cmd('prev') let l:cmd = s:get_cmd('prev')
if empty(l:cmd) || l:cmd.pos_start.lnum < line('.') if empty(l:cmd) || l:cmd.pos_start.lnum < line('.')
call vimtex#pos#set_cursor(l:save_pos) call vimtex#pos#set_cursor(l:save_pos)
@@ -375,7 +375,7 @@ function! s:get_frac_inline() abort " {{{1
let l:pos_after = -1 let l:pos_after = -1
let l:pos_before = -1 let l:pos_before = -1
while v:true while 1
let l:pos_before = l:pos_after let l:pos_before = l:pos_after
let l:pos_after = match(l:line, '\/', l:pos_after+1) let l:pos_after = match(l:line, '\/', l:pos_after+1)
if l:pos_after < 0 || l:pos_after >= l:col | break | endif if l:pos_after < 0 || l:pos_after >= l:col | break | endif

View File

@@ -66,7 +66,7 @@ function! s:choose_dict(dict, prompt) abort " {{{1
return values(a:dict)[0] return values(a:dict)[0]
endif endif
while v:true while 1
redraw! redraw!
if !empty(a:prompt) if !empty(a:prompt)
echohl VimtexMsg echohl VimtexMsg
@@ -93,7 +93,7 @@ endfunction
function! s:choose_list(list, prompt) abort " {{{1 function! s:choose_list(list, prompt) abort " {{{1
if len(a:list) == 1 | return a:list[0] | endif if len(a:list) == 1 | return a:list[0] | endif
while v:true while 1
redraw! redraw!
if !empty(a:prompt) if !empty(a:prompt)
echohl VimtexMsg echohl VimtexMsg

View File

@@ -9,6 +9,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
function! vimtex#imaps#init_buffer() abort " {{{1 function! vimtex#imaps#init_buffer() abort " {{{1
if !g:vimtex_imaps_enabled | return | endif if !g:vimtex_imaps_enabled | return | endif
" Store mappings in buffer
if !exists('b:vimtex_imaps')
let b:vimtex_imaps = []
endif
" "
" Create imaps " Create imaps
" "
@@ -32,16 +37,18 @@ endfunction
function! vimtex#imaps#add_map(map) abort " {{{1 function! vimtex#imaps#add_map(map) abort " {{{1
let s:custom_maps = get(s:, 'custom_maps', []) + [a:map] let s:custom_maps = get(s:, 'custom_maps', []) + [a:map]
if exists('s:created_maps') if exists('b:vimtex_imaps')
call s:create_map(a:map) call s:create_map(a:map)
endif endif
endfunction endfunction
" }}}1 " }}}1
function! vimtex#imaps#list() abort " {{{1 function! vimtex#imaps#list() abort " {{{1
let l:maps = b:vimtex_imaps
silent new vimtex\ imaps silent new vimtex\ imaps
for l:map in s:created_maps for l:map in l:maps
call append('$', printf('%5S -> %-30S %S', call append('$', printf('%5S -> %-30S %S',
\ get(l:map, 'leader', get(g:, 'vimtex_imaps_leader', '`')) . l:map.lhs, \ get(l:map, 'leader', get(g:, 'vimtex_imaps_leader', '`')) . l:map.lhs,
\ l:map.rhs, \ l:map.rhs,
@@ -78,15 +85,16 @@ endfunction
" The imap generator " The imap generator
" "
function! s:create_map(map) abort " {{{1 function! s:create_map(map) abort " {{{1
if index(s:created_maps, a:map) >= 0 | return | endif if index(b:vimtex_imaps, a:map) >= 0 | return | endif
let l:map = deepcopy(a:map)
let l:leader = get(a:map, 'leader', get(g:, 'vimtex_imaps_leader', '`')) let l:leader = get(l:map, 'leader', get(g:, 'vimtex_imaps_leader', '`'))
if l:leader !=# '' && !hasmapto(l:leader, 'i') if l:leader !=# '' && !hasmapto(l:leader, 'i')
silent execute 'inoremap <silent><nowait><buffer>' l:leader . l:leader l:leader silent execute 'inoremap <silent><nowait><buffer>' l:leader . l:leader l:leader
endif endif
let l:lhs = l:leader . a:map.lhs let l:lhs = l:leader . l:map.lhs
let l:wrapper = get(a:map, 'wrapper', 'vimtex#imaps#wrap_math') let l:wrapper = get(l:map, 'wrapper', 'vimtex#imaps#wrap_math')
if ! exists('*' . l:wrapper) if ! exists('*' . l:wrapper)
echoerr 'vimtex error: imaps wrapper does not exist!' echoerr 'vimtex error: imaps wrapper does not exist!'
echoerr ' ' . l:wrapper echoerr ' ' . l:wrapper
@@ -95,25 +103,25 @@ function! s:create_map(map) abort " {{{1
" Some wrappers use a context which must be made available to the wrapper " Some wrappers use a context which must be made available to the wrapper
" function at run time. " function at run time.
if has_key(a:map, 'context') if has_key(l:map, 'context')
execute 'let l:key = "' . escape(l:lhs, '<') . '"' execute 'let l:key = "' . escape(l:lhs, '<') . '"'
let l:key .= a:map.rhs let l:key .= l:map.rhs
if !exists('b:vimtex_context') if !exists('b:vimtex_context')
let b:vimtex_context = {} let b:vimtex_context = {}
endif endif
let b:vimtex_context[l:key] = a:map.context let b:vimtex_context[l:key] = l:map.context
endif endif
" The rhs may be evaluated before being passed to wrapper, unless expr is " The rhs may be evaluated before being passed to wrapper, unless expr is
" disabled (which it is by default) " disabled (which it is by default)
if !get(a:map, 'expr') if !get(l:map, 'expr')
let a:map.rhs = string(a:map.rhs) let l:map.rhs = string(l:map.rhs)
endif endif
silent execute 'inoremap <expr><silent><nowait><buffer>' l:lhs silent execute 'inoremap <expr><silent><nowait><buffer>' l:lhs
\ l:wrapper . '("' . escape(l:lhs, '\') . '", ' . a:map.rhs . ')' \ l:wrapper . '("' . escape(l:lhs, '\') . '", ' . l:map.rhs . ')'
let s:created_maps += [a:map] let b:vimtex_imaps += [l:map]
endfunction endfunction
" }}}1 " }}}1
@@ -182,11 +190,4 @@ endfunction
" }}}1 " }}}1
" {{{1 Initialize module
let s:created_maps = []
" }}}1
endif endif

View File

@@ -82,7 +82,8 @@ endfunction
" }}}1 " }}}1
function! s:search_candidates_texinputs(fname) abort " {{{1 function! s:search_candidates_texinputs(fname) abort " {{{1
for l:suffix in [''] + split(&l:suffixesadd, ',') for l:suffix in [''] + split(&l:suffixesadd, ',')
let l:candidates = glob(b:vimtex.root . '/**/' . a:fname . l:suffix, 0, 1) let l:candidates = glob(b:vimtex.root . '/**/'
\ . fnameescape(a:fname) . l:suffix, 0, 1)
if !empty(l:candidates) if !empty(l:candidates)
return l:candidates[0] return l:candidates[0]
endif endif

View File

@@ -154,7 +154,7 @@ let s:re_prefilter = '\v%(\\' . join([
\ 'tableofcontents', \ 'tableofcontents',
\ 'todo', \ 'todo',
\], '|') . ')' \], '|') . ')'
\ . '|\%\s*%(' . join(g:vimtex_toc_todo_keywords, '|') . ')' \ . '|\%\s*%(' . join(keys(g:vimtex_toc_todo_labels), '|') . ')'
\ . '|\%\s*vimtex-include' \ . '|\%\s*vimtex-include'
for s:m in g:vimtex_toc_custom_matchers for s:m in g:vimtex_toc_custom_matchers
if has_key(s:m, 'prefilter') if has_key(s:m, 'prefilter')
@@ -513,14 +513,16 @@ endfunction
let s:matcher_todos = { let s:matcher_todos = {
\ 're' : g:vimtex#re#not_bslash . '\%\s+(' \ 're' : g:vimtex#re#not_bslash . '\%\s+('
\ . join(g:vimtex_toc_todo_keywords, '|') . ')[ :]+\s*(.*)', \ . join(keys(g:vimtex_toc_todo_labels), '|') . ')[ :]+\s*(.*)',
\ 'in_preamble' : 1, \ 'in_preamble' : 1,
\ 'priority' : 2, \ 'priority' : 2,
\} \}
function! s:matcher_todos.get_entry(context) abort dict " {{{1 function! s:matcher_todos.get_entry(context) abort dict " {{{1
let [l:type, l:text] = matchlist(a:context.line, self.re)[1:2] let [l:type, l:text] = matchlist(a:context.line, self.re)[1:2]
let l:label = g:vimtex_toc_todo_labels[toupper(l:type)]
return { return {
\ 'title' : toupper(l:type) . ': ' . l:text, \ 'title' : l:label . l:text,
\ 'number' : '', \ 'number' : '',
\ 'file' : a:context.file, \ 'file' : a:context.file,
\ 'line' : a:context.lnum, \ 'line' : a:context.lnum,
@@ -547,8 +549,10 @@ function! s:matcher_todonotes.get_entry(context) abort dict " {{{1
let s:matcher_continue = deepcopy(self) let s:matcher_continue = deepcopy(self)
endif endif
let l:label = get(g:vimtex_toc_todo_labels, 'TODO', 'TODO: ')
return { return {
\ 'title' : 'TODO: ' . title, \ 'title' : l:label . title,
\ 'number' : '', \ 'number' : '',
\ 'file' : a:context.file, \ 'file' : a:context.file,
\ 'line' : a:context.lnum, \ 'line' : a:context.lnum,

View File

@@ -79,6 +79,15 @@ function! vimtex#syntax#load#packages() abort " {{{1
catch /E117:/ catch /E117:/
endtry endtry
endfor endfor
for l:pkg in g:vimtex_syntax_autoload_packages
try
call vimtex#syntax#p#{l:pkg}#load()
catch /E117:/
call vimtex#log#warning('Syntax package does not exist: ' . l:pkg,
\ 'Please see :help g:vimtex_syntax_autoload_packages')
endtry
endfor
endfunction endfunction
" }}}1 " }}}1

View File

@@ -385,23 +385,70 @@ endfunction
" }}}1 " }}}1
function! s:get_sel_items(is_inner) abort " {{{1 function! s:get_sel_items(is_inner) abort " {{{1
let l:pos_cursor = vimtex#pos#get_cursor() let l:pos_cursor = vimtex#pos#get_cursor()
let l:val_cursor = vimtex#pos#val(l:pos_cursor)
" Find previous \item " Find previous \item
call vimtex#pos#set_cursor(l:pos_cursor[0], 1) let l:depth = 0
let l:pos_start = searchpos('^\s*\\item\S*', 'bcnWz') let l:pos_cur = vimtex#pos#next(l:pos_cursor)
if l:pos_start == [0, 0] | return [[], []] | endif while 1
call vimtex#pos#set_cursor(vimtex#pos#prev(l:pos_cur))
if l:depth > 5 | return [[], []] | endif
let l:pos_start = searchpos(
\ l:depth > 0 ? '\\begin{\w\+}' : '^\s*\\item\S*',
\ 'bcnW')
let l:val_start = vimtex#pos#val(l:pos_start)
if l:val_start == 0 | return [[], []] | endif
let l:pos_endenv = searchpos('\%(^\s*\)\?\\end{\w\+}', 'bcnW')
let l:val_endenv = vimtex#pos#val(l:pos_endenv)
if l:val_endenv == 0 || l:val_start > l:val_endenv
if l:depth == 0 | break | endif
let l:pos_cur = l:pos_start
let l:depth -= 1
else
let l:pos_cur = l:pos_endenv
let l:depth += 1
endif
endwhile
" Find end of current \item " Find end of current \item
call vimtex#pos#set_cursor(l:pos_start) let l:depth = 0
let l:pos_end = searchpos('\ze\n\s*\%(\\item\|\\end{itemize}\)', 'nW') let l:pos_cur = l:pos_start
if l:pos_end == [0, 0] while 1
\ || vimtex#pos#val(l:pos_cursor) > vimtex#pos#val(l:pos_end) call vimtex#pos#set_cursor(vimtex#pos#next(l:pos_cur))
let l:re = l:depth > 0
\ ? '\\end{\w\+}'
\ : '\n\s*\%(\\item\|\\end{\(itemize\|enumerate\)}\)'
let l:pos_end = searchpos(l:re, 'nW')
let l:val_end = vimtex#pos#val(l:pos_end)
if l:depth == 0 && l:val_end == 0
return [[], []]
endif
let l:pos_beginenv = searchpos('\\begin{\w\+}', 'cnW')
let l:val_beginenv = vimtex#pos#val(l:pos_beginenv)
if l:val_beginenv == 0 || l:val_end < l:val_beginenv
if l:depth == 0 | break | endif
let l:pos_cur = l:pos_end
let l:depth -= 1
else
let l:pos_cur = l:pos_beginenv
let l:depth += 1
endif
endwhile
" The region must include the cursor
if l:val_cursor > l:val_end
return [[], []] return [[], []]
endif endif
" Adjust for outer text object " Adjust for outer text object
if a:is_inner if a:is_inner
let l:pos_start[1] = searchpos('^\s*\\item\S*\s\?', 'cne')[1] + 1 let l:pos_start[1] = searchpos('^\s*\\item\S*\s', 'cne')[1] + 1
let l:pos_end[1] = col([l:pos_end[0], '$']) - 1 let l:pos_end[1] = col([l:pos_end[0], '$']) - 1
endif endif

View File

@@ -354,7 +354,8 @@ function! s:toc.set_syntax() abort dict "{{{1
syntax match VimtexTocNum /\v(([A-Z]+>|\d+)(\.\d+)*)?\s*/ contained syntax match VimtexTocNum /\v(([A-Z]+>|\d+)(\.\d+)*)?\s*/ contained
execute 'syntax match VimtexTocTodo' execute 'syntax match VimtexTocTodo'
\ '/\v\s\zs%(' . toupper(join(g:vimtex_toc_todo_keywords, '|')) . '): /' \ '/\v\s\zs%('
\ . toupper(join(keys(g:vimtex_toc_todo_labels), '|')) . '): /'
\ 'contained' \ 'contained'
syntax match VimtexTocHotkey /\[[^]]\+\]/ contained syntax match VimtexTocHotkey /\[[^]]\+\]/ contained
@@ -751,7 +752,7 @@ endfunction
function! s:foldtext() abort " {{{1 function! s:foldtext() abort " {{{1
let l:line = getline(v:foldstart)[3:] let l:line = getline(v:foldstart)[3:]
if b:toc.todo_sorted if b:toc.todo_sorted
\ && l:line =~# '\v%(' . join(g:vimtex_toc_todo_keywords, '|') . ')' \ && l:line =~# '\v%(' . join(keys(g:vimtex_toc_todo_labels), '|') . ')'
return substitute(l:line, '\w+\zs:.*', 's', '') return substitute(l:line, '\w+\zs:.*', 's', '')
else else
return l:line return l:line

View File

@@ -13,7 +13,7 @@ function! vimtex#view#zathura#new() abort " {{{1
return {} return {}
endif endif
if executable('ldd') if g:vimtex_view_zathura_check_libsynctex && executable('ldd')
let l:shared = split(system("sh -c 'ldd $(which zathura)'")) let l:shared = split(system("sh -c 'ldd $(which zathura)'"))
if v:shell_error == 0 if v:shell_error == 0
\ && empty(filter(l:shared, 'v:val =~# ''libsynctex''')) \ && empty(filter(l:shared, 'v:val =~# ''libsynctex'''))

View File

@@ -719,7 +719,7 @@ fun! s:SelectJavascript()
endif endif
endfun endfun
autocmd BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setfiletype javascript autocmd BufNewFile,BufRead *.{js,mjs,cjs,jsm,es,es6},Jakefile setfiletype javascript
autocmd BufNewFile,BufRead * call s:SelectJavascript() autocmd BufNewFile,BufRead * call s:SelectJavascript()
augroup end augroup end
endif endif

View File

@@ -39,7 +39,7 @@ if exists("loaded_matchit")
" note: the following regex not only recognizes macros, but also local/global keywords. " note: the following regex not only recognizes macros, but also local/global keywords.
" the purpose is recognizing things like `@inline myfunction()` " the purpose is recognizing things like `@inline myfunction()`
" or `global myfunction(...)` etc, for matchit and block movement functionality " or `global myfunction(...)` etc, for matchit and block movement functionality
let s:macro_regex = '\%(@\%(#\@!\S\)\+\|\<\%(local\|global\)\)\s\+' let s:macro_regex = '\%(@\%([#(]\@!\S\)\+\|\<\%(local\|global\)\)\s\+'
let s:nomacro = '\%(' . s:macro_regex . '\)\@<!' let s:nomacro = '\%(' . s:macro_regex . '\)\@<!'
let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+' let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+'
let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|' let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|'
@@ -76,10 +76,10 @@ if exists("loaded_matchit")
let b:match_words = 'JuliaGetMatchWords()' let b:match_words = 'JuliaGetMatchWords()'
" we need to skip everything within comments, strings and " we need to skip everything within comments, strings and
" the 'end' keyword when it is used as a range rather than as " the 'begin' and 'end' keywords when they are used as a range rather than as
" the end of a block " the delimiter of a block
let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~ ' let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~ '
\ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeKeyword\\|SymbolS\\?\\|Comment[LM]\\|\\%([bv]\\|ip\\|MIME\\|Shell\\|Doc\\)\\?String\\|RegEx\\)\\>"' \ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeKeyword\\|SymbolS\\?\\|Comment[LM]\\|\\%([bsvr]\\|ip\\|MIME\\|big\\|raw\\|test\\|html\\|int128\\|Printf\\|Shell\\|Doc\\)\\?String\\|StringPrefixed\\|RegEx\\)\\>"'
let b:undo_ftplugin = b:undo_ftplugin let b:undo_ftplugin = b:undo_ftplugin
\ . " | unlet! b:match_words b:match_skip b:match_ignorecase" \ . " | unlet! b:match_words b:match_skip b:match_ignorecase"

View File

@@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
" Maintainer: Marshall Ward <marshall.ward@gmail.com> " Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Original Maintainer: Nikolai Weibull <now@bitwi.se> " Original Maintainer: Nikolai Weibull <now@bitwi.se>
" Website: https://github.com/marshallward/vim-restructuredtext " Website: https://github.com/marshallward/vim-restructuredtext
" Latest Revision: 2018-12-29 " Latest Revision: 2020-03-31
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish

View File

@@ -86,28 +86,20 @@ else
endfunction endfunction
endif endif
" Does the given pattern match at the cursor's position? " Does the given pattern match at the given position?
function s:MatchCursor(pattern) function! s:MatchAt(lnum, col, pattern) abort
return searchpos(a:pattern, 'cnz', line('.')) == [line('.'), col('.')] let idx = a:col - 1
return match(getline(a:lnum), a:pattern, idx) == idx
endfunction endfunction
" Does the given pattern match at the given position? " Does the given pattern match at the cursor's position?
function s:MatchAt(lnum, col, pattern) function! s:MatchCursor(pattern) abort
let pos = getcurpos() return s:MatchAt(line('.'), col('.'), a:pattern)
try
call cursor(a:lnum, a:col)
let result = s:MatchCursor(a:pattern)
finally
call setpos('.', pos)
endtry
return result
endfunction endfunction
" Is the cell at the given position part of a tag? If so, return the " Is the cell at the given position part of a tag? If so, return the
" position of the opening delimiter. " position of the opening delimiter.
function s:MatchECR(...) function! s:MatchECR(...) abort
if a:0 if a:0
let lnum = a:1 let lnum = a:1
let col = a:2 let col = a:2
@@ -133,7 +125,7 @@ endfunction
" If the cell at the given position is part of a control tag, return the " If the cell at the given position is part of a control tag, return the
" respective positions of the opening and closing delimiters for that " respective positions of the opening and closing delimiters for that
" tag. " tag.
function s:MatchECRControl(...) function! s:MatchECRControl(...) abort
let pos = getcurpos() let pos = getcurpos()
if a:0 if a:0
@@ -175,7 +167,7 @@ endfunction
" Determine whether or not the control tag at the given position starts " Determine whether or not the control tag at the given position starts
" an indent. " an indent.
function s:ECRIndent(...) function! s:ECRIndent(...) abort
if a:0 if a:0
if type(a:1) == 0 if type(a:1) == 0
let [open, close] = s:MatchECRControl(a:1, a:2) let [open, close] = s:MatchECRControl(a:1, a:2)
@@ -237,7 +229,7 @@ endfunction
" Determine if the control tag at the given position ends an indent or " Determine if the control tag at the given position ends an indent or
" not. " not.
function s:ECRDedent(...) function! s:ECRDedent(...) abort
if a:0 if a:0
if type(a:1) == 0 if type(a:1) == 0
let [open, close] = s:MatchECRControl(a:1, a:2) let [open, close] = s:MatchECRControl(a:1, a:2)
@@ -297,7 +289,7 @@ function s:ECRDedent(...)
endfunction endfunction
" Find and match a control tag in the given line, if one exists. " Find and match a control tag in the given line, if one exists.
function s:FindECRControl(...) function! s:FindECRControl(...) abort
let lnum = a:0 ? a:1 : line('.') let lnum = a:0 ? a:1 : line('.')
let open = { 'lnum': 0, 'col': 0 } let open = { 'lnum': 0, 'col': 0 }
@@ -324,7 +316,7 @@ endfunction
" This takes two arguments: the first is the line to start searching " This takes two arguments: the first is the line to start searching
" from (exclusive); the second is the line to stop searching at " from (exclusive); the second is the line to stop searching at
" (inclusive). " (inclusive).
function s:FindPrevECRControl(...) function! s:FindPrevECRControl(...) abort
if a:0 == 0 if a:0 == 0
let start = line('.') let start = line('.')
let stop = 1 let stop = 1
@@ -369,7 +361,7 @@ endfunction
" GetEcrystalIndent {{{1 " GetEcrystalIndent {{{1
" ================= " =================
function GetEcrystalIndent() abort function! GetEcrystalIndent() abort
let prev_lnum = prevnonblank(v:lnum - 1) let prev_lnum = prevnonblank(v:lnum - 1)
if b:ecrystal_indent_multiline if b:ecrystal_indent_multiline
@@ -461,7 +453,7 @@ endfunction
" GetEcrystalFold {{{1 " GetEcrystalFold {{{1
" =============== " ===============
function GetEcrystalFold() abort function! GetEcrystalFold() abort
let fold = '=' let fold = '='
let col = crystal#indent#Match(v:lnum, s:ecr_control_open) let col = crystal#indent#Match(v:lnum, s:ecr_control_open)

View File

@@ -1,9 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
" Vim indent file " Vim indent file
" Vim reST indent file
" Language: reStructuredText Documentation Format " Language: reStructuredText Documentation Format
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2011-08-03 " Latest Revision: 2020-03-31
if exists("b:did_indent") if exists("b:did_indent")
finish finish

View File

@@ -39,9 +39,7 @@ syntax region typescriptArray matchgroup=typescriptBraces
syntax match typescriptNumber /\<0[bB][01][01_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty syntax match typescriptNumber /\<0[bB][01][01_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty
syntax match typescriptNumber /\<0[oO][0-7][0-7_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty syntax match typescriptNumber /\<0[oO][0-7][0-7_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty
syntax match typescriptNumber /\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty syntax match typescriptNumber /\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty
syntax match typescriptNumber /\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\|\.\d[0-9]*/ syntax match typescriptNumber /\<\%(\d[0-9_]*\%(\.\d[0-9_]*\)\=\|\.\d[0-9_]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/
\ nextgroup=typescriptExponent,@typescriptSymbols skipwhite skipempty \ nextgroup=typescriptSymbols skipwhite skipempty
syntax match typescriptExponent /[eE][+-]\=\d[0-9]*\>/
\ nextgroup=@typescriptSymbols skipwhite skipempty contained
endif endif

View File

@@ -98,7 +98,6 @@ if exists("did_typescript_hilink")
HiLink typescriptType Type HiLink typescriptType Type
HiLink typescriptNull Boolean HiLink typescriptNull Boolean
HiLink typescriptNumber Number HiLink typescriptNumber Number
HiLink typescriptExponent Number
HiLink typescriptBoolean Boolean HiLink typescriptBoolean Boolean
HiLink typescriptObjectLabel typescriptLabel HiLink typescriptObjectLabel typescriptLabel
HiLink typescriptLabel Label HiLink typescriptLabel Label

View File

@@ -275,7 +275,7 @@ syntax region juliatextString matchgroup=juliaStringDelim start=+\<text\z("\("
syntax region juliahtmlString matchgroup=juliaStringDelim start=+\<html\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw syntax region juliahtmlString matchgroup=juliaStringDelim start=+\<html\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
syntax region juliaint128String matchgroup=juliaStringDelim start=+\<u\?int128\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw syntax region juliaint128String matchgroup=juliaStringDelim start=+\<u\?int128\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
syntax region juliaDocString matchgroup=juliaStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings syntax region juliaDocString matchgroup=juliaDocStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
exec 'syntax region juliaPrintfMacro contained transparent start="@s\?printf(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaPrintfParBlock' exec 'syntax region juliaPrintfMacro contained transparent start="@s\?printf(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaPrintfParBlock'
syntax region juliaPrintfMacro contained transparent start="@s\?printf\s\+" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExprsPrintf,juliaMacro,juliaSymbolS,juliaQuotedParBlockS syntax region juliaPrintfMacro contained transparent start="@s\?printf\s\+" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExprsPrintf,juliaMacro,juliaSymbolS,juliaQuotedParBlockS
@@ -416,22 +416,23 @@ hi def link juliaComplexUnit Constant
hi def link juliaChar Character hi def link juliaChar Character
hi def link juliaString String hi def link juliaString String
hi def link juliaStringPrefixed String hi def link juliaStringPrefixed juliaString
hi def link juliabString String hi def link juliabString juliaString
hi def link juliasString String hi def link juliasString juliaString
hi def link juliavString String hi def link juliavString juliaString
hi def link juliarString String hi def link juliarString juliaString
hi def link juliaipString String hi def link juliaipString juliaString
hi def link juliabigString String hi def link juliabigString juliaString
hi def link juliaMIMEString String hi def link juliaMIMEString juliaString
hi def link juliarawString String hi def link juliarawString juliaString
hi def link juliatestString String hi def link juliatestString juliaString
hi def link juliahtmlString String hi def link juliahtmlString juliaString
hi def link juliaint128String String hi def link juliaint128String juliaString
hi def link juliaPrintfString String hi def link juliaPrintfString juliaString
hi def link juliaShellString String hi def link juliaShellString juliaString
hi def link juliaDocString String hi def link juliaDocString juliaString
hi def link juliaStringDelim String hi def link juliaStringDelim juliaString
hi def link juliaDocStringDelim juliaDocString
hi def link juliaStringVarsPla Identifier hi def link juliaStringVarsPla Identifier
hi def link juliaStringVarDelim Identifier hi def link juliaStringVarDelim Identifier

View File

@@ -84,6 +84,7 @@ syn keyword llvmKeyword
\ externally_initialized \ externally_initialized
\ extern_weak \ extern_weak
\ fastcc \ fastcc
\ tailcc
\ filter \ filter
\ from \ from
\ gc \ gc
@@ -91,6 +92,7 @@ syn keyword llvmKeyword
\ hhvmcc \ hhvmcc
\ hhvm_ccc \ hhvm_ccc
\ hidden \ hidden
\ immarg
\ initialexec \ initialexec
\ inlinehint \ inlinehint
\ inreg \ inreg

View File

@@ -705,6 +705,13 @@ syntax keyword mmaSystemSymbol MixedRadix MixedRadixQuantity MixedUnit MixtureDi
syntax keyword mmaSystemSymbol Modal Mode Modular ModularInverse ModularLambda Module syntax keyword mmaSystemSymbol Modal Mode Modular ModularInverse ModularLambda Module
syntax keyword mmaSystemSymbol Module Modulus MoebiusMu Moment Momentary MomentConvert syntax keyword mmaSystemSymbol Module Modulus MoebiusMu Moment Momentary MomentConvert
syntax keyword mmaSystemSymbol MomentConvert MomentEvaluate MomentGeneratingFunction MomentOfInertia Monday Monitor syntax keyword mmaSystemSymbol MomentConvert MomentEvaluate MomentGeneratingFunction MomentOfInertia Monday Monitor
syntax keyword mmaSystemSymbol MongoConnect MongoGetDatabase MongoGetCollection MongoGetDatabaseNames MongoDatabaseName MongoDatabaseDrop MongoGetCollectionNames
syntax keyword mmaSystemSymbol MongoCollectionName MongoCollectionDrop MongoCollectionStats MongoCollectionValidate
syntax keyword mmaSystemSymbol MongoCollectionCount MongoCollectionFind MongoCollectionFindOne MongoCollectionAggregate MongoCollectionDistinct
syntax keyword mmaSystemSymbol MongoCollectionInsert MongoCollectionUpdateOne MongoCollectionUpdateMany MongoCollectionDeleteOne MongoCollectionDeleteMany MongoCollectionReplaceOne
syntax keyword mmaSystemSymbol MongoCursorNext MongoWriteConcernCreate MongoCursorSetBatchSize MongoCursorGetBatchSize MongoCursorToArray
syntax keyword mmaSystemSymbol MongoClient MongoDatabase MongoCollection MongoCursor
syntax keyword mmaSystemSymbol MongoWriteConcern BSONObjectID MongoInsertResult MongoDriverVersion
syntax keyword mmaSystemSymbol Monitor MonomialList MonomialOrder MonsterGroupM MoonPhase MoonPosition syntax keyword mmaSystemSymbol Monitor MonomialList MonomialOrder MonsterGroupM MoonPhase MoonPosition
syntax keyword mmaSystemSymbol MoonPosition MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber syntax keyword mmaSystemSymbol MoonPosition MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber
syntax keyword mmaSystemSymbol MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform MortalityData Most syntax keyword mmaSystemSymbol MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform MortalityData Most
@@ -1298,7 +1305,7 @@ syntax match mmaOperator "&"
syntax match mmaOperator "?\{1,2}" syntax match mmaOperator "?\{1,2}"
"User Symbols "User Symbols
syntax match mmaSymbol "[^0-9][A-Za-z0-9`$]\+\s*\%([@[]\|/:\|/\=/@\)\@=" contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError syntax match mmaSymbol "[^0-9"][A-Za-z0-9`$]\+\s*\%([@[]\|/:\|/\=/@\)\@=" contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError
syntax match mmaSymbol "\<[^0-9][A-Za-z0-9`$]\+\>" contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError syntax match mmaSymbol "\<[^0-9][A-Za-z0-9`$]\+\>" contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError
syntax match mmaSymbol "\~\s*[^~]\+\s*\~"ms=s+1,me=e-1 contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError syntax match mmaSymbol "\~\s*[^~]\+\s*\~"ms=s+1,me=e-1 contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError
syntax match mmaSymbol "//\s*[A-Za-z0-9`$]\+"ms=s+2 contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError syntax match mmaSymbol "//\s*[A-Za-z0-9`$]\+"ms=s+2 contains=mmaOperator,mmaSystemSymbol,mmaBrackets,mmaError

View File

@@ -300,12 +300,15 @@ syn keyword ngxDirective large_client_header_buffers
syn keyword ngxDirective least_conn syn keyword ngxDirective least_conn
syn keyword ngxDirective least_time syn keyword ngxDirective least_time
syn keyword ngxDirective limit_conn syn keyword ngxDirective limit_conn
syn keyword ngxDirective limit_conn_dry_run
syn keyword ngxDirective limit_conn_log_level syn keyword ngxDirective limit_conn_log_level
syn keyword ngxDirective limit_conn_status syn keyword ngxDirective limit_conn_status
syn keyword ngxDirective limit_conn_zone syn keyword ngxDirective limit_conn_zone
syn keyword ngxDirective limit_except
syn keyword ngxDirective limit_rate syn keyword ngxDirective limit_rate
syn keyword ngxDirective limit_rate_after syn keyword ngxDirective limit_rate_after
syn keyword ngxDirective limit_req syn keyword ngxDirective limit_req
syn keyword ngxDirective limit_req_dry_run
syn keyword ngxDirective limit_req_log_level syn keyword ngxDirective limit_req_log_level
syn keyword ngxDirective limit_req_status syn keyword ngxDirective limit_req_status
syn keyword ngxDirective limit_req_zone syn keyword ngxDirective limit_req_zone

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
" Vim syntax file " Vim reST syntax file
" Language: reStructuredText documentation format " Language: reStructuredText documentation format
" Maintainer: Marshall Ward <marshall.ward@gmail.com> " Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Website: https://github.com/marshallward/vim-restructuredtext " Website: https://github.com/marshallward/vim-restructuredtext
" Latest Revision: 2018-12-29 " Latest Revision: 2020-03-31
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@@ -99,22 +99,32 @@ function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_righ
let first = a:start[0] let first = a:start[0]
endif endif
if a:start != '``'
let rst_contains=' contains=rstEscape' . a:name
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained' execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained'
else
let rst_contains=''
endif
execute 'syn region rst' . a:name . execute 'syn region rst' . a:name .
\ ' start=+' . a:char_left . '\zs' . a:start . \ ' start=+' . a:char_left . '\zs' . a:start .
\ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' . \ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' .
\ a:middle . \ a:middle .
\ ' end=+' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+' . \ ' end=+' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+' .
\ ' contains=rstEscape' . a:name \ rst_contains
if a:start != '``'
execute 'hi def link rstEscape'.a:name.' Special' execute 'hi def link rstEscape'.a:name.' Special'
endif
endfunction endfunction
" TODO: The "middle" argument may no longer be useful here.
function! s:DefineInlineMarkup(name, start, middle, end) function! s:DefineInlineMarkup(name, start, middle, end)
let middle = a:middle != "" ? if a:middle == '`'
\ (' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+') : let middle = ' skip=+\s'.a:middle.'+'
\ "" else
let middle = ' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+'
endif
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'") call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'")
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"')
@@ -123,8 +133,8 @@ function! s:DefineInlineMarkup(name, start, middle, end)
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}')
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>')
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '', '') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '', '')
" TODO: Additional Unicode Pd, Po, Pi, Pf, Ps characters
" TODO: Additional whitespace Unicode characters: Pd, Po, Pi, Pf, Ps
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|\%ua0\|[/:]\)', '') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|\%ua0\|[/:]\)', '')
execute 'syn match rst' . a:name . execute 'syn match rst' . a:name .
@@ -138,7 +148,7 @@ endfunction
call s:DefineInlineMarkup('Emphasis', '\*', '\*', '\*') call s:DefineInlineMarkup('Emphasis', '\*', '\*', '\*')
call s:DefineInlineMarkup('StrongEmphasis', '\*\*', '\*', '\*\*') call s:DefineInlineMarkup('StrongEmphasis', '\*\*', '\*', '\*\*')
call s:DefineInlineMarkup('InterpretedTextOrHyperlinkReference', '`', '`', '`_\{0,2}') call s:DefineInlineMarkup('InterpretedTextOrHyperlinkReference', '`', '`', '`_\{0,2}')
call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') call s:DefineInlineMarkup('InlineLiteral', '``', '`', '``')
call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}')
call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`')

View File

@@ -69,8 +69,7 @@ syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipw
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end="),\=[*+]" contains=TOP
syn match rustMacroRepeatCount ".\?[*+]" contained
syn match rustMacroVariable "$\w\+" syn match rustMacroVariable "$\w\+"
" Reserved (but not yet used) keywords {{{2 " Reserved (but not yet used) keywords {{{2
@@ -280,7 +279,6 @@ hi def link rustIdentifierPrime rustIdentifier
hi def link rustTrait rustType hi def link rustTrait rustType
hi def link rustDeriveTrait rustTrait hi def link rustDeriveTrait rustTrait
hi def link rustMacroRepeatCount rustMacroRepeatDelimiters
hi def link rustMacroRepeatDelimiters Macro hi def link rustMacroRepeatDelimiters Macro
hi def link rustMacroVariable Define hi def link rustMacroVariable Define
hi def link rustSigil StorageClass hi def link rustSigil StorageClass

View File

@@ -36,6 +36,8 @@ syntax keyword svelteKeyword slot contained containedin=htmlTag
" https://github.com/mxw/vim-jsx/blob/master/after/syntax/jsx.vim " https://github.com/mxw/vim-jsx/blob/master/after/syntax/jsx.vim
syntax region svelteExpression start="{" end="" contains=jsBlock,javascriptBlock containedin=htmlString,htmlTag,htmlArg,htmlValue,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlHead,htmlTitle,htmlBoldItalicUnderline,htmlUnderlineBold,htmlUnderlineItalicBold,htmlUnderlineBoldItalic,htmlItalicUnderline,htmlItalicBold,htmlItalicBoldUnderline,htmlItalicUnderlineBold,htmlLink,htmlLeadingSpace,htmlBold,htmlBoldUnderline,htmlBoldItalic,htmlBoldUnderlineItalic,htmlUnderline,htmlUnderlineItalic,htmlItalic,htmlStrike,javaScript syntax region svelteExpression start="{" end="" contains=jsBlock,javascriptBlock containedin=htmlString,htmlTag,htmlArg,htmlValue,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlHead,htmlTitle,htmlBoldItalicUnderline,htmlUnderlineBold,htmlUnderlineItalicBold,htmlUnderlineBoldItalic,htmlItalicUnderline,htmlItalicBold,htmlItalicBoldUnderline,htmlItalicUnderlineBold,htmlLink,htmlLeadingSpace,htmlBold,htmlBoldUnderline,htmlBoldItalic,htmlBoldUnderlineItalic,htmlUnderline,htmlUnderlineItalic,htmlItalic,htmlStrike,javaScript
syntax region svelteSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
" Block conditionals. " Block conditionals.
syntax match svelteConditional "#if" contained containedin=jsBlock,javascriptBlock syntax match svelteConditional "#if" contained containedin=jsBlock,javascriptBlock
syntax match svelteConditional "/if" contained containedin=jsBlock,javascriptBlock syntax match svelteConditional "/if" contained containedin=jsBlock,javascriptBlock
@@ -60,6 +62,59 @@ highlight def link svelteConditional Conditional
highlight def link svelteKeyword Keyword highlight def link svelteKeyword Keyword
highlight def link svelteRepeat Repeat highlight def link svelteRepeat Repeat
" Preprocessed languages that aren't supported out of the box by Svelte require
" additional syntax files to be pulled in and can slow Vim down a bit. For that
" reason, preprocessed languages must be enabled manually. Note that some may
" require additional plugins that contain the actual syntax definitions.
"
" Heavily cribbed from https://github.com/posva/vim-vue and largely completed by
" @davidroeca (thank you!).
" A syntax should be registered if there's a valid syntax definition known to
" Vim and it is enabled for the Svelte plugin.
function! s:enabled(language)
" Check whether a syntax file for {language} exists
if empty(globpath(&runtimepath, 'syntax/' . a:language . '.vim'))
return 0
endif
" If g:svelte_preprocessors is set, check for it there, otherwise return 0.
if exists('g:svelte_preprocessors') && type(g:svelte_preprocessors) == v:t_list
return index(g:svelte_preprocessors, a:language) != -1
else
return 0
endif
endfunction
let s:languages = [
\ { 'name': 'less', 'tag': 'style' },
\ { 'name': 'scss', 'tag': 'style' },
\ { 'name': 'sass', 'tag': 'style' },
\ { 'name': 'stylus', 'tag': 'style' },
\ { 'name': 'typescript', 'tag': 'script' },
\ ]
for s:language in s:languages
let s:attr = '\(lang\|type\)=\("\|''\)[^\2]*' . s:language.name . '[^\2]*\2'
let s:start = '<' . s:language.tag . '\>\_[^>]*' . s:attr . '\_[^>]*>'
if s:enabled(s:language.name)
execute 'syntax include @' . s:language.name . ' syntax/' . s:language.name . '.vim'
unlet! b:current_syntax
execute 'syntax region svelte_' . s:language.name
\ 'keepend'
\ 'start=/' . s:start . '/'
\ 'end="</' . s:language.tag . '>"me=s-1'
\ 'contains=@' . s:language.name . ',svelteSurroundingTag'
\ 'fold'
endif
endfor
" Cybernetically enhanced web apps.
let b:current_syntax = "svelte" let b:current_syntax = "svelte"
" Sync from start because of the wacky nesting.
syntax sync fromstart
endif endif

View File

@@ -16,7 +16,7 @@ syntax sync minlines=100
syn case match syn case match
syn keyword tgKeyword def let in code dag field include defm foreach syn keyword tgKeyword def let in code dag field include defm foreach defset defvar if then else
syn keyword tgType class int string list bit bits multiclass syn keyword tgType class int string list bit bits multiclass
syn match tgNumber /\<\d\+\>/ syn match tgNumber /\<\d\+\>/

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
" Language: tmux(1) configuration file " Language: tmux(1) configuration file
" Version: 3.1 (git-f986539e) " Version: before-OpenBSD-lock (git-53c84fd4)
" URL: https://github.com/ericpruitt/tmux.vim/ " URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> " Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
@@ -66,41 +66,43 @@ for s:i in range(0, 255)
endfor endfor
syn keyword tmuxOptions syn keyword tmuxOptions
\ backspace buffer-limit command-alias default-terminal escape-time \ backspace buffer-limit command-alias copy-command default-terminal editor
\ exit-empty activity-action assume-paste-time base-index bell-action \ escape-time exit-empty activity-action assume-paste-time base-index
\ default-command default-shell default-size destroy-unattached \ bell-action default-command default-shell default-size destroy-unattached
\ detach-on-destroy display-panes-active-colour display-panes-colour \ detach-on-destroy display-panes-active-colour display-panes-colour
\ display-panes-time display-time exit-unattached focus-events history-file \ display-panes-time display-time exit-unattached extended-keys focus-events
\ history-limit key-table lock-after-time lock-command message-command-style \ history-file history-limit key-table lock-after-time lock-command
\ message-limit message-style aggressive-resize allow-rename \ message-command-style message-limit aggressive-resize allow-rename
\ alternate-screen automatic-rename automatic-rename-format \ alternate-screen automatic-rename automatic-rename-format
\ clock-mode-colour clock-mode-style main-pane-height main-pane-width \ clock-mode-colour clock-mode-style copy-mode-current-match-style
\ mode-keys mode-style monitor-activity monitor-bell monitor-silence mouse \ copy-mode-mark-style copy-mode-match-style main-pane-height
\ other-pane-height other-pane-width pane-active-border-style \ main-pane-width message-style mode-keys mode-style monitor-activity
\ pane-base-index pane-border-format pane-border-status pane-border-style \ monitor-bell monitor-silence mouse other-pane-height other-pane-width
\ prefix prefix2 remain-on-exit renumber-windows repeat-time set-clipboard \ pane-active-border-style pane-base-index pane-border-format
\ set-titles set-titles-string silence-action status status-bg status-fg \ pane-border-lines pane-border-status pane-border-style prefix prefix2
\ status-format status-interval status-justify status-keys status-left \ remain-on-exit renumber-windows repeat-time set-clipboard set-titles
\ status-left-length status-left-style status-position status-right \ set-titles-string silence-action status status-bg status-fg status-format
\ status-right-length status-right-style status-style synchronize-panes \ status-interval status-justify status-keys status-left status-left-length
\ status-left-style status-position status-right status-right-length
\ status-right-style status-style synchronize-panes terminal-features
\ terminal-overrides update-environment user-keys visual-activity \ terminal-overrides update-environment user-keys visual-activity
\ visual-bell visual-silence window-active-style window-size \ visual-bell visual-silence window-active-style window-size
\ window-status-activity-style window-status-bell-style \ window-status-activity-style window-status-bell-style
\ window-status-current-format window-status-current-style \ window-status-current-format window-status-current-style
\ window-status-format window-status-last-style window-status-separator \ window-status-format window-status-last-style window-status-separator
\ window-status-style window-style word-separators wrap-search xterm-keys \ window-status-style window-style word-separators wrap-search
syn keyword tmuxCommands syn keyword tmuxCommands
\ attach attach-session bind bind-key break-pane breakp capture-pane \ attach attach-session bind bind-key break-pane breakp capture-pane
\ capturep choose-buffer choose-client choose-tree clear-history clearhist \ capturep choose-buffer choose-client choose-tree clear-history clearhist
\ clock-mode command-prompt confirm confirm-before copy-mode detach \ clock-mode command-prompt confirm confirm-before copy-mode customize-mode
\ detach-client display display-menu display-message display-panes \ detach detach-client display display-menu display-message display-panes
\ display-popup displayp find-window findw if if-shell join-pane joinp \ display-popup displayp find-window findw if if-shell join-pane joinp
\ kill-pane kill-server kill-session kill-window killp has-session has killw \ kill-pane kill-server kill-session kill-window killp has has-session killw
\ link-window linkw list-buffers list-clients list-commands list-keys \ link-window linkw list-buffers list-clients list-commands list-keys
\ list-panes list-sessions list-windows load-buffer loadb lock lock-client \ list-panes list-sessions list-windows load-buffer loadb lock lock-client
\ lock-server lock-session lockc last-pane lastp locks ls last-window last \ lock-server lock-session lockc last-pane lastp locks ls last last-window
\ lsb lsc delete-buffer deleteb lscm lsk lsp lsw menu move-pane move-window \ lsb delete-buffer deleteb lsc lscm lsk lsp lsw menu move-pane move-window
\ movep movew new new-session new-window neww next next-layout next-window \ movep movew new new-session new-window neww next next-layout next-window
\ nextl paste-buffer pasteb pipe-pane pipep popup prev previous-layout \ nextl paste-buffer pasteb pipe-pane pipep popup prev previous-layout
\ previous-window prevl refresh refresh-client rename rename-session \ previous-window prevl refresh refresh-client rename rename-session

View File

@@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm syntax file " vifm syntax file
" Maintainer: xaizek <xaizek@posteo.net> " Maintainer: xaizek <xaizek@posteo.net>
" Last Change: March 7, 2020 " Last Change: May 17, 2020
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr. " Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
if exists('b:current_syntax') if exists('b:current_syntax')
@@ -146,9 +146,9 @@ syntax keyword vifmOption contained aproposprg autochpos caseoptions cdpath cd
\ numberwidth nuw previewprg quickview relativenumber rnu rulerformat ruf \ numberwidth nuw previewprg quickview relativenumber rnu rulerformat ruf
\ runexec scrollbind scb scrolloff so sort sortgroups sortorder sortnumbers \ runexec scrollbind scb scrolloff so sort sortgroups sortorder sortnumbers
\ shell sh shellflagcmd shcf shortmess shm showtabline stal sizefmt slowfs \ shell sh shellflagcmd shcf shortmess shm showtabline stal sizefmt slowfs
\ smartcase scs statusline stl suggestoptions syncregs syscalls tabscope \ smartcase scs statusline stl suggestoptions syncregs syscalls tablabel
\ tabstop timefmt timeoutlen title tm trash trashdir ts tuioptions to \ tabscope tabstop timefmt timeoutlen title tm trash trashdir ts tuioptions
\ undolevels ul vicmd viewcolumns vifminfo vimhelp vixcmd wildmenu wmnu \ to undolevels ul vicmd viewcolumns vifminfo vimhelp vixcmd wildmenu wmnu
\ wildstyle wordchars wrap wrapscan ws \ wildstyle wordchars wrap wrapscan ws
" Disabled boolean options " Disabled boolean options

View File

@@ -14,7 +14,7 @@ syn region zirCommentLine start=";" end="$" contains=zirTodo,@Spell
syn region zirBlock start="{" end="}" transparent fold syn region zirBlock start="{" end="}" transparent fold
syn keyword zirKeyword primitive fntype int str as ptrtoint fieldptr deref asm unreachable export syn keyword zirKeyword primitive fntype int str as ptrtoint fieldptr deref asm unreachable export ref
syn keyword zirTodo contained TODO syn keyword zirTodo contained TODO
@@ -48,7 +48,7 @@ hi def link zirHexNumber Constant
hi def link zirOctNumber Constant hi def link zirOctNumber Constant
hi def link zirBinNumber Constant hi def link zirBinNumber Constant
hi def link zirGlobal Ignore hi def link zirGlobal Identifier
hi def link zirLocal Identifier hi def link zirLocal Identifier
endif endif