This commit is contained in:
Adam Stankiewicz
2020-08-06 13:22:17 +02:00
parent 56121b4e27
commit 1e533e5982
10 changed files with 1073 additions and 962 deletions

View File

@@ -1,25 +1,43 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
function! fish#Indent() function! fish#Indent()
let l:shiftwidth = shiftwidth()
let l:prevlnum = prevnonblank(v:lnum - 1) let l:prevlnum = prevnonblank(v:lnum - 1)
if l:prevlnum ==# 0 if l:prevlnum ==# 0
return 0 return 0
endif endif
let l:indent = 0
let l:prevline = getline(l:prevlnum) let l:prevline = getline(l:prevlnum)
if l:prevline =~# '\v^\s*switch>'
return indent(l:prevlnum) + l:shiftwidth
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
let l:indent = l:shiftwidth
endif
let l:line = getline(v:lnum) let l:line = getline(v:lnum)
if l:line =~# '\v^\s*end>' let l:shiftwidth = shiftwidth()
return indent(l:prevlnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent) let l:previndent = indent(l:prevlnum)
elseif l:line =~# '\v^\s*%(case|else)>' let l:indent = l:previndent
return indent(l:prevlnum) - l:shiftwidth if l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|switch|case)>'
let l:indent += l:shiftwidth
endif endif
return indent(l:prevlnum) + l:indent if l:line =~# '\v^\s*end>'
let l:indent -= l:shiftwidth
" If we're inside a case, dedent twice because it ends the switch.
if l:prevline =~# '\v^\s*case>'
" Previous line starts the case.
let l:indent -= l:shiftwidth
else
" Scan back to a dedented line to find whether we're in a case.
let l:i = l:prevlnum
while l:i >= 1 && indent(l:i) >= l:previndent
let l:i = prevnonblank(l:i - 1)
endwhile
if indent(l:i) < l:previndent && getline(l:i) =~# '\v^\s*case>'
let l:indent -= l:shiftwidth
endif
endif
elseif l:line =~# '\v^\s*else>'
let l:indent -= l:shiftwidth
elseif l:prevline !~# '\v^\s*switch>' && l:line =~# '\v^\s*case>'
let l:indent -= l:shiftwidth
endif
if l:indent < 0
return 0
endif
return l:indent
endfunction endfunction
function! fish#Format() function! fish#Format()

View File

@@ -31,6 +31,8 @@ let s:close_patt = '\C\%(\<\%(end\|until\)\>\|)\|}\)'
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$' let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
let s:anon_func_end = '\<end\%(\s*[)}]\)\+' let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
let s:chained_func_call = "^\\v\\s*[:.]\\w+[({\"']"
" Expression used to check whether we should skip a match with searchpair(). " Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~# 'luaComment\\|luaString'" let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~# 'luaComment\\|luaString'"
@@ -100,6 +102,16 @@ function GetLuaIndent()
let i += 1 let i += 1
endif endif
" if the current line chains a function call to previous unchained line
if contents_prev !~# s:chained_func_call && contents_cur =~# s:chained_func_call
let i += 1
endif
" if the current line chains a function call to previous unchained line
if contents_prev =~# s:chained_func_call && contents_cur !~# s:chained_func_call
let i -= 1
endif
" special case: call(with, {anon = function() -- should indent only once " special case: call(with, {anon = function() -- should indent only once
if i > 1 && contents_prev =~# s:anon_func_start if i > 1 && contents_prev =~# s:anon_func_start
let i = 1 let i = 1

View File

@@ -31,6 +31,11 @@ if !exists('g:ruby_indent_block_style')
let g:ruby_indent_block_style = 'do' let g:ruby_indent_block_style = 'do'
endif endif
if !exists('g:ruby_indent_hanging_elements')
" Non-zero means hanging indents are enabled, zero means disabled
let g:ruby_indent_hanging_elements = 1
endif
setlocal nosmartindent setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it. " Now, set up our indentation expression and keys that trigger it.
@@ -323,7 +328,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort
if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0 if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0
if closing_bracket == ')' && col('.') != col('$') - 1 if closing_bracket == ')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1 if g:ruby_indent_hanging_elements
let ind = virtcol('.') - 1
else
let ind = indent(line('.'))
end
elseif g:ruby_indent_block_style == 'do' elseif g:ruby_indent_block_style == 'do'
let ind = indent(line('.')) let ind = indent(line('.'))
else " g:ruby_indent_block_style == 'expression' else " g:ruby_indent_block_style == 'expression'
@@ -548,7 +557,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort
let [opening, closing] = s:ExtraBrackets(info.plnum) let [opening, closing] = s:ExtraBrackets(info.plnum)
if opening.pos != -1 if opening.pos != -1
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if !g:ruby_indent_hanging_elements
return indent(info.plnum) + info.sw
elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$') if col('.') + 1 == col('$')
return indent(info.plnum) + info.sw return indent(info.plnum) + info.sw
else else

View File

@@ -30,4 +30,54 @@ syntax region typescriptFuncCallArg contained matchgroup=typescriptPa
syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression
syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events
syntax region typescriptDestructureString
\ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/
\ contains=typescriptASCII
\ nextgroup=typescriptDestructureAs
\ contained skipwhite skipempty
syntax cluster typescriptVariableDeclarations
\ contains=typescriptVariableDeclaration,@typescriptDestructures
syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ contained skipwhite skipempty
syntax cluster typescriptDestructureVariables contains=
\ typescriptRestOrSpread,
\ typescriptDestructureComma,
\ typescriptDestructureLabel,
\ typescriptDestructureVariable,
\ @typescriptDestructures
syntax match typescriptDestructureVariable /[A-Za-z_$]\k*/ contained
\ nextgroup=typescriptDefaultParam
\ contained skipwhite skipempty
syntax match typescriptDestructureLabel /[A-Za-z_$]\k*\ze\_s*:/
\ nextgroup=typescriptDestructureAs
\ contained skipwhite skipempty
syntax match typescriptDestructureAs /:/
\ nextgroup=typescriptDestructureVariable,@typescriptDestructures
\ contained skipwhite skipempty
syntax match typescriptDestructureComma /,/ contained
syntax cluster typescriptDestructures contains=
\ typescriptArrayDestructure,
\ typescriptObjectDestructure
syntax region typescriptArrayDestructure matchgroup=typescriptBraces
\ start=/\[/ end=/]/
\ contains=@typescriptDestructureVariables,@typescriptComments
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ transparent contained skipwhite skipempty fold
syntax region typescriptObjectDestructure matchgroup=typescriptBraces
\ start=/{/ end=/}/
\ contains=typescriptDestructureString,@typescriptDestructureVariables,@typescriptComments
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ transparent contained skipwhite skipempty fold
endif endif

View File

@@ -29,16 +29,12 @@ syntax keyword typescriptIdentifier arguments this super
\ nextgroup=@afterIdentifier \ nextgroup=@afterIdentifier
syntax keyword typescriptVariable let var syntax keyword typescriptVariable let var
\ nextgroup=typescriptVariableDeclaration \ nextgroup=@typescriptVariableDeclarations
\ skipwhite skipempty skipnl \ skipwhite skipempty
syntax keyword typescriptVariable const syntax keyword typescriptVariable const
\ nextgroup=typescriptEnum,typescriptVariableDeclaration \ nextgroup=typescriptEnum,@typescriptVariableDeclarations
\ skipwhite \ skipwhite skipempty
syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ contained skipwhite skipempty skipnl
syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/ syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/
\ nextgroup=typescriptBlock \ nextgroup=typescriptBlock

View File

@@ -74,6 +74,7 @@ if exists("did_typescript_hilink")
HiLink typescriptStringMember String HiLink typescriptStringMember String
HiLink typescriptTemplate String HiLink typescriptTemplate String
HiLink typescriptEventString String HiLink typescriptEventString String
HiLink typescriptDestructureString String
HiLink typescriptASCII Special HiLink typescriptASCII Special
HiLink typescriptTemplateSB Label HiLink typescriptTemplateSB Label
HiLink typescriptRegexpString String HiLink typescriptRegexpString String
@@ -87,6 +88,7 @@ if exists("did_typescript_hilink")
HiLink typescriptBranch Conditional HiLink typescriptBranch Conditional
HiLink typescriptIdentifier Structure HiLink typescriptIdentifier Structure
HiLink typescriptVariable Identifier HiLink typescriptVariable Identifier
HiLink typescriptDestructureVariable PreProc
HiLink typescriptEnumKeyword Identifier HiLink typescriptEnumKeyword Identifier
HiLink typescriptRepeat Repeat HiLink typescriptRepeat Repeat
HiLink typescriptForOperator Repeat HiLink typescriptForOperator Repeat
@@ -100,6 +102,7 @@ if exists("did_typescript_hilink")
HiLink typescriptNumber Number HiLink typescriptNumber Number
HiLink typescriptBoolean Boolean HiLink typescriptBoolean Boolean
HiLink typescriptObjectLabel typescriptLabel HiLink typescriptObjectLabel typescriptLabel
HiLink typescriptDestructureLabel Function
HiLink typescriptLabel Label HiLink typescriptLabel Label
HiLink typescriptTupleLable Label HiLink typescriptTupleLable Label
HiLink typescriptStringProperty String HiLink typescriptStringProperty String

View File

@@ -109,11 +109,15 @@ syntax match juliaSemicolon display ";"
syntax match juliaComma display "," syntax match juliaComma display ","
syntax match juliaColon display ":" syntax match juliaColon display ":"
" This is really ugly. It would be better to mask most keywords when a dot is
" found, introducing some kind of dot-environment
let s:nodot = '\%(\.\)\@'.s:d(1).'<!'
syntax match juliaErrorPar display "[])}]" syntax match juliaErrorPar display "[])}]"
syntax match juliaErrorEnd display "\<end\>" exec 'syntax match juliaErrorEnd display "'.s:nodot.'\<end\>"'
syntax match juliaErrorElse display "\<\%(else\|elseif\)\>" exec 'syntax match juliaErrorElse display "'.s:nodot.'\<\%(else\|elseif\)\>"'
syntax match juliaErrorCatch display "\<catch\>" exec 'syntax match juliaErrorCatch display "'.s:nodot.'\<catch\>"'
syntax match juliaErrorFinally display "\<finally\>" exec 'syntax match juliaErrorFinally display "'.s:nodot.'\<finally\>"'
syntax match juliaErrorSemicol display contained ";" syntax match juliaErrorSemicol display contained ";"
syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor
@@ -122,10 +126,6 @@ syntax region juliaSqBraIdxBlock matchgroup=juliaParDelim start="\[" end="\]" c
exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS' exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
" This is really ugly. It would be better to mask most keywords when a dot is
" found, introducing some kind of dot-environment
let s:nodot = '\%(\.\)\@'.s:d(1).'<!'
exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>"' exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>"'
syntax match juliaInfixKeyword display "\%(=\s*\)\@<!\<\%(in\|isa\)\>\S\@!\%(\s*=\)\@!" syntax match juliaInfixKeyword display "\%(=\s*\)\@<!\<\%(in\|isa\)\>\S\@!\%(\s*=\)\@!"
exec 'syntax match juliaRepKeyword display "'.s:nodot.'\<\%(break\|continue\)\>"' exec 'syntax match juliaRepKeyword display "'.s:nodot.'\<\%(break\|continue\)\>"'

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,8 @@ syn match slimTag "\w\+[><]*" contained contains=htmlTagName n
syn match slimIdChar "#{\@!" contained nextgroup=slimId syn match slimIdChar "#{\@!" contained nextgroup=slimId
syn match slimId "\%(\w\|-\)\+" contained nextgroup=@slimComponent syn match slimId "\%(\w\|-\)\+" contained nextgroup=@slimComponent
syn match slimClassChar "\." contained nextgroup=slimClass syn match slimClassChar "\." contained nextgroup=slimClass
syn match slimClass "\%(\w\|-\|\/\d+\|:\(\w\|-\)\+\)\+" contained nextgroup=@slimComponent syn match slimClass "\%(\w\|-\|\/\|:\(\w\|-\)\+\)\+" contained nextgroup=@slimComponent
syn match slimInlineTagChar "\s*:\s*" contained nextgroup=slimTag,slimClassChar,slimIdChar syn match slimInlineTagChar "\s*:\s*" contained nextgroup=slimTag,slimClassChar,slimIdChar
syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimAttr nextgroup=slimRuby syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimAttr nextgroup=slimRuby

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: June 22, 2020 " Last Change: July 27, 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')
@@ -89,7 +89,7 @@ syntax case ignore
syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine
\ OtherLine Directory Link Socket Device Executable Selected BrokenLink \ OtherLine Directory Link Socket Device Executable Selected BrokenLink
\ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch \ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch
\ AuxWin OtherWin TabLine TabLineSel HardLink \ AuxWin OtherWin TabLine TabLineSel TabNr HardLink LineNr OddLine
\ User1 User2 User3 User4 User5 User6 User7 User8 User9 \ User1 User2 User3 User4 User5 User6 User7 User8 User9
syntax keyword vifmHiStyles contained syntax keyword vifmHiStyles contained
\ bold underline reverse inverse standout italic none \ bold underline reverse inverse standout italic none