Update
This commit is contained in:
parent
055f7710b6
commit
fd74d8b2b1
@ -105,7 +105,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
||||||
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||||
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, ftplugin)
|
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, compiler, ftplugin)
|
||||||
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
||||||
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
||||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||||
|
@ -11,8 +11,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
|||||||
" modified from html.vim
|
" modified from html.vim
|
||||||
if exists("loaded_matchit")
|
if exists("loaded_matchit")
|
||||||
let b:match_ignorecase = 0
|
let b:match_ignorecase = 0
|
||||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
let s:jsx_match_words = '(:),\[:\],{:},<:>,' .
|
||||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||||
|
let b:match_words = exists('b:match_words')
|
||||||
|
\ ? b:match_words . ',' . s:jsx_match_words
|
||||||
|
\ : s:jsx_match_words
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal suffixesadd+=.jsx
|
setlocal suffixesadd+=.jsx
|
||||||
|
@ -75,4 +75,11 @@ if get(g:, "terraform_align", 1)
|
|||||||
setlocal shiftwidth=2
|
setlocal shiftwidth=2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Set the commentstring
|
||||||
|
if exists('g:terraform_commentstring')
|
||||||
|
let &l:commentstring=g:terraform_commentstring
|
||||||
|
else
|
||||||
|
setlocal commentstring=#%s
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -36,6 +36,10 @@ endif
|
|||||||
" jsBlock take care of ending the region.
|
" jsBlock take care of ending the region.
|
||||||
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
||||||
|
|
||||||
|
" JSX comments inside XML tag should color as comment. Note the trivial end pattern; we let
|
||||||
|
" jsComment take care of ending the region.
|
||||||
|
syn region xmlString contained start=+//+ end=++ contains=jsComment
|
||||||
|
|
||||||
" JSX child blocks behave just like JSX attributes, except that (a) they are
|
" JSX child blocks behave just like JSX attributes, except that (a) they are
|
||||||
" syntactically distinct, and (b) they need the syn-extend argument, or else
|
" syntactically distinct, and (b) they need the syn-extend argument, or else
|
||||||
" nested XML end-tag patterns may end the outer jsxRegion.
|
" nested XML end-tag patterns may end the outer jsxRegion.
|
||||||
@ -49,7 +53,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
|||||||
" and generic Flow type annotations (http://flowtype.org/).
|
" and generic Flow type annotations (http://flowtype.org/).
|
||||||
syn region jsxRegion
|
syn region jsxRegion
|
||||||
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
||||||
\ skip=+<!--\_.\{-}-->+
|
\ skip=+<!--\_.\{-}-->+
|
||||||
\ end=+</\z1\_\s\{-}>+
|
\ end=+</\z1\_\s\{-}>+
|
||||||
\ end=+/>+
|
\ end=+/>+
|
||||||
|
@ -21,13 +21,17 @@ if version < 600
|
|||||||
endif
|
endif
|
||||||
syntax clear
|
syntax clear
|
||||||
|
|
||||||
syn match yamlBlock "[\[\]\{\}\|\>]"
|
syn match yamlInline "[\[\]\{\}]"
|
||||||
|
syn match yamlBlock "[>|]\d\?[+-]"
|
||||||
|
|
||||||
syn region yamlComment start="\#" end="$"
|
syn region yamlComment start="\#" end="$"
|
||||||
syn match yamlIndicator "#YAML:\S\+"
|
syn match yamlIndicator "#YAML:\S\+"
|
||||||
|
|
||||||
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)'" end="'" skip="\\'"
|
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)'" end="'" skip="\\'"
|
||||||
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
||||||
|
syn region yamlString matchgroup=yamlBlock start=/[>|]\s*\n\+\z(\s\+\)\S/rs=s+1 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||||
|
syn region yamlString matchgroup=yamlBlock start=/[>|]\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+2 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||||
|
syn region yamlString matchgroup=yamlBlock start=/[>|]\d\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+3 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||||
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
||||||
syn match yamlEscape "\\\o\o\=\o\=" contained
|
syn match yamlEscape "\\\o\o\=\o\=" contained
|
||||||
syn match yamlEscape "\\x\x\+" contained
|
syn match yamlEscape "\\x\x\+" contained
|
||||||
@ -53,6 +57,7 @@ hi link yamlKey Identifier
|
|||||||
hi link yamlType Type
|
hi link yamlType Type
|
||||||
|
|
||||||
hi link yamlComment Comment
|
hi link yamlComment Comment
|
||||||
|
hi link yamlInline Operator
|
||||||
hi link yamlBlock Operator
|
hi link yamlBlock Operator
|
||||||
hi link yamlString String
|
hi link yamlString String
|
||||||
hi link yamlEscape Special
|
hi link yamlEscape Special
|
||||||
|
@ -310,6 +310,10 @@ function! crystal_lang#format(option_str, ...) abort
|
|||||||
call setpos('.', pos_save)
|
call setpos('.', pos_save)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! crystal_lang#expand(file, pos, ...) abort
|
||||||
|
return crystal_lang#tool('expand', a:file, a:pos, get(a:, 1, ''))
|
||||||
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
@ -23,22 +23,18 @@ function! elixir#indent#indent(lnum)
|
|||||||
|
|
||||||
let handlers = [
|
let handlers = [
|
||||||
\'top_of_file',
|
\'top_of_file',
|
||||||
\'starts_with_end',
|
|
||||||
\'starts_with_mid_or_end_block_keyword',
|
|
||||||
\'following_trailing_do',
|
|
||||||
\'following_trailing_rocket',
|
|
||||||
\'following_trailing_binary_operator',
|
\'following_trailing_binary_operator',
|
||||||
\'starts_with_pipe',
|
\'starts_with_pipe',
|
||||||
\'starts_with_close_bracket',
|
|
||||||
\'starts_with_binary_operator',
|
\'starts_with_binary_operator',
|
||||||
\'inside_nested_construct',
|
\'inside_block',
|
||||||
\'starts_with_comment',
|
\'starts_with_end',
|
||||||
\'inside_generic_block',
|
\'inside_generic_block',
|
||||||
\'follow_prev_nb'
|
\'follow_prev_nb'
|
||||||
\]
|
\]
|
||||||
for handler in handlers
|
for handler in handlers
|
||||||
call s:debug('testing handler elixir#indent#handle_'.handler)
|
call s:debug('testing handler elixir#indent#handle_'.handler)
|
||||||
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
|
let context = {'lnum': lnum, 'text': text, 'prev_nb_lnum': prev_nb_lnum, 'prev_nb_text': prev_nb_text}
|
||||||
|
let indent = function('elixir#indent#handle_'.handler)(context)
|
||||||
if indent != -1
|
if indent != -1
|
||||||
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
||||||
call cursor(curs_lnum, curs_col)
|
call cursor(curs_lnum, curs_col)
|
||||||
@ -57,9 +53,17 @@ function! s:debug(str)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:starts_with(context, expr)
|
||||||
|
return s:_starts_with(a:context.text, a:expr, a:context.lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:prev_starts_with(context, expr)
|
||||||
|
return s:_starts_with(a:context.prev_nb_text, a:expr, a:context.prev_nb_lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Returns 0 or 1 based on whether or not the text starts with the given
|
" Returns 0 or 1 based on whether or not the text starts with the given
|
||||||
" expression and is not a string or comment
|
" expression and is not a string or comment
|
||||||
function! s:starts_with(text, expr, lnum)
|
function! s:_starts_with(text, expr, lnum)
|
||||||
let pos = match(a:text, '^\s*'.a:expr)
|
let pos = match(a:text, '^\s*'.a:expr)
|
||||||
if pos == -1
|
if pos == -1
|
||||||
return 0
|
return 0
|
||||||
@ -74,9 +78,13 @@ function! s:starts_with(text, expr, lnum)
|
|||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:prev_ends_with(context, expr)
|
||||||
|
return s:_ends_with(a:context.prev_nb_text, a:expr, a:context.prev_nb_lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Returns 0 or 1 based on whether or not the text ends with the given
|
" Returns 0 or 1 based on whether or not the text ends with the given
|
||||||
" expression and is not a string or comment
|
" expression and is not a string or comment
|
||||||
function! s:ends_with(text, expr, lnum)
|
function! s:_ends_with(text, expr, lnum)
|
||||||
let pos = match(a:text, a:expr.'\s*$')
|
let pos = match(a:text, a:expr.'\s*$')
|
||||||
if pos == -1
|
if pos == -1
|
||||||
return 0
|
return 0
|
||||||
@ -140,16 +148,16 @@ function! s:find_last_pos(lnum, text, match)
|
|||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_top_of_file(_lnum, _text, prev_nb_lnum, _prev_nb_text)
|
function! elixir#indent#handle_top_of_file(context)
|
||||||
if a:prev_nb_lnum == 0
|
if a:context.prev_nb_lnum == 0
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_follow_prev_nb(_lnum, _text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_follow_prev_nb(context)
|
||||||
return s:get_base_indent(a:prev_nb_lnum, a:prev_nb_text)
|
return s:get_base_indent(a:context.prev_nb_lnum, a:context.prev_nb_text)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Given the line at `lnum`, returns the indent of the line that acts as the 'base indent'
|
" Given the line at `lnum`, returns the indent of the line that acts as the 'base indent'
|
||||||
@ -163,13 +171,13 @@ function! s:get_base_indent(lnum, text)
|
|||||||
let data_structure_close = '\%(\]\|}\|)\)'
|
let data_structure_close = '\%(\]\|}\|)\)'
|
||||||
let pipe = '|>'
|
let pipe = '|>'
|
||||||
|
|
||||||
if s:starts_with(a:text, binary_operator, a:lnum)
|
if s:_starts_with(a:text, binary_operator, a:lnum)
|
||||||
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
||||||
elseif s:starts_with(a:text, pipe, a:lnum)
|
elseif s:_starts_with(a:text, pipe, a:lnum)
|
||||||
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
||||||
elseif s:ends_with(prev_nb_text, binary_operator, prev_nb_lnum)
|
elseif s:_ends_with(prev_nb_text, binary_operator, prev_nb_lnum)
|
||||||
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
|
||||||
elseif s:ends_with(a:text, data_structure_close, a:lnum)
|
elseif s:_ends_with(a:text, data_structure_close, a:lnum)
|
||||||
let data_structure_open = '\%(\[\|{\|(\)'
|
let data_structure_open = '\%(\[\|{\|(\)'
|
||||||
let close_match_idx = match(a:text, data_structure_close . '\s*$')
|
let close_match_idx = match(a:text, data_structure_close . '\s*$')
|
||||||
call cursor(a:lnum, close_match_idx + 1)
|
call cursor(a:lnum, close_match_idx + 1)
|
||||||
@ -181,54 +189,26 @@ function! s:get_base_indent(lnum, text)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_following_trailing_binary_operator(context)
|
||||||
if s:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)
|
|
||||||
if s:starts_with(a:text, s:keyword('end'), a:lnum)
|
|
||||||
return indent(a:prev_nb_lnum)
|
|
||||||
else
|
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! elixir#indent#handle_following_trailing_rocket(lnum, text, prev_nb_lnum, prev_nb_text)
|
|
||||||
if s:ends_with(a:prev_nb_text, '->', a:prev_nb_lnum)
|
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
|
||||||
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||||
|
|
||||||
if s:ends_with(a:prev_nb_text, binary_operator, a:prev_nb_lnum)
|
if s:prev_ends_with(a:context, binary_operator)
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_following_prev_end(_lnum, _text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_starts_with_pipe(context)
|
||||||
if s:ends_with(a:prev_nb_text, s:keyword('end'), a:prev_nb_lnum)
|
if s:starts_with(a:context, '|>')
|
||||||
return indent(a:prev_nb_lnum)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_nb_text)
|
|
||||||
if s:starts_with(a:text, '|>', a:lnum)
|
|
||||||
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||||
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
let pos = s:find_last_pos(a:context.prev_nb_lnum, a:context.prev_nb_text, match_operator)
|
||||||
if pos == -1
|
if pos == -1
|
||||||
return indent(a:prev_nb_lnum)
|
return indent(a:context.prev_nb_lnum)
|
||||||
else
|
else
|
||||||
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
let next_word_pos = match(strpart(a:context.prev_nb_text, pos+1, len(a:context.prev_nb_text)-1), '\S')
|
||||||
if next_word_pos == -1
|
if next_word_pos == -1
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||||
else
|
else
|
||||||
return pos + 1 + next_word_pos
|
return pos + 1 + next_word_pos
|
||||||
end
|
end
|
||||||
@ -238,16 +218,8 @@ function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_n
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_starts_with_comment(_lnum, text, prev_nb_lnum, _prev_nb_text)
|
function! elixir#indent#handle_starts_with_end(context)
|
||||||
if match(a:text, '^\s*#') != -1
|
if s:starts_with(a:context, s:keyword('end'))
|
||||||
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 s:starts_with(a:text, s:keyword('end'), a:lnum)
|
|
||||||
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end').'\zs', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end').'\zs', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
||||||
return indent(pair_lnum)
|
return indent(pair_lnum)
|
||||||
else
|
else
|
||||||
@ -255,36 +227,18 @@ function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_starts_with_mid_or_end_block_keyword(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
function! elixir#indent#handle_starts_with_binary_operator(context)
|
||||||
if s:starts_with(a:text, s:keyword('catch\|rescue\|after\|else'), a:lnum)
|
|
||||||
let pair_lnum = searchpair(s:keyword('with\|receive\|try\|if\|fn'), s:keyword('catch\|rescue\|after\|else').'\zs', s:keyword('end'), 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
|
||||||
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 s:starts_with(a:text, '\%(\]\|}\|)\)', a:lnum)
|
|
||||||
let pair_lnum = searchpair('\%(\[\|{\|(\)', '', '\%(\]\|}\|)\)', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
|
||||||
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 = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||||
|
|
||||||
if s:starts_with(a:text, binary_operator, a:lnum)
|
if s:starts_with(a:context, binary_operator)
|
||||||
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||||
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
let pos = s:find_last_pos(a:context.prev_nb_lnum, a:context.prev_nb_text, match_operator)
|
||||||
if pos == -1
|
if pos == -1
|
||||||
return indent(a:prev_nb_lnum)
|
return indent(a:context.prev_nb_lnum)
|
||||||
else
|
else
|
||||||
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
let next_word_pos = match(strpart(a:context.prev_nb_text, pos+1, len(a:context.prev_nb_text)-1), '\S')
|
||||||
if next_word_pos == -1
|
if next_word_pos == -1
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||||
else
|
else
|
||||||
return pos + 1 + next_word_pos
|
return pos + 1 + next_word_pos
|
||||||
end
|
end
|
||||||
@ -298,162 +252,89 @@ endfunction
|
|||||||
" nested structure. For example, we might be in a function in a map in a
|
" 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
|
" function, etc... so we need to first figure out what the innermost structure
|
||||||
" is then forward execution to the proper handler
|
" is then forward execution to the proper handler
|
||||||
function! elixir#indent#handle_inside_nested_construct(lnum, text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_inside_block(context)
|
||||||
let start_pattern = '\C\%(\<with\>\|\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
|
let start_pattern = '\C\%(\<with\>\|\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
|
||||||
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
|
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
|
||||||
let pair_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", max([0, a:lnum - g:elixir_indent_max_lookbehind]))
|
" hack - handle do: better
|
||||||
let pair_lnum = pair_info[0]
|
let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||||
let pair_col = pair_info[1]
|
let block_start_lnum = block_info[0]
|
||||||
if pair_lnum != 0 || pair_col != 0
|
let block_start_col = block_info[1]
|
||||||
let pair_text = getline(pair_lnum)
|
if block_start_lnum != 0 || block_start_col != 0
|
||||||
let pair_char = pair_text[pair_col - 1]
|
let block_text = getline(block_start_lnum)
|
||||||
if pair_char == 'f'
|
let block_start_char = block_text[block_start_col - 1]
|
||||||
call s:debug("testing s:do_handle_inside_fn")
|
|
||||||
return s:do_handle_inside_fn(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
let never_match = '\(a\)\@=b'
|
||||||
elseif pair_char == '['
|
let config = {
|
||||||
call s:debug("testing s:do_handle_inside_square_brace")
|
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||||
return s:do_handle_inside_square_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||||
elseif pair_char == '{'
|
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after'), 'pattern_match_clauses': s:keyword('catch\|rescue')},
|
||||||
call s:debug("testing s:do_handle_inside_curly_brace")
|
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
|
||||||
return s:do_handle_inside_curly_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
\'i': {'aligned_clauses': s:keyword('end\|else'), 'pattern_match_clauses': never_match},
|
||||||
elseif pair_char == '('
|
\'[': {'aligned_clauses': ']', 'pattern_match_clauses': never_match},
|
||||||
call s:debug("testing s:do_handle_inside_parens")
|
\'{': {'aligned_clauses': '}', 'pattern_match_clauses': never_match},
|
||||||
return s:do_handle_inside_parens(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
\'(': {'aligned_clauses': ')', 'pattern_match_clauses': never_match}
|
||||||
elseif pair_char == 'w'
|
\}
|
||||||
call s:debug("testing s:do_handle_inside_with")
|
|
||||||
return s:do_handle_inside_with(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
if block_start_char == 'w'
|
||||||
|
call s:debug("testing s:handle_with")
|
||||||
|
return s:handle_with(block_start_lnum, block_start_col, a:context)
|
||||||
else
|
else
|
||||||
call s:debug("testing s:do_handle_inside_keyword_block")
|
let block_config = config[block_start_char]
|
||||||
return s:do_handle_inside_keyword_block(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
if s:starts_with(a:context, block_config.aligned_clauses)
|
||||||
end
|
call s:debug("clause")
|
||||||
else
|
return indent(block_start_lnum)
|
||||||
return -1
|
|
||||||
end
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:do_handle_inside_with(pair_lnum, pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
|
|
||||||
if a:pair_lnum == a:lnum
|
|
||||||
" This is the `with` line or an inline `with`/`do`
|
|
||||||
call s:debug("current line is `with`")
|
|
||||||
return -1
|
|
||||||
else
|
|
||||||
" Determine if in with/do, do/else|end, or else/end
|
|
||||||
let start_pattern = '\C\%(\<with\>\|\<else\>\|\<do\>\)'
|
|
||||||
let end_pattern = '\C\%(\<end\>\)'
|
|
||||||
let pair_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
|
||||||
let pair_lnum = pair_info[0]
|
|
||||||
let pair_col = pair_info[1]
|
|
||||||
|
|
||||||
let pair_text = getline(pair_lnum)
|
|
||||||
let pair_char = pair_text[pair_col - 1]
|
|
||||||
|
|
||||||
if s:starts_with(a:text, '\Cdo:', a:lnum)
|
|
||||||
call s:debug("current line is do:")
|
|
||||||
return pair_col - 1 + s:sw()
|
|
||||||
elseif s:starts_with(a:text, '\Celse:', a:lnum)
|
|
||||||
call s:debug("current line is else:")
|
|
||||||
return pair_col - 1
|
|
||||||
elseif s:starts_with(a:text, '\C\(\<do\>\|\<else\>\)', a:lnum)
|
|
||||||
call s:debug("current line is do/else")
|
|
||||||
return pair_col - 1
|
|
||||||
elseif s:starts_with(pair_text, '\C\(do\|else\):', pair_lnum)
|
|
||||||
call s:debug("inside do:/else:")
|
|
||||||
return pair_col - 1 + s:sw()
|
|
||||||
elseif pair_char == 'w'
|
|
||||||
call s:debug("inside with/do")
|
|
||||||
return pair_col + 4
|
|
||||||
elseif pair_char == 'd'
|
|
||||||
call s:debug("inside do/else|end")
|
|
||||||
return pair_col - 1 + s:sw()
|
|
||||||
else
|
|
||||||
call s:debug("inside else/end")
|
|
||||||
return s:do_handle_inside_pattern_match_block(pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s: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 s:starts_with(a:prev_nb_text, keyword_pattern, a:prev_nb_lnum)
|
|
||||||
call s:debug("prev nb line is keyword")
|
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
|
||||||
else
|
|
||||||
return s:do_handle_inside_pattern_match_block(a:pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Implements indent for pattern-matching blocks (e.g. case, fn, with/else)
|
|
||||||
function! s:do_handle_inside_pattern_match_block(block_start_lnum, text, prev_nb_lnum, prev_nb_text)
|
|
||||||
if a:text =~ '->'
|
|
||||||
call s:debug("current line contains ->")
|
|
||||||
return indent(a:block_start_lnum) + s:sw()
|
|
||||||
elseif a:prev_nb_text =~ '->'
|
|
||||||
call s:debug("prev nb line contains ->")
|
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
|
||||||
else
|
|
||||||
return indent(a:prev_nb_lnum)
|
|
||||||
end
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s: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
|
|
||||||
return s:do_handle_inside_pattern_match_block(a:pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s: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) + s:sw()
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
end
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:do_handle_inside_curly_brace(pair_lnum, _pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
|
|
||||||
return indent(a:pair_lnum) + s:sw()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:do_handle_inside_parens(pair_lnum, pair_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
|
|
||||||
if a:pair_lnum
|
|
||||||
if s:ends_with(a:prev_nb_text, '(', a:prev_nb_lnum)
|
|
||||||
return indent(a:prev_nb_lnum) + s:sw()
|
|
||||||
elseif a:pair_lnum == a:prev_nb_lnum
|
|
||||||
" Align indent (e.g. "def add(a,")
|
|
||||||
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, '[^(]\+,')
|
|
||||||
if pos == -1
|
|
||||||
return 0
|
|
||||||
else
|
else
|
||||||
return pos
|
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
|
||||||
end
|
let relative_lnum = max([clause_lnum, block_start_lnum])
|
||||||
else
|
call s:debug("pattern matching relative to lnum " . relative_lnum)
|
||||||
return indent(a:prev_nb_lnum)
|
return s:do_handle_pattern_match_block(relative_lnum, a:context)
|
||||||
|
endif
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_inside_generic_block(lnum, _text, prev_nb_lnum, prev_nb_text)
|
function! s:handle_with(start_lnum, start_col, context)
|
||||||
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end'), 'bW', "line('.') == ".a:lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:lnum - g:elixir_indent_max_lookbehind]))
|
let block_info = searchpairpos('\C\%(\<with\>\|\<do\>\|\<else\>\)', '', s:keyword('end'), 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
|
||||||
|
let block_start_lnum = block_info[0]
|
||||||
|
let block_start_col = block_info[1]
|
||||||
|
|
||||||
|
let block_start_text = getline(block_start_lnum)
|
||||||
|
let block_start_char = block_start_text[block_start_col - 1]
|
||||||
|
|
||||||
|
if s:starts_with(a:context, s:keyword('do\|else\|end'))
|
||||||
|
return indent(a:start_lnum)
|
||||||
|
elseif block_start_char == 'w' || s:starts_with(a:context, '\C\(do\|else\):')
|
||||||
|
return indent(a:start_lnum) + 5
|
||||||
|
elseif s:_starts_with(block_start_text, '\C\(do\|else\):', a:start_lnum)
|
||||||
|
return indent(block_start_lnum) + s:sw()
|
||||||
|
else
|
||||||
|
return s:do_handle_pattern_match_block(a:start_lnum, a:context)
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:do_handle_pattern_match_block(relative_line, context)
|
||||||
|
let relative_indent = indent(a:relative_line)
|
||||||
|
" hack!
|
||||||
|
if a:context.text =~ '\(fn.*\)\@<!->'
|
||||||
|
call s:debug("current line contains ->; assuming match definition")
|
||||||
|
return relative_indent + s:sw()
|
||||||
|
elseif search('\(fn.*\)\@<!->', 'bnW', a:relative_line) != 0
|
||||||
|
call s:debug("a previous line contains ->; assuming match handler")
|
||||||
|
return relative_indent + 2 * s:sw()
|
||||||
|
else
|
||||||
|
call s:debug("couldn't find any previous ->; assuming body text")
|
||||||
|
return relative_indent + s:sw()
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_inside_generic_block(context)
|
||||||
|
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end'), 'bW', "line('.') == ".a:context.lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||||
if pair_lnum
|
if pair_lnum
|
||||||
" TODO: @jbodah 2017-03-29: this should probably be the case in *all*
|
" TODO: @jbodah 2017-03-29: this should probably be the case in *all*
|
||||||
" blocks
|
" blocks
|
||||||
if s:ends_with(a:prev_nb_text, ',', a:prev_nb_lnum)
|
if s:prev_ends_with(a:context, ',')
|
||||||
return indent(pair_lnum) + 2 * s:sw()
|
return indent(pair_lnum) + 2 * s:sw()
|
||||||
else
|
else
|
||||||
return indent(pair_lnum) + s:sw()
|
return indent(pair_lnum) + s:sw()
|
||||||
|
@ -137,10 +137,6 @@ function! go#config#SetGuruScope(scope) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#GocodeUnimportedPackages() abort
|
|
||||||
return get(g:, 'go_gocode_unimported_packages', 0)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
||||||
function! go#config#GocodeSocketType() abort
|
function! go#config#GocodeSocketType() abort
|
||||||
return get(g:, 'go_gocode_socket_type', s:sock_type)
|
return get(g:, 'go_gocode_socket_type', s:sock_type)
|
||||||
@ -150,8 +146,8 @@ function! go#config#GocodeProposeBuiltins() abort
|
|||||||
return get(g:, 'go_gocode_propose_builtins', 1)
|
return get(g:, 'go_gocode_propose_builtins', 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#GocodeAutobuild() abort
|
function! go#config#GocodeProposeSource() abort
|
||||||
return get(g:, 'go_gocode_autobuild', 1)
|
return get(g:, 'go_gocode_propose_source', 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#EchoCommandInfo() abort
|
function! go#config#EchoCommandInfo() abort
|
||||||
@ -284,6 +280,14 @@ function! go#config#SetAsmfmtAutosave(value) abort
|
|||||||
let g:go_asmfmt_autosave = a:value
|
let g:go_asmfmt_autosave = a:value
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#ModFmtAutosave() abort
|
||||||
|
return get(g:, "go_mod_fmt_autosave", 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#SetModFmtAutosave(value) abort
|
||||||
|
let g:go_mod_fmt_autosave = a:value
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#DocMaxHeight() abort
|
function! go#config#DocMaxHeight() abort
|
||||||
return get(g:, "go_doc_max_height", 20)
|
return get(g:, "go_doc_max_height", 20)
|
||||||
endfunction
|
endfunction
|
||||||
@ -418,7 +422,7 @@ function! go#config#HighlightVariableDeclarations() abort
|
|||||||
return get(g:, 'go_highlight_variable_declarations', 0)
|
return get(g:, 'go_highlight_variable_declarations', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function go#config#FoldEnable(...) abort
|
function! go#config#FoldEnable(...) abort
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
return index(go#config#FoldEnable(), a:1) > -1
|
return index(go#config#FoldEnable(), a:1) > -1
|
||||||
endif
|
endif
|
||||||
|
246
autoload/julia/doc.vim
Normal file
246
autoload/julia/doc.vim
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" path to the julia binary to communicate with
|
||||||
|
if has('win32') || has('win64')
|
||||||
|
if exists('g:julia#doc#juliapath')
|
||||||
|
" use assigned g:julia#doc#juliapath
|
||||||
|
elseif executable('julia')
|
||||||
|
" use julia command in PATH
|
||||||
|
let g:julia#doc#juliapath = 'julia'
|
||||||
|
else
|
||||||
|
" search julia binary in the default installation paths
|
||||||
|
let pathlist = sort(glob($LOCALAPPDATA . '\Julia-*\bin\julia.exe', 1, 1))
|
||||||
|
let g:julia#doc#juliapath = get(pathlist, -1, 'julia')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:julia#doc#juliapath = get(g:, 'julia#doc#juliapath', 'julia')
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:version() abort
|
||||||
|
let VERSION = {'major': 0, 'minor': 0}
|
||||||
|
if !executable(g:julia#doc#juliapath)
|
||||||
|
return VERSION
|
||||||
|
endif
|
||||||
|
|
||||||
|
let cmd = printf('%s -v', g:julia#doc#juliapath)
|
||||||
|
let output = system(cmd)
|
||||||
|
let versionstr = matchstr(output, '\C^julia version \zs\d\+\.\d\+\ze')
|
||||||
|
let [major, minor] = map(split(versionstr, '\.'), 'str2nr(v:val)')
|
||||||
|
let VERSION.major = major
|
||||||
|
let VERSION.minor = minor
|
||||||
|
return VERSION
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:VERSION = s:version()
|
||||||
|
let s:NODOCPATTERN = '\C\VNo documentation found.'
|
||||||
|
|
||||||
|
function! julia#doc#lookup(keyword, ...) abort
|
||||||
|
let juliapath = get(a:000, 0, g:julia#doc#juliapath)
|
||||||
|
let keyword = escape(a:keyword, '"\')
|
||||||
|
let cmd = printf('%s -E "@doc %s"', juliapath, keyword)
|
||||||
|
return systemlist(cmd)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia#doc#open(keyword) abort
|
||||||
|
if empty(a:keyword)
|
||||||
|
call s:warn('Not an appropriate keyword.')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !executable(g:julia#doc#juliapath)
|
||||||
|
call s:warn('%s command is not executable', g:julia#doc#juliapath)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let doc = julia#doc#lookup(a:keyword, g:julia#doc#juliapath)
|
||||||
|
if empty(doc) || match(doc[0], s:NODOCPATTERN) > -1
|
||||||
|
call s:warn('No documentation found for "%s".', a:keyword)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" workaround for * and ? since a buffername cannot include them
|
||||||
|
let keyword = a:keyword
|
||||||
|
let keyword = substitute(keyword, '\*', ':asterisk:', 'g')
|
||||||
|
let keyword = substitute(keyword, '?', ':question:', 'g')
|
||||||
|
let buffername = printf('juliadoc: %s', keyword)
|
||||||
|
|
||||||
|
call s:write_to_preview_window(doc, "juliadoc", buffername)
|
||||||
|
|
||||||
|
call filter(s:HELPHISTORY, 'v:val isnot# a:keyword')
|
||||||
|
call add(s:HELPHISTORY, a:keyword)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:write_to_preview_window(content, ftype, buffername)
|
||||||
|
" Are we in the preview window from the outset? If not, best to close any
|
||||||
|
" preview windows that might exist.
|
||||||
|
let pvw = &previewwindow
|
||||||
|
if !pvw
|
||||||
|
silent! pclose!
|
||||||
|
endif
|
||||||
|
execute "silent! pedit +setlocal\\ nobuflisted\\ noswapfile\\"
|
||||||
|
\ "buftype=nofile\\ bufhidden=wipe" a:buffername
|
||||||
|
silent! wincmd P
|
||||||
|
if &previewwindow
|
||||||
|
setlocal modifiable noreadonly
|
||||||
|
silent! %delete _
|
||||||
|
call append(0, a:content)
|
||||||
|
silent! $delete _
|
||||||
|
normal! ggj
|
||||||
|
setlocal nomodified readonly nomodifiable
|
||||||
|
execute "setfiletype" a:ftype
|
||||||
|
" Only return to a normal window if we didn't start in a preview window.
|
||||||
|
if !pvw
|
||||||
|
silent! wincmd p
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" We couldn't make it to the preview window, so as a fallback we dump the
|
||||||
|
" contents in the status area.
|
||||||
|
execute printf("echo '%s'", join(a:content, "\n"))
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:warn(...) abort
|
||||||
|
if a:0 == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
echohl WarningMsg
|
||||||
|
try
|
||||||
|
if a:0 == 1
|
||||||
|
echo a:1
|
||||||
|
else
|
||||||
|
echo call('printf', a:000)
|
||||||
|
endif
|
||||||
|
finally
|
||||||
|
echohl None
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s:KEYWORDPATTERN = '\m@\?\h\k*!\?'
|
||||||
|
|
||||||
|
" This function is called in normal mode or visual mode.
|
||||||
|
function! julia#doc#keywordprg(word) abort
|
||||||
|
if a:word is# ''
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let word = s:unfnameescape(a:word)
|
||||||
|
if word is# expand('<cword>')
|
||||||
|
" 'K' in normal mode
|
||||||
|
" NOTE: Because ! and @ is not in 'iskeyword' option, this func ignore
|
||||||
|
" the argument to recognize keywords like "@time" and "push!"
|
||||||
|
let view = winsaveview()
|
||||||
|
let lnum = line('.')
|
||||||
|
let tail = searchpos(s:KEYWORDPATTERN, 'ce', lnum)
|
||||||
|
let head = searchpos(s:KEYWORDPATTERN, 'bc', lnum)
|
||||||
|
call winrestview(view)
|
||||||
|
if head == [0, 0] || tail == [0, 0]
|
||||||
|
return
|
||||||
|
else
|
||||||
|
let start = head[1] - 1
|
||||||
|
let end = tail[1] - 1
|
||||||
|
let word = getline(lnum)[start : end]
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
call julia#doc#open(word)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists('+shellslash')
|
||||||
|
let s:ESCAPEDCHARS = " \t\n\"#%'*<?`|"
|
||||||
|
else
|
||||||
|
let s:ESCAPEDCHARS = " \t\n*?[{`$\\%#'\"|!<"
|
||||||
|
endif
|
||||||
|
let s:FNAMEESCAPEPATTERN = '\\\ze[' . escape(s:ESCAPEDCHARS, ']^-\') . ']'
|
||||||
|
|
||||||
|
" this function reproduces an original string escaped by fnameescape()
|
||||||
|
function! s:unfnameescape(str) abort
|
||||||
|
if a:str is# ''
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" NOTE: We cannot determine the original string if a:str starts from '\-',
|
||||||
|
" '\+' or '\>' because fnameescape('-') ==# fnameescape('\-').
|
||||||
|
if a:str is# '\-'
|
||||||
|
" Remove escape anyway.
|
||||||
|
return '-'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:str =~# '^\\[+>]'
|
||||||
|
let str = a:str[1:]
|
||||||
|
else
|
||||||
|
let str = a:str
|
||||||
|
endif
|
||||||
|
return substitute(str, s:FNAMEESCAPEPATTERN, '', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s:HELPPROMPT = 'help?> '
|
||||||
|
let s:HELPHISTORY = []
|
||||||
|
|
||||||
|
function! julia#doc#prompt() abort
|
||||||
|
let inputhist = s:savehistory('input')
|
||||||
|
echohl MoreMsg
|
||||||
|
try
|
||||||
|
call s:restorehistory('input', s:HELPHISTORY)
|
||||||
|
let keyword = input(s:HELPPROMPT, '', 'customlist,julia#doc#complete')
|
||||||
|
|
||||||
|
" Clear the last prompt
|
||||||
|
normal! :
|
||||||
|
finally
|
||||||
|
echohl None
|
||||||
|
call s:restorehistory('input', inputhist)
|
||||||
|
endtry
|
||||||
|
|
||||||
|
if empty(keyword)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call julia#doc#open(keyword)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:savehistory(name) abort
|
||||||
|
if histnr(a:name) == -1
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let history = []
|
||||||
|
for i in range(1, histnr(a:name))
|
||||||
|
let item = histget(a:name, i)
|
||||||
|
if !empty(item)
|
||||||
|
call add(history, item)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return history
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:restorehistory(name, history) abort
|
||||||
|
call histdel(a:name)
|
||||||
|
for item in a:history
|
||||||
|
call histadd(a:name, item)
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if s:VERSION.major == 0 && s:VERSION.minor <= 6
|
||||||
|
let s:REPL_SEARCH = 'Base.Docs.repl_search'
|
||||||
|
else
|
||||||
|
let s:REPL_SEARCH = 'import REPL.repl_search; repl_search'
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! julia#doc#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
return s:likely(a:ArgLead)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:likely(str) abort
|
||||||
|
" escape twice
|
||||||
|
let str = escape(escape(a:str, '"\'), '"\')
|
||||||
|
let cmd = printf('%s -E "%s(\"%s\")"', g:julia#doc#juliapath, s:REPL_SEARCH, str)
|
||||||
|
let output = systemlist(cmd)
|
||||||
|
return split(matchstr(output[0], '\C^search: \zs.*'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
@ -244,8 +244,8 @@ function! julia_blocks#init_mappings()
|
|||||||
call julia_blocks#select_reset()
|
call julia_blocks#select_reset()
|
||||||
augroup JuliaBlocks
|
augroup JuliaBlocks
|
||||||
au!
|
au!
|
||||||
au InsertEnter *.jl call julia_blocks#select_reset()
|
au InsertEnter <buffer> call julia_blocks#select_reset()
|
||||||
au CursorMoved *.jl call s:cursor_moved()
|
au CursorMoved <buffer> call s:cursor_moved()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" we would need some autocmd event associated with exiting from
|
" we would need some autocmd event associated with exiting from
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -105,7 +105,7 @@ function! s:GetBufferRubyEntity( name, type, ... )
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let curpos = getpos(".")
|
let curpos = getpos(".")
|
||||||
let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' )
|
let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' )
|
||||||
call cursor(lastpos[1], lastpos[2])
|
call cursor(lastpos[1], lastpos[2])
|
||||||
|
|
||||||
if lnum > enum
|
if lnum > enum
|
||||||
@ -255,15 +255,27 @@ class VimRubyCompletion
|
|||||||
|
|
||||||
# {{{ buffer analysis magic
|
# {{{ buffer analysis magic
|
||||||
def load_requires
|
def load_requires
|
||||||
|
|
||||||
|
custom_paths = VIM::evaluate("get(g:, 'rubycomplete_load_paths', [])")
|
||||||
|
|
||||||
|
if !custom_paths.empty?
|
||||||
|
$LOAD_PATH.concat(custom_paths).uniq!
|
||||||
|
end
|
||||||
|
|
||||||
buf = VIM::Buffer.current
|
buf = VIM::Buffer.current
|
||||||
enum = buf.line_number
|
enum = buf.line_number
|
||||||
nums = Range.new( 1, enum )
|
nums = Range.new( 1, enum )
|
||||||
nums.each do |x|
|
nums.each do |x|
|
||||||
|
|
||||||
ln = buf[x]
|
ln = buf[x]
|
||||||
begin
|
begin
|
||||||
eval( "require %s" % $1 ) if /.*require\s*(["'].*?["'])/.match( ln )
|
if /.*require_relative\s*(.*)$/.match( ln )
|
||||||
rescue Exception
|
eval( "require %s" % File.expand_path($1) )
|
||||||
#ignore?
|
elsif /.*require\s*(["'].*?["'])/.match( ln )
|
||||||
|
eval( "require %s" % $1 )
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
dprint e.inspect
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -346,8 +358,13 @@ class VimRubyCompletion
|
|||||||
if x != cur_line
|
if x != cur_line
|
||||||
next if x == 0
|
next if x == 0
|
||||||
ln = buf[x]
|
ln = buf[x]
|
||||||
if /^\s*(module|class|def|include)\s+/.match(ln)
|
is_const = false
|
||||||
clscnt += 1 if $1 == "class"
|
if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln)
|
||||||
|
clscnt += 1 if /class|module/.match($1)
|
||||||
|
# We must make sure to load each constant only once to avoid errors
|
||||||
|
if is_const
|
||||||
|
ln.gsub!(/\s*?[|]{0,2}=\s*?/, '||=')
|
||||||
|
end
|
||||||
#dprint "\$1$1
|
#dprint "\$1$1
|
||||||
classdef += "%s\n" % ln
|
classdef += "%s\n" % ln
|
||||||
classdef += "end\n" if /def\s+/.match(ln)
|
classdef += "end\n" if /def\s+/.match(ln)
|
||||||
@ -425,7 +442,6 @@ class VimRubyCompletion
|
|||||||
return get_buffer_entity_list( "class" )
|
return get_buffer_entity_list( "class" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def load_rails
|
def load_rails
|
||||||
allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
|
allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
|
||||||
return if allow_rails.to_i.zero?
|
return if allow_rails.to_i.zero?
|
||||||
@ -531,7 +547,6 @@ class VimRubyCompletion
|
|||||||
ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods
|
ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -617,7 +632,6 @@ class VimRubyCompletion
|
|||||||
want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')")
|
want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')")
|
||||||
load_gems unless want_gems.to_i.zero?
|
load_gems unless want_gems.to_i.zero?
|
||||||
|
|
||||||
|
|
||||||
input = VIM::Buffer.current.line
|
input = VIM::Buffer.current.line
|
||||||
cpos = VIM::Window.current.cursor[1] - 1
|
cpos = VIM::Window.current.cursor[1] - 1
|
||||||
input = input[0..cpos]
|
input = input[0..cpos]
|
||||||
@ -670,6 +684,7 @@ class VimRubyCompletion
|
|||||||
message = Regexp.quote($4)
|
message = Regexp.quote($4)
|
||||||
dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ]
|
dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ]
|
||||||
load_buffer_class( receiver )
|
load_buffer_class( receiver )
|
||||||
|
load_buffer_module( receiver )
|
||||||
begin
|
begin
|
||||||
classes = eval("#{receiver}.constants")
|
classes = eval("#{receiver}.constants")
|
||||||
#methods = eval("#{receiver}.methods")
|
#methods = eval("#{receiver}.methods")
|
||||||
@ -790,7 +805,6 @@ class VimRubyCompletion
|
|||||||
methods += Kernel.public_methods
|
methods += Kernel.public_methods
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object")
|
include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object")
|
||||||
methods = clean_sel( methods, message )
|
methods = clean_sel( methods, message )
|
||||||
methods = (methods-Object.instance_methods) if include_object == "0"
|
methods = (methods-Object.instance_methods) if include_object == "0"
|
||||||
@ -833,7 +847,6 @@ let s:rubycomplete_rails_loaded = 0
|
|||||||
call s:DefRuby()
|
call s:DefRuby()
|
||||||
"}}} ruby-side code
|
"}}} ruby-side code
|
||||||
|
|
||||||
|
|
||||||
" vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl:
|
" vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -86,7 +86,7 @@ function! s:Run(dict, rustc_args, args)
|
|||||||
|
|
||||||
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
||||||
let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
|
let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
|
||||||
if output != ''
|
if output !=# ''
|
||||||
echohl WarningMsg
|
echohl WarningMsg
|
||||||
echo output
|
echo output
|
||||||
echohl None
|
echohl None
|
||||||
@ -153,7 +153,7 @@ function! s:Expand(dict, pretty, args)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rust#CompleteExpand(lead, line, pos)
|
function! rust#CompleteExpand(lead, line, pos)
|
||||||
if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$'
|
if a:line[: a:pos-1] =~# '^RustExpand!\s*\S*$'
|
||||||
" first argument and it has a !
|
" first argument and it has a !
|
||||||
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"]
|
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"]
|
||||||
if !empty(a:lead)
|
if !empty(a:lead)
|
||||||
@ -182,7 +182,7 @@ function! s:Emit(dict, type, args)
|
|||||||
let args = [relpath, '--emit', a:type, '-o', output_path] + a:args
|
let args = [relpath, '--emit', a:type, '-o', output_path] + a:args
|
||||||
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
||||||
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
|
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
|
||||||
if output != ''
|
if output !=# ''
|
||||||
echohl WarningMsg
|
echohl WarningMsg
|
||||||
echo output
|
echo output
|
||||||
echohl None
|
echohl None
|
||||||
@ -192,10 +192,10 @@ function! s:Emit(dict, type, args)
|
|||||||
exe 'silent keepalt read' fnameescape(output_path)
|
exe 'silent keepalt read' fnameescape(output_path)
|
||||||
1
|
1
|
||||||
d
|
d
|
||||||
if a:type == "llvm-ir"
|
if a:type ==# "llvm-ir"
|
||||||
setl filetype=llvm
|
setl filetype=llvm
|
||||||
let extension = 'll'
|
let extension = 'll'
|
||||||
elseif a:type == "asm"
|
elseif a:type ==# "asm"
|
||||||
setl filetype=asm
|
setl filetype=asm
|
||||||
let extension = 's'
|
let extension = 's'
|
||||||
endif
|
endif
|
||||||
@ -261,8 +261,8 @@ function! s:WithPath(func, ...)
|
|||||||
let dict.tmpdir_relpath = filename
|
let dict.tmpdir_relpath = filename
|
||||||
let dict.path = dict.tmpdir.'/'.filename
|
let dict.path = dict.tmpdir.'/'.filename
|
||||||
|
|
||||||
let saved.mod = &mod
|
let saved.mod = &modified
|
||||||
set nomod
|
set nomodified
|
||||||
|
|
||||||
silent exe 'keepalt write! ' . fnameescape(dict.path)
|
silent exe 'keepalt write! ' . fnameescape(dict.path)
|
||||||
if pathisempty
|
if pathisempty
|
||||||
@ -343,7 +343,7 @@ function! s:ShellTokenize(text)
|
|||||||
endif
|
endif
|
||||||
let l:state = 3
|
let l:state = 3
|
||||||
elseif l:state == 5 " single-quoted
|
elseif l:state == 5 " single-quoted
|
||||||
if l:c == "'"
|
if l:c ==# "'"
|
||||||
let l:state = 1
|
let l:state = 1
|
||||||
else
|
else
|
||||||
let l:current .= l:c
|
let l:current .= l:c
|
||||||
@ -361,7 +361,7 @@ function! s:RmDir(path)
|
|||||||
if empty(a:path)
|
if empty(a:path)
|
||||||
echoerr 'Attempted to delete empty path'
|
echoerr 'Attempted to delete empty path'
|
||||||
return 0
|
return 0
|
||||||
elseif a:path == '/' || a:path == $HOME
|
elseif a:path ==# '/' || a:path ==# $HOME
|
||||||
echoerr 'Attempted to delete protected path: ' . a:path
|
echoerr 'Attempted to delete protected path: ' . a:path
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@ -414,22 +414,83 @@ function! rust#Play(count, line1, line2, ...) abort
|
|||||||
call setreg('"', save_regcont, save_regtype)
|
call setreg('"', save_regcont, save_regtype)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content)
|
let url = l:rust_playpen_url."?code=".webapi#http#encodeURI(content)
|
||||||
|
|
||||||
if strlen(body) > 5000
|
if strlen(url) > 5000
|
||||||
echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None
|
echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(url).')' | echohl None
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let payload = "format=simple&url=".webapi#http#encodeURI(body)
|
let payload = "format=simple&url=".webapi#http#encodeURI(url)
|
||||||
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
|
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
|
||||||
let url = res.content
|
if res.status[0] ==# '2'
|
||||||
|
let url = res.content
|
||||||
if exists('g:rust_clip_command')
|
|
||||||
call system(g:rust_clip_command, url)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
redraw | echomsg 'Done: '.url
|
let footer = ''
|
||||||
|
if exists('g:rust_clip_command')
|
||||||
|
call system(g:rust_clip_command, url)
|
||||||
|
if !v:shell_error
|
||||||
|
let footer = ' (copied to clipboard)'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
redraw | echomsg 'Done: '.url.footer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Run a test under the cursor or all tests {{{1
|
||||||
|
|
||||||
|
" Finds a test function name under the cursor. Returns empty string when a
|
||||||
|
" test function is not found.
|
||||||
|
function! s:SearchTestFunctionNameUnderCursor() abort
|
||||||
|
let cursor_line = line('.')
|
||||||
|
|
||||||
|
" Find #[test] attribute
|
||||||
|
if search('#\[test]', 'bcW') is 0
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Move to an opening brace of the test function
|
||||||
|
let test_func_line = search('^\s*fn\s\+\h\w*\s*(.\+{$', 'eW')
|
||||||
|
if test_func_line is 0
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Search the end of test function (closing brace) to ensure that the
|
||||||
|
" cursor position is within function definition
|
||||||
|
normal! %
|
||||||
|
if line('.') < cursor_line
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return matchstr(getline(test_func_line), '^\s*fn\s\+\zs\h\w*')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! rust#Test(all, options) abort
|
||||||
|
let pwd = expand('%:p:h')
|
||||||
|
if findfile('Cargo.toml', pwd . ';') ==# ''
|
||||||
|
return rust#Run(1, '--test ' . a:options)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pwd = shellescape(pwd)
|
||||||
|
|
||||||
|
if a:all
|
||||||
|
execute '!cd ' . pwd . ' && cargo test ' . a:options
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let saved = getpos('.')
|
||||||
|
try
|
||||||
|
let func_name = s:SearchTestFunctionNameUnderCursor()
|
||||||
|
if func_name ==# ''
|
||||||
|
echohl ErrorMsg
|
||||||
|
echo 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
|
||||||
|
echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
execute '!cd ' . pwd . ' && cargo test ' . func_name . ' ' . a:options
|
||||||
|
finally
|
||||||
|
call setpos('.', saved)
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
@ -18,6 +18,7 @@ let s:global_variable_list = [
|
|||||||
\ 'rust_last_rustc_args',
|
\ 'rust_last_rustc_args',
|
||||||
\ 'rust_original_delimitMate_excluded_regions',
|
\ 'rust_original_delimitMate_excluded_regions',
|
||||||
\ 'rust_playpen_url',
|
\ 'rust_playpen_url',
|
||||||
|
\ 'rust_prev_delimitMate_quotes',
|
||||||
\ 'rust_recent_nearest_cargo_tol',
|
\ 'rust_recent_nearest_cargo_tol',
|
||||||
\ 'rust_recent_root_cargo_toml',
|
\ 'rust_recent_root_cargo_toml',
|
||||||
\ 'rust_recommended_style',
|
\ 'rust_recommended_style',
|
||||||
|
48
autoload/rust/delimitmate.vim
Normal file
48
autoload/rust/delimitmate.vim
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
|
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
||||||
|
|
||||||
|
" For this buffer, when delimitMate issues the `User delimitMate_map`
|
||||||
|
" event in the autocommand system, add the above-defined extra excluded
|
||||||
|
" regions to delimitMate's state, if they have not already been added.
|
||||||
|
function! rust#delimitmate#onMap() abort
|
||||||
|
if &filetype !=# 'rust'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get(b:, "delimitMate_quotes")
|
||||||
|
let b:rust_prev_delimitMate_quotes = b:delimitMate_quotes
|
||||||
|
endif
|
||||||
|
let b:delimitMate_quotes = "\" `"
|
||||||
|
|
||||||
|
if match(delimitMate#Get("excluded_regions"),
|
||||||
|
\ s:delimitMate_extra_excluded_regions) == -1
|
||||||
|
call delimitMate#Set("excluded_regions",
|
||||||
|
\delimitMate#Get("excluded_regions").s:delimitMate_extra_excluded_regions)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" For this buffer, when delimitMate issues the `User delimitMate_unmap`
|
||||||
|
" event in the autocommand system, delete the above-defined extra excluded
|
||||||
|
" regions from delimitMate's state (the deletion being idempotent and
|
||||||
|
" having no effect if the extra excluded regions are not present in the
|
||||||
|
" targeted part of delimitMate's state).
|
||||||
|
function! rust#delimitmate#onUnmap() abort
|
||||||
|
if &filetype !=# 'rust'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get(b:, "rust_prev_delimitMate_quotes")
|
||||||
|
let b:delimitMate_quotes = b:rust_prev_delimitMate_quotes
|
||||||
|
endif
|
||||||
|
|
||||||
|
call delimitMate#Set("excluded_regions", substitute(
|
||||||
|
\ delimitMate#Get("excluded_regions"),
|
||||||
|
\ '\C\V' . s:delimitMate_extra_excluded_regions,
|
||||||
|
\ '', 'g'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
@ -63,6 +63,20 @@ function! s:RustfmtWriteMode()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:RustfmtConfig()
|
||||||
|
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
|
||||||
|
if l:rustfmt_toml !=# ''
|
||||||
|
return '--config-path '.l:rustfmt_toml
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:_rustfmt_toml = findfile('.rustfmt.toml', expand('%:p:h') . ';')
|
||||||
|
if l:_rustfmt_toml !=# ''
|
||||||
|
return '--config-path '.l:_rustfmt_toml
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:RustfmtCommandRange(filename, line1, line2)
|
function! s:RustfmtCommandRange(filename, line1, line2)
|
||||||
if g:rustfmt_file_lines == 0
|
if g:rustfmt_file_lines == 0
|
||||||
echo "--file-lines is not supported in the installed `rustfmt` executable"
|
echo "--file-lines is not supported in the installed `rustfmt` executable"
|
||||||
@ -71,6 +85,7 @@ function! s:RustfmtCommandRange(filename, line1, line2)
|
|||||||
|
|
||||||
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
|
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
|
||||||
let l:write_mode = s:RustfmtWriteMode()
|
let l:write_mode = s:RustfmtWriteMode()
|
||||||
|
let l:rustfmt_config = s:RustfmtConfig()
|
||||||
|
|
||||||
" FIXME: When --file-lines gets to be stable, enhance this version range checking
|
" FIXME: When --file-lines gets to be stable, enhance this version range checking
|
||||||
" accordingly.
|
" accordingly.
|
||||||
@ -78,34 +93,73 @@ function! s:RustfmtCommandRange(filename, line1, line2)
|
|||||||
\ (s:rustfmt_unstable_features && (s:rustfmt_version < '1.'))
|
\ (s:rustfmt_unstable_features && (s:rustfmt_version < '1.'))
|
||||||
\ ? '--unstable-features' : ''
|
\ ? '--unstable-features' : ''
|
||||||
|
|
||||||
let l:cmd = printf("%s %s %s %s --file-lines '[%s]' %s", g:rustfmt_command,
|
let l:cmd = printf("%s %s %s %s %s --file-lines '[%s]' %s", g:rustfmt_command,
|
||||||
\ l:write_mode, g:rustfmt_options,
|
\ l:write_mode, g:rustfmt_options,
|
||||||
\ l:unstable_features, json_encode(l:arg), shellescape(a:filename))
|
\ l:unstable_features, l:rustfmt_config,
|
||||||
|
\ json_encode(l:arg), shellescape(a:filename))
|
||||||
return l:cmd
|
return l:cmd
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:RustfmtCommand(filename)
|
function! s:RustfmtCommand()
|
||||||
let l:write_mode = s:RustfmtWriteMode()
|
if g:rustfmt_emit_files
|
||||||
return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options . " " . shellescape(a:filename)
|
let l:write_mode = "--emit=stdout"
|
||||||
|
else
|
||||||
|
let l:write_mode = "--write-mode=display"
|
||||||
|
endif
|
||||||
|
" rustfmt will pick on the right config on its own due to the
|
||||||
|
" current directory change.
|
||||||
|
return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:DeleteLines(start, end) abort
|
||||||
|
silent! execute a:start . ',' . a:end . 'delete _'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:RunRustfmt(command, tmpname, fail_silently)
|
function! s:RunRustfmt(command, tmpname, fail_silently)
|
||||||
mkview!
|
mkview!
|
||||||
|
|
||||||
if exists("*systemlist")
|
let l:stderr_tmpname = tempname()
|
||||||
let out = systemlist(a:command)
|
let l:command = a:command . ' 2> ' . l:stderr_tmpname
|
||||||
|
|
||||||
|
if a:tmpname ==# ''
|
||||||
|
" Rustfmt in stdin/stdout mode
|
||||||
|
|
||||||
|
" chdir to the directory of the file
|
||||||
|
let l:has_lcd = haslocaldir()
|
||||||
|
let l:prev_cd = getcwd()
|
||||||
|
execute 'lchdir! '.expand('%:h')
|
||||||
|
|
||||||
|
let l:buffer = getline(1, '$')
|
||||||
|
if exists("*systemlist")
|
||||||
|
silent let out = systemlist(l:command, l:buffer)
|
||||||
|
else
|
||||||
|
silent let out = split(system(l:command, l:buffer), '\r\?\n')
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let out = split(system(a:command), '\r\?\n')
|
if exists("*systemlist")
|
||||||
|
silent let out = systemlist(l:command)
|
||||||
|
else
|
||||||
|
silent let out = split(system(l:command), '\r\?\n')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if v:shell_error == 0 || v:shell_error == 3
|
let l:stderr = readfile(l:stderr_tmpname)
|
||||||
|
|
||||||
|
call delete(l:stderr_tmpname)
|
||||||
|
|
||||||
|
if v:shell_error == 0
|
||||||
" remove undo point caused via BufWritePre
|
" remove undo point caused via BufWritePre
|
||||||
try | silent undojoin | catch | endtry
|
try | silent undojoin | catch | endtry
|
||||||
|
|
||||||
" take the tmpfile's content, this is better than rename
|
if a:tmpname ==# ''
|
||||||
" because it preserves file modes.
|
let l:content = l:out
|
||||||
let l:content = readfile(a:tmpname)
|
else
|
||||||
1,$d _
|
" take the tmpfile's content, this is better than rename
|
||||||
|
" because it preserves file modes.
|
||||||
|
let l:content = readfile(a:tmpname)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:DeleteLines(len(l:content), line('$'))
|
||||||
call setline(1, l:content)
|
call setline(1, l:content)
|
||||||
|
|
||||||
" only clear location list if it was previously filled to prevent
|
" only clear location list if it was previously filled to prevent
|
||||||
@ -117,61 +171,69 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
endif
|
endif
|
||||||
elseif g:rustfmt_fail_silently == 0 && a:fail_silently == 0
|
elseif g:rustfmt_fail_silently == 0 && a:fail_silently == 0
|
||||||
" otherwise get the errors and put them in the location list
|
" otherwise get the errors and put them in the location list
|
||||||
let errors = []
|
let l:errors = []
|
||||||
|
|
||||||
let prev_line = ""
|
let l:prev_line = ""
|
||||||
for line in out
|
for l:line in l:stderr
|
||||||
" error: expected one of `;` or `as`, found `extern`
|
" error: expected one of `;` or `as`, found `extern`
|
||||||
" --> src/main.rs:2:1
|
" --> src/main.rs:2:1
|
||||||
let tokens = matchlist(line, '^\s-->\s\(.\{-}\):\(\d\+\):\(\d\+\)$')
|
let tokens = matchlist(l:line, '^\s\+-->\s\(.\{-}\):\(\d\+\):\(\d\+\)$')
|
||||||
if !empty(tokens)
|
if !empty(tokens)
|
||||||
call add(errors, {"filename": @%,
|
call add(l:errors, {"filename": @%,
|
||||||
\"lnum": tokens[2],
|
\"lnum": tokens[2],
|
||||||
\"col": tokens[3],
|
\"col": tokens[3],
|
||||||
\"text": prev_line})
|
\"text": l:prev_line})
|
||||||
endif
|
endif
|
||||||
let prev_line = line
|
let l:prev_line = l:line
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
if empty(errors)
|
if !empty(l:errors)
|
||||||
% | " Couldn't detect rustfmt error format, output errors
|
call setloclist(0, l:errors, 'r')
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(errors)
|
|
||||||
call setloclist(0, errors, 'r')
|
|
||||||
echohl Error | echomsg "rustfmt returned error" | echohl None
|
echohl Error | echomsg "rustfmt returned error" | echohl None
|
||||||
|
else
|
||||||
|
echo "rust.vim: was not able to parse rustfmt messages. Here is the raw output:"
|
||||||
|
echo "\n"
|
||||||
|
for l:line in l:stderr
|
||||||
|
echo l:line
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:got_fmt_error = 1
|
let s:got_fmt_error = 1
|
||||||
lwindow
|
lwindow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call delete(a:tmpname)
|
" Restore the current directory if needed
|
||||||
|
if a:tmpname ==# ''
|
||||||
|
if l:has_lcd
|
||||||
|
execute 'lchdir! '.l:prev_cd
|
||||||
|
else
|
||||||
|
execute 'chdir! '.l:prev_cd
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
silent! loadview
|
silent! loadview
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:rustfmtSaveToTmp()
|
function! rustfmt#FormatRange(line1, line2)
|
||||||
let l:tmpname = tempname()
|
let l:tmpname = tempname()
|
||||||
call writefile(getline(1, '$'), l:tmpname)
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
return l:tmpname
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! rustfmt#FormatRange(line1, line2)
|
|
||||||
let l:tmpname = s:rustfmtSaveToTmp()
|
|
||||||
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
|
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
|
||||||
call s:RunRustfmt(command, l:tmpname, 0)
|
call s:RunRustfmt(command, l:tmpname, 0)
|
||||||
|
call delete(l:tmpname)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rustfmt#Format()
|
function! rustfmt#Format()
|
||||||
let l:tmpname = s:rustfmtSaveToTmp()
|
call s:RunRustfmt(s:RustfmtCommand(), '', 0)
|
||||||
let command = s:RustfmtCommand(l:tmpname)
|
endfunction
|
||||||
call s:RunRustfmt(command, l:tmpname, 0)
|
|
||||||
|
function! rustfmt#Cmd()
|
||||||
|
" Mainly for debugging
|
||||||
|
return s:RustfmtCommand()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rustfmt#PreWrite()
|
function! rustfmt#PreWrite()
|
||||||
if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0)
|
if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0)
|
||||||
if findfile('rustfmt.toml', '.;') !=# ''
|
if findfile('rustfmt.toml', '.;') !=# '' || findfile('.rustfmt.toml', '.;') !=# ''
|
||||||
let b:rustfmt_autosave = 1
|
let b:rustfmt_autosave = 1
|
||||||
let b:rustfmt_autosave_because_of_config = 1
|
let b:rustfmt_autosave_because_of_config = 1
|
||||||
endif
|
endif
|
||||||
@ -181,9 +243,7 @@ function! rustfmt#PreWrite()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:tmpname = s:rustfmtSaveToTmp()
|
call s:RunRustfmt(s:RustfmtCommand(), '', 1)
|
||||||
let command = s:RustfmtCommand(l:tmpname)
|
|
||||||
call s:RunRustfmt(command, l:tmpname, 1)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,8 +12,10 @@ endif
|
|||||||
runtime compiler/rustc.vim
|
runtime compiler/rustc.vim
|
||||||
let current_compiler = "cargo"
|
let current_compiler = "cargo"
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
if exists(':CompilerSet') != 2
|
if exists(':CompilerSet') != 2
|
||||||
command -nargs=* CompilerSet setlocal <args>
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
@ -41,8 +43,10 @@ CompilerSet errorformat+=
|
|||||||
\%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
|
\%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
|
||||||
\%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
|
\%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l:%c
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
15
compiler/nix-build.vim
Normal file
15
compiler/nix-build.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||||
|
|
||||||
|
if exists('current_compiler')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = 'nix-build'
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
CompilerSet errorformat=error:\ %m\ at\ %f:%l:%c,builder\ for\ \'%m\'\ failed\ with\ exit\ code\ %n,fixed-output\ derivation\ produced\ path\ \'%s\'\ with\ %m
|
||||||
|
CompilerSet makeprg=nix-build
|
||||||
|
|
||||||
|
endif
|
@ -26,6 +26,7 @@ CompilerSet errorformat=
|
|||||||
\%E%f:%l:in\ `%*[^']':\ %m,
|
\%E%f:%l:in\ `%*[^']':\ %m,
|
||||||
\%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#,
|
\%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#,
|
||||||
\%E\ \ \ \ \ Failure/Error:\ %m,
|
\%E\ \ \ \ \ Failure/Error:\ %m,
|
||||||
|
\%E\ \ \ \ \ Failure/Error:,
|
||||||
\%C\ \ \ \ \ %m,
|
\%C\ \ \ \ \ %m,
|
||||||
\%C%\\s%#,
|
\%C%\\s%#,
|
||||||
\%-G%.%#
|
\%-G%.%#
|
||||||
|
@ -11,8 +11,10 @@ if exists("current_compiler")
|
|||||||
endif
|
endif
|
||||||
let current_compiler = "rustc"
|
let current_compiler = "rustc"
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
" vint: -ProhibitAbbreviationOption
|
||||||
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
if exists(":CompilerSet") != 2
|
if exists(":CompilerSet") != 2
|
||||||
command -nargs=* CompilerSet setlocal <args>
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
@ -45,8 +47,10 @@ CompilerSet errorformat+=
|
|||||||
\%-G%*[\ ]^%*[~],
|
\%-G%*[\ ]^%*[~],
|
||||||
\%-G%*[\ ]...
|
\%-G%*[\ ]...
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
" vint: -ProhibitAbbreviationOption
|
||||||
unlet s:cpo_save
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
@ -209,6 +209,7 @@ endif
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" crystal, from crystal.vim in rhysd/vim-crystal
|
" crystal, from crystal.vim in rhysd/vim-crystal
|
||||||
|
" vint: -ProhibitAutocmdWithNoGroup
|
||||||
autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal
|
autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal
|
||||||
autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal
|
autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal
|
||||||
autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby
|
autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby
|
||||||
@ -370,6 +371,25 @@ au BufReadPost *.s call s:gofiletype_post()
|
|||||||
|
|
||||||
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
||||||
|
|
||||||
|
" Set the filetype if the first non-comment and non-blank line starts with
|
||||||
|
" 'module <path>'.
|
||||||
|
au BufNewFile,BufRead go.mod call s:gomod()
|
||||||
|
|
||||||
|
fun! s:gomod()
|
||||||
|
for l:i in range(1, line('$'))
|
||||||
|
let l:l = getline(l:i)
|
||||||
|
if l:l ==# '' || l:l[:1] ==# '//'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:l =~# '^module .\+'
|
||||||
|
set filetype=gomod
|
||||||
|
endif
|
||||||
|
|
||||||
|
break
|
||||||
|
endfor
|
||||||
|
endfun
|
||||||
|
|
||||||
" vim: sw=2 ts=2 et
|
" vim: sw=2 ts=2 et
|
||||||
augroup end
|
augroup end
|
||||||
endif
|
endif
|
||||||
@ -623,13 +643,14 @@ au BufRead,BufNewFile nginx*.conf set ft=nginx
|
|||||||
au BufRead,BufNewFile *nginx.conf set ft=nginx
|
au BufRead,BufNewFile *nginx.conf set ft=nginx
|
||||||
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
|
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
|
||||||
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
|
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
|
||||||
|
au BufRead,BufNewFile */nginx/*.conf set ft=nginx
|
||||||
augroup end
|
augroup end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" nim, from nim.vim in zah/nim.vim:_BASIC
|
" nim, from nim.vim in zah/nim.vim:_BASIC
|
||||||
au BufNewFile,BufRead *.nim,*.nims set filetype=nim
|
au BufNewFile,BufRead *.nim,*.nims,*.nimble set filetype=nim
|
||||||
augroup end
|
augroup end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -944,8 +965,10 @@ endif
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" rust, from rust.vim in rust-lang/rust.vim
|
" rust, from rust.vim in rust-lang/rust.vim
|
||||||
au BufRead,BufNewFile *.rs set filetype=rust
|
" vint: -ProhibitAutocmdWithNoGroup
|
||||||
au BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=cfg | endif
|
|
||||||
|
autocmd BufRead,BufNewFile *.rs set filetype=rust
|
||||||
|
autocmd BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=cfg | endif
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
augroup end
|
augroup end
|
||||||
@ -1067,7 +1090,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
|
|||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" toml, from toml.vim in cespare/vim-toml
|
" toml, from toml.vim in cespare/vim-toml
|
||||||
" Go dep and Rust use several TOML config files that are not named with .toml.
|
" Go dep and Rust use several TOML config files that are not named with .toml.
|
||||||
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,Pipfile set filetype=toml
|
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,*/.cargo/credentials,Pipfile set filetype=toml
|
||||||
augroup end
|
augroup end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<
|
|||||||
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
||||||
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
||||||
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0)
|
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0)
|
||||||
|
command! -buffer -nargs=* CrystalExpand echo crystal_lang#expand(expand('%'), getpos('.'), <q-args>).output
|
||||||
|
|
||||||
nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
||||||
nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
||||||
|
@ -12,7 +12,7 @@ endif
|
|||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
if !exists('b:git_dir')
|
if !exists('b:git_dir')
|
||||||
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
|
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]\|:[\/][\/]\|^\a\a\+:'
|
||||||
" Stay out of the way
|
" Stay out of the way
|
||||||
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
|
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
|
||||||
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
|
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
|
||||||
|
@ -19,11 +19,12 @@ setlocal comments=:#
|
|||||||
setlocal commentstring=#=%s=#
|
setlocal commentstring=#=%s=#
|
||||||
setlocal cinoptions+=#1
|
setlocal cinoptions+=#1
|
||||||
setlocal define=^\\s*macro\\>
|
setlocal define=^\\s*macro\\>
|
||||||
|
setlocal fo-=t fo+=croql
|
||||||
|
|
||||||
let b:julia_vim_loaded = 1
|
let b:julia_vim_loaded = 1
|
||||||
|
|
||||||
let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<"
|
let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<"
|
||||||
\ . " define< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<"
|
\ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<"
|
||||||
\ . " | unlet! b:julia_vim_loaded"
|
\ . " | unlet! b:julia_vim_loaded"
|
||||||
|
|
||||||
" MatchIt plugin support
|
" MatchIt plugin support
|
||||||
@ -93,6 +94,14 @@ if has("gui_win32")
|
|||||||
let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter"
|
let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Lookup documents
|
||||||
|
nnoremap <silent><buffer> <Plug>(JuliaDocPrompt) :<C-u>call julia#doc#prompt()<CR>
|
||||||
|
command! -nargs=1 -buffer -complete=customlist,julia#doc#complete JuliaDoc call julia#doc#open(<q-args>)
|
||||||
|
command! -nargs=1 -buffer JuliaDocKeywordprg call julia#doc#keywordprg(<q-args>)
|
||||||
|
setlocal keywordprg=:JuliaDocKeywordprg
|
||||||
|
let b:undo_ftplugin .= " | setlocal keywordprg<"
|
||||||
|
let b:undo_ftplugin .= " | delcommand JuliaDoc | delcommand JuliaDocKeywordprg"
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
34
ftplugin/juliadoc.vim
Normal file
34
ftplugin/juliadoc.vim
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Julia document
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
setlocal conceallevel=2
|
||||||
|
setlocal concealcursor=nc
|
||||||
|
setlocal wrap
|
||||||
|
|
||||||
|
if !exists('b:undo_ftplugin')
|
||||||
|
let b:undo_ftplugin = ''
|
||||||
|
endif
|
||||||
|
let b:undo_ftplugin .= 'setlocal conceallevel< concealcursor< wrap<'
|
||||||
|
|
||||||
|
" Lookup documents
|
||||||
|
nnoremap <silent><buffer> <Plug>(JuliaDocPrompt) :<C-u>call julia#doc#prompt()<CR>
|
||||||
|
command! -nargs=1 -buffer -complete=customlist,julia#doc#complete JuliaDoc call julia#doc#open(<q-args>)
|
||||||
|
command! -nargs=1 -buffer JuliaDocKeywordprg call julia#doc#keywordprg(<q-args>)
|
||||||
|
setlocal keywordprg=:JuliaDocKeywordprg
|
||||||
|
let b:undo_ftplugin .= " | setlocal keywordprg<"
|
||||||
|
let b:undo_ftplugin .= " | delcommand JuliaDoc | delcommand JuliaDocKeywordprg"
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
endif
|
@ -12,8 +12,10 @@ if exists("b:did_ftplugin")
|
|||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
augroup rust.vim
|
augroup rust.vim
|
||||||
autocmd!
|
autocmd!
|
||||||
@ -69,32 +71,13 @@ augroup rust.vim
|
|||||||
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
autocmd User delimitMate_map :call rust#delimitmate#onMap()
|
||||||
|
autocmd User delimitMate_unmap :call rust#delimitmate#onUnmap()
|
||||||
|
endif
|
||||||
|
|
||||||
" For this buffer, when delimitMate issues the `User delimitMate_map`
|
" Integration with auto-pairs (https://github.com/jiangmiao/auto-pairs)
|
||||||
" event in the autocommand system, add the above-defined extra excluded
|
if exists("g:AutoPairsLoaded") && !get(g:, 'rust_keep_autopairs_default', 0)
|
||||||
" regions to delimitMate's state, if they have not already been added.
|
let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '`':'`'}
|
||||||
autocmd User <buffer>
|
|
||||||
\ if expand('<afile>') ==# 'delimitMate_map' && match(
|
|
||||||
\ delimitMate#Get("excluded_regions"),
|
|
||||||
\ s:delimitMate_extra_excluded_regions) == -1
|
|
||||||
\| let b:delimitMate_excluded_regions =
|
|
||||||
\ delimitMate#Get("excluded_regions")
|
|
||||||
\ . s:delimitMate_extra_excluded_regions
|
|
||||||
\|endif
|
|
||||||
|
|
||||||
" For this buffer, when delimitMate issues the `User delimitMate_unmap`
|
|
||||||
" event in the autocommand system, delete the above-defined extra excluded
|
|
||||||
" regions from delimitMate's state (the deletion being idempotent and
|
|
||||||
" having no effect if the extra excluded regions are not present in the
|
|
||||||
" targeted part of delimitMate's state).
|
|
||||||
autocmd User <buffer>
|
|
||||||
\ if expand('<afile>') ==# 'delimitMate_unmap'
|
|
||||||
\| let b:delimitMate_excluded_regions = substitute(
|
|
||||||
\ delimitMate#Get("excluded_regions"),
|
|
||||||
\ '\C\V' . s:delimitMate_extra_excluded_regions,
|
|
||||||
\ '', 'g')
|
|
||||||
\|endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has("folding") && get(g:, 'rust_fold', 0)
|
if has("folding") && get(g:, 'rust_fold', 0)
|
||||||
@ -154,6 +137,9 @@ augroup rust.vim
|
|||||||
" See |:RustInfoToFile| for docs
|
" See |:RustInfoToFile| for docs
|
||||||
command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>)
|
command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>)
|
||||||
|
|
||||||
|
" See |:RustTest| for docs
|
||||||
|
command! -buffer -nargs=* -bang RustTest call rust#Test(<bang>0, <q-args>)
|
||||||
|
|
||||||
if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args")
|
if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args")
|
||||||
let b:rust_last_rustc_args = []
|
let b:rust_last_rustc_args = []
|
||||||
let b:rust_last_args = []
|
let b:rust_last_args = []
|
||||||
@ -192,23 +178,25 @@ augroup rust.vim
|
|||||||
\|xunmap <buffer> ]]
|
\|xunmap <buffer> ]]
|
||||||
\|ounmap <buffer> [[
|
\|ounmap <buffer> [[
|
||||||
\|ounmap <buffer> ]]
|
\|ounmap <buffer> ]]
|
||||||
\|set matchpairs-=<:>
|
\|setlocal matchpairs-=<:>
|
||||||
\|unlet b:match_skip
|
\|unlet b:match_skip
|
||||||
\"
|
\"
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" Code formatting on save
|
" Code formatting on save
|
||||||
autocmd BufWritePre *.rs silent! call rustfmt#PreWrite()
|
autocmd BufWritePre <buffer> silent! call rustfmt#PreWrite()
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
set matchpairs+=<:>
|
setlocal matchpairs+=<:>
|
||||||
" For matchit.vim (rustArrow stops `Fn() -> X` messing things up)
|
" For matchit.vim (rustArrow stops `Fn() -> X` messing things up)
|
||||||
let b:match_skip = 's:comment\|string\|rustArrow'
|
let b:match_skip = 's:comment\|string\|rustArrow'
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
@ -7,30 +7,36 @@ if !exists(':Tagbar')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
let g:tagbar_type_rust = {
|
if !exists('g:tagbar_type_rust')
|
||||||
\ 'ctagstype' : 'rust',
|
let g:tagbar_type_rust = {
|
||||||
\ 'kinds' : [
|
\ 'ctagstype' : 'rust',
|
||||||
\'T:types',
|
\ 'kinds' : [
|
||||||
\'f:functions',
|
\'T:types',
|
||||||
\'g:enumerations',
|
\'f:functions',
|
||||||
\'s:structures',
|
\'g:enumerations',
|
||||||
\'m:modules',
|
\'s:structures',
|
||||||
\'c:constants',
|
\'m:modules',
|
||||||
\'t:traits',
|
\'c:constants',
|
||||||
\'i:trait implementations',
|
\'t:traits',
|
||||||
\ ]
|
\'i:trait implementations',
|
||||||
\ }
|
\ ]
|
||||||
|
\ }
|
||||||
|
endif
|
||||||
|
|
||||||
" In case you've updated/customized your ~/.ctags and prefer to use it.
|
" In case you've updated/customized your ~/.ctags and prefer to use it.
|
||||||
if !get(g:, 'rust_use_custom_ctags_defs', 0)
|
if !get(g:, 'rust_use_custom_ctags_defs', 0)
|
||||||
let g:tagbar_type_rust.deffile = expand('<sfile>:p:h:h:h') . '/ctags/rust.ctags'
|
let g:tagbar_type_rust.deffile = expand('<sfile>:p:h:h:h') . '/ctags/rust.ctags'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
@ -3,9 +3,25 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
|||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Define some defaults in case the included ftplugins don't set them.
|
||||||
|
let s:undo_ftplugin = ""
|
||||||
|
|
||||||
|
" Override our defaults if these were set by an included ftplugin.
|
||||||
|
if exists("b:undo_ftplugin")
|
||||||
|
let s:undo_ftplugin = b:undo_ftplugin
|
||||||
|
unlet b:undo_ftplugin
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl isk<"
|
" Combine the new set of values with those previously included.
|
||||||
|
if exists("b:undo_ftplugin")
|
||||||
|
let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl isk<" . " | " . s:undo_ftplugin
|
||||||
|
|
||||||
setlocal iskeyword+=-
|
setlocal iskeyword+=-
|
||||||
setlocal commentstring=/%s
|
setlocal commentstring=/%s
|
||||||
|
73
ftplugin/terraform.vim
Normal file
73
ftplugin/terraform.vim
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
||||||
|
|
||||||
|
" terraform.vim - basic vim/terraform integration
|
||||||
|
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||||
|
|
||||||
|
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_terraform = 1
|
||||||
|
|
||||||
|
if !exists("g:terraform_fmt_on_save")
|
||||||
|
let g:terraform_fmt_on_save = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:commands(A, L, P)
|
||||||
|
return join([
|
||||||
|
\ "apply",
|
||||||
|
\ "console",
|
||||||
|
\ "destroy",
|
||||||
|
\ "env",
|
||||||
|
\ "fmt",
|
||||||
|
\ "get",
|
||||||
|
\ "graph",
|
||||||
|
\ "import",
|
||||||
|
\ "init",
|
||||||
|
\ "output",
|
||||||
|
\ "plan",
|
||||||
|
\ "providers",
|
||||||
|
\ "push",
|
||||||
|
\ "refresh",
|
||||||
|
\ "show",
|
||||||
|
\ "taint",
|
||||||
|
\ "untaint",
|
||||||
|
\ "validate",
|
||||||
|
\ "version",
|
||||||
|
\ "workspace",
|
||||||
|
\ "debug",
|
||||||
|
\ "force-unlock",
|
||||||
|
\ "state"
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Adapted from vim-hclfmt:
|
||||||
|
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
|
||||||
|
function! terraform#fmt()
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
let l:tmpfile = tempname()
|
||||||
|
call writefile(getline(1, "$"), l:tmpfile)
|
||||||
|
let output = system("terraform fmt -write " . l:tmpfile)
|
||||||
|
if v:shell_error == 0
|
||||||
|
try | silent undojoin | catch | endtry
|
||||||
|
call rename(l:tmpfile, resolve(expand("%")))
|
||||||
|
silent edit!
|
||||||
|
let &syntax = &syntax
|
||||||
|
else
|
||||||
|
echo output
|
||||||
|
call delete(l:tmpfile)
|
||||||
|
endif
|
||||||
|
call winrestview(l:curw)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup terraform
|
||||||
|
autocmd!
|
||||||
|
autocmd VimEnter *
|
||||||
|
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
|
||||||
|
autocmd VimEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
|
||||||
|
if get(g:, "terraform_fmt_on_save", 1)
|
||||||
|
autocmd BufWritePre *.tf call terraform#fmt()
|
||||||
|
autocmd BufWritePre *.tfvars call terraform#fmt()
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
endif
|
@ -22,7 +22,7 @@ endif
|
|||||||
|
|
||||||
" Run only ESLint for Vue files by default.
|
" Run only ESLint for Vue files by default.
|
||||||
" linters specifically for Vue can still be loaded.
|
" linters specifically for Vue can still be loaded.
|
||||||
let b:ale_linter_aliases = ['vue', 'javascript']
|
let b:ale_linter_aliases = get(get(g:, 'ale_linter_aliases', {}), 'vue', ['vue', 'javascript'])
|
||||||
let b:ale_linters = ['eslint']
|
let b:ale_linters = get(get(g:, 'ale_linters', {}), 'vue', ['eslint', 'vls'])
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -129,17 +129,17 @@ let s:access_modifier_regex = '\C^\s*\%(public\|protected\|private\)\s*\%(#.*\)\
|
|||||||
|
|
||||||
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
||||||
function s:IsInStringOrComment(lnum, col)
|
function s:IsInStringOrComment(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_strcom
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string.
|
" Check if the character at lnum:col is inside a string.
|
||||||
function s:IsInString(lnum, col)
|
function s:IsInString(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_string
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string or documentation.
|
" Check if the character at lnum:col is inside a string or documentation.
|
||||||
function s:IsInStringOrDocumentation(lnum, col)
|
function s:IsInStringOrDocumentation(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_stringdoc
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string delimiter
|
" Check if the character at lnum:col is inside a string delimiter
|
||||||
|
@ -36,6 +36,10 @@ if !exists('g:python_pep8_indent_multiline_string')
|
|||||||
let g:python_pep8_indent_multiline_string = 0
|
let g:python_pep8_indent_multiline_string = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:python_pep8_indent_hang_closing')
|
||||||
|
let g:python_pep8_indent_hang_closing = 0
|
||||||
|
endif
|
||||||
|
|
||||||
let s:block_rules = {
|
let s:block_rules = {
|
||||||
\ '^\s*elif\>': ['if', 'elif'],
|
\ '^\s*elif\>': ['if', 'elif'],
|
||||||
\ '^\s*except\>': ['try', 'except'],
|
\ '^\s*except\>': ['try', 'except'],
|
||||||
@ -59,7 +63,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
|||||||
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||||
" are inserted temporarily into the buffer.
|
" are inserted temporarily into the buffer.
|
||||||
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
\ '=~? "\\vstring|comment|jedi\\S"'
|
\ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"'
|
||||||
|
|
||||||
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
\ '=~? "\\vcomment|jedi\\S"'
|
\ '=~? "\\vcomment|jedi\\S"'
|
||||||
@ -90,14 +94,6 @@ else
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:pair_sort(x, y)
|
|
||||||
if a:x[0] == a:y[0]
|
|
||||||
return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1
|
|
||||||
else
|
|
||||||
return a:x[0] > a:y[0] ? 1 : -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find backwards the closest open parenthesis/bracket/brace.
|
" Find backwards the closest open parenthesis/bracket/brace.
|
||||||
function! s:find_opening_paren(...)
|
function! s:find_opening_paren(...)
|
||||||
" optional arguments: line and column (defaults to 1) to search around
|
" optional arguments: line and column (defaults to 1) to search around
|
||||||
@ -144,27 +140,21 @@ endfunction
|
|||||||
" Find possible indent(s) of the block starter that matches the current line.
|
" Find possible indent(s) of the block starter that matches the current line.
|
||||||
function! s:find_start_of_block(lnum, types, multiple)
|
function! s:find_start_of_block(lnum, types, multiple)
|
||||||
let r = []
|
let r = []
|
||||||
let types = copy(a:types)
|
|
||||||
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||||
let lnum = a:lnum
|
let lnum = a:lnum
|
||||||
let last_indent = indent(lnum) + 1
|
let last_indent = indent(lnum) + 1
|
||||||
while lnum > 0 && last_indent > 0
|
while lnum > 0 && last_indent > 0
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
if indent < last_indent
|
if indent < last_indent
|
||||||
for type in types
|
if getline(lnum) =~# re
|
||||||
let re = '\v^\s*'.type.'>'
|
if !a:multiple
|
||||||
if getline(lnum) =~# re
|
return [indent]
|
||||||
if !a:multiple
|
|
||||||
return [indent]
|
|
||||||
endif
|
|
||||||
if index(r, indent) == -1
|
|
||||||
let r += [indent]
|
|
||||||
endif
|
|
||||||
" Remove any handled type, e.g. 'if'.
|
|
||||||
call remove(types, index(types, type))
|
|
||||||
endif
|
endif
|
||||||
endfor
|
if index(r, indent) == -1
|
||||||
let last_indent = indent(lnum)
|
let r += [indent]
|
||||||
|
endif
|
||||||
|
let last_indent = indent
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
endwhile
|
endwhile
|
||||||
@ -205,8 +195,11 @@ function! s:indent_like_opening_paren(lnum)
|
|||||||
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
||||||
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
||||||
|
|
||||||
|
let hang_closing = get(b:, 'python_pep8_indent_hang_closing',
|
||||||
|
\ get(g:, 'python_pep8_indent_hang_closing', 0))
|
||||||
|
|
||||||
if nothing_after_opening_paren
|
if nothing_after_opening_paren
|
||||||
if starts_with_closing_paren
|
if starts_with_closing_paren && !hang_closing
|
||||||
let res = base
|
let res = base
|
||||||
else
|
else
|
||||||
let res = base + s:sw()
|
let res = base + s:sw()
|
||||||
@ -220,10 +213,13 @@ function! s:indent_like_opening_paren(lnum)
|
|||||||
" indent further to distinguish the continuation line
|
" indent further to distinguish the continuation line
|
||||||
" from the next logical line.
|
" from the next logical line.
|
||||||
if text =~# b:control_statement && res == base + s:sw()
|
if text =~# b:control_statement && res == base + s:sw()
|
||||||
return base + s:sw() * 2
|
" But only if not inside parens itself (Flake's E127).
|
||||||
else
|
let [paren_lnum, _] = s:find_opening_paren(paren_lnum)
|
||||||
return res
|
if paren_lnum <= 0
|
||||||
|
return res + s:sw()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Match indent of first block of this type.
|
" Match indent of first block of this type.
|
||||||
@ -337,11 +333,11 @@ endfunction
|
|||||||
" Is the syntax at lnum (and optionally cnum) a python string?
|
" Is the syntax at lnum (and optionally cnum) a python string?
|
||||||
function! s:is_python_string(lnum, ...)
|
function! s:is_python_string(lnum, ...)
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
let linelen = len(line)
|
if a:0
|
||||||
if linelen < 1
|
let cols = type(a:1) != type([]) ? [a:1] : a:1
|
||||||
let linelen = 1
|
else
|
||||||
|
let cols = range(1, max([1, len(line)]))
|
||||||
endif
|
endif
|
||||||
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
|
|
||||||
for cnum in cols
|
for cnum in cols
|
||||||
if match(map(synstack(a:lnum, cnum),
|
if match(map(synstack(a:lnum, cnum),
|
||||||
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
||||||
@ -361,7 +357,7 @@ function! GetPythonPEPIndent(lnum)
|
|||||||
let prevline = getline(a:lnum-1)
|
let prevline = getline(a:lnum-1)
|
||||||
|
|
||||||
" Multilinestrings: continous, docstring or starting.
|
" Multilinestrings: continous, docstring or starting.
|
||||||
if s:is_python_string(a:lnum-1, len(prevline))
|
if s:is_python_string(a:lnum-1, max([1, len(prevline)]))
|
||||||
\ && (s:is_python_string(a:lnum, 1)
|
\ && (s:is_python_string(a:lnum, 1)
|
||||||
\ || match(line, '^\%("""\|''''''\)') != -1)
|
\ || match(line, '^\%("""\|''''''\)') != -1)
|
||||||
|
|
||||||
@ -379,8 +375,8 @@ function! GetPythonPEPIndent(lnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_python_string(a:lnum-1)
|
if s:is_python_string(a:lnum-1)
|
||||||
" Previous line is (completely) a string.
|
" Previous line is (completely) a string: keep current indent.
|
||||||
return indent(a:lnum-1)
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
||||||
|
@ -6,7 +6,7 @@ endif
|
|||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal cindent
|
setlocal cindent
|
||||||
setlocal cinoptions+=j1,J1
|
setlocal cinoptions+=j1,J1,(2s,u2s,U1,m1,+2s
|
||||||
|
|
||||||
setlocal indentexpr=DartIndent()
|
setlocal indentexpr=DartIndent()
|
||||||
|
|
||||||
|
@ -26,17 +26,6 @@ if exists("*GoIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" use shiftwidth function only if it's available
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
func s:sw()
|
|
||||||
return shiftwidth()
|
|
||||||
endfunc
|
|
||||||
else
|
|
||||||
func s:sw()
|
|
||||||
return &sw
|
|
||||||
endfunc
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! GoIndent(lnum)
|
function! GoIndent(lnum)
|
||||||
let prevlnum = prevnonblank(a:lnum-1)
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
if prevlnum == 0
|
if prevlnum == 0
|
||||||
@ -51,19 +40,23 @@ function! GoIndent(lnum)
|
|||||||
|
|
||||||
let ind = previ
|
let ind = previ
|
||||||
|
|
||||||
|
if prevl =~ ' = `[^`]*$'
|
||||||
|
" previous line started a multi-line raw string
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
if prevl =~ '[({]\s*$'
|
if prevl =~ '[({]\s*$'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let ind += s:sw()
|
let ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
if prevl =~# '^\s*\(case .*\|default\):$'
|
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
" previous line is part of a switch statement
|
" previous line is part of a switch statement
|
||||||
let ind += s:sw()
|
let ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
" TODO: handle if the previous line is a label.
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
if thisl =~ '^\s*[)}]'
|
if thisl =~ '^\s*[)}]'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let ind -= s:sw()
|
let ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Colons are tricky.
|
" Colons are tricky.
|
||||||
@ -71,7 +64,7 @@ function! GoIndent(lnum)
|
|||||||
" We ignore trying to deal with jump labels because (a) they're rare, and
|
" We ignore trying to deal with jump labels because (a) they're rare, and
|
||||||
" (b) they're hard to disambiguate from a composite literal key.
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
if thisl =~# '^\s*\(case .*\|default\):$'
|
if thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
let ind -= s:sw()
|
let ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -50,8 +50,9 @@ function GetJuliaNestingStruct(lnum, ...)
|
|||||||
let e = a:0 > 1 ? a:2 : -1
|
let e = a:0 > 1 ? a:2 : -1
|
||||||
let blocks_stack = []
|
let blocks_stack = []
|
||||||
let num_closed_blocks = 0
|
let num_closed_blocks = 0
|
||||||
|
let tt = get(b:, 'julia_syntax_version', 10) == 6 ? '\|\%(\%(abstract\|primitive\)\s\+\)\@<!type' : ''
|
||||||
while 1
|
while 1
|
||||||
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\=\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\%(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s, e)
|
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\?\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|\%(bare\)\?module\|quote\|do'.tt.'\)\>', s, e)
|
||||||
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e)
|
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e)
|
||||||
|
|
||||||
if fb < 0 && fe < 0
|
if fb < 0 && fe < 0
|
||||||
@ -133,7 +134,7 @@ function GetJuliaNestingStruct(lnum, ...)
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|\%(staged\)\?function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(\%(abstract\|primitive\)\s\+\)\?type\|immutable\|let\|quote\|do\)\>', s)
|
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|\%(staged\)\?function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(abstract\|primitive\)\s\+type\|immutable\|let\|quote\|do'.tt.'\)\>', s)
|
||||||
if i >= 0 && i == fb
|
if i >= 0 && i == fb
|
||||||
if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1
|
if match(line, '\C\<\%(mutable\|abstract\|primitive\)', i) != -1
|
||||||
let s = i+11
|
let s = i+11
|
||||||
|
@ -7,15 +7,15 @@ setlocal indentexpr=GetMarkdownIndent()
|
|||||||
setlocal nolisp
|
setlocal nolisp
|
||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
|
|
||||||
" Automatically insert bullets
|
|
||||||
setlocal formatoptions+=r
|
|
||||||
" Do not automatically insert bullets when auto-wrapping with text-width
|
|
||||||
setlocal formatoptions-=c
|
|
||||||
" Accept various markers as bullets
|
|
||||||
setlocal comments=b:*,b:+,b:-
|
|
||||||
|
|
||||||
" Automatically continue blockquote on line break
|
" Automatically continue blockquote on line break
|
||||||
setlocal comments+=b:>
|
setlocal formatoptions+=r
|
||||||
|
setlocal comments=b:>
|
||||||
|
if get(g:, "vim_markdown_auto_insert_bullets", 1)
|
||||||
|
" Do not automatically insert bullets when auto-wrapping with text-width
|
||||||
|
setlocal formatoptions-=c
|
||||||
|
" Accept various markers as bullets
|
||||||
|
setlocal comments+=b:*,b:+,b:-
|
||||||
|
endif
|
||||||
|
|
||||||
" Only define the function once
|
" Only define the function once
|
||||||
if exists("*GetMarkdownIndent") | finish | endif
|
if exists("*GetMarkdownIndent") | finish | endif
|
||||||
|
@ -11,7 +11,7 @@ endif
|
|||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal indentexpr=GetNixIndent()
|
setlocal indentexpr=GetNixIndent()
|
||||||
setlocal indentkeys+=0=then,0=else,0=inherit,*<Return>
|
setlocal indentkeys+=0=then,0=else,0=inherit,0=in,*<Return>
|
||||||
|
|
||||||
if exists("*GetNixIndent")
|
if exists("*GetNixIndent")
|
||||||
finish
|
finish
|
||||||
@ -21,8 +21,8 @@ let s:cpo_save = &cpo
|
|||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||||
let s:binding_open = '\%(\<let\>\|{\)'
|
let s:binding_open = '\%(\<let\>\)'
|
||||||
let s:binding_close = '\%(\<in\>\|}\)'
|
let s:binding_close = '\%(\<in\>\)'
|
||||||
let s:block_open = '\%({\|[\)'
|
let s:block_open = '\%({\|[\)'
|
||||||
let s:block_close = '\%(}\|]\)'
|
let s:block_close = '\%(}\|]\)'
|
||||||
|
|
||||||
@ -54,14 +54,6 @@ function! GetNixIndent()
|
|||||||
return indent(bslnum)
|
return indent(bslnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if last_line =~ ';$'
|
|
||||||
let bslnum = searchpair(s:binding_open, '', s:binding_close, 'bnW',
|
|
||||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "StringSpecial$"')
|
|
||||||
if bslnum != 0
|
|
||||||
let ind = indent(bslnum) + &sw
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if last_line =~ s:block_open . '\s*$'
|
if last_line =~ s:block_open . '\s*$'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
@ -78,7 +70,7 @@ function! GetNixIndent()
|
|||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if getline(v:lnum - 1) =~ '^\<in\s*$'
|
if last_line =~ '^\<in\s*$'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ if !exists('g:python_pep8_indent_multiline_string')
|
|||||||
let g:python_pep8_indent_multiline_string = 0
|
let g:python_pep8_indent_multiline_string = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:python_pep8_indent_hang_closing')
|
||||||
|
let g:python_pep8_indent_hang_closing = 0
|
||||||
|
endif
|
||||||
|
|
||||||
let s:block_rules = {
|
let s:block_rules = {
|
||||||
\ '^\s*elif\>': ['if', 'elif'],
|
\ '^\s*elif\>': ['if', 'elif'],
|
||||||
\ '^\s*except\>': ['try', 'except'],
|
\ '^\s*except\>': ['try', 'except'],
|
||||||
@ -59,7 +63,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
|||||||
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||||
" are inserted temporarily into the buffer.
|
" are inserted temporarily into the buffer.
|
||||||
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
\ '=~? "\\vstring|comment|jedi\\S"'
|
\ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"'
|
||||||
|
|
||||||
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
\ '=~? "\\vcomment|jedi\\S"'
|
\ '=~? "\\vcomment|jedi\\S"'
|
||||||
@ -90,14 +94,6 @@ else
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:pair_sort(x, y)
|
|
||||||
if a:x[0] == a:y[0]
|
|
||||||
return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1
|
|
||||||
else
|
|
||||||
return a:x[0] > a:y[0] ? 1 : -1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find backwards the closest open parenthesis/bracket/brace.
|
" Find backwards the closest open parenthesis/bracket/brace.
|
||||||
function! s:find_opening_paren(...)
|
function! s:find_opening_paren(...)
|
||||||
" optional arguments: line and column (defaults to 1) to search around
|
" optional arguments: line and column (defaults to 1) to search around
|
||||||
@ -144,27 +140,21 @@ endfunction
|
|||||||
" Find possible indent(s) of the block starter that matches the current line.
|
" Find possible indent(s) of the block starter that matches the current line.
|
||||||
function! s:find_start_of_block(lnum, types, multiple)
|
function! s:find_start_of_block(lnum, types, multiple)
|
||||||
let r = []
|
let r = []
|
||||||
let types = copy(a:types)
|
|
||||||
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||||
let lnum = a:lnum
|
let lnum = a:lnum
|
||||||
let last_indent = indent(lnum) + 1
|
let last_indent = indent(lnum) + 1
|
||||||
while lnum > 0 && last_indent > 0
|
while lnum > 0 && last_indent > 0
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
if indent < last_indent
|
if indent < last_indent
|
||||||
for type in types
|
if getline(lnum) =~# re
|
||||||
let re = '\v^\s*'.type.'>'
|
if !a:multiple
|
||||||
if getline(lnum) =~# re
|
return [indent]
|
||||||
if !a:multiple
|
|
||||||
return [indent]
|
|
||||||
endif
|
|
||||||
if index(r, indent) == -1
|
|
||||||
let r += [indent]
|
|
||||||
endif
|
|
||||||
" Remove any handled type, e.g. 'if'.
|
|
||||||
call remove(types, index(types, type))
|
|
||||||
endif
|
endif
|
||||||
endfor
|
if index(r, indent) == -1
|
||||||
let last_indent = indent(lnum)
|
let r += [indent]
|
||||||
|
endif
|
||||||
|
let last_indent = indent
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
endwhile
|
endwhile
|
||||||
@ -205,8 +195,11 @@ function! s:indent_like_opening_paren(lnum)
|
|||||||
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
||||||
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
||||||
|
|
||||||
|
let hang_closing = get(b:, 'python_pep8_indent_hang_closing',
|
||||||
|
\ get(g:, 'python_pep8_indent_hang_closing', 0))
|
||||||
|
|
||||||
if nothing_after_opening_paren
|
if nothing_after_opening_paren
|
||||||
if starts_with_closing_paren
|
if starts_with_closing_paren && !hang_closing
|
||||||
let res = base
|
let res = base
|
||||||
else
|
else
|
||||||
let res = base + s:sw()
|
let res = base + s:sw()
|
||||||
@ -220,10 +213,13 @@ function! s:indent_like_opening_paren(lnum)
|
|||||||
" indent further to distinguish the continuation line
|
" indent further to distinguish the continuation line
|
||||||
" from the next logical line.
|
" from the next logical line.
|
||||||
if text =~# b:control_statement && res == base + s:sw()
|
if text =~# b:control_statement && res == base + s:sw()
|
||||||
return base + s:sw() * 2
|
" But only if not inside parens itself (Flake's E127).
|
||||||
else
|
let [paren_lnum, _] = s:find_opening_paren(paren_lnum)
|
||||||
return res
|
if paren_lnum <= 0
|
||||||
|
return res + s:sw()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Match indent of first block of this type.
|
" Match indent of first block of this type.
|
||||||
@ -337,11 +333,11 @@ endfunction
|
|||||||
" Is the syntax at lnum (and optionally cnum) a python string?
|
" Is the syntax at lnum (and optionally cnum) a python string?
|
||||||
function! s:is_python_string(lnum, ...)
|
function! s:is_python_string(lnum, ...)
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
let linelen = len(line)
|
if a:0
|
||||||
if linelen < 1
|
let cols = type(a:1) != type([]) ? [a:1] : a:1
|
||||||
let linelen = 1
|
else
|
||||||
|
let cols = range(1, max([1, len(line)]))
|
||||||
endif
|
endif
|
||||||
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
|
|
||||||
for cnum in cols
|
for cnum in cols
|
||||||
if match(map(synstack(a:lnum, cnum),
|
if match(map(synstack(a:lnum, cnum),
|
||||||
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
||||||
@ -361,7 +357,7 @@ function! GetPythonPEPIndent(lnum)
|
|||||||
let prevline = getline(a:lnum-1)
|
let prevline = getline(a:lnum-1)
|
||||||
|
|
||||||
" Multilinestrings: continous, docstring or starting.
|
" Multilinestrings: continous, docstring or starting.
|
||||||
if s:is_python_string(a:lnum-1, len(prevline))
|
if s:is_python_string(a:lnum-1, max([1, len(prevline)]))
|
||||||
\ && (s:is_python_string(a:lnum, 1)
|
\ && (s:is_python_string(a:lnum, 1)
|
||||||
\ || match(line, '^\%("""\|''''''\)') != -1)
|
\ || match(line, '^\%("""\|''''''\)') != -1)
|
||||||
|
|
||||||
@ -379,8 +375,8 @@ function! GetPythonPEPIndent(lnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_python_string(a:lnum-1)
|
if s:is_python_string(a:lnum-1)
|
||||||
" Previous line is (completely) a string.
|
" Previous line is (completely) a string: keep current indent.
|
||||||
return indent(a:lnum-1)
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
||||||
|
@ -69,7 +69,7 @@ let s:skip_expr =
|
|||||||
let s:ruby_indent_keywords =
|
let s:ruby_indent_keywords =
|
||||||
\ '^\s*\zs\<\%(module\|class\|if\|for' .
|
\ '^\s*\zs\<\%(module\|class\|if\|for' .
|
||||||
\ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' .
|
\ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' .
|
||||||
\ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' .
|
\ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' .
|
||||||
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
|
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
|
||||||
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
|
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ let s:ruby_deindent_keywords =
|
|||||||
let s:end_start_regex =
|
let s:end_start_regex =
|
||||||
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
|
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
|
||||||
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
|
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
|
||||||
\ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' .
|
\ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' .
|
||||||
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
|
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
|
||||||
|
|
||||||
" Regex that defines the middle-match for the 'end' keyword.
|
" Regex that defines the middle-match for the 'end' keyword.
|
||||||
@ -195,8 +195,29 @@ function! GetRubyIndent(...) abort
|
|||||||
|
|
||||||
" 2.3. Work on the previous line. {{{2
|
" 2.3. Work on the previous line. {{{2
|
||||||
" -------------------------------
|
" -------------------------------
|
||||||
|
|
||||||
|
" Special case: we don't need the real s:PrevNonBlankNonString for an empty
|
||||||
|
" line inside a string. And that call can be quite expensive in that
|
||||||
|
" particular situation.
|
||||||
let indent_callback_names = [
|
let indent_callback_names = [
|
||||||
\ 's:EmptyInsideString',
|
\ 's:EmptyInsideString',
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
for callback_name in indent_callback_names
|
||||||
|
" Decho "Running: ".callback_name
|
||||||
|
let indent = call(function(callback_name), [indent_info])
|
||||||
|
|
||||||
|
if indent >= 0
|
||||||
|
" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info)
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" Previous line number
|
||||||
|
let indent_info.plnum = s:PrevNonBlankNonString(indent_info.clnum - 1)
|
||||||
|
let indent_info.pline = getline(indent_info.plnum)
|
||||||
|
|
||||||
|
let indent_callback_names = [
|
||||||
\ 's:StartOfFile',
|
\ 's:StartOfFile',
|
||||||
\ 's:AfterAccessModifier',
|
\ 's:AfterAccessModifier',
|
||||||
\ 's:ContinuedLine',
|
\ 's:ContinuedLine',
|
||||||
@ -208,10 +229,6 @@ function! GetRubyIndent(...) abort
|
|||||||
\ 's:AfterIndentKeyword',
|
\ 's:AfterIndentKeyword',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
" Previous line number
|
|
||||||
let indent_info.plnum = s:PrevNonBlankNonString(indent_info.clnum - 1)
|
|
||||||
let indent_info.pline = getline(indent_info.plnum)
|
|
||||||
|
|
||||||
for callback_name in indent_callback_names
|
for callback_name in indent_callback_names
|
||||||
" Decho "Running: ".callback_name
|
" Decho "Running: ".callback_name
|
||||||
let indent = call(function(callback_name), [indent_info])
|
let indent = call(function(callback_name), [indent_info])
|
||||||
@ -389,12 +406,17 @@ function! s:LeadingOperator(cline_info) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:EmptyInsideString(pline_info) abort
|
function! s:EmptyInsideString(pline_info) abort
|
||||||
" If the line is empty and inside a string (plnum would not be the real
|
" If the line is empty and inside a string (the previous line is a string,
|
||||||
" prevnonblank in that case), use the previous line's indent
|
" too), use the previous line's indent
|
||||||
let info = a:pline_info
|
let info = a:pline_info
|
||||||
|
|
||||||
if info.cline =~ '^\s*$' && info.plnum != prevnonblank(info.clnum - 1)
|
let plnum = prevnonblank(info.clnum - 1)
|
||||||
return indent(prevnonblank(info.clnum))
|
let pline = getline(plnum)
|
||||||
|
|
||||||
|
if info.cline =~ '^\s*$'
|
||||||
|
\ && s:IsInStringOrComment(plnum, 1)
|
||||||
|
\ && s:IsInStringOrComment(plnum, strlen(pline))
|
||||||
|
return indent(plnum)
|
||||||
endif
|
endif
|
||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -31,8 +31,10 @@ if exists("*GetRustIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
" Come here when loading the script the first time.
|
" Come here when loading the script the first time.
|
||||||
|
|
||||||
@ -46,12 +48,12 @@ function! s:get_line_trimmed(lnum)
|
|||||||
" If the last character in the line is a comment, do a binary search for
|
" If the last character in the line is a comment, do a binary search for
|
||||||
" the start of the comment. synID() is slow, a linear search would take
|
" the start of the comment. synID() is slow, a linear search would take
|
||||||
" too long on a long line.
|
" too long on a long line.
|
||||||
if synIDattr(synID(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo'
|
if synIDattr(synID(a:lnum, line_len, 1), "name") =~? 'Comment\|Todo'
|
||||||
let min = 1
|
let min = 1
|
||||||
let max = line_len
|
let max = line_len
|
||||||
while min < max
|
while min < max
|
||||||
let col = (min + max) / 2
|
let col = (min + max) / 2
|
||||||
if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo'
|
if synIDattr(synID(a:lnum, col, 1), "name") =~? 'Comment\|Todo'
|
||||||
let max = col
|
let max = col
|
||||||
else
|
else
|
||||||
let min = col + 1
|
let min = col + 1
|
||||||
@ -71,7 +73,7 @@ function! s:is_string_comment(lnum, col)
|
|||||||
if has('syntax_items')
|
if has('syntax_items')
|
||||||
for id in synstack(a:lnum, a:col)
|
for id in synstack(a:lnum, a:col)
|
||||||
let synname = synIDattr(id, "name")
|
let synname = synIDattr(id, "name")
|
||||||
if synname == "rustString" || synname =~ "^rustComment"
|
if synname ==# "rustString" || synname =~# "^rustComment"
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -90,13 +92,13 @@ function GetRustIndent(lnum)
|
|||||||
|
|
||||||
if has('syntax_items')
|
if has('syntax_items')
|
||||||
let synname = synIDattr(synID(a:lnum, 1, 1), "name")
|
let synname = synIDattr(synID(a:lnum, 1, 1), "name")
|
||||||
if synname == "rustString"
|
if synname ==# "rustString"
|
||||||
" If the start of the line is in a string, don't change the indent
|
" If the start of the line is in a string, don't change the indent
|
||||||
return -1
|
return -1
|
||||||
elseif synname =~ '\(Comment\|Todo\)'
|
elseif synname =~? '\(Comment\|Todo\)'
|
||||||
\ && line !~ '^\s*/\*' " not /* opening line
|
\ && line !~# '^\s*/\*' " not /* opening line
|
||||||
if synname =~ "CommentML" " multi-line
|
if synname =~? "CommentML" " multi-line
|
||||||
if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*'
|
if line !~# '^\s*\*' && getline(a:lnum - 1) =~# '^\s*/\*'
|
||||||
" This is (hopefully) the line after a /*, and it has no
|
" This is (hopefully) the line after a /*, and it has no
|
||||||
" leader, so the correct indentation is that of the
|
" leader, so the correct indentation is that of the
|
||||||
" previous line.
|
" previous line.
|
||||||
@ -123,22 +125,22 @@ function GetRustIndent(lnum)
|
|||||||
" Search backwards for the previous non-empty line.
|
" Search backwards for the previous non-empty line.
|
||||||
let prevlinenum = prevnonblank(a:lnum - 1)
|
let prevlinenum = prevnonblank(a:lnum - 1)
|
||||||
let prevline = s:get_line_trimmed(prevlinenum)
|
let prevline = s:get_line_trimmed(prevlinenum)
|
||||||
while prevlinenum > 1 && prevline !~ '[^[:blank:]]'
|
while prevlinenum > 1 && prevline !~# '[^[:blank:]]'
|
||||||
let prevlinenum = prevnonblank(prevlinenum - 1)
|
let prevlinenum = prevnonblank(prevlinenum - 1)
|
||||||
let prevline = s:get_line_trimmed(prevlinenum)
|
let prevline = s:get_line_trimmed(prevlinenum)
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Handle where clauses nicely: subsequent values should line up nicely.
|
" Handle where clauses nicely: subsequent values should line up nicely.
|
||||||
if prevline[len(prevline) - 1] == ","
|
if prevline[len(prevline) - 1] ==# ","
|
||||||
\ && prevline =~# '^\s*where\s'
|
\ && prevline =~# '^\s*where\s'
|
||||||
return indent(prevlinenum) + 6
|
return indent(prevlinenum) + 6
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if prevline[len(prevline) - 1] == ","
|
if prevline[len(prevline) - 1] ==# ","
|
||||||
\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
|
\ && s:get_line_trimmed(a:lnum) !~# '^\s*[\[\]{}]'
|
||||||
\ && prevline !~ '^\s*fn\s'
|
\ && prevline !~# '^\s*fn\s'
|
||||||
\ && prevline !~ '([^()]\+,$'
|
\ && prevline !~# '([^()]\+,$'
|
||||||
\ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>'
|
\ && s:get_line_trimmed(a:lnum) !~# '^\s*\S\+\s*=>'
|
||||||
" Oh ho! The previous line ended in a comma! I bet cindent will try to
|
" Oh ho! The previous line ended in a comma! I bet cindent will try to
|
||||||
" take this too far... For now, let's normally use the previous line's
|
" take this too far... For now, let's normally use the previous line's
|
||||||
" indent.
|
" indent.
|
||||||
@ -197,7 +199,7 @@ function GetRustIndent(lnum)
|
|||||||
else
|
else
|
||||||
" At the module scope, inside square brackets only
|
" At the module scope, inside square brackets only
|
||||||
"if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
|
"if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
|
||||||
if line =~ "^\\s*]"
|
if line =~# "^\\s*]"
|
||||||
" It's the closing line, dedent it
|
" It's the closing line, dedent it
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -211,8 +213,10 @@ function GetRustIndent(lnum)
|
|||||||
return cindent(a:lnum)
|
return cindent(a:lnum)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" vint: -ProhibitAbbreviationOption
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
" vint: +ProhibitAbbreviationOption
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ syn keyword jenkinsfileBuiltInVariable currentBuild
|
|||||||
|
|
||||||
syn keyword jenkinsfileSection pipeline agent stages steps
|
syn keyword jenkinsfileSection pipeline agent stages steps
|
||||||
|
|
||||||
syn keyword jenkinsfileDirective environment options parameters triggers stage tools input when
|
syn keyword jenkinsfileDirective environment options parameters triggers stage tools input when libraries
|
||||||
|
|
||||||
syn keyword jenkinsfileOption contained buildDiscarder disableConcurrentBuilds overrideIndexTriggers skipDefaultCheckout nextgroup=jenkinsfileOptionParams
|
syn keyword jenkinsfileOption contained buildDiscarder disableConcurrentBuilds overrideIndexTriggers skipDefaultCheckout nextgroup=jenkinsfileOptionParams
|
||||||
syn keyword jenkinsfileOption contained skipStagesAfterUnstable checkoutToSubdirectory timeout retry timestamps nextgroup=jenkinsfileOptionParams
|
syn keyword jenkinsfileOption contained skipStagesAfterUnstable checkoutToSubdirectory timeout retry timestamps nextgroup=jenkinsfileOptionParams
|
||||||
syn region jenkinsfileOptionParams contained start="(" end=")" transparent contains=@groovyTop
|
syn region jenkinsfileOptionParams contained start='(' end=')' transparent contains=@groovyTop
|
||||||
syn match jenkinsfileOptionO /[a-zA-Z]\+([^)]*)/ contains=jenkinsfileOption,jenkinsfileOptionParams transparent containedin=groovyParenT1
|
syn match jenkinsfileOptionO /[a-zA-Z]\+([^)]*)/ contains=jenkinsfileOption,jenkinsfileOptionParams transparent containedin=groovyParenT1
|
||||||
|
|
||||||
syn keyword jenkinsfileCoreStep checkout
|
syn keyword jenkinsfileCoreStep checkout
|
||||||
@ -26,7 +26,7 @@ syn keyword jenkinsfileCoreStep tool
|
|||||||
" TODO: These should probably be broken out.
|
" TODO: These should probably be broken out.
|
||||||
syn keyword jenkinsfileCoreStep post always changed failure success unstable aborted
|
syn keyword jenkinsfileCoreStep post always changed failure success unstable aborted
|
||||||
|
|
||||||
syn region jenkinsFileDockerConfigBlock contained start="{" end="}" contains=groovyString,jenkinsfileDockerKeyword transparent
|
syn region jenkinsFileDockerConfigBlock contained start='{' end='}' contains=groovyString,jenkinsfileDockerKeyword transparent
|
||||||
syn keyword jenkinsFileDockerKeyword contained image args dockerfile additionalBuildArgs
|
syn keyword jenkinsFileDockerKeyword contained image args dockerfile additionalBuildArgs
|
||||||
|
|
||||||
syn keyword jenkinsfilePipelineStep Applitools ArtifactoryGradleBuild Consul MavenDescriptorStep OneSky VersionNumber
|
syn keyword jenkinsfilePipelineStep Applitools ArtifactoryGradleBuild Consul MavenDescriptorStep OneSky VersionNumber
|
||||||
@ -123,6 +123,8 @@ hi link jenkinsfilePipelineStep Include
|
|||||||
hi link jenkinsfileBuiltInVariable Identifier
|
hi link jenkinsfileBuiltInVariable Identifier
|
||||||
hi link jenkinsFileDockerKeyword jenkinsfilePipelineStep
|
hi link jenkinsFileDockerKeyword jenkinsfilePipelineStep
|
||||||
|
|
||||||
let b:current_syntax = "Jenkinsfile"
|
let b:current_syntax = 'Jenkinsfile'
|
||||||
|
|
||||||
|
" vim:set et sw=0 ts=2 ft=vim tw=78:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -19,7 +19,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
syn keyword carpSyntax def defn let do if while ref address set! the
|
syn keyword carpSyntax def defn let do if while ref address set! the
|
||||||
syn keyword carpSyntax defmacro defdynamic quote cons list array
|
syn keyword carpSyntax defmacro defdynamic quote cons list array fn
|
||||||
syn keyword carpSyntax expand deftype register system-include register-type
|
syn keyword carpSyntax expand deftype register system-include register-type
|
||||||
syn keyword carpSyntax defmodule copy use module defalias definterface eval
|
syn keyword carpSyntax defmodule copy use module defalias definterface eval
|
||||||
syn keyword carpSyntax expand instantiate type info help quit env build run
|
syn keyword carpSyntax expand instantiate type info help quit env build run
|
||||||
@ -64,6 +64,7 @@ syn cluster carpQuotedOrNormal contains=carpDelimiter
|
|||||||
syn region carpQuotedStruc start="@("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
syn region carpQuotedStruc start="@("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
syn region carpQuotedStruc start="&("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
syn region carpQuotedStruc start="&("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
syn region carpQuotedStruc start="("rs=s+1 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
syn region carpQuotedStruc start="("rs=s+1 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
syn region carpQuotedStruc start="{"rs=s+1 end="}"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
syn region carpQuotedStruc start="\["rs=s+1 end="\]"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
syn region carpQuotedStruc start="\["rs=s+1 end="\]"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
|
||||||
syn cluster carpQuotedStuff add=carpQuotedStruc
|
syn cluster carpQuotedStuff add=carpQuotedStruc
|
||||||
@ -73,6 +74,7 @@ syn region carpStruc matchgroup=Delimiter start="&("rs=s+2 matchgroup=Delimiter
|
|||||||
syn region carpStruc matchgroup=Delimiter start="&"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
syn region carpStruc matchgroup=Delimiter start="&"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
||||||
syn region carpStruc matchgroup=Delimiter start="@"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
syn region carpStruc matchgroup=Delimiter start="@"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
||||||
syn region carpStruc matchgroup=Delimiter start="("rs=s+1 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
syn region carpStruc matchgroup=Delimiter start="("rs=s+1 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="{"rs=s+1 matchgroup=Delimiter end="}"re=e-1 contains=@carpNormal
|
||||||
syn region carpStruc matchgroup=Delimiter start="\["rs=s+1 matchgroup=Delimiter end="\]"re=e-1 contains=@carpNormal
|
syn region carpStruc matchgroup=Delimiter start="\["rs=s+1 matchgroup=Delimiter end="\]"re=e-1 contains=@carpNormal
|
||||||
|
|
||||||
syn region carpString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/
|
syn region carpString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/
|
||||||
|
@ -23,7 +23,7 @@ endif
|
|||||||
" Operators
|
" Operators
|
||||||
if exists('g:crystal_operators')
|
if exists('g:crystal_operators')
|
||||||
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||||
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\|//"
|
||||||
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
|
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -31,11 +31,11 @@ endif
|
|||||||
syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
||||||
syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
||||||
|
|
||||||
syn region crystalInterpolation matchgroup=crystalInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,@crystalNotTop
|
syn region crystalInterpolation matchgroup=crystalInterpolationDelim start="#{" end="}" contained contains=ALLBUT,@crystalNotTop
|
||||||
syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelimiter,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable
|
syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelim,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable
|
||||||
syn match crystalInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained
|
syn match crystalInterpolationDelim "#\ze\%(\$\|@@\=\)\w\+" display contained
|
||||||
syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelimiter,crystalPredefinedVariable,crystalInvalidVariable
|
syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelim,crystalPredefinedVariable,crystalInvalidVariable
|
||||||
syn match crystalInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained
|
syn match crystalInterpolationDelim "#\ze\$\%(-\w\|\W\)" display contained
|
||||||
syn region crystalNoInterpolation start="\\#{" end="}" contained
|
syn region crystalNoInterpolation start="\\#{" end="}" contained
|
||||||
syn match crystalNoInterpolation "\\#{" display contained
|
syn match crystalNoInterpolation "\\#{" display contained
|
||||||
syn match crystalNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
|
syn match crystalNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
|
||||||
@ -232,11 +232,13 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
|
|||||||
syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@crystalNotTop fold
|
syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@crystalNotTop fold
|
||||||
|
|
||||||
" statements without 'do'
|
" statements without 'do'
|
||||||
syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
|
syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
|
||||||
syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
|
syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
|
||||||
|
syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=ALLBUT,@crystalNotTop fold
|
||||||
syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop fold
|
syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop fold
|
||||||
|
|
||||||
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
|
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
|
||||||
|
syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression
|
||||||
syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression
|
syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression
|
||||||
|
|
||||||
syn match crystalExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalBlockExpression
|
syn match crystalExceptional "\<\%(\%(\%(;\|^\)\s*\)\@<=rescue\|else\|ensure\)\>[?!]\@!" contained containedin=crystalBlockExpression
|
||||||
@ -313,78 +315,73 @@ syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|pr
|
|||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
|
||||||
|
|
||||||
hi def link crystalClass crystalDefine
|
hi def link crystalClass crystalDefine
|
||||||
hi def link crystalModule crystalDefine
|
hi def link crystalModule crystalDefine
|
||||||
hi def link crystalStruct crystalDefine
|
hi def link crystalStruct crystalDefine
|
||||||
hi def link crystalLib crystalDefine
|
hi def link crystalLib crystalDefine
|
||||||
hi def link crystalMacro crystalDefine
|
hi def link crystalMacro crystalDefine
|
||||||
hi def link crystalEnum crystalDefine
|
hi def link crystalEnum crystalDefine
|
||||||
hi def link crystalMethodExceptional crystalDefine
|
hi def link crystalMethodExceptional crystalDefine
|
||||||
hi def link crystalDefine Define
|
hi def link crystalDefine Define
|
||||||
hi def link crystalFunction Function
|
hi def link crystalFunction Function
|
||||||
hi def link crystalConditional Conditional
|
hi def link crystalConditional Conditional
|
||||||
hi def link crystalConditionalModifier crystalConditional
|
hi def link crystalConditionalModifier crystalConditional
|
||||||
hi def link crystalExceptional crystalConditional
|
hi def link crystalExceptional crystalConditional
|
||||||
hi def link crystalRepeat Repeat
|
hi def link crystalRepeat Repeat
|
||||||
hi def link crystalRepeatModifier crystalRepeat
|
hi def link crystalRepeatModifier crystalRepeat
|
||||||
hi def link crystalOptionalDo crystalRepeat
|
hi def link crystalOptionalDo crystalRepeat
|
||||||
hi def link crystalControl Statement
|
hi def link crystalControl Statement
|
||||||
hi def link crystalInclude Include
|
hi def link crystalInclude Include
|
||||||
hi def link crystalRecord Statement
|
hi def link crystalRecord Statement
|
||||||
hi def link crystalInteger Number
|
hi def link crystalInteger Number
|
||||||
hi def link crystalASCIICode Character
|
hi def link crystalASCIICode Character
|
||||||
hi def link crystalFloat Float
|
hi def link crystalFloat Float
|
||||||
hi def link crystalBoolean Boolean
|
hi def link crystalBoolean Boolean
|
||||||
hi def link crystalException Exception
|
hi def link crystalException Exception
|
||||||
if !exists('g:crystal_no_identifiers')
|
if !exists('g:crystal_no_identifiers')
|
||||||
hi def link crystalIdentifier Identifier
|
hi def link crystalIdentifier Identifier
|
||||||
else
|
else
|
||||||
hi def link crystalIdentifier NONE
|
hi def link crystalIdentifier NONE
|
||||||
endif
|
endif
|
||||||
hi def link crystalClassVariable crystalIdentifier
|
hi def link crystalClassVariable crystalIdentifier
|
||||||
hi def link crystalConstant Type
|
hi def link crystalConstant Type
|
||||||
hi def link crystalGlobalVariable crystalIdentifier
|
hi def link crystalGlobalVariable crystalIdentifier
|
||||||
hi def link crystalBlockParameter crystalIdentifier
|
hi def link crystalBlockParameter crystalIdentifier
|
||||||
hi def link crystalInstanceVariable crystalIdentifier
|
hi def link crystalInstanceVariable crystalIdentifier
|
||||||
hi def link crystalFreshVariable crystalIdentifier
|
hi def link crystalFreshVariable crystalIdentifier
|
||||||
hi def link crystalPredefinedIdentifier crystalIdentifier
|
hi def link crystalPredefinedIdentifier crystalIdentifier
|
||||||
hi def link crystalPredefinedConstant crystalPredefinedIdentifier
|
hi def link crystalPredefinedConstant crystalPredefinedIdentifier
|
||||||
hi def link crystalPredefinedVariable crystalPredefinedIdentifier
|
hi def link crystalPredefinedVariable crystalPredefinedIdentifier
|
||||||
hi def link crystalSymbol Constant
|
hi def link crystalSymbol Constant
|
||||||
hi def link crystalKeyword Keyword
|
hi def link crystalKeyword Keyword
|
||||||
hi def link crystalOperator Operator
|
hi def link crystalOperator Operator
|
||||||
hi def link crystalAccess Statement
|
hi def link crystalAccess Statement
|
||||||
hi def link crystalAttribute Statement
|
hi def link crystalAttribute Statement
|
||||||
hi def link crystalPseudoVariable Constant
|
hi def link crystalPseudoVariable Constant
|
||||||
hi def link crystalCharLiteral Character
|
hi def link crystalCharLiteral Character
|
||||||
|
hi def link crystalComment Comment
|
||||||
hi def link crystalComment Comment
|
|
||||||
hi def link crystalTodo Todo
|
hi def link crystalTodo Todo
|
||||||
|
|
||||||
hi def link crystalStringEscape Special
|
hi def link crystalStringEscape Special
|
||||||
hi def link crystalInterpolationDelimiter Delimiter
|
hi def link crystalInterpolationDelim Delimiter
|
||||||
hi def link crystalNoInterpolation crystalString
|
hi def link crystalNoInterpolation crystalString
|
||||||
hi def link crystalSharpBang PreProc
|
hi def link crystalSharpBang PreProc
|
||||||
hi def link crystalRegexpDelimiter crystalStringDelimiter
|
hi def link crystalRegexpDelimiter crystalStringDelimiter
|
||||||
hi def link crystalSymbolDelimiter crystalStringDelimiter
|
hi def link crystalSymbolDelimiter crystalStringDelimiter
|
||||||
hi def link crystalStringDelimiter Delimiter
|
hi def link crystalStringDelimiter Delimiter
|
||||||
hi def link crystalHeredoc crystalString
|
hi def link crystalString String
|
||||||
hi def link crystalString String
|
hi def link crystalHeredoc crystalString
|
||||||
hi def link crystalRegexpEscape crystalRegexpSpecial
|
hi def link crystalRegexpEscape crystalRegexpSpecial
|
||||||
hi def link crystalRegexpQuantifier crystalRegexpSpecial
|
hi def link crystalRegexpQuantifier crystalRegexpSpecial
|
||||||
hi def link crystalRegexpAnchor crystalRegexpSpecial
|
hi def link crystalRegexpAnchor crystalRegexpSpecial
|
||||||
hi def link crystalRegexpDot crystalRegexpCharClass
|
hi def link crystalRegexpDot crystalRegexpCharClass
|
||||||
hi def link crystalRegexpCharClass crystalRegexpSpecial
|
hi def link crystalRegexpCharClass crystalRegexpSpecial
|
||||||
hi def link crystalRegexpSpecial Special
|
hi def link crystalRegexpSpecial Special
|
||||||
hi def link crystalRegexpComment Comment
|
hi def link crystalRegexpComment Comment
|
||||||
hi def link crystalRegexp crystalString
|
hi def link crystalRegexp crystalString
|
||||||
|
|
||||||
hi def link crystalLinkAttr PreProc
|
|
||||||
|
|
||||||
hi def link crystalMacro PreProc
|
hi def link crystalMacro PreProc
|
||||||
|
hi def link crystalLinkAttr crystalMacro
|
||||||
hi def link crystalInvalidVariable Error
|
hi def link crystalError Error
|
||||||
hi def link crystalError Error
|
hi def link crystalInvalidVariable crystalError
|
||||||
hi def link crystalSpaceError crystalError
|
hi def link crystalSpaceError crystalError
|
||||||
|
|
||||||
let b:current_syntax = 'crystal'
|
let b:current_syntax = 'crystal'
|
||||||
|
@ -20,7 +20,7 @@ endif
|
|||||||
syn include @gitcommitDiff syntax/diff.vim
|
syn include @gitcommitDiff syntax/diff.vim
|
||||||
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
|
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
|
||||||
|
|
||||||
syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
syn match gitcommitSummary ".*\%<50v" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
||||||
syn match gitcommitOverflow ".*" contained contains=@Spell
|
syn match gitcommitOverflow ".*" contained contains=@Spell
|
||||||
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
|
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
|
||||||
|
|
||||||
|
@ -49,12 +49,12 @@ hi def link goFloats Type
|
|||||||
hi def link goComplexes Type
|
hi def link goComplexes Type
|
||||||
|
|
||||||
" Predefined functions and values
|
" Predefined functions and values
|
||||||
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
|
syn keyword goBuiltins append cap close complex copy delete imag len
|
||||||
syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
|
syn keyword goBuiltins make new panic print println real recover
|
||||||
syn keyword goBoolean true false
|
syn keyword goBoolean true false
|
||||||
syn keyword goPredefinedIdentifiers nil iota
|
syn keyword goPredefinedIdentifiers nil iota
|
||||||
|
|
||||||
hi def link goBuiltins Keyword
|
hi def link goBuiltins Identifier
|
||||||
hi def link goBoolean Boolean
|
hi def link goBoolean Boolean
|
||||||
hi def link goPredefinedIdentifiers goBoolean
|
hi def link goPredefinedIdentifiers goBoolean
|
||||||
|
|
||||||
@ -150,14 +150,14 @@ endif
|
|||||||
" var, const
|
" var, const
|
||||||
if go#config#FoldEnable('varconst')
|
if go#config#FoldEnable('varconst')
|
||||||
syn region goVar start='var (' end='^\s*)$' transparent fold
|
syn region goVar start='var (' end='^\s*)$' transparent fold
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
|
||||||
syn region goConst start='const (' end='^\s*)$' transparent fold
|
syn region goConst start='const (' end='^\s*)$' transparent fold
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
|
||||||
else
|
else
|
||||||
syn region goVar start='var (' end='^\s*)$' transparent
|
syn region goVar start='var (' end='^\s*)$' transparent
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
|
||||||
syn region goConst start='const (' end='^\s*)$' transparent
|
syn region goConst start='const (' end='^\s*)$' transparent
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments,goPointerOperator
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Single-line var, const, and import.
|
" Single-line var, const, and import.
|
||||||
@ -216,6 +216,7 @@ endif
|
|||||||
" Extra types commonly seen
|
" Extra types commonly seen
|
||||||
if go#config#HighlightExtraTypes()
|
if go#config#HighlightExtraTypes()
|
||||||
syn match goExtraType /\<bytes\.\(Buffer\)\>/
|
syn match goExtraType /\<bytes\.\(Buffer\)\>/
|
||||||
|
syn match goExtraType /\<context\.\(Context\)\>/
|
||||||
syn match goExtraType /\<io\.\(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
|
syn match goExtraType /\<io\.\(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
|
||||||
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
|
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
|
||||||
syn match goExtraType /\<unsafe\.Pointer\>/
|
syn match goExtraType /\<unsafe\.Pointer\>/
|
||||||
|
50
syntax/gomod.vim
Normal file
50
syntax/gomod.vim
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||||
|
|
||||||
|
" gomod.vim: Vim syntax file for go.mod file
|
||||||
|
"
|
||||||
|
" Quit when a (custom) syntax file was already loaded
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax case match
|
||||||
|
|
||||||
|
" match keywords
|
||||||
|
syntax keyword gomodModule module
|
||||||
|
syntax keyword gomodRequire require
|
||||||
|
syntax keyword gomodExclude exclude
|
||||||
|
syntax keyword gomodReplace replace
|
||||||
|
|
||||||
|
" require, exclude and replace can be also grouped into block
|
||||||
|
syntax region gomodRequire start='require (' end=')' transparent contains=gomodRequire,gomodVersion
|
||||||
|
syntax region gomodExclude start='exclude (' end=')' transparent contains=gomodExclude,gomodVersion
|
||||||
|
syntax region gomodReplace start='replace (' end=')' transparent contains=gomodReplace,gomodVersion
|
||||||
|
|
||||||
|
" set highlights
|
||||||
|
highlight default link gomodModule Keyword
|
||||||
|
highlight default link gomodRequire Keyword
|
||||||
|
highlight default link gomodExclude Keyword
|
||||||
|
highlight default link gomodReplace Keyword
|
||||||
|
|
||||||
|
" comments are always in form of // ...
|
||||||
|
syntax region gomodComment start="//" end="$" contains=@Spell
|
||||||
|
highlight default link gomodComment Comment
|
||||||
|
|
||||||
|
" make sure quoted import paths are higlighted
|
||||||
|
syntax region gomodString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||||
|
highlight default link gomodString String
|
||||||
|
|
||||||
|
" replace operator is in the form of '=>'
|
||||||
|
syntax match gomodReplaceOperator "\v\=\>"
|
||||||
|
highlight default link gomodReplaceOperator Operator
|
||||||
|
|
||||||
|
|
||||||
|
" highlight semver, note that this is very simple. But it works for now
|
||||||
|
syntax match gomodVersion "v\d\+\.\d\+\.\d\+"
|
||||||
|
syntax match gomodVersion "v\d\+\.\d\+\.\d\+-\S*"
|
||||||
|
syntax match gomodVersion "v\d\+\.\d\+\.\d\++incompatible"
|
||||||
|
highlight default link gomodVersion Identifier
|
||||||
|
|
||||||
|
let b:current_syntax = "gomod"
|
||||||
|
|
||||||
|
endif
|
@ -53,7 +53,7 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
|
|||||||
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
||||||
|
|
||||||
" Strings, Templates, Numbers
|
" Strings, Templates, Numbers
|
||||||
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend
|
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial,@Spell extend
|
||||||
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
||||||
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
||||||
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
||||||
@ -150,8 +150,8 @@ syntax region jsTryCatchBlock contained matchgroup=jsTryCatchBraces s
|
|||||||
syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold
|
syntax region jsFinallyBlock contained matchgroup=jsFinallyBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold
|
||||||
syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsBlock,jsSwitchCase extend fold
|
syntax region jsSwitchBlock contained matchgroup=jsSwitchBraces start=/{/ end=/}/ contains=@jsAll,jsBlock,jsSwitchCase extend fold
|
||||||
syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold
|
syntax region jsRepeatBlock contained matchgroup=jsRepeatBraces start=/{/ end=/}/ contains=@jsAll,jsBlock extend fold
|
||||||
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression,jsComment extend fold
|
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression,jsComment nextgroup=jsFlowDefinition extend fold
|
||||||
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsDestructuringArray,jsComment extend fold
|
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression,jsDestructuringBlock,jsDestructuringArray,jsComment nextgroup=jsFlowDefinition extend fold
|
||||||
syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword extend fold
|
syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectShorthandProp,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword extend fold
|
||||||
syntax region jsBlock matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsSpreadExpression extend fold
|
syntax region jsBlock matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsSpreadExpression extend fold
|
||||||
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
|
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
|
||||||
|
184
syntax/julia.vim
184
syntax/julia.vim
@ -32,15 +32,15 @@ if !exists("b:julia_syntax_highlight_deprecated")
|
|||||||
let b:julia_syntax_highlight_deprecated = get(g:, "julia_syntax_highlight_deprecated", 0)
|
let b:julia_syntax_highlight_deprecated = get(g:, "julia_syntax_highlight_deprecated", 0)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if b:julia_syntax_version =~? '\<\%(curr\%(ent\)\?\|release\|6\|0\.6\)\>'
|
if b:julia_syntax_version =~? '\<\%(curr\%(ent\)\?\|release\|7\|0\.7\|10\|1.0\)\>'
|
||||||
|
let b:julia_syntax_version = 10
|
||||||
|
elseif b:julia_syntax_version =~? '\<\%(next\|devel\|11\|1\.1\)\>'
|
||||||
|
let b:julia_syntax_version = 11
|
||||||
|
elseif b:julia_syntax_version =~? '\<\%(prev\%(ious\)\?\|legacy\|6\|0\.6\)\>'
|
||||||
let b:julia_syntax_version = 6
|
let b:julia_syntax_version = 6
|
||||||
elseif b:julia_syntax_version =~? '\<\%(next\|devel\|7\|0\.7\)\>'
|
|
||||||
let b:julia_syntax_version = 7
|
|
||||||
elseif b:julia_syntax_version =~? '\<\%(prev\%(ious\)\?\|legacy\|5\|0\.5\)\>'
|
|
||||||
let b:julia_syntax_version = 5
|
|
||||||
else
|
else
|
||||||
echohl WarningMsg | echomsg "Unrecognized or unsupported julia syntax version: " . b:julia_syntax_version | echohl None
|
echohl WarningMsg | echomsg "Unrecognized or unsupported julia syntax version: " . b:julia_syntax_version | echohl None
|
||||||
let b:julia_syntax_version = 6
|
let b:julia_syntax_version = 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0)
|
let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0)
|
||||||
@ -96,39 +96,29 @@ syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems
|
|||||||
|
|
||||||
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
|
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
|
||||||
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef
|
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef
|
||||||
if b:julia_syntax_version == 5
|
syntax cluster juliaBlocksItems contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock,juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock
|
||||||
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll
|
if b:julia_syntax_version == 6
|
||||||
|
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems06
|
||||||
else
|
else
|
||||||
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll,@juliaBlocksItems0607
|
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems06,@juliaTypesItems1011
|
||||||
endif
|
|
||||||
syntax cluster juliaBlocksItemsAll contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock
|
|
||||||
syntax cluster juliaBlocksItems0607 contains=juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock
|
|
||||||
if b:julia_syntax_version == 5
|
|
||||||
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506
|
|
||||||
elseif b:julia_syntax_version == 6
|
|
||||||
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506,@juliaTypesItems0607
|
|
||||||
else
|
|
||||||
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506,@juliaTypesItems0607,@juliaTypesItems07
|
|
||||||
endif
|
endif
|
||||||
syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
|
syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
|
||||||
syntax cluster juliaTypesItems05 contains=juliaBaseTypeIter05,juliaBaseTypeRange05
|
syntax cluster juliaTypesItems06 contains=juliaBaseTypeNum06,juliaBaseTypeRange06,juliaBaseTypeDict06,juliaBaseTypeSet06
|
||||||
syntax cluster juliaTypesItems0506 contains=juliaBaseTypeNum0506,juliaBaseTypeRange0506,juliaBaseTypeDict0506,juliaBaseTypeSet0506
|
syntax cluster juliaTypesItems1011 contains=juliaBaseTypeBasic1011,juliaBaseTypeNum1011,juliaBaseTypeError1011,juliaBaseTypeIter1011,juliaBaseTypeRange1011,juliaBaseTypeArray1011,juliaBaseTypeDict1011,juliaBaseTypeSet1011,juliaBaseTypeC1011,juliaBaseTypeDisplay1011,juliaBaseTypeIO1011,juliaBaseTypeString1011
|
||||||
syntax cluster juliaTypesItems0607 contains=juliaBaseTypeBasic0607,juliaBaseTypeArray0607,juliaBaseTypeSet0607,juliaBaseTypeProcess0607,juliaBaseTypeRange0607,juliaBaseTypeTime0607
|
|
||||||
syntax cluster juliaTypesItems07 contains=juliaBaseTypeBasic07,juliaBaseTypeNum07,juliaBaseTypeError07,juliaBaseTypeIter07,juliaBaseTypeRange07,juliaBaseTypeArray07,juliaBaseTypeDict07,juliaBaseTypeSet07,juliaBaseTypeC07,juliaBaseTypeDisplay07,juliaBaseTypeIO07
|
|
||||||
|
|
||||||
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric
|
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstMMap,juliaConstC,juliaConstGeneric
|
||||||
syntax cluster juliaConstItems0506 contains=juliaConstNum0506,juliaConstIO0506
|
syntax cluster juliaConstItems06 contains=juliaConstNum06,juliaConstIO06
|
||||||
syntax cluster juliaConstItems07 contains=juliaConstGeneric07,juliaPossibleEuler,juliaConstEnv07,juliaConstIO07
|
syntax cluster juliaConstItems1011 contains=juliaConstGeneric1011,juliaPossibleEuler,juliaConstEnv1011,juliaConstIO1011
|
||||||
if b:julia_syntax_version <= 6
|
if b:julia_syntax_version == 6
|
||||||
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506
|
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems06
|
||||||
else
|
else
|
||||||
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506,@juliaConstItems07
|
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems06,@juliaConstItems1011
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra
|
syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra
|
||||||
syntax cluster juliaSymbolItems contains=juliaPossibleSymbol
|
syntax cluster juliaSymbolItems contains=juliaPossibleSymbol
|
||||||
syntax cluster juliaNumberItems contains=juliaNumbers
|
syntax cluster juliaNumberItems contains=juliaNumbers
|
||||||
syntax cluster juliaStringItems contains=juliaChar,juliaString,juliabString,juliasString,juliavString,juliaipString,juliabigString,juliaMIMEString,juliaShellString,juliaDocString,juliaRegEx
|
syntax cluster juliaStringItems contains=juliaChar,juliaString,juliaStringPrefixed,juliabString,juliasString,juliavString,juliaipString,juliabigString,juliaMIMEString,juliarawString,juliatextString,juliahtmlString,juliaint128String,juliaShellString,juliaDocString,juliaRegEx
|
||||||
syntax cluster juliaPrintfItems contains=juliaPrintfParBlock,juliaPrintfString
|
syntax cluster juliaPrintfItems contains=juliaPrintfParBlock,juliaPrintfString
|
||||||
syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juliaCTransOperator,juliaTernaryRegion,juliaColon,juliaSemicolon,juliaComma
|
syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juliaCTransOperator,juliaTernaryRegion,juliaColon,juliaSemicolon,juliaComma
|
||||||
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
|
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
|
||||||
@ -166,16 +156,8 @@ syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="("
|
|||||||
syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
||||||
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
|
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
|
||||||
|
|
||||||
if b:julia_syntax_version >= 6
|
syntax match juliaKeyword display "\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>"
|
||||||
let s:keywords = '\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>'
|
syntax match juliaInfixKeyword display "\%(=\s*\)\@<!\<\%(in\|isa\)\>\S\@!\%(\s*=\)\@!"
|
||||||
let s:infixkeywords = '\<\%(in\|isa\)\>'
|
|
||||||
else
|
|
||||||
let s:keywords = '\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\)\>'
|
|
||||||
let s:infixkeywords = '\<\%(in\)\>'
|
|
||||||
endif
|
|
||||||
|
|
||||||
exec 'syntax match juliaKeyword display "' . s:keywords . '"'
|
|
||||||
exec 'syntax match juliaInfixKeyword display "\%(=\s*\)\@<!' . s:infixkeywords . '\S\@!\%(\s*=\)\@!"'
|
|
||||||
syntax match juliaRepKeyword display "\<\%(break\|continue\)\>"
|
syntax match juliaRepKeyword display "\<\%(break\|continue\)\>"
|
||||||
syntax region juliaConditionalBlock matchgroup=juliaConditional start="\<if\>" end="\<end\>" contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock fold
|
syntax region juliaConditionalBlock matchgroup=juliaConditional start="\<if\>" end="\<end\>" contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock fold
|
||||||
syntax region juliaConditionalEIBlock matchgroup=juliaConditional transparent contained start="\<elseif\>" end="\<\%(end\|else\|elseif\)\>"me=s-1 contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock
|
syntax region juliaConditionalEIBlock matchgroup=juliaConditional transparent contained start="\<elseif\>" end="\<\%(end\|else\|elseif\)\>"me=s-1 contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock
|
||||||
@ -186,8 +168,10 @@ syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="\<begin\>" end=
|
|||||||
syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="\<function\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="\<function\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="\<macro\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="\<macro\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="\<quote\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="\<quote\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
syntax region juliaTypeBlock matchgroup=juliaBlKeyword start="\<type\>" end="\<end\>" contains=@juliaExpressions fold
|
if b:julia_syntax_version <= 10
|
||||||
syntax region juliaImmutableBlock matchgroup=juliaBlKeyword start="\<immutable\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaTypeBlock matchgroup=juliaBlKeyword06 start="\<type\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaImmutableBlock matchgroup=juliaBlKeyword06 start="\<immutable\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
endif
|
||||||
syntax region juliaStructBlock matchgroup=juliaBlKeyword start="\<struct\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaStructBlock matchgroup=juliaBlKeyword start="\<struct\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="\<mutable struct\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="\<mutable struct\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\<let\>" end="\<end\>" contains=@juliaExpressions fold
|
syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\<let\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
@ -206,39 +190,34 @@ syntax match juliaComprehensionIf contained "\<if\>"
|
|||||||
|
|
||||||
exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"'
|
exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"'
|
||||||
|
|
||||||
syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|\%(Intrinsic\)\?Function\|Union\|Type\%(Name\|Constructor\|Var\)\?\|Any\|ANY\|Vararg\|Top\|None\|Nothing\|Ptr\|Void\|Exception\|Module\|Box\|Expr\|LambdaStaticData\|\%(Data\|Union\)Type\|\%(LineNumber\|Label\|Goto\|Quote\|Top\|Symbol\|Getfield\)Node\|\%(Weak\|Global\)\?Ref\|Associative\|Method\(Table\)\?\|GetfieldNode\|Nullable\|Pair\|Val\|TypeMap\%(Level\|Entry\)\)\>"
|
syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|Function\|Union\%(All\)\?\|Type\%(Name\|Var\)\?\|Any\|ANY\|Vararg\|Ptr\|Exception\|Module\|Expr\|DataType\|\%(LineNumber\|Quote\)Node\|\%(Weak\|Global\)\?Ref\|Method\|Pair\|Val\)\>"
|
||||||
syntax match juliaBaseTypeBasic0607 display "\<\%(UnionAll\|CodeInfo\)\>"
|
syntax match juliaBaseTypeBasic06 display "\<\%(Void\|\%(Label\|Goto\)Node\|Associative\|MethodTable\|Nullable\|TypeMap\%(Level\|Entry\)\|CodeInfo\)\>"
|
||||||
syntax match juliaBaseTypeBasic07 display "\<\%(Some\|Missing\)\>"
|
syntax match juliaBaseTypeBasic1011 display "\<\%(Nothing\|Some\|Missing\)\>"
|
||||||
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>"
|
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>"
|
||||||
syntax match juliaBaseTypeNum0506 display "\<Complex\%(32\|64\|128\)\>"
|
syntax match juliaBaseTypeNum06 display "\<Complex\%(32\|64\|128\)\>"
|
||||||
syntax match juliaBaseTypeNum07 display "\<\%(AbstractIrrational\|ComplexF\%(16\|32\|64\)\)\>"
|
syntax match juliaBaseTypeNum1011 display "\<\%(AbstractIrrational\|ComplexF\%(16\|32\|64\)\)\>"
|
||||||
syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>"
|
syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>"
|
||||||
syntax match juliaBaseTypeC07 display "\<Cvoid\>"
|
syntax match juliaBaseTypeC1011 display "\<Cvoid\>"
|
||||||
syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>"
|
syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>"
|
||||||
syntax match juliaBaseTypeError07 display "\<\%(StringIndexError\|MissingException\)\>"
|
syntax match juliaBaseTypeError1011 display "\<\%(StringIndexError\|MissingException\)\>"
|
||||||
syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
|
syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
|
||||||
syntax match juliaBaseTypeIter05 display "\<\%(Zip\|Filter\)\>"
|
syntax match juliaBaseTypeIter1011 display "\<CartesianIndices\>"
|
||||||
syntax match juliaBaseTypeIter07 display "\<CartesianIndices\>"
|
|
||||||
syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>"
|
syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>"
|
||||||
syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\)\>"
|
syntax match juliaBaseTypeString1011 display "\<SubstitutionString\>"
|
||||||
syntax match juliaBaseTypeArray0607 display "\<\%(Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
|
syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\|Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
|
||||||
syntax match juliaBaseTypeArray07 display "\<\%(BroadcastStyle\|Adjoint\|Transpose\|LinearIndices\)\>"
|
syntax match juliaBaseTypeArray1011 display "\<\%(Broadcast\|Adjoint\|Transpose\|LinearIndices\)\>"
|
||||||
syntax match juliaBaseTypeDict display "\<\%(WeakKey\)\?Dict\>"
|
syntax match juliaBaseTypeDict display "\<\%(WeakKey\)\?Dict\>"
|
||||||
syntax match juliaBaseTypeDict0506 display "\<ObjectIdDict\>"
|
syntax match juliaBaseTypeDict06 display "\<ObjectIdDict\>"
|
||||||
syntax match juliaBaseTypeDict07 display "\<IdDict\>"
|
syntax match juliaBaseTypeDict1011 display "\<IdDict\>"
|
||||||
syntax match juliaBaseTypeSet display "\<Set\>"
|
syntax match juliaBaseTypeSet display "\<\%(Set\|AbstractSet\)\>"
|
||||||
syntax match juliaBaseTypeSet0506 display "\<IntSet\>"
|
syntax match juliaBaseTypeSet06 display "\<IntSet\>"
|
||||||
syntax match juliaBaseTypeSet0607 display "\<AbstractSet\>"
|
syntax match juliaBaseTypeSet1011 display "\<\%(BitSet\|AbstractDict\)\>"
|
||||||
syntax match juliaBaseTypeSet07 display "\<\%(\%(Bit\|Key\)Set\|AbstractDict\)\>"
|
|
||||||
syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"
|
syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"
|
||||||
syntax match juliaBaseTypeIO07 display "\<GenericIOBuffer\>"
|
syntax match juliaBaseTypeIO1011 display "\<GenericIOBuffer\>"
|
||||||
syntax match juliaBaseTypeProcess display "\<\%(ProcessGroup\|Pipe\|Cmd\)\>"
|
syntax match juliaBaseTypeProcess display "\<\%(Pipe\|Cmd\|PipeBuffer\)\>"
|
||||||
syntax match juliaBaseTypeProcess0607 display "\<PipeBuffer\>"
|
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\|ExponentialBackOff\|StepRangeLen\)\>"
|
||||||
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\)\>"
|
syntax match juliaBaseTypeRange06 display "\<Range\>"
|
||||||
syntax match juliaBaseTypeRange05 display "\<FloatRange\>"
|
syntax match juliaBaseTypeRange1011 display "\<\(Abstract\|Lin\)Range\>"
|
||||||
syntax match juliaBaseTypeRange0506 display "\<Range\>"
|
|
||||||
syntax match juliaBaseTypeRange0607 display "\<\%(ExponentialBackOff\|StepRangeLen\)\>"
|
|
||||||
syntax match juliaBaseTypeRange07 display "\<\(Abstract\|Lin\)Range\>"
|
|
||||||
syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>"
|
syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>"
|
||||||
syntax match juliaBaseTypeFact display "\<Factorization\>"
|
syntax match juliaBaseTypeFact display "\<Factorization\>"
|
||||||
syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>"
|
syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>"
|
||||||
@ -246,13 +225,12 @@ syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Ne
|
|||||||
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
|
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
|
||||||
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
|
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
|
||||||
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>"
|
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>"
|
||||||
syntax match juliaBaseTypeDisplay07 display "\<AbstractDisplay\>"
|
syntax match juliaBaseTypeDisplay1011 display "\<AbstractDisplay\>"
|
||||||
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\)\>"
|
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\|DateFormat\)\>"
|
||||||
syntax match juliaBaseTypeTime0607 display "\<DateFormat\>"
|
|
||||||
syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>"
|
syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>"
|
||||||
|
|
||||||
syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)"
|
syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)"
|
||||||
syntax match juliaConstNum0506 display "\%(\<\%(eu\?\|eulergamma\|γ\|catalan\|φ\|golden\)\>\)"
|
syntax match juliaConstNum06 display "\%(\<\%(eu\?\|eulergamma\|γ\|catalan\|φ\|golden\)\>\)"
|
||||||
" Note: recognition of ℯ, which Vim does not consider a valid identifier, is
|
" Note: recognition of ℯ, which Vim does not consider a valid identifier, is
|
||||||
" complicated. We detect possible uses by just looking for the character (for
|
" complicated. We detect possible uses by just looking for the character (for
|
||||||
" performance) and then check that it's actually used by its own.
|
" performance) and then check that it's actually used by its own.
|
||||||
@ -262,12 +240,12 @@ syntax match juliaPossibleEuler "ℯ" contains=juliaEuler
|
|||||||
exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=ℯ\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"'
|
exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=ℯ\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"'
|
||||||
syntax match juliaConstBool display "\<\%(true\|false\)\>"
|
syntax match juliaConstBool display "\<\%(true\|false\)\>"
|
||||||
syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>"
|
syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>"
|
||||||
syntax match juliaConstEnv07 display "\<DEPOT_PATH\>"
|
syntax match juliaConstEnv1011 display "\<DEPOT_PATH\>"
|
||||||
syntax match juliaConstIO0506 display "\<\%(STD\%(OUT\|IN\|ERR\)\|DevNull\)\>"
|
syntax match juliaConstIO06 display "\<\%(STD\%(OUT\|IN\|ERR\)\|DevNull\)\>"
|
||||||
syntax match juliaConstIO07 display "\<\%(std\%(out\|in\|err\)\|devnull\)\>"
|
syntax match juliaConstIO1011 display "\<\%(std\%(out\|in\|err\)\|devnull\)\>"
|
||||||
syntax match juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
|
syntax match juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
|
||||||
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
|
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
|
||||||
syntax match juliaConstGeneric07 display "\<missing\>"
|
syntax match juliaConstGeneric1011 display "\<\%(undef\|missing\)\>"
|
||||||
|
|
||||||
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
|
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
|
||||||
|
|
||||||
@ -335,13 +313,20 @@ syntax match juliaChar display "'\\U\x\{1,8\}'" contains=juliaUniCharLarge
|
|||||||
|
|
||||||
exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!?]\@'.s:d(1).'<!\.\?' . "'" . '"'
|
exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!?]\@'.s:d(1).'<!\.\?' . "'" . '"'
|
||||||
|
|
||||||
|
" TODO: some of these might be specialized; the rest could be just left to the
|
||||||
|
" generic juliaStringPrefixed fallback
|
||||||
syntax region juliaString matchgroup=juliaStringDelim start=+\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckStrings
|
syntax region juliaString matchgroup=juliaStringDelim start=+\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckStrings
|
||||||
|
exec 'syntax region juliaStringPrefixed matchgroup=juliaStringDelim start=+\<' . s:idregex . '\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw'
|
||||||
syntax region juliabString matchgroup=juliaStringDelim start=+\<b\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
syntax region juliabString matchgroup=juliaStringDelim start=+\<b\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
syntax region juliasString matchgroup=juliaStringDelim start=+\<s\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
syntax region juliasString matchgroup=juliaStringDelim start=+\<s\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
syntax region juliavString matchgroup=juliaStringDelim start=+\<v\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
syntax region juliavString matchgroup=juliaStringDelim start=+\<v\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
syntax region juliaipString matchgroup=juliaStringDelim start=+\<ip\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
syntax region juliaipString matchgroup=juliaStringDelim start=+\<ip\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
syntax region juliabigString matchgroup=juliaStringDelim start=+\<big\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
syntax region juliabigString matchgroup=juliaStringDelim start=+\<big\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
syntax region juliaMIMEString matchgroup=juliaStringDelim start=+\<MIME\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
syntax region juliaMIMEString matchgroup=juliaStringDelim start=+\<MIME\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
|
syntax region juliarawString matchgroup=juliaStringDelim start=+\<raw\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
|
syntax region juliatextString matchgroup=juliaStringDelim start=+\<text\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
|
syntax region juliahtmlString matchgroup=juliaStringDelim start=+\<html\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
|
syntax region juliaint128String matchgroup=juliaStringDelim start=+\<u\?int128\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialCharsRaw
|
||||||
|
|
||||||
syntax region juliaDocString matchgroup=juliaStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
|
syntax region juliaDocString matchgroup=juliaStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
|
||||||
|
|
||||||
@ -367,6 +352,9 @@ syntax match juliaOctalEscapeChar display contained "\\\o\{3\}"
|
|||||||
syntax match juliaHexEscapeChar display contained "\\x\x\{2\}"
|
syntax match juliaHexEscapeChar display contained "\\x\x\{2\}"
|
||||||
syntax match juliaUniCharSmall display contained "\\u\x\{1,4\}"
|
syntax match juliaUniCharSmall display contained "\\u\x\{1,4\}"
|
||||||
syntax match juliaUniCharLarge display contained "\\U\x\{1,8\}"
|
syntax match juliaUniCharLarge display contained "\\U\x\{1,8\}"
|
||||||
|
syntax cluster juliaSpecialCharsRaw contains=juliaDoubleBackslash,juliaEscapedQuote
|
||||||
|
syntax match juliaDoubleBackslash display contained "\\\\"
|
||||||
|
syntax match juliaEscapedQuote display contained "\\\""
|
||||||
|
|
||||||
syntax cluster juliaPrintfChars contains=juliaErrorPrintfFmt,juliaPrintfFmt
|
syntax cluster juliaPrintfChars contains=juliaErrorPrintfFmt,juliaPrintfFmt
|
||||||
syntax match juliaErrorPrintfFmt display contained "\\\?%."
|
syntax match juliaErrorPrintfFmt display contained "\\\?%."
|
||||||
@ -422,11 +410,12 @@ hi def link juliaKeyword Keyword
|
|||||||
hi def link juliaInfixKeyword Keyword
|
hi def link juliaInfixKeyword Keyword
|
||||||
hi def link juliaRepKeyword Keyword
|
hi def link juliaRepKeyword Keyword
|
||||||
hi def link juliaBlKeyword Keyword
|
hi def link juliaBlKeyword Keyword
|
||||||
|
exec 'hi! def link juliaBlKeyword06 ' . (b:julia_syntax_version == 6 ? 'Keyword' : b:julia_syntax_version == 10 ? 'juliaDeprecated' : 'NONE')
|
||||||
hi def link juliaConditional Conditional
|
hi def link juliaConditional Conditional
|
||||||
hi def link juliaRepeat Repeat
|
hi def link juliaRepeat Repeat
|
||||||
hi def link juliaException Exception
|
hi def link juliaException Exception
|
||||||
hi def link juliaTypedef Keyword
|
hi def link juliaTypedef Keyword
|
||||||
exec 'hi! def link juliaOuter ' . (b:julia_syntax_version >= 7 ? 'Keyword' : 'NONE')
|
exec 'hi! def link juliaOuter ' . (b:julia_syntax_version >= 10 ? 'Keyword' : 'NONE')
|
||||||
hi def link juliaBaseTypeBasic Type
|
hi def link juliaBaseTypeBasic Type
|
||||||
hi def link juliaBaseTypeNum Type
|
hi def link juliaBaseTypeNum Type
|
||||||
hi def link juliaBaseTypeC Type
|
hi def link juliaBaseTypeC Type
|
||||||
@ -448,21 +437,13 @@ hi def link juliaBaseTypeRandom Type
|
|||||||
hi def link juliaBaseTypeDisplay Type
|
hi def link juliaBaseTypeDisplay Type
|
||||||
hi def link juliaBaseTypeTime Type
|
hi def link juliaBaseTypeTime Type
|
||||||
hi def link juliaBaseTypeOther Type
|
hi def link juliaBaseTypeOther Type
|
||||||
for t in ["Basic", "Array", "Set", "Range", "Time", "Process"]
|
|
||||||
let h = b:julia_syntax_version >= 6 ? "Type" : "NONE"
|
|
||||||
exec "hi! def link juliaBaseType" . t . "0607 " . h
|
|
||||||
endfor
|
|
||||||
for t in ["Iter", "Range"]
|
|
||||||
let h = b:julia_syntax_version == 5 ? "Type" : b:julia_syntax_version == 6 ? "juliaDeprecated" : "NONE"
|
|
||||||
exec "hi! def link juliaBaseType" . t . "05 " . h
|
|
||||||
endfor
|
|
||||||
for t in ["Num", "Range", "Dict", "Set"]
|
for t in ["Num", "Range", "Dict", "Set"]
|
||||||
let h = b:julia_syntax_version <= 6 ? "Type" : "juliaDeprecated"
|
let h = b:julia_syntax_version == 6 ? "Type" : b:julia_syntax_version == 10 ? "juliaDeprecated" : "NONE"
|
||||||
exec "hi! def link juliaBaseType" . t . "0506 " . h
|
exec "hi! def link juliaBaseType" . t . "06 " . h
|
||||||
endfor
|
endfor
|
||||||
for t in ["Range", "Dict", "Set", "Basic", "C", "Array", "Iter", "Display", "IO", "Num", "Error"]
|
for t in ["Range", "Dict", "Set", "Basic", "C", "Array", "Iter", "Display", "IO", "Num", "Error", "String"]
|
||||||
let h = b:julia_syntax_version >= 7 ? "Type" : "NONE"
|
let h = b:julia_syntax_version >= 10 ? "Type" : "NONE"
|
||||||
exec "hi! def link juliaBaseType" . t . "07 " . h
|
exec "hi! def link juliaBaseType" . t . "1011 " . h
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" NOTE: deprecated constants are not highlighted as such. For once,
|
" NOTE: deprecated constants are not highlighted as such. For once,
|
||||||
@ -470,9 +451,9 @@ endfor
|
|||||||
" Plus, one-letter variables like `e` and `γ` can be used with other
|
" Plus, one-letter variables like `e` and `γ` can be used with other
|
||||||
" meanings.
|
" meanings.
|
||||||
hi def link juliaConstNum Constant
|
hi def link juliaConstNum Constant
|
||||||
let h = b:julia_syntax_version <= 6 ? "Constant" : "NONE"
|
let h = b:julia_syntax_version == 6 ? "Constant" : "NONE"
|
||||||
exec "hi! def link juliaConstNum0506 " . h
|
exec "hi! def link juliaConstNum06 " . h
|
||||||
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
|
let h = b:julia_syntax_version >= 10 ? "Constant" : "NONE"
|
||||||
exec "hi! def link juliaEuler " . h
|
exec "hi! def link juliaEuler " . h
|
||||||
|
|
||||||
hi def link juliaConstEnv Constant
|
hi def link juliaConstEnv Constant
|
||||||
@ -483,11 +464,11 @@ hi def link juliaRangeEnd Constant
|
|||||||
hi def link juliaConstBool Boolean
|
hi def link juliaConstBool Boolean
|
||||||
|
|
||||||
for t in ["Generic", "IO", "Env"]
|
for t in ["Generic", "IO", "Env"]
|
||||||
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
|
let h = b:julia_syntax_version >= 10 ? "Constant" : "NONE"
|
||||||
exec "hi! def link juliaConst" . t . "07 " . h
|
exec "hi! def link juliaConst" . t . "1011 " . h
|
||||||
endfor
|
endfor
|
||||||
let h = b:julia_syntax_version < 7 ? "Constant" : "juliaDeprecated"
|
let h = b:julia_syntax_version == 6 ? "Constant" : b:julia_syntax_version == 10 ? "juliaDeprecated" : "NONE"
|
||||||
exec "hi! def link juliaConstIO0506 " . h
|
exec "hi! def link juliaConstIO06 " . h
|
||||||
|
|
||||||
hi def link juliaComprehensionFor Keyword
|
hi def link juliaComprehensionFor Keyword
|
||||||
hi def link juliaComprehensionIf Keyword
|
hi def link juliaComprehensionIf Keyword
|
||||||
@ -509,6 +490,7 @@ hi def link juliaComplexUnit Constant
|
|||||||
hi def link juliaChar Character
|
hi def link juliaChar Character
|
||||||
|
|
||||||
hi def link juliaString String
|
hi def link juliaString String
|
||||||
|
hi def link juliaStringPrefixed String
|
||||||
hi def link juliabString String
|
hi def link juliabString String
|
||||||
hi def link juliasString String
|
hi def link juliasString String
|
||||||
hi def link juliavString String
|
hi def link juliavString String
|
||||||
@ -516,6 +498,10 @@ hi def link juliarString String
|
|||||||
hi def link juliaipString String
|
hi def link juliaipString String
|
||||||
hi def link juliabigString String
|
hi def link juliabigString String
|
||||||
hi def link juliaMIMEString String
|
hi def link juliaMIMEString String
|
||||||
|
hi def link juliarawString String
|
||||||
|
hi def link juliatestString String
|
||||||
|
hi def link juliahtmlString String
|
||||||
|
hi def link juliaint128String String
|
||||||
hi def link juliaPrintfString String
|
hi def link juliaPrintfString String
|
||||||
hi def link juliaShellString String
|
hi def link juliaShellString String
|
||||||
hi def link juliaDocString String
|
hi def link juliaDocString String
|
||||||
@ -530,6 +516,8 @@ hi def link juliaOctalEscapeChar SpecialChar
|
|||||||
hi def link juliaHexEscapeChar SpecialChar
|
hi def link juliaHexEscapeChar SpecialChar
|
||||||
hi def link juliaUniCharSmall SpecialChar
|
hi def link juliaUniCharSmall SpecialChar
|
||||||
hi def link juliaUniCharLarge SpecialChar
|
hi def link juliaUniCharLarge SpecialChar
|
||||||
|
hi def link juliaDoubleBackslash SpecialChar
|
||||||
|
hi def link juliaEscapedQuote SpecialChar
|
||||||
|
|
||||||
hi def link juliaPrintfFmt SpecialChar
|
hi def link juliaPrintfFmt SpecialChar
|
||||||
|
|
||||||
|
69
syntax/juliadoc.vim
Normal file
69
syntax/juliadoc.vim
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" Vim syntax file for julia document view
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
|
|
||||||
|
syntax region juliadocCode matchgroup=juliadocCodeDelimiter start="`" end="`" concealends display oneline
|
||||||
|
syntax region juliadocCode matchgroup=juliadocCodeDelimiter start="``" end="``" concealends display oneline contains=juliadocCodeLatex
|
||||||
|
syntax region juliadocCode matchgroup=juliadocCodeDelimiter start="^\s*```.*$" end='^\s*```' concealends
|
||||||
|
syntax region juliadocH1 matchgroup=juliadocHeadingDelimiter start="##\@!" end="$" concealends display oneline
|
||||||
|
syntax region juliadocH2 matchgroup=juliadocHeadingDelimiter start="###\@!" end="$" concealends display oneline
|
||||||
|
syntax region juliadocH3 matchgroup=juliadocHeadingDelimiter start="####\@!" end="$" concealends display oneline
|
||||||
|
syntax region juliadocH4 matchgroup=juliadocHeadingDelimiter start="#####\@!" end="$" concealends display oneline
|
||||||
|
syntax region juliadocH5 matchgroup=juliadocHeadingDelimiter start="######\@!" end="$" concealends display oneline
|
||||||
|
syntax region juliadocH6 matchgroup=juliadocHeadingDelimiter start="#######\@!" end="$" concealends display oneline
|
||||||
|
syntax match juliadocLink "\[\^\@!.\{-1,}\](.\{-1,})" contains=juliadocLinkBody,juliadocLinkUrl display keepend
|
||||||
|
syntax region juliadocLinkBody matchgroup=juliadocLinkDelimiter start="\[" end="\]" concealends display contained oneline
|
||||||
|
syntax match juliadocLinkUrl "(\zs@ref\s\+.\{-1,}\ze)" contains=juliadocLinkUrlConceal display keepend
|
||||||
|
syntax match juliadocLinkUrlConceal "@ref\s\+" conceal display contained
|
||||||
|
syntax match juliadocCrossref "\[`.\{-1,}`\](@ref)" contains=juliadocCrossrefBody display keepend
|
||||||
|
syntax region juliadocCrossrefBody matchgroup=juliadocCrossrefDelimiter start="\[`" end="`\](@ref)" concealends display contained oneline
|
||||||
|
syntax region juliadocMath matchgroup=juliadocMathDelimiter start="\$" end="\$" concealends display oneline
|
||||||
|
syntax match juliadocListing "^\s*\zs\%([-+*]\|\d\+[.)]\)\ze\s" display
|
||||||
|
syntax match juliadocFootnote "^\s*\[\^[[:alnum:]]\+\]:\s*" display contains=juliadocFootnoteBody keepend
|
||||||
|
syntax region juliadocFootnoteBody matchgroup=juliadocFootnoteDelimiter start="^\s*\zs\[\^" end="\]" concealends display contained oneline
|
||||||
|
syntax match juliadocFootnoteRef "\s\[\^[[:alnum:]]\+\]" display contains=juliadocFootnoteRefBody,juliadocFootnoteRefConceal keepend
|
||||||
|
syntax match juliadocFootnoteRefBody "[[:alnum:]]\+" display contained
|
||||||
|
syntax match juliadocFootnoteRefConceal "\^" conceal display contained
|
||||||
|
syntax region juliadocBlockquote matchgroup=juliadocBlockquoteDelimiter start="^\s*>\s" end="$" concealends display oneline
|
||||||
|
syntax match juliadocRules "^-\{3,}" display
|
||||||
|
syntax region juliadocAdmonitions matchgroup=juliadocAdmonitionsDelimiter start="^\s*!!!" end="$" concealends display contains=juliadocAdmonitionsType,juliadocAdmonitionsTitle oneline keepend
|
||||||
|
syntax match juliadocAdmonitionsType "\c\%(danger\|warning\|info\|note\|tip\)\>" display contained
|
||||||
|
syntax region juliadocAdmonitionsTitle matchgroup=juliadocAdmonitionsTitleDelimiter start='"' end='"' display contained oneline
|
||||||
|
|
||||||
|
if &encoding ==# 'utf-8'
|
||||||
|
for [s:from, s:to] in items(julia_latex_symbols#get_dict())
|
||||||
|
execute printf('syntax match juliadocCodeLatex "\\%s" conceal cchar=%s display contained', escape(s:from, '~"\.^$[]*'), s:to)
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
highlight default link juliadocCode String
|
||||||
|
highlight default link juliadocCodeLatex String
|
||||||
|
highlight default link juliadocH1 Title
|
||||||
|
highlight default link juliadocH2 Title
|
||||||
|
highlight default link juliadocH3 Title
|
||||||
|
highlight default link juliadocH4 Title
|
||||||
|
highlight default link juliadocH5 Title
|
||||||
|
highlight default link juliadocH6 Title
|
||||||
|
highlight default link juliadocLinkBody Identifier
|
||||||
|
highlight default link juliadocLinkUrl Underlined
|
||||||
|
highlight default link juliadocCrossref Underlined
|
||||||
|
highlight default link juliadocCrossrefBody Underlined
|
||||||
|
highlight default link juliadocMath Special
|
||||||
|
highlight default link juliadocListing PreProc
|
||||||
|
highlight default link juliadocFootnoteBody PreProc
|
||||||
|
highlight default link juliadocFootnoteRefBody PreProc
|
||||||
|
highlight default link juliadocBlockquote Comment
|
||||||
|
highlight default link juliadocRules PreProc
|
||||||
|
highlight default link juliadocAdmonitionsType Todo
|
||||||
|
highlight default link juliadocAdmonitionsTitle Title
|
||||||
|
|
||||||
|
let b:current_syntax = "juliadoc"
|
||||||
|
|
||||||
|
endif
|
@ -84,25 +84,25 @@ syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
|
|||||||
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
|
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
|
||||||
|
|
||||||
"HTML headings
|
"HTML headings
|
||||||
syn region htmlH1 start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn region htmlH2 start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn region htmlH3 start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn region htmlH4 start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn region htmlH5 start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn region htmlH6 start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
||||||
syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
|
||||||
|
|
||||||
"define Markdown groups
|
"define Markdown groups
|
||||||
syn match mkdLineBreak / \+$/
|
syn match mkdLineBreak / \+$/
|
||||||
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
|
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
|
||||||
syn region mkdCode start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/' . s:concealends
|
||||||
syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!``/ skip=/[^`]`[^`]/ end=/\(\([^\\]\|^\)\\\)\@<!``/' . s:concealends
|
||||||
syn region mkdCode start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealends
|
||||||
syn region mkdCode start=/\s*\~\~[^\~]*/ end=/[^\~]*\~\~\s*/
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!\~\~/ end=/\(\([^\\]\|^\)\\\)\@<!\~\~/' . s:concealends
|
||||||
syn region mkdCode start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/' . s:concealends
|
||||||
syn region mkdCode start="<pre[^>]*\\\@<!>" end="</pre>"
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre[^>]*\\\@<!>" end="</pre>"' . s:concealends
|
||||||
syn region mkdCode start="<code[^>]*\\\@<!>" end="</code>"
|
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code[^>]*\\\@<!>" end="</code>"' . s:concealends
|
||||||
syn region mkdFootnote start="\[^" end="\]"
|
syn region mkdFootnote start="\[^" end="\]"
|
||||||
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
|
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
|
||||||
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
|
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
|
||||||
@ -117,7 +117,7 @@ syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_\(_\|\s\)*$/
|
|||||||
" YAML frontmatter
|
" YAML frontmatter
|
||||||
if get(g:, 'vim_markdown_frontmatter', 0)
|
if get(g:, 'vim_markdown_frontmatter', 0)
|
||||||
syn include @yamlTop syntax/yaml.vim
|
syn include @yamlTop syntax/yaml.vim
|
||||||
syn region Comment matchgroup=mkdDelimiter start="\%^---$" end="^---$" contains=@yamlTop keepend
|
syn region Comment matchgroup=mkdDelimiter start="\%^---$" end="^\(---\|...\)$" contains=@yamlTop keepend
|
||||||
unlet! b:current_syntax
|
unlet! b:current_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -152,6 +152,7 @@ syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,
|
|||||||
"highlighting for Markdown groups
|
"highlighting for Markdown groups
|
||||||
HtmlHiLink mkdString String
|
HtmlHiLink mkdString String
|
||||||
HtmlHiLink mkdCode String
|
HtmlHiLink mkdCode String
|
||||||
|
HtmlHiLink mkdCodeDelimiter String
|
||||||
HtmlHiLink mkdCodeStart String
|
HtmlHiLink mkdCodeStart String
|
||||||
HtmlHiLink mkdCodeEnd String
|
HtmlHiLink mkdCodeEnd String
|
||||||
HtmlHiLink mkdFootnote Comment
|
HtmlHiLink mkdFootnote Comment
|
||||||
|
@ -43,7 +43,7 @@ endif
|
|||||||
|
|
||||||
syntax match mustacheError '}}}\?'
|
syntax match mustacheError '}}}\?'
|
||||||
syntax match mustacheInsideError '{{[{$#<>=!\/]\?'
|
syntax match mustacheInsideError '{{[{$#<>=!\/]\?'
|
||||||
syntax region mustacheInside start=/{{/ end=/}}}\?/ keepend containedin=TOP,@htmlMustacheContainer
|
syntax region mustacheInside start=/{{[^!]/ end=/}}}\?/ keepend containedin=TOP,@htmlMustacheContainer
|
||||||
syntax match mustacheOperators '=\|\.\|/' contained containedin=mustacheInside,@htmlMustacheContainer
|
syntax match mustacheOperators '=\|\.\|/' contained containedin=mustacheInside,@htmlMustacheContainer
|
||||||
syntax region mustacheSection start='{{[$#^/]'lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer
|
syntax region mustacheSection start='{{[$#^/]'lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer
|
||||||
syntax region mustachePartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer
|
syntax region mustachePartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer
|
||||||
@ -52,8 +52,8 @@ syntax match mustacheHandlebars '{{\|}}' contained containedin=mustacheInside,@h
|
|||||||
syntax match mustacheUnescape '{{{\|}}}' contained containedin=mustacheInside,@htmlMustacheContainer
|
syntax match mustacheUnescape '{{{\|}}}' contained containedin=mustacheInside,@htmlMustacheContainer
|
||||||
syntax match mustacheConditionals '\([/#]\(if\|unless\)\|else\)' contained containedin=mustacheInside
|
syntax match mustacheConditionals '\([/#]\(if\|unless\)\|else\)' contained containedin=mustacheInside
|
||||||
syntax match mustacheHelpers '[/#]\(with\|each\)' contained containedin=mustacheSection
|
syntax match mustacheHelpers '[/#]\(with\|each\)' contained containedin=mustacheSection
|
||||||
syntax region mustacheComment start=/{{!/rs=s+2 skip=/{{.\{-}}}/ end=/}}/re=e-2 contains=Todo contained containedin=mustacheInside,@htmlMustacheContainer
|
syntax region mustacheComment start=/{{!/rs=s+2 skip=/{{.\{-}}}/ end=/}}/re=e-2 contains=Todo contained containedin=TOP,mustacheInside,@htmlMustacheContainer
|
||||||
syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=mustacheInside,@htmlMustacheContainer
|
syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=TOP,mustacheInside,@htmlMustacheContainer
|
||||||
syntax region mustacheQString start=/'/ skip=/\\'/ end=/'/ contained containedin=mustacheInside
|
syntax region mustacheQString start=/'/ skip=/\\'/ end=/'/ contained containedin=mustacheInside
|
||||||
syntax region mustacheDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=mustacheInside
|
syntax region mustacheDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=mustacheInside
|
||||||
|
|
||||||
|
@ -36,12 +36,15 @@ syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell
|
|||||||
|
|
||||||
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
|
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
|
||||||
|
|
||||||
syn match nixSimpleStringSpecial /\\./ contained
|
syn match nixSimpleStringSpecial /\\\%([nrt"\\$]\|$\)/ contained
|
||||||
syn match nixStringSpecial /''['$]/ contained
|
syn match nixStringSpecial /''['$]/ contained
|
||||||
syn match nixStringSpecial /''\\./ contained
|
syn match nixStringSpecial /''\\[nrt]/ contained
|
||||||
|
|
||||||
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial
|
syn match nixInvalidSimpleStringEscape /\\[^nrt"\\$]/ contained
|
||||||
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$\\]+ end=+''+ contains=nixInterpolation,nixStringSpecial
|
syn match nixInvalidStringEscape /''\\[^nrt]/ contained
|
||||||
|
|
||||||
|
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial,nixInvalidSimpleStringEscape
|
||||||
|
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$\\]+ end=+''+ contains=nixInterpolation,nixStringSpecial,nixInvalidStringEscape
|
||||||
|
|
||||||
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
|
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
|
||||||
|
|
||||||
@ -53,7 +56,7 @@ syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contai
|
|||||||
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
|
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
|
||||||
|
|
||||||
syn match nixAttributeDot "\." contained
|
syn match nixAttributeDot "\." contained
|
||||||
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'-.]\|$\)" contained
|
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'.-]\|$\)" contained
|
||||||
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
|
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
|
||||||
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
|
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
|
||||||
|
|
||||||
@ -149,41 +152,43 @@ syn keyword nixNamespacedBuiltin contained
|
|||||||
|
|
||||||
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
|
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
|
||||||
|
|
||||||
hi def link nixArgOperator Operator
|
hi def link nixArgOperator Operator
|
||||||
hi def link nixArgumentDefinition Identifier
|
hi def link nixArgumentDefinition Identifier
|
||||||
hi def link nixArgumentEllipsis Operator
|
hi def link nixArgumentEllipsis Operator
|
||||||
hi def link nixAssertKeyword Keyword
|
hi def link nixAssertKeyword Keyword
|
||||||
hi def link nixAttribute Identifier
|
hi def link nixAttribute Identifier
|
||||||
hi def link nixAttributeDot Operator
|
hi def link nixAttributeDot Operator
|
||||||
hi def link nixBoolean Boolean
|
hi def link nixBoolean Boolean
|
||||||
hi def link nixBuiltin Special
|
hi def link nixBuiltin Special
|
||||||
hi def link nixComment Comment
|
hi def link nixComment Comment
|
||||||
hi def link nixConditional Conditional
|
hi def link nixConditional Conditional
|
||||||
hi def link nixHomePath Include
|
hi def link nixHomePath Include
|
||||||
hi def link nixIfExprKeyword Keyword
|
hi def link nixIfExprKeyword Keyword
|
||||||
hi def link nixInherit Keyword
|
hi def link nixInherit Keyword
|
||||||
hi def link nixInteger Integer
|
hi def link nixInteger Integer
|
||||||
hi def link nixInterpolation Macro
|
hi def link nixInterpolation Macro
|
||||||
hi def link nixInterpolationDelimiter Delimiter
|
hi def link nixInterpolationDelimiter Delimiter
|
||||||
hi def link nixInterpolationParam Macro
|
hi def link nixInterpolationParam Macro
|
||||||
hi def link nixLetExprKeyword Keyword
|
hi def link nixInvalidSimpleStringEscape Error
|
||||||
hi def link nixNamespacedBuiltin Special
|
hi def link nixInvalidStringEscape Error
|
||||||
hi def link nixNull Constant
|
hi def link nixLetExprKeyword Keyword
|
||||||
hi def link nixOperator Operator
|
hi def link nixNamespacedBuiltin Special
|
||||||
hi def link nixPath Include
|
hi def link nixNull Constant
|
||||||
hi def link nixPathDelimiter Delimiter
|
hi def link nixOperator Operator
|
||||||
hi def link nixRecKeyword Keyword
|
hi def link nixPath Include
|
||||||
hi def link nixSearchPath Include
|
hi def link nixPathDelimiter Delimiter
|
||||||
hi def link nixSimpleBuiltin Keyword
|
hi def link nixRecKeyword Keyword
|
||||||
hi def link nixSimpleFunctionArgument Identifier
|
hi def link nixSearchPath Include
|
||||||
hi def link nixSimpleString String
|
hi def link nixSimpleBuiltin Keyword
|
||||||
hi def link nixSimpleStringSpecial SpecialChar
|
hi def link nixSimpleFunctionArgument Identifier
|
||||||
hi def link nixString String
|
hi def link nixSimpleString String
|
||||||
hi def link nixStringDelimiter Delimiter
|
hi def link nixSimpleStringSpecial SpecialChar
|
||||||
hi def link nixStringSpecial Special
|
hi def link nixString String
|
||||||
hi def link nixTodo Todo
|
hi def link nixStringDelimiter Delimiter
|
||||||
hi def link nixURI Include
|
hi def link nixStringSpecial Special
|
||||||
hi def link nixWithExprKeyword Keyword
|
hi def link nixTodo Todo
|
||||||
|
hi def link nixURI Include
|
||||||
|
hi def link nixWithExprKeyword Keyword
|
||||||
|
|
||||||
" This could lead up to slow syntax highlighting for large files, but usually
|
" This could lead up to slow syntax highlighting for large files, but usually
|
||||||
" large files such as all-packages.nix are one large attribute set, so if we'd
|
" large files such as all-packages.nix are one large attribute set, so if we'd
|
||||||
|
@ -57,7 +57,7 @@ syn match pugPlainChar "\\" contained
|
|||||||
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
|
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
|
||||||
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
||||||
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug,@Spell
|
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug,@Spell
|
||||||
syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugPipedText skipnl
|
syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugPipedText skipnl
|
||||||
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
|
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
|
||||||
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
|
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug,@Spell nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
|
||||||
syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
|
syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
|
||||||
|
@ -35,8 +35,8 @@ syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
|
|||||||
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||||
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
||||||
syn match qmlSpecial "\\\d\d\d\|\\."
|
syn match qmlSpecial "\\\d\d\d\|\\."
|
||||||
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"+ keepend contains=qmlSpecial,@htmlPreproc,@Spell
|
||||||
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'+ keepend contains=qmlSpecial,@htmlPreproc,@Spell
|
||||||
|
|
||||||
syn match qmlCharacter "'\\.'"
|
syn match qmlCharacter "'\\.'"
|
||||||
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||||
|
@ -206,11 +206,6 @@ syn region rustCommentBlockNest matchgroup=rustCommentBlock star
|
|||||||
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
|
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
|
||||||
syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent
|
syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent
|
||||||
|
|
||||||
if exists("b:current_syntax_embed")
|
|
||||||
syn match rustCommentLine "^//"
|
|
||||||
syn match rustCommentLineDoc "^//\%(//\@!\|!\)"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" FIXME: this is a really ugly and not fully correct implementation. Most
|
" FIXME: this is a really ugly and not fully correct implementation. Most
|
||||||
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
|
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
|
||||||
" a comment, but in practice at present it leaves comments open two levels
|
" a comment, but in practice at present it leaves comments open two levels
|
||||||
@ -235,12 +230,18 @@ if !exists("b:current_syntax_embed")
|
|||||||
syntax include @RustCodeInComment <sfile>:p:h/rust.vim
|
syntax include @RustCodeInComment <sfile>:p:h/rust.vim
|
||||||
unlet b:current_syntax_embed
|
unlet b:current_syntax_embed
|
||||||
|
|
||||||
|
" Currently regions marked as ```<some-other-syntax> will not get
|
||||||
|
" highlighted at all. In the future, we can do as vim-markdown does and
|
||||||
|
" highlight with the other syntax. But for now, let's make sure we find
|
||||||
|
" the closing block marker, because the rules below won't catch it.
|
||||||
|
syn region rustCommentLinesDocNonRustCode matchgroup=rustCommentDocCodeFence start='^\z(\s*//[!/]\s*```\).\+$' end='^\z1$' keepend contains=rustCommentLineDoc
|
||||||
|
|
||||||
" We borrow the rules from rust’s src/librustdoc/html/markdown.rs, so that
|
" We borrow the rules from rust’s src/librustdoc/html/markdown.rs, so that
|
||||||
" we only highlight as Rust what it would perceive as Rust (almost; it’s
|
" we only highlight as Rust what it would perceive as Rust (almost; it’s
|
||||||
" possible to trick it if you try hard, and indented code blocks aren’t
|
" possible to trick it if you try hard, and indented code blocks aren’t
|
||||||
" supported because Markdown is a menace to parse and only mad dogs and
|
" supported because Markdown is a menace to parse and only mad dogs and
|
||||||
" Englishmen would try to handle that case correctly in this syntax file).
|
" Englishmen would try to handle that case correctly in this syntax file).
|
||||||
syn region rustCommentLinesDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\s*//[!/]\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment
|
syn region rustCommentLinesDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\s*//[!/]\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment,rustCommentLineDocLeader
|
||||||
syn region rustCommentBlockDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\%(\s*\*\)\?\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment,rustCommentBlockDocStar
|
syn region rustCommentBlockDocRustCode matchgroup=rustCommentDocCodeFence start='^\z(\%(\s*\*\)\?\s*```\)[^A-Za-z0-9_-]*\%(\%(should_panic\|no_run\|ignore\|allow_fail\|rust\|test_harness\|compile_fail\|E\d\{4}\)\%([^A-Za-z0-9_-]\+\|$\)\)*$' end='^\z1$' keepend contains=@RustCodeInComment,rustCommentBlockDocStar
|
||||||
" Strictly, this may or may not be correct; this code, for example, would
|
" Strictly, this may or may not be correct; this code, for example, would
|
||||||
" mishighlight:
|
" mishighlight:
|
||||||
@ -254,6 +255,7 @@ if !exists("b:current_syntax_embed")
|
|||||||
"
|
"
|
||||||
" … but I don’t care. Balance of probability, and all that.
|
" … but I don’t care. Balance of probability, and all that.
|
||||||
syn match rustCommentBlockDocStar /^\s*\*\s\?/ contained
|
syn match rustCommentBlockDocStar /^\s*\*\s\?/ contained
|
||||||
|
syn match rustCommentLineDocLeader "^\s*//\%(//\@!\|!\)" contained
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Default highlighting {{{1
|
" Default highlighting {{{1
|
||||||
@ -308,6 +310,7 @@ hi def link rustFuncCall Function
|
|||||||
hi def link rustShebang Comment
|
hi def link rustShebang Comment
|
||||||
hi def link rustCommentLine Comment
|
hi def link rustCommentLine Comment
|
||||||
hi def link rustCommentLineDoc SpecialComment
|
hi def link rustCommentLineDoc SpecialComment
|
||||||
|
hi def link rustCommentLineDocLeader rustCommentLineDoc
|
||||||
hi def link rustCommentLineDocError Error
|
hi def link rustCommentLineDocError Error
|
||||||
hi def link rustCommentBlock rustCommentLine
|
hi def link rustCommentBlock rustCommentLine
|
||||||
hi def link rustCommentBlockDoc rustCommentLineDoc
|
hi def link rustCommentBlockDoc rustCommentLineDoc
|
||||||
|
@ -195,6 +195,7 @@ syntax keyword swiftAttributes
|
|||||||
\ @IBDesignable
|
\ @IBDesignable
|
||||||
\ @IBInspectable
|
\ @IBInspectable
|
||||||
\ @IBOutlet
|
\ @IBOutlet
|
||||||
|
\ @inlinable
|
||||||
\ @noescape
|
\ @noescape
|
||||||
\ @nonobjc
|
\ @nonobjc
|
||||||
\ @noreturn
|
\ @noreturn
|
||||||
@ -204,6 +205,7 @@ syntax keyword swiftAttributes
|
|||||||
\ @objc
|
\ @objc
|
||||||
\ @testable
|
\ @testable
|
||||||
\ @UIApplicationMain
|
\ @UIApplicationMain
|
||||||
|
\ @usableFromInline
|
||||||
\ @warn_unused_result
|
\ @warn_unused_result
|
||||||
|
|
||||||
syntax keyword swiftConditionStatement #available
|
syntax keyword swiftConditionStatement #available
|
||||||
|
@ -27,12 +27,16 @@ syn region tomlString oneline start=/'/ end=/'/
|
|||||||
syn region tomlString start=/'''/ end=/'''/
|
syn region tomlString start=/'''/ end=/'''/
|
||||||
hi def link tomlString String
|
hi def link tomlString String
|
||||||
|
|
||||||
syn match tomlInteger /\<[+-]\=[0-9]\(_\=\d\)*\>/ display
|
syn match tomlInteger /[+-]\=\<[1-9]\(_\=\d\)*\>/ display
|
||||||
syn match tomlInteger /\<[+-]\=\(inf\|nan\)\>/ display
|
syn match tomlInteger /[+-]\=\<0\>/ display
|
||||||
|
syn match tomlInteger /[+-]\=\<0x[[:xdigit:]]\(_\=[[:xdigit:]]\)*\>/ display
|
||||||
|
syn match tomlInteger /[+-]\=\<0o[0-7]\(_\=[0-7]\)*\>/ display
|
||||||
|
syn match tomlInteger /[+-]\=\<0b[01]\(_\=[01]\)*\>/ display
|
||||||
|
syn match tomlInteger /[+-]\=\<\(inf\|nan\)\>/ display
|
||||||
hi def link tomlInteger Number
|
hi def link tomlInteger Number
|
||||||
|
|
||||||
syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\.\d\+\>/ display
|
syn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\.\d\+\>/ display
|
||||||
syn match tomlFloat /\<[+-]\=[0-9]\(_\=\d\)*\(\.[0-9]\(_\=\d\)*\)\=[eE][+-]\=[0-9]\(_\=\d\)*\>/ display
|
syn match tomlFloat /[+-]\=\<\d\(_\=\d\)*\(\.\d\(_\=\d\)*\)\=[eE][+-]\=\d\(_\=\d\)*\>/ display
|
||||||
hi def link tomlFloat Float
|
hi def link tomlFloat Float
|
||||||
|
|
||||||
syn match tomlBoolean /\<\%(true\|false\)\>/ display
|
syn match tomlBoolean /\<\%(true\|false\)\>/ display
|
||||||
|
@ -58,7 +58,7 @@ endif "" JSDoc end
|
|||||||
syntax case match
|
syntax case match
|
||||||
|
|
||||||
"" Syntax in the typescript code"{{{
|
"" Syntax in the typescript code"{{{
|
||||||
syn match typescriptSpecial "\\\d\d\d\|\\."
|
syn match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}" contained containedin=typescriptStringD,typescriptStringS,typescriptStringB display
|
||||||
syn region typescriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=typescriptSpecial,@htmlPreproc extend
|
syn region typescriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=typescriptSpecial,@htmlPreproc extend
|
||||||
syn region typescriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=typescriptSpecial,@htmlPreproc extend
|
syn region typescriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=typescriptSpecial,@htmlPreproc extend
|
||||||
syn region typescriptStringB start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=typescriptInterpolation,typescriptSpecial,@htmlPreproc extend
|
syn region typescriptStringB start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=typescriptInterpolation,typescriptSpecial,@htmlPreproc extend
|
||||||
@ -87,28 +87,31 @@ syntax keyword typescriptPrototype contained prototype
|
|||||||
"}}}
|
"}}}
|
||||||
" DOM, Browser and Ajax Support {{{
|
" DOM, Browser and Ajax Support {{{
|
||||||
""""""""""""""""""""""""
|
""""""""""""""""""""""""
|
||||||
syntax keyword typescriptBrowserObjects window navigator screen history location
|
if get(g:, 'typescript_ignore_browserwords', 0)
|
||||||
|
syntax keyword typescriptBrowserObjects window navigator screen history location
|
||||||
|
|
||||||
syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea
|
syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea
|
||||||
syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode
|
syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode
|
||||||
syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName
|
syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName
|
||||||
|
|
||||||
syntax keyword typescriptAjaxObjects XMLHttpRequest
|
syntax keyword typescriptAjaxObjects XMLHttpRequest
|
||||||
syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText
|
syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText
|
||||||
syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader
|
syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader
|
||||||
|
|
||||||
syntax keyword typescriptPropietaryObjects ActiveXObject
|
syntax keyword typescriptPropietaryObjects ActiveXObject
|
||||||
syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue
|
syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue
|
||||||
|
|
||||||
syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title
|
syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title
|
||||||
|
|
||||||
syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item
|
syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item
|
||||||
|
|
||||||
syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation
|
syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation
|
||||||
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
"" Programm Keywords"{{{
|
"" Programm Keywords"{{{
|
||||||
syntax keyword typescriptSource import export from as
|
syntax keyword typescriptSource import export from as
|
||||||
syntax keyword typescriptIdentifier arguments this let var void const
|
syntax keyword typescriptIdentifier arguments this void
|
||||||
|
syntax keyword typescriptStorageClass let var const
|
||||||
syntax keyword typescriptOperator delete new instanceof typeof
|
syntax keyword typescriptOperator delete new instanceof typeof
|
||||||
syntax keyword typescriptBoolean true false
|
syntax keyword typescriptBoolean true false
|
||||||
syntax keyword typescriptNull null undefined
|
syntax keyword typescriptNull null undefined
|
||||||
@ -137,7 +140,7 @@ syntax keyword typescriptReserved constructor declare as interface module abstra
|
|||||||
syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite
|
syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite
|
||||||
"}}}
|
"}}}
|
||||||
" DOM2 Objects"{{{
|
" DOM2 Objects"{{{
|
||||||
syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number symbol never object
|
syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number symbol never object unknown
|
||||||
syntax keyword typescriptExceptions DOMException
|
syntax keyword typescriptExceptions DOMException
|
||||||
"}}}
|
"}}}
|
||||||
" DOM2 CONSTANT"{{{
|
" DOM2 CONSTANT"{{{
|
||||||
@ -187,7 +190,7 @@ syntax match typescriptDotNotation "\.style\." nextgroup=typescriptCssStyles
|
|||||||
|
|
||||||
|
|
||||||
"" Code blocks
|
"" Code blocks
|
||||||
syntax cluster typescriptAll contains=typescriptComment,typescriptLineComment,typescriptDocComment,typescriptStringD,typescriptStringS,typescriptStringB,typescriptRegexpString,typescriptNumber,typescriptFloat,typescriptDecorators,typescriptLabel,typescriptSource,typescriptType,typescriptOperator,typescriptBoolean,typescriptNull,typescriptFuncKeyword,typescriptConditional,typescriptGlobal,typescriptRepeat,typescriptBranch,typescriptStatement,typescriptGlobalObjects,typescriptMessage,typescriptIdentifier,typescriptExceptions,typescriptReserved,typescriptDeprecated,typescriptDomErrNo,typescriptDomNodeConsts,typescriptHtmlEvents,typescriptDotNotation,typescriptBrowserObjects,typescriptDOMObjects,typescriptAjaxObjects,typescriptPropietaryObjects,typescriptDOMMethods,typescriptHtmlElemProperties,typescriptDOMProperties,typescriptEventListenerKeywords,typescriptEventListenerMethods,typescriptAjaxProperties,typescriptAjaxMethods,typescriptFuncArg
|
syntax cluster typescriptAll contains=typescriptComment,typescriptLineComment,typescriptDocComment,typescriptStringD,typescriptStringS,typescriptStringB,typescriptRegexpString,typescriptNumber,typescriptFloat,typescriptDecorators,typescriptLabel,typescriptSource,typescriptType,typescriptOperator,typescriptBoolean,typescriptNull,typescriptFuncKeyword,typescriptConditional,typescriptGlobal,typescriptRepeat,typescriptBranch,typescriptStatement,typescriptGlobalObjects,typescriptMessage,typescriptIdentifier,typescriptStorageClass,typescriptExceptions,typescriptReserved,typescriptDeprecated,typescriptDomErrNo,typescriptDomNodeConsts,typescriptHtmlEvents,typescriptDotNotation,typescriptBrowserObjects,typescriptDOMObjects,typescriptAjaxObjects,typescriptPropietaryObjects,typescriptDOMMethods,typescriptHtmlElemProperties,typescriptDOMProperties,typescriptEventListenerKeywords,typescriptEventListenerMethods,typescriptAjaxProperties,typescriptAjaxMethods,typescriptFuncArg
|
||||||
|
|
||||||
if main_syntax == "typescript"
|
if main_syntax == "typescript"
|
||||||
syntax sync clear
|
syntax sync clear
|
||||||
@ -263,6 +266,7 @@ if version >= 508 || !exists("did_typescript_syn_inits")
|
|||||||
HiLink typescriptConditional Conditional
|
HiLink typescriptConditional Conditional
|
||||||
HiLink typescriptBranch Conditional
|
HiLink typescriptBranch Conditional
|
||||||
HiLink typescriptIdentifier Identifier
|
HiLink typescriptIdentifier Identifier
|
||||||
|
HiLink typescriptStorageClass StorageClass
|
||||||
HiLink typescriptRepeat Repeat
|
HiLink typescriptRepeat Repeat
|
||||||
HiLink typescriptStatement Statement
|
HiLink typescriptStatement Statement
|
||||||
HiLink typescriptFuncKeyword Function
|
HiLink typescriptFuncKeyword Function
|
||||||
|
@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
|||||||
|
|
||||||
" vifm syntax file
|
" vifm syntax file
|
||||||
" Maintainer: xaizek <xaizek@posteo.net>
|
" Maintainer: xaizek <xaizek@posteo.net>
|
||||||
" Last Change: July 4, 2018
|
" Last Change: September 22, 2018
|
||||||
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
|
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
@ -19,11 +19,12 @@ syntax keyword vifmCommand contained alink apropos bmark bmarks bmgo change
|
|||||||
\ chmod chown clone compare cope[n] co[py] cq[uit] d[elete] delbmarks
|
\ chmod chown clone compare cope[n] co[py] cq[uit] d[elete] delbmarks
|
||||||
\ delm[arks] di[splay] dirs e[dit] el[se] empty en[dif] exi[t] file fin[d]
|
\ delm[arks] di[splay] dirs e[dit] el[se] empty en[dif] exi[t] file fin[d]
|
||||||
\ fini[sh] go[to] gr[ep] h[elp] histnext his[tory] histprev jobs locate ls
|
\ fini[sh] go[to] gr[ep] h[elp] histnext his[tory] histprev jobs locate ls
|
||||||
\ lstrash marks mes[sages] mkdir m[ove] noh[lsearch] on[ly] popd pushd pu[t]
|
\ lstrash marks media mes[sages] mkdir m[ove] noh[lsearch] on[ly] popd pushd
|
||||||
\ pw[d] qa[ll] q[uit] redr[aw] reg[isters] rename restart restore rlink
|
\ pu[t] pw[d] qa[ll] q[uit] redr[aw] reg[isters] regular rename restart
|
||||||
\ screen sh[ell] siblnext siblprev sor[t] sp[lit] s[ubstitute] tabc[lose]
|
\ restore rlink screen sh[ell] siblnext siblprev sor[t] sp[lit] s[ubstitute]
|
||||||
\ tabm[ove] tabname tabnew touch tr trashes tree sync undol[ist] ve[rsion]
|
\ tabc[lose] tabm[ove] tabname tabnew touch tr trashes tree sync undol[ist]
|
||||||
\ vie[w] vifm vs[plit] winc[md] w[rite] wq wqa[ll] xa[ll] x[it] y[ank]
|
\ ve[rsion] vie[w] vifm vs[plit] winc[md] w[rite] wq wqa[ll] xa[ll] x[it]
|
||||||
|
\ y[ank]
|
||||||
\ nextgroup=vifmArgs
|
\ nextgroup=vifmArgs
|
||||||
|
|
||||||
" commands that might be prepended to a command without changing everything else
|
" commands that might be prepended to a command without changing everything else
|
||||||
@ -128,7 +129,7 @@ syntax keyword vifmOption contained aproposprg autochpos caseoptions cdpath cd
|
|||||||
\ deleteprg dotdirs dotfiles dirsize fastrun fillchars fcs findprg
|
\ deleteprg dotdirs dotfiles dirsize fastrun fillchars fcs findprg
|
||||||
\ followlinks fusehome gdefault grepprg histcursor history hi hlsearch hls
|
\ followlinks fusehome gdefault grepprg histcursor history hi hlsearch hls
|
||||||
\ iec ignorecase ic iooptions incsearch is laststatus lines locateprg ls
|
\ iec ignorecase ic iooptions incsearch is laststatus lines locateprg ls
|
||||||
\ lsoptions lsview milleroptions millerview mintimeoutlen number nu
|
\ lsoptions lsview mediaprg milleroptions millerview mintimeoutlen number nu
|
||||||
\ numberwidth nuw previewprg quickview relativenumber rnu rulerformat ruf
|
\ numberwidth nuw previewprg quickview relativenumber rnu rulerformat ruf
|
||||||
\ runexec scrollbind scb scrolloff so sort sortgroups sortorder sortnumbers
|
\ runexec scrollbind scb scrolloff so sort sortgroups sortorder sortnumbers
|
||||||
\ shell sh shortmess shm showtabline stal sizefmt slowfs smartcase scs
|
\ shell sh shortmess shm showtabline stal sizefmt slowfs smartcase scs
|
||||||
@ -383,11 +384,12 @@ syntax match vifmEnvVar contained /\$[0-9a-zA-Z_]\+/
|
|||||||
syntax match vifmNumber contained /\d\+/
|
syntax match vifmNumber contained /\d\+/
|
||||||
|
|
||||||
" Optional map arguments right after command name
|
" Optional map arguments right after command name
|
||||||
syntax match vifmMapArgList '\(<silent>\s*\)*' contained nextgroup=vifmMapLhs
|
syntax match vifmMapArgList '\(<\(silent\|wait\)>\s*\)*' contained
|
||||||
|
\ nextgroup=vifmMapLhs
|
||||||
|
|
||||||
" Ange-bracket notation
|
" Ange-bracket notation
|
||||||
syntax case ignore
|
syntax case ignore
|
||||||
syntax match vifmNotation '<\(esc\|cr\|space\|del\|nop\|\(s-\)\?tab\|home\|end\|left\|right\|up\|down\|bs\|delete\|insert\|pageup\|pagedown\|\([acms]-\)\?f\d\{1,2\}\|c-s-[a-z[\]^_]\|s-c-[a-z[\]^_]\|c-[a-z[\]^_]\|[am]-c-[a-z]\|c-[am]-[a-z]\|[am]-[a-z]\)>'
|
syntax match vifmNotation '<\(esc\|cr\|space\|del\|nop\|\(s-\)\?tab\|home\|end\|left\|right\|up\|down\|bs\|delete\|insert\|pageup\|pagedown\|\([acms]-\)\?f\d\{1,2\}\|c-s-[a-z[\]^_]\|s-c-[a-z[\]^_]\|c-[a-z[\]^_@]\|[am]-c-[a-z]\|c-[am]-[a-z]\|[am]-[a-z]\)>'
|
||||||
syntax case match
|
syntax case match
|
||||||
|
|
||||||
" Whole line comment
|
" Whole line comment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user