Update
This commit is contained in:
parent
ef369d45a5
commit
af87010071
@ -18,6 +18,38 @@ if g:terraform_align && exists(':Tabularize')
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
function! TerraformFolds()
|
||||
let thisline = getline(v:lnum)
|
||||
if match(thisline, '^resource') >= 0
|
||||
return ">1"
|
||||
elseif match(thisline, '^provider') >= 0
|
||||
return ">1"
|
||||
elseif match(thisline, '^module') >= 0
|
||||
return ">1"
|
||||
elseif match(thisline, '^variable') >= 0
|
||||
return ">1"
|
||||
elseif match(thisline, '^output') >= 0
|
||||
return ">1"
|
||||
else
|
||||
return "="
|
||||
endif
|
||||
endfunction
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=TerraformFolds()
|
||||
setlocal foldlevel=1
|
||||
|
||||
function! TerraformFoldText()
|
||||
let foldsize = (v:foldend-v:foldstart)
|
||||
return getline(v:foldstart).' ('.foldsize.' lines)'
|
||||
endfunction
|
||||
setlocal foldtext=TerraformFoldText()
|
||||
|
||||
"inoremap <space> <C-O>za
|
||||
nnoremap <space> za
|
||||
onoremap <space> <C-C>za
|
||||
vnoremap <space> zf
|
||||
|
||||
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
|
||||
if get(g:, "terraform_align", 1)
|
||||
setlocal tabstop=2
|
||||
@ -25,4 +57,5 @@ if get(g:, "terraform_align", 1)
|
||||
setlocal shiftwidth=2
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
@ -38,8 +38,8 @@ syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil
|
||||
syn keyword yamlConstant TRUE True true YES Yes yes ON On on
|
||||
syn keyword yamlConstant FALSE False false NO No no OFF Off off
|
||||
|
||||
syn match yamlKey "^\s*\zs\S\+\ze\s*:"
|
||||
syn match yamlKey "^\s*-\s*\zs\S\+\ze\s*:"
|
||||
syn match yamlKey "^\s*\zs[^ \t\"]\+\ze\s*:"
|
||||
syn match yamlKey "^\s*-\s*\zs[^ \t\"]\+\ze\s*:"
|
||||
syn match yamlAnchor "&\S\+"
|
||||
syn match yamlAlias "*\S\+"
|
||||
|
||||
|
@ -1,219 +1,347 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
let s:NO_COLON_BEFORE = ':\@<!'
|
||||
let s:NO_COLON_AFTER = ':\@!'
|
||||
let s:ENDING_SYMBOLS = '\]\|}\|)'
|
||||
let s:ARROW = '->'
|
||||
let s:END_WITH_ARROW = s:ARROW.'$'
|
||||
let s:SKIP_SYNTAX = '\%(Comment\|String\)$'
|
||||
let s:BLOCK_SKIP = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:SKIP_SYNTAX."'"
|
||||
let s:DEF = '^\s*def'
|
||||
let s:FN = '\<fn\>'
|
||||
let s:MULTILINE_FN = s:FN.'\%(.*end\)\@!'
|
||||
let s:BLOCK_START = '\%(\<do\>\|'.s:FN.'\)\>'
|
||||
let s:MULTILINE_BLOCK = '\%(\<do\>'.s:NO_COLON_AFTER.'\|'.s:MULTILINE_FN.'\)'
|
||||
let s:BLOCK_MIDDLE = '\<\%(else\|match\|elsif\|catch\|after\|rescue\)\>'
|
||||
let s:BLOCK_END = 'end'
|
||||
let s:STARTS_WITH_PIPELINE = '^\s*|>.*$'
|
||||
let s:QUERY_FROM = '^\s*\<from\>.*\<in\>.*,'
|
||||
let s:ENDING_WITH_ASSIGNMENT = '=\s*$'
|
||||
let s:INDENT_KEYWORDS = s:NO_COLON_BEFORE.'\%('.s:MULTILINE_BLOCK.'\|'.s:BLOCK_MIDDLE.'\)'
|
||||
let s:DEINDENT_KEYWORDS = '^\s*\<\%('.s:BLOCK_END.'\|'.s:BLOCK_MIDDLE.'\)\>'
|
||||
let s:PAIR_START = '\<\%('.s:NO_COLON_BEFORE.s:BLOCK_START.'\)\>'.s:NO_COLON_AFTER
|
||||
let s:PAIR_MIDDLE = '^\s*\%('.s:BLOCK_MIDDLE.'\)\>'.s:NO_COLON_AFTER.'\zs'
|
||||
let s:PAIR_END = '\<\%('.s:NO_COLON_BEFORE.s:BLOCK_END.'\)\>\zs'
|
||||
let s:LINE_COMMENT = '^\s*#'
|
||||
let s:MATCH_OPERATOR = '[^!><=]=[^~=>]'
|
||||
|
||||
function! s:pending_parenthesis(line)
|
||||
if a:line.last_non_blank.text !~ s:ARROW
|
||||
return elixir#util#count_indentable_symbol_diff(a:line.last_non_blank, '(', '\%(end\s*\)\@<!)')
|
||||
end
|
||||
function! elixir#indent#debug(str)
|
||||
if exists("g:elixir_indent_debug") && g:elixir_indent_debug
|
||||
echom a:str
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:pending_square_brackets(line)
|
||||
if a:line.last_non_blank.text !~ s:ARROW
|
||||
return elixir#util#count_indentable_symbol_diff(a:line.last_non_blank, '[', ']')
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! s:pending_brackets(line)
|
||||
if a:line.last_non_blank.text !~ s:ARROW
|
||||
return elixir#util#count_indentable_symbol_diff(a:line.last_non_blank, '{', '}')
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#deindent_case_arrow(ind, line)
|
||||
if get(b:old_ind, 'arrow', 0) > 0
|
||||
\ && (a:line.current.text =~ s:ARROW
|
||||
\ || a:line.current.text =~ s:BLOCK_END)
|
||||
let ind = b:old_ind.arrow
|
||||
let b:old_ind.arrow = 0
|
||||
return ind
|
||||
" Returns 0 or 1 based on whether or not the text starts with the given
|
||||
" expression and is not a string or comment
|
||||
function! elixir#indent#starts_with(text, expr, lnum)
|
||||
let pos = match(a:text, '^\s*'.a:expr)
|
||||
if pos == -1
|
||||
return 0
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#deindent_ending_symbols(ind, line)
|
||||
if a:line.current.text =~ '^\s*\('.s:ENDING_SYMBOLS.'\)'
|
||||
return a:ind - &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#deindent_keywords(ind, line)
|
||||
if a:line.current.text =~ s:DEINDENT_KEYWORDS
|
||||
let bslnum = searchpair(
|
||||
\ s:PAIR_START,
|
||||
\ s:PAIR_MIDDLE,
|
||||
\ s:PAIR_END,
|
||||
\ 'nbW',
|
||||
\ s:BLOCK_SKIP
|
||||
\ )
|
||||
|
||||
return indent(bslnum)
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#deindent_opened_symbols(ind, line)
|
||||
let s:opened_symbol =
|
||||
\ s:pending_parenthesis(a:line)
|
||||
\ + s:pending_square_brackets(a:line)
|
||||
\ + s:pending_brackets(a:line)
|
||||
|
||||
if s:opened_symbol < 0
|
||||
let ind = get(b:old_ind, 'symbol', a:ind + (s:opened_symbol * &sw))
|
||||
let ind = float2nr(ceil(floor(ind)/&sw)*&sw)
|
||||
return ind <= 0 ? 0 : ind
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_after_pipeline(ind, line)
|
||||
if exists("b:old_ind.pipeline")
|
||||
\ && elixir#util#is_blank(a:line.last.text)
|
||||
\ && a:line.current.text !~ s:STARTS_WITH_PIPELINE
|
||||
" Reset indentation in pipelines if there is a blank line between
|
||||
" pipes
|
||||
let ind = b:old_ind.pipeline
|
||||
unlet b:old_ind.pipeline
|
||||
return ind
|
||||
elseif a:line.last_non_blank.text =~ s:STARTS_WITH_PIPELINE
|
||||
if empty(substitute(a:line.current.text, ' ', '', 'g'))
|
||||
\ || a:line.current.text =~ s:STARTS_WITH_PIPELINE
|
||||
return indent(a:line.last_non_blank.num)
|
||||
elseif a:line.last_non_blank.text !~ s:INDENT_KEYWORDS
|
||||
let ind = b:old_ind.pipeline
|
||||
unlet b:old_ind.pipeline
|
||||
return ind
|
||||
end
|
||||
end
|
||||
|
||||
return a:ind
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_assignment(ind, line)
|
||||
if a:line.last_non_blank.text =~ s:ENDING_WITH_ASSIGNMENT
|
||||
let b:old_ind.pipeline = indent(a:line.last_non_blank.num) " FIXME: side effect
|
||||
return a:ind + &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_brackets(ind, line)
|
||||
if s:pending_brackets(a:line) > 0
|
||||
return a:ind + &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_case_arrow(ind, line)
|
||||
if a:line.last_non_blank.text =~ s:END_WITH_ARROW && a:line.last_non_blank.text !~ '\<fn\>'
|
||||
let b:old_ind.arrow = a:ind
|
||||
return a:ind + &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_ending_symbols(ind, line)
|
||||
if a:line.last_non_blank.text =~ '^\s*\('.s:ENDING_SYMBOLS.'\)\s*$'
|
||||
return a:ind + &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_keywords(ind, line)
|
||||
if a:line.last_non_blank.text =~ s:INDENT_KEYWORDS && a:line.last_non_blank.text !~ s:LINE_COMMENT
|
||||
return a:ind + &sw
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_parenthesis(ind, line)
|
||||
if s:pending_parenthesis(a:line) > 0
|
||||
\ && a:line.last_non_blank.text !~ s:DEF
|
||||
\ && a:line.last_non_blank.text !~ s:END_WITH_ARROW
|
||||
let b:old_ind.symbol = a:ind
|
||||
return matchend(a:line.last_non_blank.text, '(')
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_pipeline_assignment(ind, line)
|
||||
if a:line.current.text =~ s:STARTS_WITH_PIPELINE
|
||||
\ && a:line.last_non_blank.text =~ s:MATCH_OPERATOR
|
||||
let b:old_ind.pipeline = indent(a:line.last_non_blank.num)
|
||||
" if line starts with pipeline
|
||||
" and last_non_blank line is an attribution
|
||||
" indents pipeline in same level as attribution
|
||||
let assign_pos = match(a:line.last_non_blank.text, '=\s*\zs[^ ]')
|
||||
return (elixir#util#is_indentable_at(a:line.last_non_blank.num, assign_pos) ? assign_pos : a:ind)
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_pipeline_continuation(ind, line)
|
||||
if a:line.last_non_blank.text =~ s:STARTS_WITH_PIPELINE
|
||||
\ && a:line.current.text =~ s:STARTS_WITH_PIPELINE
|
||||
return indent(a:line.last_non_blank.num)
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_square_brackets(ind, line)
|
||||
if s:pending_square_brackets(a:line) > 0
|
||||
if a:line.last_non_blank.text =~ '[\s*$'
|
||||
return a:ind + &sw
|
||||
" NOTE: @jbodah 2017-02-24: pos is the index of the match which is
|
||||
" zero-indexed. Add one to make it the column number
|
||||
if elixir#indent#is_string_or_comment(a:lnum, pos + 1)
|
||||
return 0
|
||||
else
|
||||
" if start symbol is followed by a character, indent based on the
|
||||
" whitespace after the symbol, otherwise use the default shiftwidth
|
||||
" Avoid negative indentation index
|
||||
return matchend(a:line.last_non_blank.text, '[\s*')
|
||||
return 1
|
||||
end
|
||||
else
|
||||
return a:ind
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#indent_ecto_queries(ind, line)
|
||||
if a:line.last_non_blank.text =~ s:QUERY_FROM
|
||||
return a:ind + &sw
|
||||
" Returns 0 or 1 based on whether or not the text ends with the given
|
||||
" expression and is not a string or comment
|
||||
function! elixir#indent#ends_with(text, expr, lnum)
|
||||
let pos = match(a:text, a:expr.'\s*$')
|
||||
if pos == -1
|
||||
return 0
|
||||
else
|
||||
return a:ind
|
||||
if elixir#indent#is_string_or_comment(a:lnum, pos)
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
endfunction
|
||||
|
||||
" Returns 0 or 1 based on whether or not the text matches the given expression
|
||||
function! elixir#indent#contains(text, expr)
|
||||
return a:text =~ a:expr
|
||||
endfunction
|
||||
|
||||
" Returns 0 or 1 based on whether or not the given line number and column
|
||||
" number pair is a string or comment
|
||||
function! elixir#indent#is_string_or_comment(line, col)
|
||||
return synIDattr(synID(a:line, a:col, 1), "name") =~ '\%(String\|Comment\)'
|
||||
endfunction
|
||||
|
||||
" Skip expression for searchpair. Returns 0 or 1 based on whether the value
|
||||
" under the cursor is a string or comment
|
||||
function! elixir#indent#searchpair_back_skip()
|
||||
" NOTE: @jbodah 2017-02-27: for some reason this function gets called with
|
||||
" and index that doesn't exist in the line sometimes. Detect and account for
|
||||
" that situation
|
||||
let curr_col = col('.')
|
||||
if getline('.')[curr_col-1] == ''
|
||||
let curr_col = curr_col-1
|
||||
endif
|
||||
return elixir#indent#is_string_or_comment(line('.'), curr_col)
|
||||
endfunction
|
||||
|
||||
" DRY up searchpair calls
|
||||
function! elixir#indent#searchpair_back(start, mid, end)
|
||||
let line = line('.')
|
||||
return searchpair(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
|
||||
endfunction
|
||||
|
||||
" DRY up searchpairpos calls
|
||||
function! elixir#indent#searchpairpos_back(start, mid, end)
|
||||
let line = line('.')
|
||||
return searchpairpos(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
|
||||
endfunction
|
||||
|
||||
" DRY up regex for keywords that 1) makes sure we only look at complete words
|
||||
" and 2) ignores atoms
|
||||
function! elixir#indent#keyword(expr)
|
||||
return ':\@<!\<\C\%('.a:expr.'\)\>:\@!'
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#starts_with_comment(text)
|
||||
return match(a:text, '^\s*#') != -1
|
||||
endfunction
|
||||
|
||||
" Start at the end of text and search backwards looking for a match. Also peek
|
||||
" ahead if we get a match to make sure we get a complete match. This means
|
||||
" that the result should be the position of the start of the right-most match
|
||||
function! elixir#indent#find_last_pos(lnum, text, match)
|
||||
let last = len(a:text) - 1
|
||||
let c = last
|
||||
|
||||
while c >= 0
|
||||
let substr = strpart(a:text, c, last)
|
||||
let peek = strpart(a:text, c - 1, last)
|
||||
let ss_match = match(substr, a:match)
|
||||
if ss_match != -1
|
||||
let peek_match = match(peek, a:match)
|
||||
if peek_match == ss_match + 1
|
||||
let syng = synIDattr(synID(a:lnum, c + ss_match, 1), 'name')
|
||||
if syng !~ '\%(String\|Comment\)'
|
||||
return c + ss_match
|
||||
end
|
||||
end
|
||||
end
|
||||
let c -= 1
|
||||
endwhile
|
||||
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_top_of_file(_lnum, _text, prev_nb_lnum, _prev_nb_text)
|
||||
if a:prev_nb_lnum == 0
|
||||
return 0
|
||||
else
|
||||
return -1
|
||||
end
|
||||
endfunction
|
||||
|
||||
" TODO: @jbodah 2017-03-31: remove
|
||||
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
if elixir#indent#ends_with(a:prev_nb_text, elixir#indent#keyword('do'), a:prev_nb_lnum)
|
||||
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
|
||||
return indent(a:prev_nb_lnum)
|
||||
else
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||
|
||||
if elixir#indent#ends_with(a:prev_nb_text, binary_operator, a:prev_nb_lnum)
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
if elixir#indent#starts_with(a:text, '|>', a:lnum)
|
||||
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
||||
if pos == -1
|
||||
return indent(a:prev_nb_lnum)
|
||||
else
|
||||
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
||||
if next_word_pos == -1
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
else
|
||||
return pos + 1 + next_word_pos
|
||||
end
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_comment(_lnum, text, prev_nb_lnum, _prev_nb_text)
|
||||
if elixir#indent#starts_with_comment(a:text)
|
||||
return indent(a:prev_nb_lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
|
||||
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end').'\zs')
|
||||
return indent(pair_lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_mid_or_end_block_keyword(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||
if elixir#indent#starts_with(a:text, elixir#indent#keyword('catch\|rescue\|after\|else'), a:lnum)
|
||||
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('with\|receive\|try\|if\|fn'), elixir#indent#keyword('catch\|rescue\|after\|else').'\zs', elixir#indent#keyword('end'))
|
||||
return indent(pair_lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_close_bracket(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||
if elixir#indent#starts_with(a:text, '\%(\]\|}\|)\)', a:lnum)
|
||||
let pair_lnum = elixir#indent#searchpair_back('\%(\[\|{\|(\)', '', '\%(\]\|}\|)\)')
|
||||
return indent(pair_lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_starts_with_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||
|
||||
if elixir#indent#starts_with(a:text, binary_operator, a:lnum)
|
||||
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
||||
if pos == -1
|
||||
return indent(a:prev_nb_lnum)
|
||||
else
|
||||
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
||||
if next_word_pos == -1
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
else
|
||||
return pos + 1 + next_word_pos
|
||||
end
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" To handle nested structures properly we need to find the innermost
|
||||
" nested structure. For example, we might be in a function in a map in a
|
||||
" function, etc... so we need to first figure out what the innermost structure
|
||||
" is then forward execution to the proper handler
|
||||
function! elixir#indent#handle_inside_nested_construct(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
let start_pattern = '\C\%(\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
|
||||
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
|
||||
let pair_info = elixir#indent#searchpairpos_back(start_pattern, '', end_pattern)
|
||||
let pair_lnum = pair_info[0]
|
||||
let pair_col = pair_info[1]
|
||||
if pair_lnum != 0 || pair_col != 0
|
||||
let pair_text = getline(pair_lnum)
|
||||
let pair_char = pair_text[pair_col - 1]
|
||||
if pair_char == 'f'
|
||||
call elixir#indent#debug("testing elixir#indent#do_handle_inside_fn")
|
||||
return elixir#indent#do_handle_inside_fn(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||
elseif pair_char == '['
|
||||
call elixir#indent#debug("testing elixir#indent#do_handle_inside_square_brace")
|
||||
return elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||
elseif pair_char == '{'
|
||||
call elixir#indent#debug("testing elixir#indent#do_handle_inside_curly_brace")
|
||||
return elixir#indent#do_handle_inside_curly_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||
elseif pair_char == '('
|
||||
call elixir#indent#debug("testing elixir#indent#do_handle_inside_parens")
|
||||
return elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||
else
|
||||
call elixir#indent#debug("testing elixir#indent#do_handle_inside_keyword_block")
|
||||
return elixir#indent#do_handle_inside_keyword_block(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||
end
|
||||
else
|
||||
return -1
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#do_handle_inside_keyword_block(pair_lnum, _pair_col, _lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
let keyword_pattern = '\C\%(\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<after\>\|\<catch\>\|\<rescue\>\|\<else\>\)'
|
||||
if a:pair_lnum
|
||||
" last line is a "receive" or something
|
||||
if elixir#indent#starts_with(a:prev_nb_text, keyword_pattern, a:prev_nb_lnum)
|
||||
call elixir#indent#debug("prev nb line is keyword")
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
elseif elixir#indent#contains(a:text, '->')
|
||||
call elixir#indent#debug("contains ->")
|
||||
" TODO: @jbodah 2017-03-31: test contains ignores str + comments
|
||||
return indent(a:pair_lnum) + &sw
|
||||
elseif elixir#indent#contains(a:prev_nb_text, '->')
|
||||
call elixir#indent#debug("prev nb line contains ->")
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
else
|
||||
call elixir#indent#debug("doesnt start with comment or contain ->")
|
||||
return indent(a:prev_nb_lnum)
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#do_handle_inside_fn(pair_lnum, _pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
if a:pair_lnum && a:pair_lnum != a:lnum
|
||||
if elixir#indent#contains(a:text, '->')
|
||||
return indent(a:pair_lnum) + &sw
|
||||
else
|
||||
if elixir#indent#ends_with(a:prev_nb_text, '->', a:prev_nb_lnum)
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
else
|
||||
return indent(a:prev_nb_lnum)
|
||||
end
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
|
||||
" If in list...
|
||||
if a:pair_lnum != 0 || a:pair_col != 0
|
||||
let pair_text = getline(a:pair_lnum)
|
||||
let substr = strpart(pair_text, a:pair_col, len(pair_text)-1)
|
||||
let indent_pos = match(substr, '\S')
|
||||
if indent_pos != -1
|
||||
return indent_pos + a:pair_col
|
||||
else
|
||||
return indent(a:pair_lnum) + &sw
|
||||
endif
|
||||
else
|
||||
return -1
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#do_handle_inside_curly_brace(pair_lnum, _pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
|
||||
return indent(a:pair_lnum) + &sw
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
|
||||
if a:pair_lnum
|
||||
if elixir#indent#ends_with(a:prev_nb_text, '(', a:prev_nb_lnum)
|
||||
return indent(a:prev_nb_lnum) + &sw
|
||||
elseif a:pair_lnum == a:prev_nb_lnum
|
||||
" Align indent (e.g. "def add(a,")
|
||||
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, '[^(]\+,')
|
||||
if pos == -1
|
||||
return 0
|
||||
else
|
||||
return pos
|
||||
end
|
||||
else
|
||||
return indent(a:prev_nb_lnum)
|
||||
end
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_inside_generic_block(lnum, _text, prev_nb_lnum, prev_nb_text)
|
||||
let pair_lnum = searchpair(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end'), 'bW', "line('.') == ".a:lnum." || elixir#indent#is_string_or_comment(line('.'), col('.'))")
|
||||
if pair_lnum
|
||||
" TODO: @jbodah 2017-03-29: this should probably be the case in *all*
|
||||
" blocks
|
||||
if elixir#indent#ends_with(a:prev_nb_text, ',', a:prev_nb_lnum)
|
||||
return indent(pair_lnum) + 2 * &sw
|
||||
else
|
||||
return indent(pair_lnum) + &sw
|
||||
endif
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
@ -1,52 +1,28 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
let s:SKIP_SYNTAX = '\%(Comment\|String\)$'
|
||||
function! elixir#util#get_filename(word) abort
|
||||
let word = a:word
|
||||
|
||||
function! elixir#util#is_indentable_at(line, col)
|
||||
if a:col == -1 " skip synID lookup for not found match
|
||||
return 1
|
||||
end
|
||||
" TODO: Remove these 2 lines
|
||||
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
|
||||
" Vim is making some mess on parsing the syntax of 'end', it is being
|
||||
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
|
||||
call synID(a:line, a:col, 1)
|
||||
" This forces vim to sync the syntax. Using fromstart is very slow on files
|
||||
" over 1k lines
|
||||
syntax sync minlines=20 maxlines=150
|
||||
" get first thing that starts uppercase, until the first space or end of line
|
||||
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
|
||||
|
||||
return synIDattr(synID(a:line, a:col, 1), "name")
|
||||
\ !~ s:SKIP_SYNTAX
|
||||
endfunction
|
||||
" remove any trailing characters that don't look like a nested module
|
||||
let word = substitute(word,'\.\U.*$','','g')
|
||||
|
||||
function! elixir#util#count_indentable_symbol_diff(line, open, close)
|
||||
return
|
||||
\ s:match_count(a:line, a:open)
|
||||
\ - s:match_count(a:line, a:close)
|
||||
endfunction
|
||||
" replace module dots with slash
|
||||
let word = substitute(word,'\.','/','g')
|
||||
|
||||
function! s:match_count(line, pattern)
|
||||
let size = strlen(a:line.text)
|
||||
let index = 0
|
||||
let counter = 0
|
||||
" remove any special chars
|
||||
let word = substitute(word,'[^A-z0-9-_/]','','g')
|
||||
|
||||
while index < size
|
||||
let index = match(a:line.text, a:pattern, index)
|
||||
if index >= 0
|
||||
let index += 1
|
||||
if elixir#util#is_indentable_at(a:line.num, index)
|
||||
let counter +=1
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
endwhile
|
||||
" convert to snake_case
|
||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
|
||||
let word = substitute(word,'-','_','g')
|
||||
let word = tolower(word)
|
||||
|
||||
return counter
|
||||
endfunction
|
||||
|
||||
function elixir#util#is_blank(string)
|
||||
return a:string =~ '^\s*$'
|
||||
return word
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
@ -371,6 +371,7 @@ let linkreltypes = linkreltypes + ['pgpkey']
|
||||
" a and button are special elements for interactive, some element can't be its descendent
|
||||
let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|textarea'
|
||||
|
||||
let crossorigin = ['anonymous', 'use-credentials']
|
||||
|
||||
|
||||
let g:xmldata_html5 = {
|
||||
@ -582,7 +583,7 @@ let g:xmldata_html5 = {
|
||||
\ ],
|
||||
\ 'img': [
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
|
||||
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']})
|
||||
\ ],
|
||||
\ 'input': [
|
||||
\ [],
|
||||
@ -614,7 +615,7 @@ let g:xmldata_html5 = {
|
||||
\ ],
|
||||
\ 'link': [
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
|
||||
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', '']})
|
||||
\ ],
|
||||
\ 'main': [
|
||||
\ flow_elements + ['style'],
|
||||
@ -722,7 +723,7 @@ let g:xmldata_html5 = {
|
||||
\ ],
|
||||
\ 'script': [
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset, 'nonce': []})
|
||||
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset, 'nonce': [], 'crossorigin': crossorigin})
|
||||
\ ],
|
||||
\ 'section': [
|
||||
\ flow_elements + ['style'],
|
||||
@ -834,7 +835,7 @@ let g:xmldata_html5 = {
|
||||
\ ],
|
||||
\ 'video': [
|
||||
\ flow_elements + ['source', 'track'],
|
||||
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'playsinline': ['playsinline', ''], 'poster': [], 'height': [], 'width': [], 'src': []})
|
||||
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'playsinline': ['playsinline', ''], 'poster': [], 'height': [], 'width': [], 'src': [], 'crossorigin': crossorigin})
|
||||
\ ],
|
||||
\ 'wbr': [
|
||||
\ [],
|
||||
|
@ -1,5 +1,10 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
|
||||
" Vim compiler plugin
|
||||
" Language: JavaScript
|
||||
" Maintainer: vim-javascript community
|
||||
" URL: https://github.com/pangloss/vim-javascript
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
|
@ -24,10 +24,10 @@ CompilerSet errorformat=
|
||||
\%D(in\ %f),
|
||||
\%\\s%#from\ %f:%l:%m,
|
||||
\%\\s%#from\ %f:%l:,
|
||||
\%\\s%##\ %f:%l:%m,
|
||||
\%\\s%##\ %f:%l,
|
||||
\%\\s%#[%f:%l:\ %#%m,
|
||||
\%\\s%#%f:%l:\ %#%m,
|
||||
\%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%.%#,
|
||||
\%\\s%##\ %f:%l%\\&%.%#%\\D:%.%#,
|
||||
\%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
|
||||
\%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
|
||||
\%\\s%#%f:%l:,
|
||||
\%m\ [%f:%l]:,
|
||||
\%+Erake\ aborted!,
|
||||
|
@ -165,8 +165,6 @@ au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||
au BufRead,BufNewFile * call s:DetectElixir()
|
||||
|
||||
au FileType elixir,eelixir setl sw=2 sts=2 et iskeyword+=!,?
|
||||
|
||||
function! s:setf(filetype) abort
|
||||
let &filetype = a:filetype
|
||||
endfunction
|
||||
@ -283,7 +281,9 @@ augroup filetypedetect
|
||||
" Language: OpenGL Shading Language
|
||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
||||
|
||||
autocmd! BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh,*.vs,*.fs,*.gs,*.tcs,*.tes,*.tesc,*.tese,*.comp set filetype=glsl
|
||||
" Extensions supported by Khronos reference compiler
|
||||
" https://github.com/KhronosGroup/glslang
|
||||
autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.geom,*.frag,*.comp set filetype=glsl
|
||||
|
||||
" vim:set sts=2 sw=2 :
|
||||
augroup END
|
||||
@ -376,10 +376,16 @@ augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" javascript:pangloss/vim-javascript:_JAVASCRIPT
|
||||
au BufNewFile,BufRead *.js setf javascript
|
||||
au BufNewFile,BufRead *.jsm setf javascript
|
||||
au BufNewFile,BufRead Jakefile setf javascript
|
||||
au BufNewFile,BufRead *.es6 setf javascript
|
||||
au BufNewFile,BufRead *.{js,jsm,es,es6},Jakefile setf javascript
|
||||
|
||||
fun! s:SourceFlowSyntax()
|
||||
if !exists('javascript_plugin_flow') && !exists('b:flow_active') &&
|
||||
\ search('\v\C%^\_s*%(//\s*|/\*[ \t\n*]*)\@flow>','nw')
|
||||
runtime extras/flow.vim
|
||||
let b:flow_active = 1
|
||||
endif
|
||||
endfun
|
||||
au FileType javascript au BufRead,BufWritePost <buffer> call s:SourceFlowSyntax()
|
||||
|
||||
fun! s:SelectJavascript()
|
||||
if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>'
|
||||
@ -616,11 +622,6 @@ augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" plantuml:aklt/plantuml-syntax
|
||||
" Vim ftdetect file
|
||||
" Language: PlantUML
|
||||
" Maintainer: Aaron C. Meadows < language name at shadowguarddev dot com>
|
||||
" Version: 0.1
|
||||
|
||||
if did_filetype()
|
||||
finish
|
||||
endif
|
||||
@ -975,6 +976,12 @@ augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" twig:lumiliet/vim-twig
|
||||
|
||||
if !exists('g:vim_twig_filetype_detected') && has("autocmd")
|
||||
au BufNewFile,BufRead *.twig set filetype=html.twig
|
||||
au BufNewFile,BufRead *.html.twig set filetype=html.twig
|
||||
au BufNewFile,BufRead *.xml.twig set filetype=xml.twig
|
||||
endif
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
@ -1002,7 +1009,7 @@ augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" vue:posva/vim-vue
|
||||
au BufNewFile,BufRead *.vue setf vue.html.javascript.css
|
||||
au BufNewFile,BufRead *.vue setf vue
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
|
@ -16,7 +16,7 @@ if !exists("g:eelixir_default_subtype")
|
||||
endif
|
||||
|
||||
if !exists("b:eelixir_subtype")
|
||||
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
||||
let s:lines = join(getline(1, 5) + [getline('$')], "\n")
|
||||
let b:eelixir_subtype = matchstr(s:lines,'eelixir_subtype=\zs\w\+')
|
||||
if b:eelixir_subtype == ''
|
||||
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
|
||||
@ -100,7 +100,7 @@ endif
|
||||
setlocal comments=:<%#
|
||||
setlocal commentstring=<%#\ %s\ %>
|
||||
|
||||
let b:undo_ftplugin = "setl cms< "
|
||||
let b:undo_ftplugin = "setl cms< " .
|
||||
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -17,45 +17,24 @@ if exists("loaded_matchit") && !exists("b:match_words")
|
||||
\ ',{:},\[:\],(:)'
|
||||
endif
|
||||
|
||||
setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,?
|
||||
setlocal comments=:#
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
function! GetElixirFilename(word)
|
||||
let word = a:word
|
||||
|
||||
" get first thing that starts uppercase, until the first space or end of line
|
||||
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
|
||||
|
||||
" remove any trailing characters that don't look like a nested module
|
||||
let word = substitute(word,'\.\U.*$','','g')
|
||||
|
||||
" replace module dots with slash
|
||||
let word = substitute(word,'\.','/','g')
|
||||
|
||||
" remove any special chars
|
||||
let word = substitute(word,'[^A-z0-9-_/]','','g')
|
||||
|
||||
" convert to snake_case
|
||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
|
||||
let word = substitute(word,'-','_','g')
|
||||
let word = tolower(word)
|
||||
|
||||
return word
|
||||
endfunction
|
||||
|
||||
let &l:path =
|
||||
\ join([
|
||||
\ getcwd().'/lib',
|
||||
\ getcwd().'/src',
|
||||
\ getcwd().'/deps/**/lib',
|
||||
\ getcwd().'/deps/**/src',
|
||||
\ 'lib',
|
||||
\ 'src',
|
||||
\ 'deps/**/lib',
|
||||
\ 'deps/**/src',
|
||||
\ &g:path
|
||||
\ ], ',')
|
||||
setlocal includeexpr=GetElixirFilename(v:fname)
|
||||
setlocal includeexpr=elixir#util#get_filename(v:fname)
|
||||
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
|
||||
|
||||
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
||||
|
||||
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< '.
|
||||
\ '| unlet! b:match_ignorecase b:match_words'
|
||||
|
||||
endif
|
||||
|
@ -1,22 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
||||
|
||||
" Vim plugin file
|
||||
" Language: PlantUML
|
||||
" Maintainer: Aaron C. Meadows < language name at shadowguarddev dot com>
|
||||
" Version: 0.1
|
||||
|
||||
if exists("b:loaded_plantuml_plugin")
|
||||
if exists('b:loaded_plantuml_plugin')
|
||||
finish
|
||||
endif
|
||||
let b:loaded_plantuml_plugin = 1
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists("g:plantuml_executable_script")
|
||||
let g:plantuml_executable_script="plantuml"
|
||||
if !exists('g:plantuml_executable_script')
|
||||
let g:plantuml_executable_script='plantuml'
|
||||
endif
|
||||
|
||||
if exists("loaded_matchit")
|
||||
if exists('loaded_matchit')
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words =
|
||||
\ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' .
|
||||
@ -27,7 +22,7 @@ if exists("loaded_matchit")
|
||||
\ ',\<\while\>:\<endwhile\>'
|
||||
endif
|
||||
|
||||
let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
|
||||
let &l:makeprg=g:plantuml_executable_script . ' ' . fnameescape(expand('%'))
|
||||
|
||||
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
||||
|
||||
|
@ -19,6 +19,8 @@ setlocal formatoptions=tcqro
|
||||
" Enable autocompletion of hyphenated PowerShell commands,
|
||||
" e.g. Get-Content or Get-ADUser
|
||||
setlocal iskeyword+=-
|
||||
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
||||
setlocal bomb
|
||||
|
||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||
if has("gui_win32")
|
||||
|
@ -16,6 +16,8 @@ let b:did_ftplugin = 1
|
||||
setlocal tw=0
|
||||
setlocal commentstring=#%s
|
||||
setlocal formatoptions=tcqro
|
||||
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
||||
setlocal bomb
|
||||
|
||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||
if has("gui_win32")
|
||||
|
@ -71,7 +71,7 @@ endif
|
||||
|
||||
function! s:query_path(root) abort
|
||||
let code = "print $:.join %q{,}"
|
||||
if &shell =~# 'sh'
|
||||
if &shell =~# 'sh' && empty(&shellxquote)
|
||||
let prefix = 'env PATH='.shellescape($PATH).' '
|
||||
else
|
||||
let prefix = ''
|
||||
@ -164,23 +164,23 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
||||
nmap <buffer><script> <SID>: :<C-U>
|
||||
nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
||||
|
||||
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR>
|
||||
nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR>
|
||||
xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR>
|
||||
xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR>
|
||||
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR>
|
||||
nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR>
|
||||
xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR>
|
||||
xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR>
|
||||
|
||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR>
|
||||
nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR>
|
||||
nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR>
|
||||
xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR>
|
||||
xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR>
|
||||
xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR>
|
||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR>
|
||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR>
|
||||
nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR>
|
||||
nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR>
|
||||
xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR>
|
||||
xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR>
|
||||
xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR>
|
||||
xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR>
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin
|
||||
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
||||
@ -290,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
|
||||
norm! gv
|
||||
endif
|
||||
let i = 0
|
||||
call map(a:syn, 'hlID(v:val)')
|
||||
while i < cnt
|
||||
let i = i + 1
|
||||
let line = line('.')
|
||||
let col = col('.')
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
while pos != 0 && s:synname() !~# a:syn
|
||||
while pos != 0 && index(a:syn, s:synid()) < 0
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
endwhile
|
||||
if pos == 0
|
||||
@ -305,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:synname() abort
|
||||
return synIDattr(synID(line('.'),col('.'),0),'name')
|
||||
function! s:synid() abort
|
||||
return synID(line('.'),col('.'),0)
|
||||
endfunction
|
||||
|
||||
function! s:wrap_i(back,forward) abort
|
||||
@ -362,7 +363,7 @@ function! RubyCursorFile() abort
|
||||
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
|
||||
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
|
||||
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
|
||||
if s:synname() ==# 'rubyConstant'
|
||||
if s:synid() ==# hlID('rubyConstant')
|
||||
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
|
||||
let cfile = substitute(cfile,'::','/','g')
|
||||
let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
|
||||
|
@ -13,4 +13,11 @@ runtime! ftplugin/html.vim
|
||||
|
||||
setlocal suffixesadd+=.vue
|
||||
|
||||
if exists('g:loaded_ale')
|
||||
let g:ale_linters = get(g:, 'ale_linters', {})
|
||||
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])
|
||||
let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {})
|
||||
let g:ale_linter_aliases.vue = get(g:ale_linter_aliases, 'vue', 'javascript')
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -27,7 +27,12 @@ endif
|
||||
|
||||
function GetAnsibleIndent(lnum)
|
||||
if a:lnum == 1 || !prevnonblank(a:lnum-1)
|
||||
return 0
|
||||
endif
|
||||
if exists("g:ansible_unindent_after_newline")
|
||||
if (a:lnum -1) != prevnonblank(a:lnum - 1)
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
let prevlnum = prevnonblank(a:lnum - 1)
|
||||
let maintain = indent(prevlnum)
|
||||
|
@ -1,97 +1,48 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
setlocal nosmartindent
|
||||
setlocal indentexpr=elixir#indent()
|
||||
setlocal indentkeys+=0),0],0=\|>,=->
|
||||
setlocal indentkeys+=0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
|
||||
|
||||
if exists("b:did_indent") || exists("*elixir#indent")
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
end
|
||||
let b:did_indent = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
setlocal indentexpr=elixir#indent(v:lnum)
|
||||
|
||||
function! elixir#indent()
|
||||
" initiates the `old_ind` dictionary
|
||||
let b:old_ind = get(b:, 'old_ind', {})
|
||||
" initiates the `line` dictionary
|
||||
let line = s:build_line(v:lnum)
|
||||
setlocal indentkeys+=0=end,0=catch,0=rescue,0=after,0=else,=->,0},0],0),0=\|>,0=<>
|
||||
" TODO: @jbodah 2017-02-27: all operators should cause reindent when typed
|
||||
|
||||
if s:is_beginning_of_file(line)
|
||||
" Reset `old_ind` dictionary at the beginning of the file
|
||||
let b:old_ind = {}
|
||||
" At the start of the file use zero indent.
|
||||
return 0
|
||||
elseif !s:is_indentable_line(line)
|
||||
" Keep last line indentation if the current line does not have an
|
||||
" indentable syntax
|
||||
return indent(line.last_non_blank.num)
|
||||
else
|
||||
" Calculates the indenation level based on the rules
|
||||
" All the rules are defined in `autoload/elixir/indent.vim`
|
||||
let ind = indent(line.last_non_blank.num)
|
||||
call s:debug('>>> line = ' . string(line.current))
|
||||
call s:debug('>>> ind = ' . ind)
|
||||
let ind = s:indent('deindent_case_arrow', ind, line)
|
||||
let ind = s:indent('indent_parenthesis', ind, line)
|
||||
let ind = s:indent('indent_square_brackets', ind, line)
|
||||
let ind = s:indent('indent_brackets', ind, line)
|
||||
let ind = s:indent('deindent_opened_symbols', ind, line)
|
||||
let ind = s:indent('indent_pipeline_assignment', ind, line)
|
||||
let ind = s:indent('indent_pipeline_continuation', ind, line)
|
||||
let ind = s:indent('indent_after_pipeline', ind, line)
|
||||
let ind = s:indent('indent_assignment', ind, line)
|
||||
let ind = s:indent('indent_ending_symbols', ind, line)
|
||||
let ind = s:indent('indent_keywords', ind, line)
|
||||
let ind = s:indent('deindent_keywords', ind, line)
|
||||
let ind = s:indent('deindent_ending_symbols', ind, line)
|
||||
let ind = s:indent('indent_case_arrow', ind, line)
|
||||
let ind = s:indent('indent_ecto_queries', ind, line)
|
||||
call s:debug('<<< final = ' . ind)
|
||||
return ind
|
||||
end
|
||||
function! elixir#indent(lnum)
|
||||
let lnum = a:lnum
|
||||
let text = getline(lnum)
|
||||
let prev_nb_lnum = prevnonblank(lnum-1)
|
||||
let prev_nb_text = getline(prev_nb_lnum)
|
||||
|
||||
call elixir#indent#debug("==> Indenting line " . lnum)
|
||||
call elixir#indent#debug("text = '" . text . "'")
|
||||
|
||||
let handlers = [
|
||||
\'top_of_file',
|
||||
\'starts_with_end',
|
||||
\'starts_with_mid_or_end_block_keyword',
|
||||
\'following_trailing_do',
|
||||
\'following_trailing_binary_operator',
|
||||
\'starts_with_pipe',
|
||||
\'starts_with_close_bracket',
|
||||
\'starts_with_binary_operator',
|
||||
\'inside_nested_construct',
|
||||
\'starts_with_comment',
|
||||
\'inside_generic_block'
|
||||
\]
|
||||
for handler in handlers
|
||||
call elixir#indent#debug('testing handler elixir#indent#handle_'.handler)
|
||||
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||
if indent != -1
|
||||
call elixir#indent#debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
||||
return indent
|
||||
endif
|
||||
endfor
|
||||
|
||||
call elixir#indent#debug("defaulting")
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function s:indent(rule, ind, line)
|
||||
let Fn = function('elixir#indent#'.a:rule)
|
||||
let ind = Fn(a:ind, a:line)
|
||||
call s:debug(a:rule . ' = ' . ind)
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
function s:debug(message)
|
||||
if get(g:, 'elixir_indent_debug', 0)
|
||||
echom a:message
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! s:is_beginning_of_file(line)
|
||||
return a:line.last_non_blank.num == 0
|
||||
endfunction
|
||||
|
||||
function! s:is_indentable_line(line)
|
||||
return elixir#util#is_indentable_at(a:line.current.num, 1)
|
||||
endfunction
|
||||
|
||||
function! s:build_line(line)
|
||||
let line = { 'current': {}, 'last': {}, 'last_non_blank': {} }
|
||||
let line.current = s:new_line(a:line)
|
||||
let line.last = s:new_line(line.current.num - 1)
|
||||
let line.last_non_blank = s:new_line(prevnonblank(line.current.num - 1))
|
||||
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:new_line(num)
|
||||
return {
|
||||
\ "num": a:num,
|
||||
\ "text": getline(a:num)
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
endif
|
||||
|
@ -13,11 +13,7 @@ if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:haskell_indent_disable')
|
||||
let g:haskell_indent_disable = 0
|
||||
endif
|
||||
|
||||
if g:haskell_indent_disable != 0
|
||||
if get(g:, 'haskell_indent_disable', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
@ -68,7 +64,7 @@ if !exists('g:haskell_indent_guard')
|
||||
endif
|
||||
|
||||
setlocal indentexpr=GetHaskellIndent()
|
||||
setlocal indentkeys=0},0),0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
|
||||
setlocal indentkeys=0},0),0],!^F,o,O,0=where,0=let,0=deriving,<space>
|
||||
|
||||
function! s:isInBlock(hlstack)
|
||||
return index(a:hlstack, 'haskellDelimiter') > -1 || index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
|
||||
@ -159,15 +155,6 @@ function! GetHaskellIndent()
|
||||
return 0
|
||||
endif
|
||||
|
||||
" " comment indentation
|
||||
" if l:line =~ '^\s*--'
|
||||
" let l:s = match(l:prevline, '-- ')
|
||||
" if l:s > -1
|
||||
" endif
|
||||
" " if l:prevline =~ '^\s*--'
|
||||
" " return match(l:prevline, '\S')
|
||||
" " endif
|
||||
|
||||
" { foo :: Int
|
||||
" >>,
|
||||
"
|
||||
@ -258,12 +245,16 @@ function! GetHaskellIndent()
|
||||
" where
|
||||
" >>foo
|
||||
"
|
||||
if l:prevline =~ '\C\<where\>\s*$'
|
||||
return match(l:prevline, '\S') + get(g:, 'haskell_indent_after_bare_where', &shiftwidth)
|
||||
endif
|
||||
|
||||
" do
|
||||
" >>foo
|
||||
"
|
||||
" foo =
|
||||
" >>bar
|
||||
if l:prevline =~ '\C\(\<where\>\|\<do\>\|=\)\s*$'
|
||||
if l:prevline =~ '\C\(\<do\>\|=\)\s*$'
|
||||
return match(l:prevline, '\S') + &shiftwidth
|
||||
endif
|
||||
|
||||
@ -279,7 +270,7 @@ function! GetHaskellIndent()
|
||||
" case foo of
|
||||
" >>bar -> quux
|
||||
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
|
||||
if exists('g:haskell_indent_case_alternative') && g:haskell_indent_case_alternative
|
||||
if get(g:,'haskell_indent_case_alternative', 0)
|
||||
return match(l:prevline, '\S') + &shiftwidth
|
||||
else
|
||||
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
|
||||
@ -319,6 +310,14 @@ function! GetHaskellIndent()
|
||||
endif
|
||||
endif
|
||||
|
||||
" foo :: Int
|
||||
" -> Int
|
||||
" >>>>-> Int
|
||||
"
|
||||
" foo :: Monad m
|
||||
" => Functor f
|
||||
" >>>>=> Int
|
||||
"
|
||||
" foo :: Int
|
||||
" -> Int
|
||||
" foo x
|
||||
@ -327,32 +326,36 @@ function! GetHaskellIndent()
|
||||
" :: Int
|
||||
" -> Int
|
||||
" foo x
|
||||
if l:prevline =~ '^\s*[-=]>' && l:line !~ '^\s*[-=]>'
|
||||
if s:isInBlock(l:hlstack)
|
||||
return match(l:prevline, '[^\s-=>]')
|
||||
if l:prevline =~ '^\s*[-=]>'
|
||||
if l:line =~ '^\s*[-=]>'
|
||||
return match(l:prevline, '[-=]')
|
||||
else
|
||||
let l:m = matchstr(l:line, '^\s*\zs\<\S\+\>\ze')
|
||||
let l:l = l:prevline
|
||||
let l:c = 1
|
||||
if s:isInBlock(l:hlstack)
|
||||
return match(l:prevline, '[^-=]')
|
||||
else
|
||||
let l:m = matchstr(l:line, '^\s*\zs\<\S\+\>\ze')
|
||||
let l:l = l:prevline
|
||||
let l:c = 1
|
||||
|
||||
while v:lnum != l:c
|
||||
" fun decl
|
||||
if l:l =~ ('^\s*' . l:m . '\(\s*::\|\n\s\+::\)')
|
||||
let l:s = match(l:l, l:m)
|
||||
if match(l:l, '\C^\s*\<default\>') > -1
|
||||
return l:s - 8
|
||||
else
|
||||
return l:s
|
||||
while v:lnum != l:c
|
||||
" fun decl
|
||||
if l:l =~ ('^\s*' . l:m . '\(\s*::\|\n\s\+::\)')
|
||||
let l:s = match(l:l, l:m)
|
||||
if match(l:l, '\C^\s*\<default\>') > -1
|
||||
return l:s - 8
|
||||
else
|
||||
return l:s
|
||||
endif
|
||||
" empty line, stop looking
|
||||
elseif l:l =~ '^$'
|
||||
return 0
|
||||
endif
|
||||
" empty line, stop looking
|
||||
elseif l:l =~ '^$'
|
||||
return 0
|
||||
endif
|
||||
let l:c += 1
|
||||
let l:l = getline(v:lnum - l:c)
|
||||
endwhile
|
||||
let l:c += 1
|
||||
let l:l = getline(v:lnum - l:c)
|
||||
endwhile
|
||||
|
||||
return 0
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -403,12 +406,17 @@ function! GetHaskellIndent()
|
||||
|
||||
" in foo
|
||||
" where bar
|
||||
"
|
||||
" or
|
||||
"
|
||||
" foo
|
||||
" >>where
|
||||
if l:line =~ '\C^\s*\<where\>'
|
||||
if match(l:prevline, '\C^\s\+in\s\+') == 0
|
||||
return match(l:prevline, 'in') - g:haskell_indent_in
|
||||
endif
|
||||
|
||||
return match(l:prevline, '\S') + &shiftwidth
|
||||
return match(l:prevline, '\S') + get(g:, 'haskell_indent_before_where', &shiftwidth)
|
||||
endif
|
||||
|
||||
" let x = 1
|
||||
|
@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
||||
" Language: Javascript
|
||||
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
||||
" URL: https://github.com/pangloss/vim-javascript
|
||||
" Last Change: March 9, 2017
|
||||
" Last Change: May 16, 2017
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
@ -12,6 +12,10 @@ if exists('b:did_indent')
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" indent correctly if inside <script>
|
||||
" vim/vim@690afe1 for the switch from cindent
|
||||
let b:html_indent_script1 = 'inc'
|
||||
|
||||
" Now, set up our indentation expression and keys that trigger it.
|
||||
setlocal indentexpr=GetJavascriptIndent()
|
||||
setlocal autoindent nolisp nosmartindent
|
||||
@ -23,6 +27,13 @@ setlocal indentkeys+=0],0)
|
||||
|
||||
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
|
||||
let b:syng_str = get(b:,'syng_str','string\|template\|special')
|
||||
" template strings may want to be excluded when editing graphql:
|
||||
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
||||
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
||||
|
||||
" Only define the function once.
|
||||
if exists('*GetJavascriptIndent')
|
||||
finish
|
||||
@ -38,7 +49,7 @@ if exists('*shiftwidth')
|
||||
endfunction
|
||||
else
|
||||
function s:sw()
|
||||
return &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
|
||||
return &l:shiftwidth ? &l:shiftwidth : &l:tabstop
|
||||
endfunction
|
||||
endif
|
||||
|
||||
@ -46,6 +57,10 @@ endif
|
||||
" matches before pos.
|
||||
let s:z = has('patch-7.4.984') ? 'z' : ''
|
||||
|
||||
let s:syng_com = 'comment\|doc'
|
||||
" Expression used to check whether we should skip a match with searchpair().
|
||||
let s:skip_expr = "s:syn_at(line('.'),col('.')) =~? b:syng_strcom"
|
||||
|
||||
" searchpair() wrapper
|
||||
if has('reltime')
|
||||
function s:GetPair(start,end,flags,skip,time,...)
|
||||
@ -57,56 +72,80 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!'
|
||||
let s:syng_str = 'string\|template\|special'
|
||||
let s:syng_com = 'comment\|doc'
|
||||
" Expression used to check whether we should skip a match with searchpair().
|
||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
|
||||
|
||||
function s:parse_cino(f) abort
|
||||
return float2nr(eval(substitute(substitute(join(split(
|
||||
\ matchstr(&cino,'\C.*'.a:f.'\zs[^,]*'), 's',1), '*'.s:W)
|
||||
\ , '^-\=\zs\*','',''), '^-\=\zs\.','0.','')))
|
||||
function s:syn_at(l,c)
|
||||
let pos = join([a:l,a:c],',')
|
||||
if has_key(s:synId_cache,pos)
|
||||
return s:synId_cache[pos]
|
||||
endif
|
||||
let s:synId_cache[pos] = synIDattr(synID(a:l,a:c,0),'name')
|
||||
return s:synId_cache[pos]
|
||||
endfunction
|
||||
|
||||
function s:parse_cino(f)
|
||||
let [cin, divider, n] = [strridx(&cino,a:f), 0, '']
|
||||
if cin == -1
|
||||
return
|
||||
endif
|
||||
let [sign, cstr] = &cino[cin+1] ==# '-' ? [-1, &cino[cin+2:]] : [1, &cino[cin+1:]]
|
||||
for c in split(cstr,'\zs')
|
||||
if c ==# '.' && !divider
|
||||
let divider = 1
|
||||
elseif c ==# 's'
|
||||
if n is ''
|
||||
let n = s:W
|
||||
else
|
||||
let n = str2nr(n) * s:W
|
||||
endif
|
||||
break
|
||||
elseif c =~ '\d'
|
||||
let [n, divider] .= [c, 0]
|
||||
else
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return sign * str2nr(n) / max([str2nr(divider),1])
|
||||
endfunction
|
||||
|
||||
" Optimized {skip} expr, used only once per GetJavascriptIndent() call
|
||||
function s:skip_func()
|
||||
if getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
|
||||
return eval(s:skip_expr)
|
||||
if s:topCol == 1 || line('.') < s:scriptTag
|
||||
return {} " E728, used as limit condition for loops and searchpair()
|
||||
endif
|
||||
let s:topCol = col('.')
|
||||
if getline('.') =~ '\%<'.s:topCol.'c\/.\{-}\/\|\%>'.s:topCol.'c[''"]\|\\$'
|
||||
if eval(s:skip_expr)
|
||||
let s:topCol = 0
|
||||
endif
|
||||
return !s:topCol
|
||||
elseif s:checkIn || search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
|
||||
let s:checkIn = eval(s:skip_expr)
|
||||
if s:checkIn
|
||||
let s:topCol = 0
|
||||
endif
|
||||
endif
|
||||
let s:looksyn = line('.')
|
||||
return s:checkIn
|
||||
endfunction
|
||||
|
||||
function s:alternatePair(stop)
|
||||
let pos = getpos('.')[1:2]
|
||||
let pat = '[][(){};]'
|
||||
while search('\m'.pat,'bW',a:stop)
|
||||
function s:alternatePair()
|
||||
let [l:pos, pat, l:for] = [getpos('.'), '[][(){};]', 3]
|
||||
while search('\m'.pat,'bW')
|
||||
if s:skip_func() | continue | endif
|
||||
let idx = stridx('])};',s:looking_at())
|
||||
if idx is 3 | let pat = '[{}()]' | continue | endif
|
||||
if idx + 1
|
||||
if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) <= 0
|
||||
if idx is 3
|
||||
if l:for is 1
|
||||
return s:GetPair('{','}','bW','s:skip_func()',2000) > 0 || setpos('.',l:pos)
|
||||
endif
|
||||
let [pat, l:for] = ['[{}();]', l:for - 1]
|
||||
elseif idx + 1
|
||||
if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000) < 1
|
||||
break
|
||||
endif
|
||||
else
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
call call('cursor',pos)
|
||||
endfunction
|
||||
|
||||
function s:save_pos(f,...)
|
||||
let l:pos = getpos('.')[1:2]
|
||||
let ret = call(a:f,a:000)
|
||||
call call('cursor',l:pos)
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function s:syn_at(l,c)
|
||||
return synIDattr(synID(a:l,a:c,0),'name')
|
||||
call setpos('.',l:pos)
|
||||
endfunction
|
||||
|
||||
function s:looking_at()
|
||||
@ -118,10 +157,10 @@ function s:token()
|
||||
endfunction
|
||||
|
||||
function s:previous_token()
|
||||
let l:pos = getpos('.')[1:2]
|
||||
let l:pos = getpos('.')
|
||||
if search('\m\k\{1,}\|\S','ebW')
|
||||
if (getline('.')[col('.')-2:col('.')-1] == '*/' || line('.') != l:pos[0] &&
|
||||
\ getline('.') =~ '\%<'.col('.').'c\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com
|
||||
if (strpart(getline('.'),col('.')-2,2) == '*/' || line('.') != l:pos[1] &&
|
||||
\ getline('.')[:col('.')-1] =~ '\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com
|
||||
while search('\m\S\ze\_s*\/[/*]','bW')
|
||||
if s:syn_at(line('.'),col('.')) !~? s:syng_com
|
||||
return s:token()
|
||||
@ -130,51 +169,66 @@ function s:previous_token()
|
||||
else
|
||||
return s:token()
|
||||
endif
|
||||
call setpos('.',l:pos)
|
||||
endif
|
||||
call call('cursor',l:pos)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
for s:__ in ['__previous_token','__IsBlock']
|
||||
function s:{s:__}(...)
|
||||
let l:pos = getpos('.')
|
||||
try
|
||||
return call('s:'.matchstr(expand('<sfile>'),'.*__\zs\w\+'),a:000)
|
||||
catch
|
||||
finally
|
||||
call setpos('.',l:pos)
|
||||
endtry
|
||||
endfunction
|
||||
endfor
|
||||
|
||||
function s:expr_col()
|
||||
if getline('.')[col('.')-2] == ':'
|
||||
return 1
|
||||
endif
|
||||
let bal = 0
|
||||
while search('\m[{}?:;]','bW')
|
||||
if eval(s:skip_expr) | continue | endif
|
||||
" switch (looking_at())
|
||||
exe { '}': "if s:GetPair('{','}','bW',s:skip_expr,200) <= 0 | return | endif",
|
||||
\ ';': "return",
|
||||
\ '{': "return getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()",
|
||||
\ ':': "let bal -= getline('.')[max([col('.')-2,0]):col('.')] !~ '::'",
|
||||
\ '?': "let bal += 1 | if bal > 0 | return 1 | endif" }[s:looking_at()]
|
||||
let [bal, l:pos] = [0, getpos('.')]
|
||||
while bal < 1 && search('\m[{}?:;]','bW',s:scriptTag)
|
||||
if eval(s:skip_expr)
|
||||
continue
|
||||
elseif s:looking_at() == ':'
|
||||
let bal -= strpart(getline('.'),col('.')-2,3) !~ '::'
|
||||
elseif s:looking_at() == '?'
|
||||
let bal += 1
|
||||
elseif s:looking_at() == '{' && getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()
|
||||
let bal = 1
|
||||
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
call setpos('.',l:pos)
|
||||
return max([bal,0])
|
||||
endfunction
|
||||
|
||||
" configurable regexes that define continuation lines, not including (, {, or [.
|
||||
let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
||||
\ '\C\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)')
|
||||
let s:continuation = get(g:,'javascript_continuation',
|
||||
\ '\C\%([-+<>=,.~!?/*^%|&:]\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||
|
||||
function s:continues(ln,con)
|
||||
if !cursor(a:ln, match(' '.a:con,s:continuation))
|
||||
let teol = s:looking_at()
|
||||
if teol == '/'
|
||||
return s:syn_at(line('.'),col('.')) !~? 'regex'
|
||||
elseif teol =~ '[-+>]'
|
||||
return getline('.')[col('.')-2] != tr(teol,'>','=')
|
||||
elseif teol =~ '\l'
|
||||
let token = matchstr(a:con[-15:],s:continuation)
|
||||
if strlen(token)
|
||||
call cursor(a:ln,strlen(a:con))
|
||||
if token =~ '[/>]'
|
||||
return s:syn_at(a:ln,col('.')) !~? (token == '>' ? 'jsflow\|^html' : 'regex')
|
||||
elseif token =~ '\l'
|
||||
return s:previous_token() != '.'
|
||||
elseif teol == ':'
|
||||
elseif token == ':'
|
||||
return s:expr_col()
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" get the line of code stripped of comments and move cursor to the last
|
||||
" non-comment char.
|
||||
function s:Trim(ln)
|
||||
let pline = substitute(getline(a:ln),'\s*$','','')
|
||||
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
|
||||
@ -183,24 +237,28 @@ function s:Trim(ln)
|
||||
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
|
||||
let pline = substitute(pline[:-2],'\s*$','','')
|
||||
endwhile
|
||||
return pline is '' || cursor(a:ln,strlen(pline)) ? pline : pline
|
||||
return pline
|
||||
endfunction
|
||||
|
||||
" Find line above 'lnum' that isn't empty or in a comment
|
||||
function s:PrevCodeLine(lnum)
|
||||
let [l:pos, l:n] = [getpos('.')[1:2], prevnonblank(a:lnum)]
|
||||
let l:n = prevnonblank(a:lnum)
|
||||
while l:n
|
||||
if getline(l:n) =~ '^\s*\/[/*]'
|
||||
if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') &&
|
||||
\ s:syn_at(l:n,1) =~? b:syng_str
|
||||
break
|
||||
endif
|
||||
let l:n = prevnonblank(l:n-1)
|
||||
elseif stridx(getline(l:n), '*/') + 1 && s:syn_at(l:n,1) =~? s:syng_com
|
||||
let l:pos = getpos('.')
|
||||
call cursor(l:n,1)
|
||||
keepjumps norm! [*
|
||||
let l:n = search('\m\S','nbW')
|
||||
let l:n = search('\m\S\_s*\/\*','nbW')
|
||||
call setpos('.',l:pos)
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
call call('cursor',l:pos)
|
||||
return l:n
|
||||
endfunction
|
||||
|
||||
@ -210,7 +268,7 @@ function s:Balanced(lnum)
|
||||
let l:line = getline(a:lnum)
|
||||
let pos = match(l:line, '[][(){}]', 0)
|
||||
while pos != -1
|
||||
if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom
|
||||
if s:syn_at(a:lnum,pos + 1) !~? b:syng_strcom
|
||||
let l:open += match(' ' . l:line[pos],'[[({]')
|
||||
if l:open < 0
|
||||
return
|
||||
@ -225,6 +283,7 @@ endfunction
|
||||
|
||||
function s:OneScope(lnum)
|
||||
let pline = s:Trim(a:lnum)
|
||||
call cursor(a:lnum,strlen(pline))
|
||||
let kw = 'else do'
|
||||
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
|
||||
if s:previous_token() =~# '^\%(await\|each\)$'
|
||||
@ -235,7 +294,27 @@ function s:OneScope(lnum)
|
||||
endif
|
||||
endif
|
||||
return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 &&
|
||||
\ s:save_pos('s:previous_token') != '.'
|
||||
\ s:__previous_token() != '.' && !s:doWhile()
|
||||
endfunction
|
||||
|
||||
function s:doWhile()
|
||||
if expand('<cword>') ==# 'while'
|
||||
let [bal, l:pos] = [0, getpos('.')]
|
||||
call search('\m\<','cbW')
|
||||
while bal < 1 && search('\m\C[{}]\|\<\%(do\|while\)\>','bW')
|
||||
if eval(s:skip_expr)
|
||||
continue
|
||||
elseif s:looking_at() ==# 'd'
|
||||
let bal += s:__IsBlock(1)
|
||||
elseif s:looking_at() ==# 'w'
|
||||
let bal -= s:__previous_token() != '.'
|
||||
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
call setpos('.',l:pos)
|
||||
return max([bal,0])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
|
||||
@ -259,32 +338,36 @@ function s:iscontOne(i,num,cont)
|
||||
endfunction
|
||||
|
||||
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
||||
function s:IsBlock()
|
||||
if s:looking_at() == '{'
|
||||
function s:IsBlock(...)
|
||||
if a:0 || s:looking_at() == '{'
|
||||
let l:n = line('.')
|
||||
let char = s:previous_token()
|
||||
if match(s:stack,'\cxml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx'
|
||||
return char != '{'
|
||||
elseif char =~ '\k'
|
||||
if char ==# 'type'
|
||||
return s:previous_token() !~# '^\%(im\|ex\)port$'
|
||||
return s:__previous_token() !~# '^\%(im\|ex\)port$'
|
||||
endif
|
||||
return index(split('return const let import export extends yield default delete var await void typeof throw case new of in instanceof')
|
||||
\ ,char) < (line('.') != l:n) || s:save_pos('s:previous_token') == '.'
|
||||
\ ,char) < (line('.') != l:n) || s:__previous_token() == '.'
|
||||
elseif char == '>'
|
||||
return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? '^jsflow'
|
||||
return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? 'jsflow\|^html'
|
||||
elseif char == '*'
|
||||
return s:__previous_token() == ':'
|
||||
elseif char == ':'
|
||||
return !s:save_pos('s:expr_col')
|
||||
return !s:expr_col()
|
||||
elseif char == '/'
|
||||
return s:syn_at(line('.'),col('.')) =~? 'regex'
|
||||
endif
|
||||
return char !~ '[=~!<*,?^%|&([]' &&
|
||||
return char !~ '[=~!<,.?^%|&([]' &&
|
||||
\ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function GetJavascriptIndent()
|
||||
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
||||
let s:synId_cache = {}
|
||||
" Get the current line.
|
||||
call cursor(v:lnum,1)
|
||||
let l:line = getline('.')
|
||||
@ -299,7 +382,7 @@ function GetJavascriptIndent()
|
||||
elseif l:line !~ '^\s*\/[/*]'
|
||||
return -1
|
||||
endif
|
||||
elseif syns =~? s:syng_str
|
||||
elseif syns =~? b:syng_str
|
||||
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
|
||||
let b:js_cache[0] = v:lnum
|
||||
endif
|
||||
@ -319,37 +402,33 @@ function GetJavascriptIndent()
|
||||
endif
|
||||
|
||||
" the containing paren, bracket, or curly. Many hacks for performance
|
||||
let idx = index([']',')','}'],l:line[0])
|
||||
let [ s:scriptTag, idx ] = [ get(get(b:,'hi_indent',{}),'blocklnr'),
|
||||
\ index([']',')','}'],l:line[0]) ]
|
||||
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
|
||||
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
|
||||
call call('cursor',b:js_cache[1:])
|
||||
call call('cursor',b:js_cache[2] ? b:js_cache[1:] : [0,0])
|
||||
else
|
||||
let [s:looksyn, s:checkIn, top] = [v:lnum - 1, 0, (!indent(l:lnum) &&
|
||||
\ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum]
|
||||
let [s:looksyn, s:checkIn, s:topCol] = [v:lnum - 1, 0, 0]
|
||||
if idx + 1
|
||||
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000,top)
|
||||
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000)
|
||||
elseif getline(v:lnum) !~ '^\S' && syns =~? 'block'
|
||||
call s:GetPair('{','}','bW','s:skip_func()',2000,top)
|
||||
call s:GetPair('{','}','bW','s:skip_func()',2000)
|
||||
else
|
||||
call s:alternatePair(top)
|
||||
call s:alternatePair()
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2])
|
||||
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [s:scriptTag,0] : getpos('.')[1:2])
|
||||
let num = b:js_cache[1]
|
||||
|
||||
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0]
|
||||
if !num || s:IsBlock()
|
||||
if !b:js_cache[2] || s:IsBlock()
|
||||
let ilnum = line('.')
|
||||
let pline = s:save_pos('s:Trim',l:lnum)
|
||||
if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
|
||||
let pline = s:Trim(l:lnum)
|
||||
if b:js_cache[2] && s:looking_at() == ')' && s:GetPair('(',')','bW',s:skip_expr,100) > 0
|
||||
let num = ilnum == num ? line('.') : num
|
||||
if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.'
|
||||
if &cino !~ ':'
|
||||
let switch_offset = s:W
|
||||
else
|
||||
let switch_offset = max([-indent(num),s:parse_cino(':')])
|
||||
endif
|
||||
let switch_offset = &cino !~ ':' ? s:W : max([-indent(num),s:parse_cino(':')])
|
||||
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
|
||||
return indent(num) + switch_offset
|
||||
endif
|
||||
@ -362,12 +441,13 @@ function GetJavascriptIndent()
|
||||
endif
|
||||
elseif idx < 0 && getline(b:js_cache[1])[b:js_cache[2]-1] == '(' && &cino =~ '('
|
||||
let pval = s:parse_cino('(')
|
||||
return !pval ? (s:parse_cino('w') ? 0 : -(!!search('\m\S','W'.s:z,num))) + virtcol('.') :
|
||||
\ max([indent('.') + pval + (s:GetPair('(',')','nbrmW',s:skip_expr,100,num) * s:W),0])
|
||||
return !pval || !search('\m\S','nbW',num) && !s:parse_cino('U') ?
|
||||
\ (s:parse_cino('w') ? 0 : -!!search('\m\S','W'.s:z,num)) + virtcol('.') :
|
||||
\ max([indent('.') + pval + s:GetPair('(',')','nbrmW',s:skip_expr,100,num) * s:W,0])
|
||||
endif
|
||||
|
||||
" main return
|
||||
if l:line =~ '^\%([])}]\||}\)'
|
||||
if l:line =~ '^[])}]\|^|}'
|
||||
return max([indent(num),0])
|
||||
elseif num
|
||||
return indent(num) + s:W + switch_offset + bL + isOp
|
||||
|
@ -1,6 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
||||
|
||||
if exists("b:did_indent")
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
@ -9,7 +9,7 @@ setlocal indentexpr=GetPlantUMLIndent()
|
||||
setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,}
|
||||
|
||||
" only define the indent code once
|
||||
if exists("*GetPlantUMLIndent")
|
||||
if exists('*GetPlantUMLIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
@ -49,22 +49,21 @@ set cpo&vim
|
||||
" 1. Variables {{{1
|
||||
" ============
|
||||
|
||||
" Regex of syntax group names that are or delimit strings/symbols or are comments.
|
||||
let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
|
||||
\ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
|
||||
\ '\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>'
|
||||
|
||||
" Regex of syntax group names that are strings.
|
||||
" Syntax group names that are strings.
|
||||
let s:syng_string =
|
||||
\ '\<ruby\%(String\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|StringEscape\)\>'
|
||||
\ ['String', 'Interpolation', 'InterpolationDelimiter', 'NoInterpolation', 'StringEscape']
|
||||
|
||||
" Regex of syntax group names that are strings or documentation.
|
||||
let s:syng_stringdoc =
|
||||
\ '\<ruby\%(String\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|StringEscape\|Documentation\)\>'
|
||||
" Syntax group names that are strings or documentation.
|
||||
let s:syng_stringdoc = s:syng_string + ['Documentation']
|
||||
|
||||
" Syntax group names that are or delimit strings/symbols/regexes or are comments.
|
||||
let s:syng_strcom = s:syng_stringdoc +
|
||||
\ ['Regexp', 'RegexpDelimiter', 'RegexpEscape',
|
||||
\ 'Symbol', 'StringDelimiter', 'ASCIICode', 'Comment']
|
||||
|
||||
" Expression used to check whether we should skip a match with searchpair().
|
||||
let s:skip_expr =
|
||||
\ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
||||
\ 'index(map('.string(s:syng_strcom).',"hlID(''ruby''.v:val)"), synID(line("."),col("."),1)) >= 0'
|
||||
|
||||
" Regex used for words that, at the start of a line, add a level of indent.
|
||||
let s:ruby_indent_keywords =
|
||||
@ -152,7 +151,7 @@ let s:leading_operator_regex = '^\s*[.]'
|
||||
" 2. GetRubyIndent Function {{{1
|
||||
" =========================
|
||||
|
||||
function GetRubyIndent(...)
|
||||
function! GetRubyIndent(...) abort
|
||||
" 2.1. Setup {{{2
|
||||
" ----------
|
||||
|
||||
@ -255,7 +254,7 @@ endfunction
|
||||
" 3. Indenting Logic Callbacks {{{1
|
||||
" ============================
|
||||
|
||||
function! s:AccessModifier(cline_info)
|
||||
function! s:AccessModifier(cline_info) abort
|
||||
let info = a:cline_info
|
||||
|
||||
" If this line is an access modifier keyword, align according to the closest
|
||||
@ -279,7 +278,7 @@ function! s:AccessModifier(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:ClosingBracketOnEmptyLine(cline_info)
|
||||
function! s:ClosingBracketOnEmptyLine(cline_info) abort
|
||||
let info = a:cline_info
|
||||
|
||||
" If we got a closing bracket on an empty line, find its match and indent
|
||||
@ -308,7 +307,7 @@ function! s:ClosingBracketOnEmptyLine(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:BlockComment(cline_info)
|
||||
function! s:BlockComment(cline_info) abort
|
||||
" If we have a =begin or =end set indent to first column.
|
||||
if match(a:cline_info.cline, '^\s*\%(=begin\|=end\)$') != -1
|
||||
return 0
|
||||
@ -316,7 +315,7 @@ function! s:BlockComment(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:DeindentingKeyword(cline_info)
|
||||
function! s:DeindentingKeyword(cline_info) abort
|
||||
let info = a:cline_info
|
||||
|
||||
" If we have a deindenting keyword, find its match and indent to its level.
|
||||
@ -357,7 +356,7 @@ function! s:DeindentingKeyword(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:MultilineStringOrLineComment(cline_info)
|
||||
function! s:MultilineStringOrLineComment(cline_info) abort
|
||||
let info = a:cline_info
|
||||
|
||||
" If we are in a multi-line string or line-comment, don't do anything to it.
|
||||
@ -367,7 +366,7 @@ function! s:MultilineStringOrLineComment(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:ClosingHeredocDelimiter(cline_info)
|
||||
function! s:ClosingHeredocDelimiter(cline_info) abort
|
||||
let info = a:cline_info
|
||||
|
||||
" If we are at the closing delimiter of a "<<" heredoc-style string, set the
|
||||
@ -381,7 +380,7 @@ function! s:ClosingHeredocDelimiter(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:LeadingOperator(cline_info)
|
||||
function! s:LeadingOperator(cline_info) abort
|
||||
" If the current line starts with a leading operator, add a level of indent.
|
||||
if s:Match(a:cline_info.clnum, s:leading_operator_regex)
|
||||
return indent(s:GetMSL(a:cline_info.clnum)) + a:cline_info.sw
|
||||
@ -389,7 +388,7 @@ function! s:LeadingOperator(cline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:EmptyInsideString(pline_info)
|
||||
function! s:EmptyInsideString(pline_info) abort
|
||||
" If the line is empty and inside a string (plnum would not be the real
|
||||
" prevnonblank in that case), use the previous line's indent
|
||||
let info = a:pline_info
|
||||
@ -400,7 +399,7 @@ function! s:EmptyInsideString(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:StartOfFile(pline_info)
|
||||
function! s:StartOfFile(pline_info) abort
|
||||
" At the start of the file use zero indent.
|
||||
if a:pline_info.plnum == 0
|
||||
return 0
|
||||
@ -408,7 +407,7 @@ function! s:StartOfFile(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterAccessModifier(pline_info)
|
||||
function! s:AfterAccessModifier(pline_info) abort
|
||||
let info = a:pline_info
|
||||
|
||||
if g:ruby_indent_access_modifier_style == 'indent'
|
||||
@ -434,7 +433,7 @@ endfunction
|
||||
" puts "foo"
|
||||
" end
|
||||
"
|
||||
function! s:ContinuedLine(pline_info)
|
||||
function! s:ContinuedLine(pline_info) abort
|
||||
let info = a:pline_info
|
||||
|
||||
let col = s:Match(info.plnum, s:ruby_indent_keywords)
|
||||
@ -456,7 +455,7 @@ function! s:ContinuedLine(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterBlockOpening(pline_info)
|
||||
function! s:AfterBlockOpening(pline_info) abort
|
||||
let info = a:pline_info
|
||||
|
||||
" If the previous line ended with a block opening, add a level of indent.
|
||||
@ -482,7 +481,7 @@ function! s:AfterBlockOpening(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterLeadingOperator(pline_info)
|
||||
function! s:AfterLeadingOperator(pline_info) abort
|
||||
" If the previous line started with a leading operator, use its MSL's level
|
||||
" of indent
|
||||
if s:Match(a:pline_info.plnum, s:leading_operator_regex)
|
||||
@ -491,7 +490,7 @@ function! s:AfterLeadingOperator(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterHangingSplat(pline_info)
|
||||
function! s:AfterHangingSplat(pline_info) abort
|
||||
let info = a:pline_info
|
||||
|
||||
" If the previous line ended with the "*" of a splat, add a level of indent
|
||||
@ -501,7 +500,7 @@ function! s:AfterHangingSplat(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterUnbalancedBracket(pline_info)
|
||||
function! s:AfterUnbalancedBracket(pline_info) abort
|
||||
let info = a:pline_info
|
||||
|
||||
" If the previous line contained unclosed opening brackets and we are still
|
||||
@ -541,7 +540,7 @@ function! s:AfterUnbalancedBracket(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterEndKeyword(pline_info)
|
||||
function! s:AfterEndKeyword(pline_info) abort
|
||||
let info = a:pline_info
|
||||
" If the previous line ended with an "end", match that "end"s beginning's
|
||||
" indent.
|
||||
@ -562,7 +561,7 @@ function! s:AfterEndKeyword(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:AfterIndentKeyword(pline_info)
|
||||
function! s:AfterIndentKeyword(pline_info) abort
|
||||
let info = a:pline_info
|
||||
let col = s:Match(info.plnum, s:ruby_indent_keywords)
|
||||
|
||||
@ -589,7 +588,7 @@ function! s:AfterIndentKeyword(pline_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:PreviousNotMSL(msl_info)
|
||||
function! s:PreviousNotMSL(msl_info) abort
|
||||
let info = a:msl_info
|
||||
|
||||
" If the previous line wasn't a MSL
|
||||
@ -608,7 +607,7 @@ function! s:PreviousNotMSL(msl_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:IndentingKeywordInMSL(msl_info)
|
||||
function! s:IndentingKeywordInMSL(msl_info) abort
|
||||
let info = a:msl_info
|
||||
" If the MSL line had an indenting keyword in it, add a level of indent.
|
||||
" TODO: this does not take into account contrived things such as
|
||||
@ -632,7 +631,7 @@ function! s:IndentingKeywordInMSL(msl_info)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:ContinuedHangingOperator(msl_info)
|
||||
function! s:ContinuedHangingOperator(msl_info) abort
|
||||
let info = a:msl_info
|
||||
|
||||
" If the previous line ended with [*+/.,-=], but wasn't a block ending or a
|
||||
@ -652,32 +651,37 @@ endfunction
|
||||
" 4. Auxiliary Functions {{{1
|
||||
" ======================
|
||||
|
||||
function! s:IsInRubyGroup(groups, lnum, col) abort
|
||||
let ids = map(copy(a:groups), 'hlID("ruby".v:val)')
|
||||
return index(ids, synID(a:lnum, a:col, 1)) >= 0
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
||||
function s:IsInStringOrComment(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
|
||||
function! s:IsInStringOrComment(lnum, col) abort
|
||||
return s:IsInRubyGroup(s:syng_strcom, a:lnum, a:col)
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string.
|
||||
function s:IsInString(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
||||
function! s:IsInString(lnum, col) abort
|
||||
return s:IsInRubyGroup(s:syng_string, a:lnum, a:col)
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string or documentation.
|
||||
function s:IsInStringOrDocumentation(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
|
||||
function! s:IsInStringOrDocumentation(lnum, col) abort
|
||||
return s:IsInRubyGroup(s:syng_stringdoc, a:lnum, a:col)
|
||||
endfunction
|
||||
|
||||
" Check if the character at lnum:col is inside a string delimiter
|
||||
function s:IsInStringDelimiter(lnum, col)
|
||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'rubyStringDelimiter'
|
||||
function! s:IsInStringDelimiter(lnum, col) abort
|
||||
return s:IsInRubyGroup(['StringDelimiter'], a:lnum, a:col)
|
||||
endfunction
|
||||
|
||||
function s:IsAssignment(str, pos)
|
||||
function! s:IsAssignment(str, pos) abort
|
||||
return strpart(a:str, 0, a:pos - 1) =~ '=\s*$'
|
||||
endfunction
|
||||
|
||||
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
||||
function s:PrevNonBlankNonString(lnum)
|
||||
function! s:PrevNonBlankNonString(lnum) abort
|
||||
let in_block = 0
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
while lnum > 0
|
||||
@ -702,7 +706,7 @@ function s:PrevNonBlankNonString(lnum)
|
||||
endfunction
|
||||
|
||||
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
|
||||
function s:GetMSL(lnum)
|
||||
function! s:GetMSL(lnum) abort
|
||||
" Start on the line we're at and use its indent.
|
||||
let msl = a:lnum
|
||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
||||
@ -807,7 +811,7 @@ function s:GetMSL(lnum)
|
||||
endfunction
|
||||
|
||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
||||
function s:ExtraBrackets(lnum)
|
||||
function! s:ExtraBrackets(lnum) abort
|
||||
let opening = {'parentheses': [], 'braces': [], 'brackets': []}
|
||||
let closing = {'parentheses': [], 'braces': [], 'brackets': []}
|
||||
|
||||
@ -869,7 +873,7 @@ function s:ExtraBrackets(lnum)
|
||||
return [rightmost_opening, rightmost_closing]
|
||||
endfunction
|
||||
|
||||
function s:Match(lnum, regex)
|
||||
function! s:Match(lnum, regex) abort
|
||||
let line = getline(a:lnum)
|
||||
let offset = match(line, '\C'.a:regex)
|
||||
let col = offset + 1
|
||||
@ -889,7 +893,7 @@ endfunction
|
||||
" Locates the containing class/module's definition line, ignoring nested classes
|
||||
" along the way.
|
||||
"
|
||||
function! s:FindContainingClass()
|
||||
function! s:FindContainingClass() abort
|
||||
let saved_position = getpos('.')
|
||||
|
||||
while searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
|
||||
|
@ -5,41 +5,64 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vue') == -1
|
||||
" Maintainer: Eduardo San Martin Morote
|
||||
" Author: Adriaan Zonnenberg
|
||||
|
||||
if exists("b:did_indent")
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Load indent files for required languages
|
||||
for language in ['stylus', 'pug', 'css', 'javascript', 'html', 'coffee']
|
||||
function! s:get_indentexpr(language)
|
||||
unlet! b:did_indent
|
||||
exe "runtime! indent/".language.".vim"
|
||||
exe "let s:".language."indent = &indentexpr"
|
||||
execute 'runtime! indent/' . a:language . '.vim'
|
||||
return &indentexpr
|
||||
endfunction
|
||||
|
||||
" The order is important here, tags without attributes go last.
|
||||
" HTML is left out, it will be used when there is no match.
|
||||
let s:languages = [
|
||||
\ { 'name': 'pug', 'pairs': ['<template lang="pug"', '</template>'] },
|
||||
\ { 'name': 'stylus', 'pairs': ['<style lang="stylus"', '</style>'] },
|
||||
\ { 'name': 'css', 'pairs': ['<style', '</style>'] },
|
||||
\ { 'name': 'coffee', 'pairs': ['<script lang="coffee"', '</script>'] },
|
||||
\ { 'name': 'javascript', 'pairs': ['<script', '</script>'] },
|
||||
\ ]
|
||||
|
||||
for language in s:languages
|
||||
" Set 'indentexpr' if the user has an indent file installed for the language
|
||||
if strlen(globpath(&rtp, 'indent/'. language.name .'.vim'))
|
||||
let language.indentexpr = s:get_indentexpr(language.name)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let s:html_indent = s:get_indentexpr('html')
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetVueIndent()
|
||||
|
||||
if exists("*GetVueIndent")
|
||||
if exists('*GetVueIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetVueIndent()
|
||||
if searchpair('<template lang="pug"', '', '</template>', 'bWr')
|
||||
exe "let indent = ".s:pugindent
|
||||
elseif searchpair('<style lang="stylus"', '', '</style>', 'bWr')
|
||||
exe "let indent = ".s:stylusindent
|
||||
elseif searchpair('<style', '', '</style>', 'bWr')
|
||||
exe "let indent = ".s:cssindent
|
||||
elseif searchpair('<script lang="coffee"', '', '</script>', 'bWr')
|
||||
exe "let indent = ".s:coffeeindent
|
||||
elseif searchpair('<script', '', '</script>', 'bWr')
|
||||
exe "let indent = ".s:javascriptindent
|
||||
for language in s:languages
|
||||
let opening_tag_line = searchpair(language.pairs[0], '', language.pairs[1], 'bWr')
|
||||
|
||||
if opening_tag_line
|
||||
execute 'let indent = ' . get(language, 'indentexpr', -1)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if exists('l:indent')
|
||||
if (opening_tag_line == prevnonblank(v:lnum - 1) || opening_tag_line == v:lnum)
|
||||
\ || getline(v:lnum) =~ '\v^\s*\</(script|style|template)'
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
exe "let indent = ".s:htmlindent
|
||||
" Couldn't find language, fall back to html
|
||||
execute 'let indent = ' . s:html_indent
|
||||
endif
|
||||
|
||||
return indent > -1 ? indent : s:htmlindent
|
||||
return indent
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
|
||||
" Vim syntax file
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2016 Nov 17
|
||||
" Last Change: 2016 Nov 18
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@ -365,7 +365,7 @@ syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
if !exists("c_no_if0")
|
||||
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
|
||||
syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
|
||||
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
|
||||
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
|
||||
else
|
||||
|
@ -177,7 +177,7 @@ end
|
||||
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
|
||||
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
|
||||
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
|
||||
syn match crystalFunctionDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
||||
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
|
||||
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
||||
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
|
@ -28,15 +28,15 @@ syn region glslPreProc start="^\s*#\s*\(error\|pragma\|extension\|versi
|
||||
syn keyword glslBoolean true false
|
||||
|
||||
" Integer Numbers
|
||||
syn match glslDecimalInt display "\(0\|[1-9]\d*\)"
|
||||
syn match glslOctalInt display "0\o\+"
|
||||
syn match glslHexInt display "0[xX]\x\+"
|
||||
syn match glslDecimalInt display "\(0\|[1-9]\d*\)[uU]\?"
|
||||
syn match glslOctalInt display "0\o\+[uU]\?"
|
||||
syn match glslHexInt display "0[xX]\x\+[uU]\?"
|
||||
|
||||
" Float Numbers
|
||||
syn match glslFloat display "\d\+\.\([eE][+-]\=\d\+\)\="
|
||||
syn match glslFloat display "\.\d\+\([eE][+-]\=\d\+\)\="
|
||||
syn match glslFloat display "\d\+[eE][+-]\=\d\+"
|
||||
syn match glslFloat display "\d\+\.\d\+\([eE][+-]\=\d\+\)\="
|
||||
syn match glslFloat display "\d\+\.\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
|
||||
syn match glslFloat display "\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
|
||||
syn match glslFloat display "\d\+[eE][+-]\=\d\+\(lf\|LF\|f\|F\)\="
|
||||
syn match glslFloat display "\d\+\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
|
||||
|
||||
" Swizzles
|
||||
syn match glslSwizzle display /\.[xyzw]\{1,4\}\>/
|
||||
|
@ -76,8 +76,8 @@ hi def link goTplVariable Special
|
||||
|
||||
syn region gotplAction start="{{" end="}}" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable,goTplIdentifier display
|
||||
syn region gotplAction start="\[\[" end="\]\]" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable display
|
||||
syn region goTplComment start="{{/\*" end="\*/}}" display
|
||||
syn region goTplComment start="\[\[/\*" end="\*/\]\]" display
|
||||
syn region goTplComment start="{{\(- \)\?/\*" end="\*/\( -\)\?}}" display
|
||||
syn region goTplComment start="\[\[\(- \)\?/\*" end="\*/\( -\)\?\]\]" display
|
||||
|
||||
hi def link gotplAction PreProc
|
||||
hi def link goTplComment Comment
|
||||
|
@ -13,11 +13,7 @@ elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:haskell_disable_TH')
|
||||
let g:haskell_disable_TH = 0
|
||||
endif
|
||||
|
||||
if exists('g:haskell_backpack') && g:haskell_backpack == 1
|
||||
if get(g:, 'haskell_backpack', 0)
|
||||
syn keyword haskellBackpackStructure unit signature
|
||||
syn keyword haskellBackpackDependency dependency
|
||||
endif
|
||||
@ -63,7 +59,7 @@ syn match haskellImport "^\s*\<import\>\s\+\(\<safe\>\s\+\)\?\(\<qualified\>\s\+
|
||||
\ haskellBlockComment,
|
||||
\ haskellPragma
|
||||
syn keyword haskellKeyword do case of
|
||||
if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1
|
||||
if get(g:, 'haskell_enable_static_pointers', 0)
|
||||
syn keyword haskellStatic static
|
||||
endif
|
||||
syn keyword haskellConditional if then else
|
||||
@ -107,29 +103,29 @@ syn match haskellPreProc "^#.*$"
|
||||
syn keyword haskellTodo TODO FIXME contained
|
||||
" Treat a shebang line at the start of the file as a comment
|
||||
syn match haskellShebang "\%^#!.*$"
|
||||
if exists('g:haskell_disable_TH') && g:haskell_disable_TH == 0
|
||||
if !get(g:, 'haskell_disable_TH', 0)
|
||||
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
|
||||
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
|
||||
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
|
||||
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
|
||||
endif
|
||||
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
|
||||
if get(g:, 'haskell_enable_typeroles', 0)
|
||||
syn keyword haskellTypeRoles phantom representational nominal contained
|
||||
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend
|
||||
\ contains=
|
||||
\ haskellType,
|
||||
\ haskellTypeRoles
|
||||
endif
|
||||
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
||||
if get(g:, 'haskell_enable_quantification', 0)
|
||||
syn keyword haskellForall forall
|
||||
endif
|
||||
if exists('g:haskell_enable_recursivedo') && g:haskell_enable_recursivedo == 1
|
||||
if get(g:, 'haskell_enable_recursivedo', 0)
|
||||
syn keyword haskellRecursiveDo mdo rec
|
||||
endif
|
||||
if exists('g:haskell_enable_arrowsyntax') && g:haskell_enable_arrowsyntax == 1
|
||||
if get(g:, 'haskell_enable_arrowsyntax', 0)
|
||||
syn keyword haskellArrowSyntax proc
|
||||
endif
|
||||
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
|
||||
if get(g:, 'haskell_enable_pattern_synonyms', 0)
|
||||
syn keyword haskellPatternKeyword pattern
|
||||
endif
|
||||
|
||||
@ -161,7 +157,7 @@ highlight def link haskellAssocType Type
|
||||
highlight def link haskellQuotedType Type
|
||||
highlight def link haskellType Type
|
||||
highlight def link haskellImportKeywords Include
|
||||
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
|
||||
if get(g:, 'haskell_classic_highlighting', 0)
|
||||
highlight def link haskellDeclKeyword Keyword
|
||||
highlight def link haskellDecl Keyword
|
||||
highlight def link haskellWhere Keyword
|
||||
@ -173,35 +169,35 @@ else
|
||||
highlight def link haskellLet Structure
|
||||
endif
|
||||
|
||||
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
||||
if get(g:, 'haskell_enable_quantification', 0)
|
||||
highlight def link haskellForall Operator
|
||||
endif
|
||||
if exists('g:haskell_enable_recursivedo') && g:haskell_enable_recursivedo == 1
|
||||
if get(g:, 'haskell_enable_recursivedo', 0)
|
||||
highlight def link haskellRecursiveDo Keyword
|
||||
endif
|
||||
if exists('g:haskell_enable_arrowsyntax') && g:haskell_enable_arrowsyntax == 1
|
||||
if get(g:, 'haskell_enable_arrowsyntax', 0)
|
||||
highlight def link haskellArrowSyntax Keyword
|
||||
endif
|
||||
if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1
|
||||
if get(g:, 'haskell_enable_static_pointers', 0)
|
||||
highlight def link haskellStatic Keyword
|
||||
endif
|
||||
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
|
||||
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
|
||||
if get(g:, 'haskell_classic_highlighting', 0)
|
||||
if get(g:, 'haskell_enable_pattern_synonyms', 0)
|
||||
highlight def link haskellPatternKeyword Keyword
|
||||
endif
|
||||
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
|
||||
if get(g:, 'haskell_enable_typeroles', 0)
|
||||
highlight def link haskellTypeRoles Keyword
|
||||
endif
|
||||
else
|
||||
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
|
||||
if get(g:, 'haskell_enable_pattern_synonyms', 0)
|
||||
highlight def link haskellPatternKeyword Structure
|
||||
endif
|
||||
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
|
||||
if get(g:, 'haskell_enable_typeroles', 0)
|
||||
highlight def link haskellTypeRoles Structure
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('g:haskell_backpack') && g:haskell_backpack == 1
|
||||
if get(g:, 'haskell_backpack', 0)
|
||||
highlight def link haskellBackpackStructure Structure
|
||||
highlight def link haskellBackpackDependency Include
|
||||
endif
|
||||
|
@ -121,9 +121,11 @@ syn keyword htmlArg contained download media
|
||||
syn keyword htmlArg contained nonce
|
||||
" <area>, <a>, <img>, <iframe>, <link>
|
||||
syn keyword htmlArg contained referrerpolicy
|
||||
" <script>
|
||||
" https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
|
||||
syn keyword htmlArg contained integrity crossorigin
|
||||
" <link>
|
||||
syn keyword htmlArg contained prefetch
|
||||
" syn keyword htmlArg contained preload
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
||||
|
@ -27,7 +27,7 @@ syntax sync fromstart
|
||||
syntax case match
|
||||
|
||||
syntax match jsNoise /[:,\;]\{1}/
|
||||
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall
|
||||
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype
|
||||
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/
|
||||
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
|
||||
syntax match jsParensError /[)}\]]/
|
||||
@ -239,8 +239,8 @@ if exists("javascript_plugin_flow")
|
||||
runtime extras/flow.vim
|
||||
endif
|
||||
|
||||
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo
|
||||
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword,jsNoise,,jsBlockLabel
|
||||
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait
|
||||
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword,jsNoise,jsBlockLabel
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
@ -384,7 +384,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
endif
|
||||
|
||||
" Define the htmlJavaScript for HTML syntax html.vim
|
||||
syntax cluster htmlJavaScript contains=@jsAll
|
||||
syntax cluster htmlJavaScript contains=@jsAll,jsImport,jsExport
|
||||
syntax cluster javaScriptExpression contains=@jsAll
|
||||
|
||||
" Vim's default html.vim highlights all javascript as 'Special'
|
||||
|
@ -145,8 +145,8 @@ endif
|
||||
|
||||
if get(g:, 'vim_markdown_math', 0)
|
||||
syn include @tex syntax/tex.vim
|
||||
syn region mkdMath start="\\\@<!\$" end="\$" contains=@tex keepend
|
||||
syn region mkdMath start="\\\@<!\$\$" end="\$\$" contains=@tex keepend
|
||||
syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
|
||||
syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
|
||||
endif
|
||||
|
||||
syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath
|
||||
|
@ -10,9 +10,9 @@ end
|
||||
" Patch 7.4.1142
|
||||
if has("patch-7.4-1142")
|
||||
if has("win32")
|
||||
syn iskeyword @,48-57,_,128-167,224-235,.,/,:
|
||||
syn iskeyword @,48-57,_,128-167,224-235,.,/,:,-
|
||||
else
|
||||
syn iskeyword @,48-57,_,192-255,.,/,:
|
||||
syn iskeyword @,48-57,_,192-255,.,/,:,-
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -25,6 +25,11 @@ syn region ngxString start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|
|
||||
syn keyword ngxBoolean on
|
||||
syn keyword ngxBoolean off
|
||||
|
||||
" Number and Measures http://nginx.org/en/docs/syntax.html
|
||||
syn match ngxNumber '\<\d\+\>'
|
||||
syn match ngxMeasure '\<\d\+ms\>'
|
||||
syn match ngxMeasure '\<\d\+[smhdwMy]\>'
|
||||
syn match ngxMeasure '\<\d\+[kKmMgG]\>'
|
||||
|
||||
syn keyword ngxDirectiveBlock http
|
||||
syn keyword ngxDirectiveBlock mail
|
||||
@ -48,7 +53,7 @@ syn keyword ngxDirectiveImportant root
|
||||
syn keyword ngxDirectiveImportant server
|
||||
syn keyword ngxDirectiveImportant server_name
|
||||
syn keyword ngxDirectiveImportant listen contained
|
||||
syn region ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=+listen+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxListenOptions,ngxString
|
||||
syn region ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=+listen+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxListenOptions,ngxNumber,ngxString
|
||||
syn keyword ngxDirectiveImportant internal
|
||||
syn keyword ngxDirectiveImportant proxy_pass
|
||||
syn keyword ngxDirectiveImportant memcached_pass
|
||||
@ -84,9 +89,9 @@ syn match ngxStatusCode /\d\d\d/ contained
|
||||
syn match ngxStatusCodes /\d\d\d/ contained contains=ngxStatusCode nextgroup=ngxStatusCode skipwhite skipempty
|
||||
|
||||
syn match ngxRewriteURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxRewritedURI skipwhite skipempty
|
||||
syn region ngxRewriteURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString nextgroup=ngxRewritedURI skipwhite skipempty
|
||||
syn region ngxRewriteURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contained contains=ngxVariableString nextgroup=ngxRewritedURI skipwhite skipempty
|
||||
syn match ngxRewritedURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxRewriteFlag skipwhite skipempty
|
||||
syn region ngxRewritedURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString nextgroup=ngxRewriteFlag skipwhite skipempty
|
||||
syn region ngxRewritedURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contained contains=ngxVariableString nextgroup=ngxRewriteFlag skipwhite skipempty
|
||||
|
||||
syn keyword ngxRewriteFlag last contained
|
||||
syn keyword ngxRewriteFlag break contained
|
||||
@ -137,7 +142,10 @@ syn keyword ngxDirective autoindex
|
||||
syn keyword ngxDirective autoindex_exact_size
|
||||
syn keyword ngxDirective autoindex_format
|
||||
syn keyword ngxDirective autoindex_localtime
|
||||
syn keyword ngxDirective charset
|
||||
syn keyword ngxDirective charset nextgroup=ngxCharset skipwhite skipempty
|
||||
|
||||
syn keyword ngxCharset utf-8 UTF-8
|
||||
|
||||
syn keyword ngxDirective charset_map
|
||||
syn keyword ngxDirective charset_types
|
||||
syn keyword ngxDirective chunked_transfer_encoding
|
||||
@ -2189,27 +2197,34 @@ syn keyword ngxDirectiveThirdParty xss_input_types
|
||||
" highlight
|
||||
|
||||
hi link ngxComment Comment
|
||||
hi link ngxVariable Identifier
|
||||
hi link ngxVariable PreProc
|
||||
hi link ngxVariableString PreProc
|
||||
hi link ngxString String
|
||||
hi link ngxLocationPath String
|
||||
hi link ngxLocationNamedLoc Identifier
|
||||
hi link ngxLocationNamedLoc PreProc
|
||||
|
||||
hi link ngxBoolean Boolean
|
||||
hi link ngxStatusCode Number
|
||||
hi link ngxRewriteFlag Boolean
|
||||
hi link ngxDirective Identifier
|
||||
hi link ngxDirectiveBlock Statement
|
||||
hi link ngxDirectiveImportant Type
|
||||
hi link ngxDirectiveControl Keyword
|
||||
hi link ngxDirectiveError Constant
|
||||
hi link ngxDirectiveThirdParty Identifier
|
||||
hi link ngxDirectiveDeprecated Error
|
||||
hi link ngxDirective Identifier
|
||||
hi link ngxDirectiveThirdParty Special
|
||||
|
||||
hi link ngxBoolean Boolean
|
||||
hi link ngxNumber Number
|
||||
hi link ngxMeasure Number
|
||||
hi link ngxStatusCode Number
|
||||
hi link ngxRewriteFlag Boolean
|
||||
|
||||
hi link ngxCharset keyword
|
||||
hi link ngxListenOptions Keyword
|
||||
hi link ngxMailProtocol Keyword
|
||||
hi link ngxSSLProtocol Keyword
|
||||
|
||||
hi link ngxRewriteURI Special
|
||||
hi link ngxRewritedURI StorageClass
|
||||
|
||||
hi link ngxThirdPartyKeyword keyword
|
||||
|
||||
let b:current_syntax = "nginx"
|
||||
|
@ -3,54 +3,82 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
|
||||
" Vim syntax file
|
||||
" Language: PlantUML
|
||||
" Maintainer: Anders Thøgersen <first name at bladre dot dk>
|
||||
" Version: 0.2
|
||||
"
|
||||
if exists("b:current_syntax")
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
if version < 600
|
||||
scriptencoding utf-8
|
||||
|
||||
if v:version < 600
|
||||
syntax clear
|
||||
endif
|
||||
|
||||
let s:cpo_orig=&cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:current_syntax = "plantuml"
|
||||
let b:current_syntax = 'plantuml'
|
||||
|
||||
syntax sync minlines=100
|
||||
|
||||
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(include\|define\|undev\|ifdef\|endif\|ifndef\)\s*.*/ contains=plantumlDir
|
||||
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(define|definelong|else|enddefinelong|endif|ifdef|ifndef|include|pragma|undef\)\s*.*/ contains=plantumlDir
|
||||
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
|
||||
|
||||
syntax keyword plantumlTypeKeyword actor participant usecase abstract enum component state object artifact folder rect node frame cloud database storage agent boundary control entity card rectangle
|
||||
syntax keyword plantumlKeyword as also autonumber caption title newpage box alt opt loop par break critical note rnote hnote legend group left right of on link over end activate deactivate destroy create footbox hide show skinparam skin top bottom
|
||||
syntax keyword plantumlKeyword package namespace page up down if else elseif endif partition footer header center rotate ref return is repeat start stop while endwhile fork again kill
|
||||
syntax keyword plantumlKeyword then detach
|
||||
syntax keyword plantumlTypeKeyword abstract actor agent artifact boundary card cloud component control
|
||||
syntax keyword plantumlTypeKeyword database entity enum file folder frame node object package participant
|
||||
syntax keyword plantumlTypeKeyword queue rectangle stack state storage usecase
|
||||
|
||||
syntax keyword plantumlClassKeyword class interface
|
||||
|
||||
syntax keyword plantumlKeyword activate again also alt as autonumber bottom box break caption center create
|
||||
syntax keyword plantumlKeyword critical deactivate destroy down else elseif end endif endwhile footbox footer
|
||||
syntax keyword plantumlKeyword fork group header hide hnote if is kill left legend link loop namespace newpage
|
||||
syntax keyword plantumlKeyword note of on opt over package page par partition ref repeat return right rnote
|
||||
syntax keyword plantumlKeyword rotate show skin skinparam start stop title top up while
|
||||
" Not in 'java - jar plantuml.jar - language' output
|
||||
syntax keyword plantumlKeyword then detach sprite
|
||||
|
||||
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
|
||||
syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/
|
||||
syntax keyword plantumlColor AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond
|
||||
syntax keyword plantumlColor Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral
|
||||
syntax keyword plantumlColor CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray
|
||||
syntax keyword plantumlColor DarkGreen DarkGrey DarkKhaki DarkMagenta DarkOliveGreen DarkOrchid DarkRed
|
||||
syntax keyword plantumlColor DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise
|
||||
syntax keyword plantumlColor DarkViolet Darkorange DeepPink DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick
|
||||
syntax keyword plantumlColor FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Green
|
||||
syntax keyword plantumlColor GreenYellow Grey HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender
|
||||
syntax keyword plantumlColor LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan
|
||||
syntax keyword plantumlColor LightGoldenRodYellow LightGray LightGreen LightGrey LightPink LightSalmon
|
||||
syntax keyword plantumlColor LightSeaGreen LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue
|
||||
syntax keyword plantumlColor LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue
|
||||
syntax keyword plantumlColor MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen
|
||||
syntax keyword plantumlColor MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin
|
||||
syntax keyword plantumlColor NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod
|
||||
syntax keyword plantumlColor PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum
|
||||
syntax keyword plantumlColor PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen
|
||||
syntax keyword plantumlColor SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen
|
||||
syntax keyword plantumlColor SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow
|
||||
syntax keyword plantumlColor YellowGreen
|
||||
|
||||
" Arrows - Differentiate between horizontal and vertical arrows
|
||||
syntax match plantumlHorizontalArrow /\%([-\.]\%(|>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\|\%(<|\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[\.-]\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|\do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|\do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
|
||||
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained
|
||||
|
||||
" Class
|
||||
syntax region plantumlClass start=/{/ end=/\s*}/ contains=plantumlClassArrows,
|
||||
\ plantumlClassKeyword,
|
||||
\ @plantumlClassOp,
|
||||
\ plantumlClassSeparator,
|
||||
\ plantumlComment
|
||||
syntax region plantumlClass start=/\%(class\s[^{]\+\)\@<=\zs{/ end=/^\s*}/ contains=plantumlClassArrows,
|
||||
\ plantumlClassKeyword,
|
||||
\ @plantumlClassOp,
|
||||
\ plantumlClassSeparator,
|
||||
\ plantumlComment
|
||||
|
||||
syntax match plantumlClassPublic /+\w\+/ contained
|
||||
syntax match plantumlClassPrivate /-\w\+/ contained
|
||||
syntax match plantumlClassProtected /#\w\+/ contained
|
||||
syntax match plantumlClassPackPrivate /\~\w\+/ contained
|
||||
syntax match plantumlClassSeparator /__.\+__\|==.\+==/ contained
|
||||
syntax match plantumlClassPublic /^\s*+\s*\w\+/ contained
|
||||
syntax match plantumlClassPrivate /^\s*-\s*\w\+/ contained
|
||||
syntax match plantumlClassProtected /^\s*#\s*\w\+/ contained
|
||||
syntax match plantumlClassPackPrivate /^\s*\~\s*\w\+/ contained
|
||||
syntax match plantumlClassSeparator /__\%(.\+__\)\?\|==\%(.\+==\)\?\|--\%(.\+--\)\?\|\.\.\%(.\+\.\.\)\?/ contained
|
||||
|
||||
syntax cluster plantumlClassOp contains=plantumlClassPublic,
|
||||
\ plantumlClassPrivate,
|
||||
@ -65,82 +93,184 @@ syntax match plantumlComment /'.*$/ contains=plantumlCommentTODO
|
||||
syntax region plantumlMultilineComment start=/\/'/ end=/'\// contains=plantumlCommentTODO
|
||||
|
||||
" Labels with a colon
|
||||
syntax match plantumlColonLine /:[^:]\+$/ contains=plantumlText
|
||||
syntax match plantumlColonLine /\S\@<=\s*\zs:.\+$/ contains=plantumlSpecialString
|
||||
|
||||
" Stereotypes
|
||||
syntax match plantumlStereotype /<<.\{-1,}>>/ contains=plantumlSpecialString
|
||||
|
||||
" Activity diagram
|
||||
syntax match plantumlActivityThing /([^)]*)/
|
||||
syntax match plantumlActivitySynch /===[^=]\+===/
|
||||
|
||||
" Sequence diagram
|
||||
syntax match plantumlSequenceDivider /^\s*==[^=]\+==\s*$/
|
||||
syntax match plantumlSequenceSpace /^\s*|||\+\s*$/
|
||||
syntax match plantumlSequenceSpace /^\s*||\d\+||\+\s*$/
|
||||
|
||||
" Usecase diagram
|
||||
syntax match plantumlUsecaseActor /:.\{-1,}:/ contains=plantumlSpecialString
|
||||
|
||||
" Skinparam keywords
|
||||
syntax case ignore
|
||||
syntax keyword plantumlSkinparamKeyword ActivityBackgroundColor ActivityBarColor ActivityBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityBorderThickness ActivityDiamondBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityDiamondBorderColor ActivityDiamondFontColor ActivityDiamondFontName
|
||||
syntax keyword plantumlSkinparamKeyword ActivityDiamondFontSize ActivityDiamondFontStyle ActivityEndColor
|
||||
syntax keyword plantumlSkinparamKeyword ActivityFontColor ActivityFontName ActivityFontSize ActivityFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ActivityStartColor ActorBackgroundColor ActorBorderColor ActorFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ActorFontName ActorFontSize ActorFontStyle ActorStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ActorStereotypeFontName ActorStereotypeFontSize ActorStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword AgentBackgroundColor AgentBorderColor AgentFontColor AgentFontName AgentFontSize
|
||||
syntax keyword plantumlSkinparamKeyword AgentFontStyle AgentStereotypeFontColor AgentStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword AgentStereotypeFontSize AgentStereotypeFontStyle ArrowColor ArrowFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ArrowFontName ArrowFontSize ArrowFontStyle ArtifactBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactBorderColor ArtifactFontColor ArtifactFontName ArtifactFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactFontStyle ArtifactStereotypeFontColor ArtifactStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ArtifactStereotypeFontSize ArtifactStereotypeFontStyle BackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryBackgroundColor BoundaryBorderColor BoundaryFontColor BoundaryFontName
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryFontSize BoundaryFontStyle BoundaryStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryStereotypeFontName BoundaryStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword BoundaryStereotypeFontStyle CaptionFontColor CaptionFontName CaptionFontSize
|
||||
syntax keyword plantumlSkinparamKeyword CaptionFontStyle CircledCharacterFontColor CircledCharacterFontName
|
||||
syntax keyword plantumlSkinparamKeyword CircledCharacterFontSize CircledCharacterFontStyle CircledCharacterRadius
|
||||
syntax keyword plantumlSkinparamKeyword ClassAttributeFontColor ClassAttributeFontName ClassAttributeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ClassAttributeFontStyle ClassAttributeIconSize ClassBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ClassBorderColor ClassBorderThickness ClassFontColor ClassFontName ClassFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ClassFontStyle ClassHeaderBackgroundColor ClassStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ClassStereotypeFontName ClassStereotypeFontSize ClassStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CloudBackgroundColor CloudBorderColor CloudFontColor CloudFontName CloudFontSize
|
||||
syntax keyword plantumlSkinparamKeyword CloudFontStyle CloudStereotypeFontColor CloudStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword CloudStereotypeFontSize CloudStereotypeFontStyle CollectionsBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword CollectionsBorderColor ColorArrowSeparationSpace ComponentBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ComponentBorderColor ComponentFontColor ComponentFontName ComponentFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ComponentFontStyle ComponentStereotypeFontColor ComponentStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ComponentStereotypeFontSize ComponentStereotypeFontStyle ComponentStyle
|
||||
syntax keyword plantumlSkinparamKeyword ConditionStyle ControlBackgroundColor ControlBorderColor ControlFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ControlFontName ControlFontSize ControlFontStyle ControlStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ControlStereotypeFontName ControlStereotypeFontSize ControlStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseBackgroundColor DatabaseBorderColor DatabaseFontColor DatabaseFontName
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseFontSize DatabaseFontStyle DatabaseStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseStereotypeFontName DatabaseStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword DatabaseStereotypeFontStyle DefaultFontColor DefaultFontName DefaultFontSize
|
||||
syntax keyword plantumlSkinparamKeyword DefaultFontStyle DefaultMonospacedFontName DefaultTextAlignment
|
||||
syntax keyword plantumlSkinparamKeyword DiagramBorderColor DiagramBorderThickness Dpi EntityBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword EntityBorderColor EntityFontColor EntityFontName EntityFontSize EntityFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword EntityStereotypeFontColor EntityStereotypeFontName EntityStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword EntityStereotypeFontStyle FileBackgroundColor FileBorderColor FileFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FileFontName FileFontSize FileFontStyle FileStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FileStereotypeFontName FileStereotypeFontSize FileStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword FolderBackgroundColor FolderBorderColor FolderFontColor FolderFontName
|
||||
syntax keyword plantumlSkinparamKeyword FolderFontSize FolderFontStyle FolderStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword FolderStereotypeFontName FolderStereotypeFontSize FolderStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword FooterFontColor FooterFontName FooterFontSize FooterFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword FrameBackgroundColor FrameBorderColor FrameFontColor FrameFontName FrameFontSize
|
||||
syntax keyword plantumlSkinparamKeyword FrameFontStyle FrameStereotypeFontColor FrameStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword FrameStereotypeFontSize FrameStereotypeFontStyle Guillemet Handwritten
|
||||
syntax keyword plantumlSkinparamKeyword HeaderFontColor HeaderFontName HeaderFontSize HeaderFontStyle HyperlinkColor
|
||||
syntax keyword plantumlSkinparamKeyword HyperlinkUnderline IconIEMandatoryColor IconPackageBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword IconPackageColor IconPrivateBackgroundColor IconPrivateColor
|
||||
syntax keyword plantumlSkinparamKeyword IconProtectedBackgroundColor IconProtectedColor IconPublicBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword IconPublicColor InterfaceBackgroundColor InterfaceBorderColor InterfaceFontColor
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceFontName InterfaceFontSize InterfaceFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceStereotypeFontColor InterfaceStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceStereotypeFontSize InterfaceStereotypeFontStyle LegendBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword LegendBorderColor LegendBorderThickness LegendFontColor LegendFontName
|
||||
syntax keyword plantumlSkinparamKeyword LegendFontSize LegendFontStyle Linetype MaxAsciiMessageLength MaxMessageSize
|
||||
syntax keyword plantumlSkinparamKeyword MinClassWidth Monochrome NodeBackgroundColor NodeBorderColor NodeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword NodeFontName NodeFontSize NodeFontStyle NodeStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword NodeStereotypeFontName NodeStereotypeFontSize NodeStereotypeFontStyle Nodesep
|
||||
syntax keyword plantumlSkinparamKeyword NoteBackgroundColor NoteBorderColor NoteBorderThickness NoteFontColor
|
||||
syntax keyword plantumlSkinparamKeyword NoteFontName NoteFontSize NoteFontStyle NoteShadowing ObjectAttributeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectAttributeFontName ObjectAttributeFontSize ObjectAttributeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword ObjectBackgroundColor ObjectBorderColor ObjectBorderThickness ObjectFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectFontName ObjectFontSize ObjectFontStyle ObjectStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ObjectStereotypeFontName ObjectStereotypeFontSize ObjectStereotypeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PackageBackgroundColor PackageBorderColor PackageBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword PackageFontColor PackageFontName PackageFontSize PackageFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword PackageStereotypeFontColor PackageStereotypeFontName PackageStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword PackageStereotypeFontStyle PackageStyle Padding ParticipantBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantBorderColor ParticipantFontColor ParticipantFontName
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantFontSize ParticipantFontStyle PartitionBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword PartitionBorderColor PartitionBorderThickness PartitionFontColor
|
||||
syntax keyword plantumlSkinparamKeyword PartitionFontName PartitionFontSize PartitionFontStyle QueueBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword QueueBorderColor QueueFontColor QueueFontName QueueFontSize QueueFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontColor QueueStereotypeFontName QueueStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontStyle Ranksep RectangleBackgroundColor RectangleBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword RectangleBorderThickness RectangleFontColor RectangleFontName RectangleFontSize
|
||||
syntax keyword plantumlSkinparamKeyword RectangleFontStyle RectangleStereotypeFontColor RectangleStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword RectangleStereotypeFontSize RectangleStereotypeFontStyle RoundCorner
|
||||
syntax keyword plantumlSkinparamKeyword SameClassWidth SequenceActorBorderThickness SequenceArrowThickness
|
||||
syntax keyword plantumlSkinparamKeyword SequenceBoxBackgroundColor SequenceBoxBorderColor SequenceBoxFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceBoxFontName SequenceBoxFontSize SequenceBoxFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDelayFontColor SequenceDelayFontName SequenceDelayFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDelayFontStyle SequenceDividerBackgroundColor SequenceDividerBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDividerBorderThickness SequenceDividerFontColor SequenceDividerFontName
|
||||
syntax keyword plantumlSkinparamKeyword SequenceDividerFontSize SequenceDividerFontStyle SequenceGroupBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupBodyBackgroundColor SequenceGroupBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupBorderThickness SequenceGroupFontColor SequenceGroupFontName
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupFontSize SequenceGroupFontStyle SequenceGroupHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupHeaderFontName SequenceGroupHeaderFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceGroupHeaderFontStyle SequenceLifeLineBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceLifeLineBorderColor SequenceLifeLineBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword SequenceNewpageSeparatorColor SequenceParticipant
|
||||
syntax keyword plantumlSkinparamKeyword SequenceParticipantBorderThickness SequenceReferenceBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceBorderColor SequenceReferenceBorderThickness
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceFontColor SequenceReferenceFontName SequenceReferenceFontSize
|
||||
syntax keyword plantumlSkinparamKeyword SequenceReferenceFontStyle SequenceReferenceHeaderBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontColor SequenceStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontSize SequenceStereotypeFontStyle SequenceTitleFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SequenceTitleFontName SequenceTitleFontSize SequenceTitleFontStyle Shadowing
|
||||
syntax keyword plantumlSkinparamKeyword StackBackgroundColor StackBorderColor StackFontColor StackFontName StackFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StackFontStyle StackStereotypeFontColor StackStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword StackStereotypeFontSize StackStereotypeFontStyle StateAttributeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword StateAttributeFontName StateAttributeFontSize StateAttributeFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword StateBackgroundColor StateBorderColor StateEndColor StateFontColor StateFontName
|
||||
syntax keyword plantumlSkinparamKeyword StateFontSize StateFontStyle StateStartColor StereotypeABackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeCBackgroundColor StereotypeEBackgroundColor StereotypeIBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeNBackgroundColor StereotypePosition StorageBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword StorageBorderColor StorageFontColor StorageFontName StorageFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StorageFontStyle StorageStereotypeFontColor StorageStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword StorageStereotypeFontSize StorageStereotypeFontStyle Style SvglinkTarget
|
||||
syntax keyword plantumlSkinparamKeyword SwimlaneBorderColor SwimlaneBorderThickness SwimlaneTitleFontColor
|
||||
syntax keyword plantumlSkinparamKeyword SwimlaneTitleFontName SwimlaneTitleFontSize SwimlaneTitleFontStyle TabSize
|
||||
syntax keyword plantumlSkinparamKeyword TitleBackgroundColor TitleBorderColor TitleBorderRoundCorner
|
||||
syntax keyword plantumlSkinparamKeyword TitleBorderThickness TitleFontColor TitleFontName TitleFontSize TitleFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseBackgroundColor UsecaseBorderColor UsecaseFontColor UsecaseFontName
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseFontSize UsecaseFontStyle UsecaseStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword UsecaseStereotypeFontName UsecaseStereotypeFontSize UsecaseStereotypeFontStyle
|
||||
" Not in 'java - jar plantuml.jar - language' output
|
||||
syntax keyword plantumlSkinparamKeyword activityArrowColor activityArrowFontColor activityArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword activityArrowFontSize activityArrowFontStyle activityBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword activityBarColor activityBorderColor activityEndColor activityFontColor
|
||||
syntax keyword plantumlSkinparamKeyword activityFontName activityFontSize activityFontStyle activityStartColor
|
||||
syntax keyword plantumlSkinparamKeyword backgroundColor circledCharacterFontColor circledCharacterFontName
|
||||
syntax keyword plantumlSkinparamKeyword circledCharacterFontSize circledCharacterFontStyle circledCharacterRadius
|
||||
syntax keyword plantumlSkinparamKeyword classArrowColor classArrowFontColor classArrowFontName classArrowFontSize
|
||||
syntax keyword plantumlSkinparamKeyword classArrowFontStyle classAttributeFontColor classAttributeFontName
|
||||
syntax keyword plantumlSkinparamKeyword classAttributeFontSize classAttributeFontStyle classAttributeIconSize
|
||||
syntax keyword plantumlSkinparamKeyword classBackgroundColor classBorderColor classFontColor classFontName
|
||||
syntax keyword plantumlSkinparamKeyword classFontSize classFontStyle classStereotypeFontColor classStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword classStereotypeFontSize classStereotypeFontStyle componentArrowColor
|
||||
syntax keyword plantumlSkinparamKeyword activityArrowFontSize activityArrowFontStyle BarColor BorderColor BoxPadding
|
||||
syntax keyword plantumlSkinparamKeyword CharacterFontColor CharacterFontName CharacterFontSize CharacterFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword CharacterRadius classArrowColor classArrowFontColor classArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword classArrowFontSize classArrowFontStyle Color componentArrowColor
|
||||
syntax keyword plantumlSkinparamKeyword componentArrowFontColor componentArrowFontName componentArrowFontSize
|
||||
syntax keyword plantumlSkinparamKeyword componentArrowFontStyle componentBackgroundColor componentBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword componentFontColor componentFontName componentFontSize componentFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword componentInterfaceBackgroundColor componentInterfaceBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword componentStereotypeFontColor componentStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword componentStereotypeFontSize componentStereotypeFontStyle footerFontColor
|
||||
syntax keyword plantumlSkinparamKeyword footerFontName footerFontSize footerFontStyle headerFontColor headerFontName
|
||||
syntax keyword plantumlSkinparamKeyword headerFontSize headerFontStyle noteBackgroundColor noteBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword noteFontColor noteFontName noteFontSize noteFontStyle packageBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword packageBorderColor packageFontColor packageFontName packageFontSize
|
||||
syntax keyword plantumlSkinparamKeyword packageFontStyle sequenceActorBackgroundColor sequenceActorBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorFontColor sequenceActorFontName sequenceActorFontSize
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorFontStyle sequenceArrowColor sequenceArrowFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceArrowFontName sequenceArrowFontSize sequenceArrowFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceDividerBackgroundColor sequenceDividerFontColor sequenceDividerFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceDividerFontSize sequenceDividerFontStyle sequenceGroupBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingFontColor sequenceGroupingFontName sequenceGroupingFontSize
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingFontStyle sequenceGroupingHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontName sequenceGroupingHeaderFontSize
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontStyle sequenceLifeLineBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceLifeLineBorderColor sequenceParticipantBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantBorderColor sequenceParticipantFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontName sequenceParticipantFontSize
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontStyle sequenceTitleFontColor sequenceTitleFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceTitleFontSize sequenceTitleFontStyle stateArrowColor
|
||||
syntax keyword plantumlSkinparamKeyword stateArrowFontColor stateArrowFontName stateArrowFontSize stateArrowFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword stateAttributeFontColor stateAttributeFontName stateAttributeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword stateAttributeFontStyle stateBackgroundColor stateBorderColor stateEndColor
|
||||
syntax keyword plantumlSkinparamKeyword stateFontColor stateFontName stateFontSize stateFontStyle stateStartColor
|
||||
syntax keyword plantumlSkinparamKeyword stereotypeABackgroundColor stereotypeCBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword stereotypeEBackgroundColor stereotypeIBackgroundColor titleFontColor
|
||||
syntax keyword plantumlSkinparamKeyword titleFontName titleFontSize titleFontStyle usecaseActorBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorBorderColor usecaseActorFontColor usecaseActorFontName
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorFontSize usecaseActorFontStyle usecaseActorStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword componentArrowFontStyle componentInterfaceBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword componentInterfaceBorderColor DividerBackgroundColor DividerFontColor
|
||||
syntax keyword plantumlSkinparamKeyword DividerFontName DividerFontSize DividerFontStyle EndColor FontColor FontName
|
||||
syntax keyword plantumlSkinparamKeyword FontSize FontStyle GroupBackgroundColor GroupingFontColor GroupingFontName
|
||||
syntax keyword plantumlSkinparamKeyword GroupingFontSize GroupingFontStyle GroupingHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword GroupingHeaderFontName GroupingHeaderFontSize GroupingHeaderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword LifeLineBackgroundColor LifeLineBorderColor ParticipantPadding
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorBackgroundColor sequenceActorBorderColor sequenceActorFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceActorFontName sequenceActorFontSize sequenceActorFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceArrowColor sequenceArrowFontColor sequenceArrowFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceArrowFontSize sequenceArrowFontStyle sequenceGroupingFontColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingFontName sequenceGroupingFontSize sequenceGroupingFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontColor sequenceGroupingHeaderFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceGroupingHeaderFontSize sequenceGroupingHeaderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantBackgroundColor sequenceParticipantBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontColor sequenceParticipantFontName
|
||||
syntax keyword plantumlSkinparamKeyword sequenceParticipantFontSize sequenceParticipantFontStyle StartColor
|
||||
syntax keyword plantumlSkinparamKeyword stateArrowColor stateArrowFontColor stateArrowFontName stateArrowFontSize
|
||||
syntax keyword plantumlSkinparamKeyword stateArrowFontStyle StereotypeFontColor StereotypeFontName StereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeFontStyle usecaseActorBackgroundColor usecaseActorBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorFontColor usecaseActorFontName usecaseActorFontSize
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorFontStyle usecaseActorStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorStereotypeFontName usecaseActorStereotypeFontSize
|
||||
syntax keyword plantumlSkinparamKeyword usecaseActorStereotypeFontStyle usecaseArrowColor usecaseArrowFontColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseArrowFontName usecaseArrowFontSize usecaseArrowFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword usecaseBackgroundColor usecaseBorderColor usecaseFontColor usecaseFontName
|
||||
syntax keyword plantumlSkinparamKeyword usecaseFontSize usecaseFontStyle usecaseStereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword usecaseStereotypeFontName usecaseStereotypeFontSize usecaseStereotypeFontStyle
|
||||
|
||||
syntax keyword plantumlSkinparamKeyword ActorBackgroundColor ActorBorderColor ActorFontColor ActorFontName
|
||||
syntax keyword plantumlSkinparamKeyword ActorFontSize ActorFontStyle ActorStereotypeFontColor ActorStereotypeFontName
|
||||
syntax keyword plantumlSkinparamKeyword ActorStereotypeFontSize ActorStereotypeFontStyle ArrowColor ArrowFontColor
|
||||
syntax keyword plantumlSkinparamKeyword ArrowFontName ArrowFontSize ArrowFontStyle AttributeFontColor AttributeFontName
|
||||
syntax keyword plantumlSkinparamKeyword AttributeFontSize AttributeFontStyle AttributeIconSize BarColor
|
||||
syntax keyword plantumlSkinparamKeyword BorderColor BoxPadding CharacterFontColor CharacterFontName CharacterFontSize
|
||||
syntax keyword plantumlSkinparamKeyword CharacterFontStyle CharacterRadius Color DividerBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword DividerFontColor DividerFontName DividerFontSize DividerFontStyle EndColor
|
||||
syntax keyword plantumlSkinparamKeyword FontColor FontName FontSize FontStyle GroupBackgroundColor GroupingFontColor
|
||||
syntax keyword plantumlSkinparamKeyword GroupingFontName GroupingFontSize GroupingFontStyle GroupingHeaderFontColor
|
||||
syntax keyword plantumlSkinparamKeyword GroupingHeaderFontName GroupingHeaderFontSize GroupingHeaderFontStyle
|
||||
syntax keyword plantumlSkinparamKeyword InterfaceBackgroundColor InterfaceBorderColor LifeLineBackgroundColor
|
||||
syntax keyword plantumlSkinparamKeyword LifeLineBorderColor ParticipantBackgroundColor ParticipantBorderColor
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantFontColor ParticipantFontName ParticipantFontSize
|
||||
syntax keyword plantumlSkinparamKeyword ParticipantFontStyle ParticipantPadding StartColor StereotypeFontColor
|
||||
syntax keyword plantumlSkinparamKeyword StereotypeFontName StereotypeFontSize StereotypeFontStyle
|
||||
syntax case match
|
||||
|
||||
" Highlight
|
||||
highlight default link plantumlCommentTODO Todo
|
||||
@ -151,8 +281,8 @@ highlight default link plantumlPreProc PreProc
|
||||
highlight default link plantumlDir Constant
|
||||
highlight default link plantumlColor Constant
|
||||
highlight default link plantumlHorizontalArrow Identifier
|
||||
highlight default link plantumlDirectedOrVerticalArrowLR Special
|
||||
highlight default link plantumlDirectedOrVerticalArrowRL Special
|
||||
highlight default link plantumlDirectedOrVerticalArrowLR Identifier
|
||||
highlight default link plantumlDirectedOrVerticalArrowRL Identifier
|
||||
highlight default link plantumlLabel Special
|
||||
highlight default link plantumlText Label
|
||||
highlight default link plantumlClass Type
|
||||
@ -161,6 +291,8 @@ highlight default link plantumlClassPrivate Macro
|
||||
highlight default link plantumlClassProtected Statement
|
||||
highlight default link plantumlClassPackPrivate Function
|
||||
highlight default link plantumlClassSeparator Comment
|
||||
highlight default link plantumlSequenceDivider Comment
|
||||
highlight default link plantumlSequenceSpace Comment
|
||||
highlight default link plantumlSpecialString Special
|
||||
highlight default link plantumlString String
|
||||
highlight default link plantumlComment Comment
|
||||
@ -169,6 +301,8 @@ highlight default link plantumlColonLine Comment
|
||||
highlight default link plantumlActivityThing Type
|
||||
highlight default link plantumlActivitySynch Type
|
||||
highlight default link plantumlSkinparamKeyword Identifier
|
||||
highlight default link plantumlUsecaseActor String
|
||||
highlight default link plantumlStereotype Type
|
||||
|
||||
let &cpo=s:cpo_orig
|
||||
unlet s:cpo_orig
|
||||
|
@ -39,7 +39,9 @@ syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
|
||||
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
|
||||
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
|
||||
syn region pugAngular2 start="(" end=")" contains=htmlEvent
|
||||
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
|
||||
syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained
|
||||
syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained
|
||||
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
|
||||
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
|
||||
syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
|
||||
syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
|
||||
@ -101,6 +103,7 @@ hi def link pugCommentTodo Todo
|
||||
hi def link pugComment Comment
|
||||
hi def link pugCommentBlock Comment
|
||||
hi def link pugHtmlConditionalComment pugComment
|
||||
hi def link pugJavascriptString String
|
||||
|
||||
let b:current_syntax = "pug"
|
||||
|
||||
|
@ -124,6 +124,8 @@ syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*
|
||||
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
||||
syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
|
||||
|
||||
syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
|
||||
syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
|
||||
syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
|
||||
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||
@ -159,10 +161,10 @@ syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION
|
||||
" Normal Regular Expression {{{1
|
||||
if s:foldable('/')
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||
else
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial
|
||||
endif
|
||||
|
||||
" Generalized Regular Expression {{{1
|
||||
@ -313,8 +315,8 @@ end
|
||||
syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite
|
||||
syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable
|
||||
syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
|
||||
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyOperator
|
||||
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyOperator
|
||||
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
|
||||
syn match rubyFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
|
||||
syn match rubyFunction "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
||||
@ -500,6 +502,8 @@ else
|
||||
endif
|
||||
hi def link rubyClassVariable rubyIdentifier
|
||||
hi def link rubyConstant Type
|
||||
hi def link rubyClassName rubyConstant
|
||||
hi def link rubyModuleName rubyConstant
|
||||
hi def link rubyGlobalVariable rubyIdentifier
|
||||
hi def link rubyBlockParameter rubyIdentifier
|
||||
hi def link rubyInstanceVariable rubyIdentifier
|
||||
|
@ -152,7 +152,6 @@ syntax keyword swiftKeywords
|
||||
\ public
|
||||
\ repeat
|
||||
\ required
|
||||
\ rethrows
|
||||
\ return
|
||||
\ self
|
||||
\ set
|
||||
@ -161,7 +160,6 @@ syntax keyword swiftKeywords
|
||||
\ super
|
||||
\ switch
|
||||
\ throw
|
||||
\ throws
|
||||
\ try
|
||||
\ typealias
|
||||
\ unowned
|
||||
@ -171,6 +169,10 @@ syntax keyword swiftKeywords
|
||||
\ while
|
||||
\ willSet
|
||||
|
||||
syntax keyword swiftDefinitionModifier
|
||||
\ rethrows
|
||||
\ throws
|
||||
|
||||
syntax match swiftMultiwordKeywords "indirect case"
|
||||
syntax match swiftMultiwordKeywords "indirect enum"
|
||||
" }}}
|
||||
@ -226,6 +228,7 @@ syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType tr
|
||||
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
|
||||
syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline
|
||||
syntax match swiftType "\v<\u\w*" contained containedin=swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper,swiftTypeCastWrapper
|
||||
syntax match swiftTypeDeclaration /->/ skipwhite nextgroup=swiftType
|
||||
|
||||
syntax keyword swiftImports import
|
||||
syntax keyword swiftCastKeyword is as contained
|
||||
@ -255,6 +258,7 @@ highlight default link swiftMarker Comment
|
||||
|
||||
highlight default link swiftString String
|
||||
highlight default link swiftInterpolatedWrapper Delimiter
|
||||
highlight default link swiftTypeDeclaration Delimiter
|
||||
highlight default link swiftNumber Number
|
||||
highlight default link swiftBoolean Boolean
|
||||
|
||||
@ -273,6 +277,7 @@ highlight default link swiftPreprocessor PreProc
|
||||
highlight default link swiftMethod Function
|
||||
highlight default link swiftProperty Identifier
|
||||
|
||||
highlight default link swiftDefinitionModifier Define
|
||||
highlight default link swiftConditionStatement PreProc
|
||||
highlight default link swiftAvailability Normal
|
||||
highlight default link swiftAvailabilityArg Normal
|
||||
|
@ -42,6 +42,7 @@ syn keyword terraDataTypeBI
|
||||
\ aws_elb_service_account
|
||||
\ aws_iam_account_alias
|
||||
\ aws_iam_policy_document
|
||||
\ aws_iam_role
|
||||
\ aws_iam_server_certificate
|
||||
\ aws_instance
|
||||
\ aws_ip_ranges
|
||||
@ -54,14 +55,25 @@ syn keyword terraDataTypeBI
|
||||
\ aws_route_table
|
||||
\ aws_s3_bucket_object
|
||||
\ aws_security_group
|
||||
\ aws_sns_topic
|
||||
\ aws_subnet
|
||||
\ aws_subnet_ids
|
||||
\ aws_vpc
|
||||
\ aws_vpc_endpoint
|
||||
\ aws_vpc_endpoint_service
|
||||
\ aws_vpc_peering_connection
|
||||
\ aws_vpn_gateway
|
||||
\ azurerm_client_config
|
||||
\ circonus_account
|
||||
\ circonus_collector
|
||||
\ consul_agent_self
|
||||
\ consul_catalog_nodes
|
||||
\ consul_catalog_service
|
||||
\ consul_catalog_services
|
||||
\ consul_keys
|
||||
\ dns_a_record_set
|
||||
\ dns_cname_record_set
|
||||
\ dns_txt_record_set
|
||||
\ docker_registry_image
|
||||
\ external
|
||||
\ fastly_ip_ranges
|
||||
@ -70,11 +82,16 @@ syn keyword terraDataTypeBI
|
||||
\ newrelic_application
|
||||
\ ns1_datasource
|
||||
\ null_data_source
|
||||
\ openstack_images_image_v2
|
||||
\ openstack_networking_network_v2
|
||||
\ opsgenie_user
|
||||
\ pagerduty_escalation_policy
|
||||
\ pagerduty_schedule
|
||||
\ pagerduty_user
|
||||
\ pagerduty_vendor
|
||||
\ profitbricks_datacenter
|
||||
\ profitbricks_image
|
||||
\ profitbricks_location
|
||||
\ scaleway_bootscript
|
||||
\ scaleway_image
|
||||
\ template_cloudinit_config
|
||||
@ -84,6 +101,7 @@ syn keyword terraDataTypeBI
|
||||
|
||||
""" resource
|
||||
syn keyword terraResourceTypeBI
|
||||
\ alicloud_db_instance
|
||||
\ alicloud_disk
|
||||
\ alicloud_disk_attachment
|
||||
\ alicloud_eip
|
||||
@ -120,9 +138,13 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_api_gateway_integration_response
|
||||
\ aws_api_gateway_method
|
||||
\ aws_api_gateway_method_response
|
||||
\ aws_api_gateway_method_settings
|
||||
\ aws_api_gateway_model
|
||||
\ aws_api_gateway_resource
|
||||
\ aws_api_gateway_rest_api
|
||||
\ aws_api_gateway_stage
|
||||
\ aws_api_gateway_usage_plan
|
||||
\ aws_api_gateway_usage_plan_key
|
||||
\ aws_app_cookie_stickiness_policy
|
||||
\ aws_appautoscaling_policy
|
||||
\ aws_appautoscaling_target
|
||||
@ -138,6 +160,8 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_cloudtrail
|
||||
\ aws_cloudwatch_event_rule
|
||||
\ aws_cloudwatch_event_target
|
||||
\ aws_cloudwatch_log_destination
|
||||
\ aws_cloudwatch_log_destination_policy
|
||||
\ aws_cloudwatch_log_group
|
||||
\ aws_cloudwatch_log_metric_filter
|
||||
\ aws_cloudwatch_log_stream
|
||||
@ -149,6 +173,7 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_codedeploy_app
|
||||
\ aws_codedeploy_deployment_config
|
||||
\ aws_codedeploy_deployment_group
|
||||
\ aws_codepipeline
|
||||
\ aws_config_config_rule
|
||||
\ aws_config_configuration_recorder
|
||||
\ aws_config_configuration_recorder_status
|
||||
@ -179,9 +204,11 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_ecs_task_definition
|
||||
\ aws_efs_file_system
|
||||
\ aws_efs_mount_target
|
||||
\ aws_egress_only_internet_gateway
|
||||
\ aws_eip
|
||||
\ aws_eip_association
|
||||
\ aws_elastic_beanstalk_application
|
||||
\ aws_elastic_beanstalk_application_version
|
||||
\ aws_elastic_beanstalk_configuration_template
|
||||
\ aws_elastic_beanstalk_environment
|
||||
\ aws_elasticache_cluster
|
||||
@ -200,12 +227,14 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_flow_log
|
||||
\ aws_glacier_vault
|
||||
\ aws_iam_access_key
|
||||
\ aws_iam_account_alias
|
||||
\ aws_iam_account_password_policy
|
||||
\ aws_iam_group
|
||||
\ aws_iam_group_membership
|
||||
\ aws_iam_group_policy
|
||||
\ aws_iam_group_policy_attachment
|
||||
\ aws_iam_instance_profile
|
||||
\ aws_iam_openid_connect_provider
|
||||
\ aws_iam_policy
|
||||
\ aws_iam_policy_attachment
|
||||
\ aws_iam_role
|
||||
@ -238,6 +267,8 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_lightsail_domain
|
||||
\ aws_lightsail_instance
|
||||
\ aws_lightsail_key_pair
|
||||
\ aws_lightsail_static_ip
|
||||
\ aws_lightsail_static_ip_attachment
|
||||
\ aws_load_balancer_backend_server_policy
|
||||
\ aws_load_balancer_listener_policy
|
||||
\ aws_load_balancer_policy
|
||||
@ -287,6 +318,7 @@ syn keyword terraResourceTypeBI
|
||||
\ aws_security_group_rule
|
||||
\ aws_ses_active_receipt_rule_set
|
||||
\ aws_ses_configuration_set
|
||||
\ aws_ses_domain_identity
|
||||
\ aws_ses_event_destination
|
||||
\ aws_ses_receipt_filter
|
||||
\ aws_ses_receipt_rule
|
||||
@ -367,6 +399,7 @@ syn keyword terraResourceTypeBI
|
||||
\ azurerm_lb_probe
|
||||
\ azurerm_lb_rule
|
||||
\ azurerm_local_network_gateway
|
||||
\ azurerm_managed_disk
|
||||
\ azurerm_network_interface
|
||||
\ azurerm_network_security_group
|
||||
\ azurerm_network_security_rule
|
||||
@ -408,6 +441,12 @@ syn keyword terraResourceTypeBI
|
||||
\ chef_environment
|
||||
\ chef_node
|
||||
\ chef_role
|
||||
\ circonus_check
|
||||
\ circonus_contact_group
|
||||
\ circonus_graph
|
||||
\ circonus_metric
|
||||
\ circonus_metric_cluster
|
||||
\ circonus_rule_set
|
||||
\ clc_group
|
||||
\ clc_load_balancer
|
||||
\ clc_load_balancer_pool
|
||||
@ -450,16 +489,23 @@ syn keyword terraResourceTypeBI
|
||||
\ consul_node
|
||||
\ consul_prepared_query
|
||||
\ consul_service
|
||||
\ datadog_downtime
|
||||
\ datadog_monitor
|
||||
\ datadog_timeboard
|
||||
\ datadog_user
|
||||
\ digitalocean_domain
|
||||
\ digitalocean_droplet
|
||||
\ digitalocean_floating_ip
|
||||
\ digitalocean_loadbalancer
|
||||
\ digitalocean_record
|
||||
\ digitalocean_ssh_key
|
||||
\ digitalocean_tag
|
||||
\ digitalocean_volume
|
||||
\ dme_record
|
||||
\ dns_a_record_set
|
||||
\ dns_aaaa_record_set
|
||||
\ dns_cname_record
|
||||
\ dns_ptr_record
|
||||
\ dnsimple_record
|
||||
\ docker_container
|
||||
\ docker_image
|
||||
@ -469,8 +515,10 @@ syn keyword terraResourceTypeBI
|
||||
\ fastly_service_v1
|
||||
\ github_issue_label
|
||||
\ github_membership
|
||||
\ github_organization_webhook
|
||||
\ github_repository
|
||||
\ github_repository_collaborator
|
||||
\ github_repository_webhook
|
||||
\ github_team
|
||||
\ github_team_membership
|
||||
\ github_team_repository
|
||||
@ -503,6 +551,7 @@ syn keyword terraResourceTypeBI
|
||||
\ google_compute_vpn_gateway
|
||||
\ google_compute_vpn_tunnel
|
||||
\ google_container_cluster
|
||||
\ google_container_node_pool
|
||||
\ google_dns_managed_zone
|
||||
\ google_dns_record_set
|
||||
\ google_project
|
||||
@ -539,6 +588,11 @@ syn keyword terraResourceTypeBI
|
||||
\ influxdb_continuous_query
|
||||
\ influxdb_database
|
||||
\ influxdb_user
|
||||
\ kubernetes_config_map
|
||||
\ kubernetes_namespace
|
||||
\ kubernetes_persistent_volume
|
||||
\ kubernetes_persistent_volume_claim
|
||||
\ kubernetes_secret
|
||||
\ librato_alert
|
||||
\ librato_service
|
||||
\ librato_space
|
||||
@ -558,6 +612,7 @@ syn keyword terraResourceTypeBI
|
||||
\ openstack_blockstorage_volume_attach_v2
|
||||
\ openstack_blockstorage_volume_v1
|
||||
\ openstack_blockstorage_volume_v2
|
||||
\ openstack_compute_floatingip_associate_v2
|
||||
\ openstack_compute_floatingip_v2
|
||||
\ openstack_compute_instance_v2
|
||||
\ openstack_compute_keypair_v2
|
||||
@ -567,6 +622,7 @@ syn keyword terraResourceTypeBI
|
||||
\ openstack_fw_firewall_v1
|
||||
\ openstack_fw_policy_v1
|
||||
\ openstack_fw_rule_v1
|
||||
\ openstack_images_image_v2
|
||||
\ openstack_lb_listener_v2
|
||||
\ openstack_lb_loadbalancer_v2
|
||||
\ openstack_lb_member_v1
|
||||
@ -619,12 +675,15 @@ syn keyword terraResourceTypeBI
|
||||
\ rabbitmq_queue
|
||||
\ rabbitmq_user
|
||||
\ rabbitmq_vhost
|
||||
\ rancher_certificate
|
||||
\ rancher_environment
|
||||
\ rancher_host
|
||||
\ rancher_registration_token
|
||||
\ rancher_registry
|
||||
\ rancher_registry_credential
|
||||
\ rancher_stack
|
||||
\ random_id
|
||||
\ random_pet
|
||||
\ random_shuffle
|
||||
\ rundeck_job
|
||||
\ rundeck_private_key
|
||||
@ -638,6 +697,9 @@ syn keyword terraResourceTypeBI
|
||||
\ scaleway_volume_attachment
|
||||
\ softlayer_ssh_key
|
||||
\ softlayer_virtual_guest
|
||||
\ spotinst_aws_group
|
||||
\ spotinst_healthcheck
|
||||
\ spotinst_subscription
|
||||
\ statuscake_test
|
||||
\ tls_cert_request
|
||||
\ tls_locally_signed_cert
|
||||
|
@ -28,7 +28,7 @@ endif
|
||||
setlocal iskeyword+=-
|
||||
syntax case match
|
||||
|
||||
syn keyword tmuxAction any current none
|
||||
syn keyword tmuxAction any current default none
|
||||
syn keyword tmuxBoolean off on
|
||||
|
||||
syn keyword tmuxCmds
|
||||
@ -261,24 +261,36 @@ syn keyword tmuxOptsSetw
|
||||
\ force-width
|
||||
\ main-pane-height
|
||||
\ main-pane-width
|
||||
\ message-attr
|
||||
\ message-bg
|
||||
\ message-fg
|
||||
\ mode-keys
|
||||
\ mode-style
|
||||
\ monitor-activity
|
||||
\ monitor-silence
|
||||
\ other-pane-height
|
||||
\ other-pane-width
|
||||
\ pane-active-border-bg
|
||||
\ pane-active-border-fg
|
||||
\ pane-active-border-style
|
||||
\ pane-base-index
|
||||
\ pane-border-fg
|
||||
\ pane-border-style
|
||||
\ remain-on-exit
|
||||
\ synchronize-panes
|
||||
\ window-active-style
|
||||
\ window-status-activity-attr
|
||||
\ window-status-activity-bg
|
||||
\ window-status-activity-fg
|
||||
\ window-status-activity-style
|
||||
\ window-status-bell-style
|
||||
\ window-status-bg
|
||||
\ window-status-current-attr
|
||||
\ window-status-current-bg
|
||||
\ window-status-current-fg
|
||||
\ window-status-current-format
|
||||
\ window-status-current-style
|
||||
\ window-status-fg
|
||||
\ window-status-format
|
||||
\ window-status-last-style
|
||||
\ window-status-separator
|
||||
@ -290,7 +302,7 @@ syn keyword tmuxOptsSetw
|
||||
syn keyword tmuxTodo FIXME NOTE TODO XXX contained
|
||||
|
||||
syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
|
||||
syn match tmuxNumber /\d\+/ display
|
||||
syn match tmuxNumber /\<\d\+\>/ display
|
||||
syn match tmuxOptions /\s-\a\+/ display
|
||||
syn match tmuxVariable /\w\+=/ display
|
||||
syn match tmuxVariableExpansion /\${\=\w\+}\=/ display
|
||||
|
119
syntax/vue.vim
119
syntax/vue.vim
@ -8,90 +8,55 @@ if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("s:syntaxes")
|
||||
" Search available syntax files.
|
||||
function s:search_syntaxes(...)
|
||||
let syntaxes = {}
|
||||
let names = a:000
|
||||
for name in names
|
||||
let syntaxes[name] = 0
|
||||
endfor
|
||||
|
||||
for path in split(&runtimepath, ',')
|
||||
if isdirectory(path . '/syntax')
|
||||
for name in names
|
||||
let syntaxes[name] = syntaxes[name] || filereadable(path . '/syntax/' . name . '.vim')
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
return syntaxes
|
||||
endfunction
|
||||
|
||||
let s:syntaxes = s:search_syntaxes('pug', 'slm', 'coffee', 'stylus', 'sass', 'scss', 'less', 'typescript')
|
||||
endif
|
||||
|
||||
|
||||
syntax include @HTML syntax/html.vim
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region html keepend start=/^<template\_[^>]*>/ end=/^<\/template>/ contains=@HTML fold
|
||||
|
||||
if s:syntaxes.pug
|
||||
syntax include @PUG syntax/pug.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region pug keepend start=/<template lang=\("\|'\)[^\1]*pug[^\1]*\1>/ end="</template>" contains=@PUG fold
|
||||
syntax region pug keepend start=/<template lang=\("\|'\)[^\1]*jade[^\1]*\1>/ end="</template>" contains=@PUG fold
|
||||
endif
|
||||
""
|
||||
" Get the pattern for a HTML {name} attribute with {value}.
|
||||
function! s:attr(name, value)
|
||||
return a:name . '=\("\|''\)[^\1]*' . a:value . '[^\1]*\1'
|
||||
endfunction
|
||||
|
||||
if s:syntaxes.slm
|
||||
syntax include @SLM syntax/slm.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region slm keepend start=/<template lang=\("\|'\)[^\1]*slm[^\1]*\1>/ end="</template>" contains=@SLM fold
|
||||
endif
|
||||
""
|
||||
" Check whether a syntax file for a given {language} exists.
|
||||
function! s:syntax_available(language)
|
||||
return !empty(globpath(&runtimepath, 'syntax/' . a:language . '.vim'))
|
||||
endfunction
|
||||
|
||||
syntax include @JS syntax/javascript.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region javascript keepend matchgroup=Delimiter start=/<script\( lang="babel"\)\?\( type="text\/babel"\)\?>/ end="</script>" contains=@JS fold
|
||||
""
|
||||
" Register {language} for a given {tag}. If [attr_override] is given and not
|
||||
" empty, it will be used for the attribute pattern.
|
||||
function! s:register_language(language, tag, ...)
|
||||
let attr_override = a:0 ? a:1 : ''
|
||||
let attr = !empty(attr_override) ? attr_override : s:attr('lang', a:language)
|
||||
|
||||
if s:syntaxes.typescript
|
||||
syntax include @TS syntax/typescript.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region typescript keepend matchgroup=Delimiter start=/<script \_[^>]*\(lang=\("\|'\)[^\2]*\(ts\|typescript\)[^\2]*\2\|ts\)\_[^>]*>/ end="</script>" contains=@TS fold
|
||||
endif
|
||||
if s:syntax_available(a:language)
|
||||
execute 'syntax include @' . a:language . ' syntax/' . a:language . '.vim'
|
||||
unlet! b:current_syntax
|
||||
execute 'syntax region vue_' . a:language
|
||||
\ 'keepend'
|
||||
\ 'start=/<' . a:tag . ' \_[^>]*' . attr . '\_[^>]*>/'
|
||||
\ 'end="</' . a:tag . '>"me=s-1'
|
||||
\ 'contains=@' . a:language . ',vueSurroundingTag'
|
||||
\ 'fold'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if s:syntaxes.coffee
|
||||
syntax include @COFFEE syntax/coffee.vim
|
||||
unlet! b:current_syntax
|
||||
" Matchgroup seems to be necessary for coffee
|
||||
syntax region coffee keepend matchgroup=Delimiter start="<script lang=\"coffee\">" end="</script>" contains=@COFFEE fold
|
||||
endif
|
||||
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
|
||||
call s:register_language('slm', 'template')
|
||||
call s:register_language('handlebars', 'template')
|
||||
call s:register_language('haml', 'template')
|
||||
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
|
||||
call s:register_language('coffee', 'script')
|
||||
call s:register_language('stylus', 'style')
|
||||
call s:register_language('sass', 'style')
|
||||
call s:register_language('scss', 'style')
|
||||
call s:register_language('less', 'style')
|
||||
|
||||
syntax include @CSS syntax/css.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region css keepend start=/<style\_[^>]*>/ end="</style>" contains=@CSS fold
|
||||
|
||||
if s:syntaxes.stylus
|
||||
syntax include @stylus syntax/stylus.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region stylus keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*stylus[^\1]*\1\_[^>]*>/ end="</style>" contains=@stylus fold
|
||||
endif
|
||||
|
||||
if s:syntaxes.sass
|
||||
syntax include @sass syntax/sass.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region sass keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*sass[^\1]*\1\_[^>]*>/ end="</style>" contains=@sass fold
|
||||
endif
|
||||
|
||||
if s:syntaxes.scss
|
||||
syntax include @scss syntax/scss.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region scss keepend start=/<style \_[^>]*lang=\("\|'\)[^\1]*scss[^\1]*\1\_[^>]*>/ end="</style>" contains=@scss fold
|
||||
endif
|
||||
|
||||
if s:syntaxes.less
|
||||
syntax include @less syntax/less.vim
|
||||
unlet! b:current_syntax
|
||||
syntax region less keepend matchgroup=PreProc start=/<style \_[^>]*lang=\("\|'\)[^\1]*less[^\1]*\1\_[^>]*>/ end="</style>" contains=@less fold
|
||||
endif
|
||||
syn region vueSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
||||
syn keyword htmlSpecialTagName contained template
|
||||
syn keyword htmlArg contained scoped ts
|
||||
syn match htmlArg "[@v:][-:.0-9_a-z]*\>" contained
|
||||
|
||||
let b:current_syntax = "vue"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user