Skip to content

Commit 38282d5

Browse files
committed
Update
1 parent 36a2bf6 commit 38282d5

File tree

8 files changed

+223
-16
lines changed

8 files changed

+223
-16
lines changed

ftplugin/bicep.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set cpoptions&vim
1515

1616
" Set the commentstring
1717
setlocal commentstring=//%s
18-
let b:undo_ftplugin = ' commentstring<'
18+
let b:undo_ftplugin = 'setlocal commentstring<'
1919

2020
let &cpoptions = s:cpo_save
2121
unlet s:cpo_save

ftplugin/markdown.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ function! s:MarkdownHighlightSources(force)
792792
" Look for code blocks in the current file
793793
let filetypes = {}
794794
for line in getline(1, '$')
795-
let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*\ze.*')
795+
let ft = matchstr(line, '\(`\{3,}\|\~\{3,}\)\s*\zs[0-9A-Za-z_+-]*\ze.*')
796796
if !empty(ft) && ft !~# '^\d*$' | let filetypes[ft] = 1 | endif
797797
endfor
798798
if !exists('b:mkd_known_filetypes')
@@ -823,8 +823,10 @@ function! s:MarkdownHighlightSources(force)
823823
else
824824
let include = '@' . toupper(filetype)
825825
endif
826-
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
827-
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
826+
let command_backtick = 'syntax region %s matchgroup=%s start="^\s*`\{3,}\s*%s.*$" matchgroup=%s end="\s*`\{3,}$" keepend contains=%s%s'
827+
let command_tilde = 'syntax region %s matchgroup=%s start="^\s*\~\{3,}\s*%s.*$" matchgroup=%s end="\s*\~\{3,}$" keepend contains=%s%s'
828+
execute printf(command_backtick, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
829+
execute printf(command_tilde, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
828830
execute printf('syntax cluster mkdNonListItem add=%s', group)
829831

830832
let b:mkd_known_filetypes[ft] = 1

indent/svelte-css.vim

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
if polyglot#init#is_disabled(expand('<sfile>:p'), 'svelte', 'indent/svelte-css.vim')
2+
finish
3+
endif
4+
5+
" Vim indent file
6+
" Language: CSS
7+
" Maintainer: Nikolai Weibull <[email protected]>
8+
" Latest Revision: 2012-05-30
9+
" Use of shiftwidth() added by Oleg Zubchenko.
10+
11+
" Changes: 1) Reacquire the line while checking comment lines.
12+
13+
if exists("b:did_indent")
14+
finish
15+
endif
16+
let b:did_indent = 1
17+
18+
setlocal indentexpr=GetCSSIndent()
19+
setlocal indentkeys=0{,0},!^F,o,O
20+
setlocal nosmartindent
21+
22+
let b:undo_indent = "setl smartindent< indentkeys< indentexpr<"
23+
24+
if exists("*GetCSSIndent")
25+
finish
26+
endif
27+
let s:keepcpo= &cpo
28+
set cpo&vim
29+
30+
function s:prevnonblanknoncomment(lnum)
31+
let lnum = a:lnum
32+
while lnum > 1
33+
let lnum = prevnonblank(lnum)
34+
let line = getline(lnum)
35+
if line =~ '\*/'
36+
while lnum > 1 && line !~ '/\*'
37+
let lnum -= 1
38+
let line = getline(lnum)
39+
endwhile
40+
if line =~ '^\s*/\*'
41+
let lnum -= 1
42+
else
43+
break
44+
endif
45+
else
46+
break
47+
endif
48+
endwhile
49+
return lnum
50+
endfunction
51+
52+
function s:count_braces(lnum, count_open)
53+
let n_open = 0
54+
let n_close = 0
55+
let line = getline(a:lnum)
56+
let pattern = '[{}]'
57+
let i = match(line, pattern)
58+
while i != -1
59+
if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'css\%(Comment\|StringQ\{1,2}\)'
60+
if line[i] == '{'
61+
let n_open += 1
62+
elseif line[i] == '}'
63+
if n_open > 0
64+
let n_open -= 1
65+
else
66+
let n_close += 1
67+
endif
68+
endif
69+
endif
70+
let i = match(line, pattern, i + 1)
71+
endwhile
72+
return a:count_open ? n_open : n_close
73+
endfunction
74+
75+
function GetCSSIndent()
76+
let line = getline(v:lnum)
77+
if line =~ '^\s*\*'
78+
return cindent(v:lnum)
79+
endif
80+
81+
let pnum = s:prevnonblanknoncomment(v:lnum - 1)
82+
if pnum == 0
83+
return 0
84+
endif
85+
86+
return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth()
87+
\ - s:count_braces(v:lnum, 0) * shiftwidth()
88+
endfunction
89+
90+
let &cpo = s:keepcpo
91+
unlet s:keepcpo

indent/svelte-xml.vim

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
if polyglot#init#is_disabled(expand('<sfile>:p'), 'svelte', 'indent/svelte-xml.vim')
2+
finish
3+
endif
4+
5+
" Language: xml
6+
" Maintainer: Johannes Zellner <[email protected]>
7+
" Last Change: 2017 Jun 13
8+
" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts)
9+
" 2) will be confused by unbalanced tags in comments
10+
" or CDATA sections.
11+
" 2009-05-26 patch by Nikolai Weibull
12+
" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close
13+
14+
" Only load this indent file when no other was loaded.
15+
if exists("b:did_indent")
16+
finish
17+
endif
18+
let b:did_indent = 1
19+
let s:keepcpo= &cpo
20+
set cpo&vim
21+
22+
" [-- local settings (must come before aborting the script) --]
23+
setlocal indentexpr=XmlIndentGet(v:lnum,1)
24+
setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,}
25+
26+
if !exists('b:xml_indent_open')
27+
let b:xml_indent_open = '.\{-}<\a'
28+
" pre tag, e.g. <address>
29+
" let b:xml_indent_open = '.\{-}<[/]\@!\(address\)\@!'
30+
endif
31+
32+
if !exists('b:xml_indent_close')
33+
let b:xml_indent_close = '.\{-}</'
34+
" end pre tag, e.g. </address>
35+
" let b:xml_indent_close = '.\{-}</\(address\)\@!'
36+
endif
37+
38+
let &cpo = s:keepcpo
39+
unlet s:keepcpo
40+
41+
" [-- finish, if the function already exists --]
42+
if exists('*XmlIndentGet')
43+
finish
44+
endif
45+
46+
let s:keepcpo= &cpo
47+
set cpo&vim
48+
49+
fun! <SID>XmlIndentWithPattern(line, pat)
50+
let s = substitute('x'.a:line, a:pat, "\1", 'g')
51+
return strlen(substitute(s, "[^\1].*$", '', ''))
52+
endfun
53+
54+
" [-- check if it's xml --]
55+
fun! <SID>XmlIndentSynCheck(lnum)
56+
if '' != &syntax
57+
let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name')
58+
let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
59+
if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml'
60+
" don't indent pure non-xml code
61+
return 0
62+
elseif syn1 =~ '^xmlComment' && syn2 =~ '^xmlComment'
63+
" indent comments specially
64+
return -1
65+
endif
66+
endif
67+
return 1
68+
endfun
69+
70+
" [-- return the sum of indents of a:lnum --]
71+
fun! <SID>XmlIndentSum(lnum, style, add)
72+
let line = getline(a:lnum)
73+
if a:style == match(line, '^\s*</')
74+
return (shiftwidth() *
75+
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
76+
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
77+
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
78+
else
79+
return a:add
80+
endif
81+
endfun
82+
83+
fun! XmlIndentGet(lnum, use_syntax_check)
84+
" Find a non-empty line above the current line.
85+
let lnum = prevnonblank(a:lnum - 1)
86+
87+
" Hit the start of the file, use zero indent.
88+
if lnum == 0
89+
return 0
90+
endif
91+
92+
if a:use_syntax_check
93+
let check_lnum = <SID>XmlIndentSynCheck(lnum)
94+
let check_alnum = <SID>XmlIndentSynCheck(a:lnum)
95+
if 0 == check_lnum || 0 == check_alnum
96+
return indent(a:lnum)
97+
elseif -1 == check_lnum || -1 == check_alnum
98+
return -1
99+
endif
100+
endif
101+
102+
let ind = <SID>XmlIndentSum(lnum, -1, indent(lnum))
103+
let ind = <SID>XmlIndentSum(a:lnum, 0, ind)
104+
105+
return ind
106+
endfun
107+
108+
let &cpo = s:keepcpo
109+
unlet s:keepcpo
110+
111+
" vim:ts=8

indent/svelte.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ let s:debug = svelte#GetConfig('debug', 0)
5555
" Save shiftwidth
5656
let s:sw = &sw
5757

58-
" Use lib/indent/ files for compatibility
58+
" Use specific indent files for compatibility
5959
unlet! b:did_indent
60-
runtime lib/indent/xml.vim
60+
runtime indent/svelte-xml.vim
6161

6262
unlet! b:did_indent
63-
runtime lib/indent/css.vim
63+
runtime indent/svelte-css.vim
6464

6565
" Use normal indent files
6666
unlet! b:did_indent

syntax/nix.vim

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ syn match nixStringSpecial /''['$]/ contained
4343
syn match nixStringSpecial /\$\$/ contained
4444
syn match nixStringSpecial /''\\[nrt]/ contained
4545

46+
syn match nixSimpleStringSpecial /\$\$/ contained
47+
4648
syn match nixInvalidSimpleStringEscape /\\[^nrt"\\$]/ contained
4749
syn match nixInvalidStringEscape /''\\[^nrt]/ contained
4850

@@ -63,7 +65,7 @@ syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'.-]\|$\)" con
6365
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
6466
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
6567

66-
syn region nixInheritAttributeScope start="(" end=")" contained contains=nixComment,nixAttributeDot
68+
syn region nixInheritAttributeScope start="(" end="\ze)" contained contains=@nixExpr
6769
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
6870

6971
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition
@@ -133,7 +135,7 @@ syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-
133135
" Non-namespaced Nix builtins as of version 2.0:
134136
syn keyword nixSimpleBuiltin
135137
\ abort baseNameOf derivation derivationStrict dirOf fetchGit
136-
\ fetchMercurial fetchTarball import isNull map placeholder removeAttrs
138+
\ fetchMercurial fetchTarball import isNull map mapAttrs placeholder removeAttrs
137139
\ scopedImport throw toString
138140
139141

@@ -146,13 +148,13 @@ syn keyword nixNamespacedBuiltin contained
146148
\ findFile foldl' fromJSON functionArgs genList \ genericClosure getAttr
147149
\ getEnv hasAttr hasContext hashString head import intersectAttrs isAttrs
148150
\ isBool isFloat isFunction isInt isList isNull isString langVersion
149-
\ length lessThan listToAttrs map match mul nixPath nixVersion
151+
\ length lessThan listToAttrs map mapAttrs match mul nixPath nixVersion
150152
\ parseDrvName partition path pathExists placeholder readDir readFile
151153
\ removeAttrs replaceStrings scopedImport seq sort split splitVersion
152154
\ storeDir storePath stringLength sub substring tail throw toFile toJSON
153155
\ toPath toString toXML trace tryEval typeOf unsafeDiscardOutputDependency
154156
\ unsafeDiscardStringContext unsafeGetAttrPos valueSize fromTOML bitAnd
155-
\ bitOr bitXor
157+
\ bitOr bitXor floor ceil
156158
157159
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
158160

syntax/ruby.vim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyStringEscape
148148
syn cluster rubyStringNotTop contains=@rubyStringSpecial,@rubyNestedBrackets,@rubySingleCharEscape
149149

150150
" Regular Expression Metacharacters {{{1
151-
syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\\\\|\\)" end=")" contained
152-
syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\\\\|\\)" end=")" contained transparent contains=@rubyRegexpSpecial
153-
syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\\\|\\\]" end="\]" contained transparent contains=rubyRegexpBrackets,rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass,rubyRegexpIntersection oneline
151+
syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\\\\|\\)" end=")" contained
152+
syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\%(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\\\\|\\)" end=")" contained transparent contains=@rubyRegexpSpecial
153+
syn region rubyRegexpBrackets matchgroup=rubyRegexpCharClass start="\[\^\=" skip="\\\\\|\\\]" end="\]" contained transparent contains=rubyRegexpBrackets,rubyStringEscape,rubyRegexpEscape,rubyRegexpCharClass,rubyRegexpIntersection oneline
154154
syn match rubyRegexpCharClass "\\[DdHhRSsWw]" contained display
155155
syn match rubyRegexpCharClass "\[:\^\=\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|xdigit\):\]" contained
156156
syn match rubyRegexpCharClass "\\[pP]{^\=.\{-}}" contained display
@@ -349,7 +349,7 @@ syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,
349349
syn match rubyControl "\%#=1\<\%(break\|in\|next\|redo\|retry\|return\)\>"
350350
syn match rubyKeyword "\%#=1\<\%(super\|yield\)\>"
351351
syn match rubyBoolean "\%#=1\<\%(true\|false\)\>[?!]\@!"
352-
syn match rubyPseudoVariable "\%#=1\<\(self\|nil\)\>[?!]\@!"
352+
syn match rubyPseudoVariable "\%#=1\<\%(self\|nil\)\>[?!]\@!"
353353
syn match rubyPseudoVariable "\%#=1\<__\%(ENCODING\|dir\|FILE\|LINE\|callee\|method\)__\>"
354354
syn match rubyBeginEnd "\%#=1\<\%(BEGIN\|END\)\>"
355355

@@ -421,7 +421,7 @@ if !exists("ruby_no_special_methods")
421421
syn match rubyAccess "\%#=1\<\%(public\|private\)_class_method\>"
422422
syn match rubyAccess "\%#=1\<\%(public\|private\)_constant\>"
423423
syn match rubyAccess "\%#=1\<module_function\>"
424-
syn match rubyAttribute "\%#=1\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!" " attr is a common variable name
424+
syn match rubyAttribute "\%#=1\%(\%(^\|;\)\s*\)\@<=attr\>\%(\s*[.=]\)\@!" " attr is a common variable name
425425
syn match rubyAttribute "\%#=1\<attr_\%(accessor\|reader\|writer\)\>"
426426
syn match rubyControl "\%#=1\<\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>"
427427
syn match rubyEval "\%#=1\<eval\>"

syntax/zig.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ let s:zig_syntax_keywords = {
195195
\ , "@Vector"
196196
\ , "@sin"
197197
\ , "@cos"
198+
\ , "@tan"
198199
\ , "@exp"
199200
\ , "@exp2"
200201
\ , "@log"

0 commit comments

Comments
 (0)