Compare commits

...

8 Commits

Author SHA1 Message Date
Adam Stankiewicz
17ad302c54 Change python syntax providers, closes #209 2017-12-30 11:55:40 +01:00
Adam Stankiewicz
1541356fe1 Add json5 support, closes #256 2017-12-30 11:34:40 +01:00
Adam Stankiewicz
f3556c1eca Add carp language support, closes #258 2017-12-30 11:29:38 +01:00
Adam Stankiewicz
4855e5ee82 Add vital file for crystal, fixes #259 2017-12-30 11:26:56 +01:00
Adam Stankiewicz
bb85059bac Update 2017-12-30 11:10:32 +01:00
Adam Stankiewicz
11f53253ad Add slime syntax, closes #252 2017-12-06 13:17:06 +01:00
Adam Stankiewicz
9fe009095a Change julia provider to JuliaEditorSupport/julia-vim, closes #253 2017-12-06 13:05:56 +01:00
Adam Stankiewicz
dce9e8dec5 Update 2017-12-06 12:56:27 +01:00
47 changed files with 7843 additions and 698 deletions

View File

@@ -46,6 +46,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
- [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
- [carp](https://github.com/hellerve/carp-vim) (syntax)
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
@@ -78,10 +79,11 @@ If you need full functionality of any plugin, please use it directly with your p
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
- [jsx](https://github.com/mxw/vim-jsx) (after)
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent)
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent)
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
@@ -108,7 +110,8 @@ If you need full functionality of any plugin, please use it directly with your p
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
- [python-ident](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
- [python](https://github.com/vim-python/python-syntax) (syntax)
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, autoload, ftplugin)
@@ -121,6 +124,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin)
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)

View File

@@ -8,6 +8,10 @@ if !exists('g:terraform_remap_spacebar')
let g:terraform_remap_spacebar = 0
endif
if !exists('g:terraform_fold_sections')
let g:terraform_fold_sections = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
@@ -22,38 +26,39 @@ if g:terraform_align && exists(':Tabularize')
endfunction
endif
if g:terraform_fold_sections
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return ">1"
elseif match(thisline, '^provider') >= 0
return ">1"
elseif match(thisline, '^module') >= 0
return ">1"
elseif match(thisline, '^variable') >= 0
return ">1"
elseif match(thisline, '^output') >= 0
return ">1"
elseif match(thisline, '^data') >= 0
return ">1"
elseif match(thisline, '^terraform') >= 0
return ">1"
elseif match(thisline, '^locals') >= 0
return ">1"
else
return "="
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds()
setlocal foldlevel=1
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return ">1"
elseif match(thisline, '^provider') >= 0
return ">1"
elseif match(thisline, '^module') >= 0
return ">1"
elseif match(thisline, '^variable') >= 0
return ">1"
elseif match(thisline, '^output') >= 0
return ">1"
elseif match(thisline, '^data') >= 0
return ">1"
elseif match(thisline, '^terraform') >= 0
return ">1"
elseif match(thisline, '^locals') >= 0
return ">1"
else
return "="
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds()
setlocal foldlevel=1
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
endif
" Re-map the space bar to fold and unfold
if get(g:, "terraform_remap_spacebar", 1)
@@ -70,5 +75,4 @@ if get(g:, "terraform_align", 1)
setlocal shiftwidth=2
endif
endif

View File

@@ -26,7 +26,7 @@ syn match yamlBlock "[\[\]\{\}\|\>]"
syn region yamlComment start="\#" end="$"
syn match yamlIndicator "#YAML:\S\+"
syn region yamlString start="'" end="'" skip="\\'"
syn region yamlString start="\%(^\| \)\zs'" end="'\ze\%( \|$\)" skip="\\'"
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
syn match yamlEscape "\\\o\o\=\o\=" contained

625
autoload/LaTeXtoUnicode.vim Normal file
View File

@@ -0,0 +1,625 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Support for LaTex-to-Unicode conversion as in the Julia REPL "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:L2U_Setup()
call s:L2U_SetupGlobal()
" Keep track of whether LaTeX-to-Unicode is activated
" (used when filetype changes)
if !has_key(b:, "l2u_enabled")
let b:l2u_enabled = 0
endif
" Did we install the L2U tab mappings?
if !has_key(b:, "l2u_tab_set")
let b:l2u_tab_set = 0
endif
if !has_key(b:, "l2u_cmdtab_set")
let b:l2u_cmdtab_set = 0
endif
" Did we activate the L2U as-you-type substitutions?
if !has_key(b:, "l2u_autosub_set")
let b:l2u_autosub_set = 0
endif
" Following are some flags used to pass information between the function which
" attempts the LaTeX-to-Unicode completion and the fallback function
" Was a (possibly partial) completion found?
let b:l2u_found_completion = 0
" Is the cursor just after a single backslash
let b:l2u_singlebslash = 0
" Backup value of the completeopt settings
" (since we temporarily add the 'longest' setting while
" attempting LaTeX-to-Unicode)
let b:l2u_backup_commpleteopt = &completeopt
" Are we in the middle of a L2U tab completion?
let b:l2u_tab_completing = 0
" Are we calling the tab fallback?
let b:l2u_in_fallback = 0
endfunction
function! s:L2U_SetupGlobal()
" Initialization of global and script-local variables
" is only performed once
if get(g:, "l2u_did_global_setup", 0)
return
endif
let g:l2u_did_global_setup = 1
let g:l2u_symbols_dict = julia_latex_symbols#get_dict()
call s:L2U_deprecated_options()
if v:version < 704
let g:latex_to_unicode_tab = 0
let g:latex_to_unicode_auto = 0
endif
" YouCompleteMe and neocomplcache/neocomplete/deoplete plug-ins do not work well
" with LaTeX symbols suggestions
if exists("g:loaded_youcompleteme") ||
\ exists("g:loaded_neocomplcache") ||
\ exists("g:loaded_neocomplete") ||
\ exists("g:loaded_deoplete")
let g:latex_to_unicode_suggestions = 0
endif
" A hack to forcibly get out of completion mode: feed
" this string with feedkeys()
if has("win32") || has("win64")
if has("gui_running")
let s:l2u_esc_sequence = "\u0006"
else
let s:l2u_esc_sequence = "\u0006\b"
endif
else
let s:l2u_esc_sequence = "\u0091\b"
end
" Trigger for the previous mapping of <Tab>
let s:l2u_fallback_trigger = "\u0091L2UFallbackTab"
endfunction
" Each time the filetype changes, we may need to enable or
" disable the LaTeX-to-Unicode functionality
function! LaTeXtoUnicode#Refresh()
call s:L2U_Setup()
" by default, LaTeX-to-Unicode is only active on julia files
let file_types = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types", "julia"))
let file_types_blacklist = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types_blacklist", "$^"))
if match(&filetype, file_types) < 0 || match(&filetype, file_types_blacklist) >= 0
if b:l2u_enabled
call LaTeXtoUnicode#Disable()
else
return
endif
elseif !b:l2u_enabled
call LaTeXtoUnicode#Enable()
endif
endfunction
function! LaTeXtoUnicode#Enable()
if b:l2u_enabled
return
end
call s:L2U_ResetLastCompletionInfo()
let b:l2u_enabled = 1
" If we're editing the first file upon opening vim, this will only init the
" command line mode mapping, and the full initialization will be performed by
" the autocmd triggered by InsertEnter, defined in /ftdetect.vim.
" Otherwise, if we're opening a file from within a running vim session, this
" will actually initialize all the LaTeX-to-Unicode substitutions.
call LaTeXtoUnicode#Init()
return
endfunction
function! LaTeXtoUnicode#Disable()
if !b:l2u_enabled
return
endif
let b:l2u_enabled = 0
call LaTeXtoUnicode#Init()
return
endfunction
" Translate old options to their new equivalents
function! s:L2U_deprecated_options()
for [new, old] in [["latex_to_unicode_tab", "julia_latex_to_unicode"],
\ ["latex_to_unicode_auto", "julia_auto_latex_to_unicode"],
\ ["latex_to_unicode_suggestions", "julia_latex_suggestions_enabled"],
\ ["latex_to_unicode_eager", "julia_latex_to_unicode_eager"]]
if !has_key(g:, new) && has_key(g:, old)
exec "let g:" . new . " = g:" . old
endif
endfor
endfunction
function! s:L2U_file_type_regex(ft)
if type(a:ft) == 3
let file_types = "\\%(" . join(a:ft, "\\|") . "\\)"
elseif type(a:ft) == 1
let file_types = a:ft
else
echoerr "invalid file_type specification"
endif
return "^" . file_types . "$"
endfunction
" Some data used to keep track of the previous completion attempt.
" Used to detect
" 1) if we just attempted the same completion, or
" 2) if backspace was just pressed while completing
" This function initializes and resets the required info
function! s:L2U_ResetLastCompletionInfo()
let b:l2u_completed_once = 0
let b:l2u_bs_while_completing = 0
let b:l2u_last_compl = {
\ 'line': '',
\ 'col0': -1,
\ 'col1': -1,
\ }
endfunction
" This function only detects whether an exact match is found for a LaTeX
" symbol in front of the cursor
function! s:L2U_ismatch()
let col1 = col('.')
let l = getline('.')
let col0 = match(l[0:col1-2], '\\[^[:space:]\\]\+$')
if col0 == -1
return 0
endif
let base = l[col0 : col1-1]
return has_key(g:l2u_symbols_dict, base)
endfunction
" Helper function to sort suggestion entries
function! s:L2U_partmatches_sort(p1, p2)
return a:p1.word > a:p2.word ? 1 : a:p1.word < a:p2.word ? -1 : 0
endfunction
" Helper function to fix display of Unicode compose characters
" in the suggestions menu (they are displayed on top of '◌')
function! s:L2U_fix_compose_chars(uni)
let u = matchstr(a:uni, '^.')
let isc = ("\u0300" <= u && u <= "\u036F") ||
\ ("\u1DC0" <= u && u <= "\u1DFF") ||
\ ("\u20D0" <= u && u <= "\u20FF") ||
\ ("\uFE20" <= u && u <= "\uFE2F")
return isc ? "\u25CC" . a:uni : a:uni
endfunction
" Helper function to find the longest common prefix among
" partial completion matches (used when suggestions are disabled
" and in command line mode)
function! s:L2U_longest_common_prefix(partmatches)
let common = a:partmatches[0]
for i in range(1, len(a:partmatches)-1)
let p = a:partmatches[i]
if len(p) < len(common)
let common = common[0 : len(p)-1]
endif
for j in range(1, len(common)-1)
if p[j] != common[j]
let common = common[0 : j-1]
break
endif
endfor
endfor
return common
endfunction
" Omnicompletion function. Besides the usual two-stage omnifunc behaviour,
" it has the following peculiar features:
" *) keeps track of the previous completion attempt
" *) sets some info to be used by the fallback function
" *) either returns a list of completions if a partial match is found, or a
" Unicode char if an exact match is found
" *) forces its way out of completion mode through a hack in some cases
function! LaTeXtoUnicode#omnifunc(findstart, base)
if a:findstart
" first stage
" avoid infinite loop if the fallback happens to call omnicompletion
if b:l2u_in_fallback
let b:l2u_in_fallback = 0
return -3
endif
let b:l2u_in_fallback = 0
" set info for the callback
let b:l2u_tab_completing = 1
let b:l2u_found_completion = 1
" analyse current line
let col1 = col('.')
let l = getline('.')
let col0 = match(l[0:col1-2], '\\[^[:space:]\\]\+$')
" compare with previous completion attempt
let b:l2u_bs_while_completing = 0
let b:l2u_completed_once = 0
if col0 == b:l2u_last_compl['col0']
let prevl = b:l2u_last_compl['line']
if col1 == b:l2u_last_compl['col1'] && l ==# prevl
let b:l2u_completed_once = 1
elseif col1 == b:l2u_last_compl['col1'] - 1 && l ==# prevl[0 : col1-2] . prevl[col1 : -1]
let b:l2u_bs_while_completing = 1
endif
endif
" store completion info for next attempt
let b:l2u_last_compl['col0'] = col0
let b:l2u_last_compl['col1'] = col1
let b:l2u_last_compl['line'] = l
" is the cursor right after a backslash?
let b:l2u_singlebslash = (match(l[0:col1-2], '\\$') >= 0)
" completion not found
if col0 == -1
let b:l2u_found_completion = 0
call feedkeys(s:l2u_esc_sequence, 'n')
let col0 = -2
endif
return col0
else
" read settings (eager mode is implicit when suggestions are disabled)
let suggestions = get(g:, "latex_to_unicode_suggestions", 1)
let eager = get(g:, "latex_to_unicode_eager", 1) || !suggestions
" search for matches
let partmatches = []
let exact_match = 0
for k in keys(g:l2u_symbols_dict)
if k ==# a:base
let exact_match = 1
endif
if len(k) >= len(a:base) && k[0 : len(a:base)-1] ==# a:base
let menu = s:L2U_fix_compose_chars(g:l2u_symbols_dict[k])
if suggestions
call add(partmatches, {'word': k, 'menu': menu})
else
call add(partmatches, k)
endif
endif
endfor
" exact matches are replaced with Unicode
" exceptions:
" *) we reached an exact match by pressing backspace while completing
" *) the exact match is one among many, and the eager setting is
" disabled, and it's the first time this completion is attempted
if exact_match && !b:l2u_bs_while_completing && (len(partmatches) == 1 || eager || b:l2u_completed_once)
" the completion is successful: reset the last completion info...
call s:L2U_ResetLastCompletionInfo()
" ...force our way out of completion mode...
call feedkeys(s:l2u_esc_sequence, 'n')
" ...return the Unicode symbol
return [g:l2u_symbols_dict[a:base]]
endif
if !empty(partmatches)
" here, only partial matches were found; either keep just the longest
" common prefix, or pass them on
if !suggestions
let partmatches = [s:L2U_longest_common_prefix(partmatches)]
else
call sort(partmatches, "s:L2U_partmatches_sort")
endif
endif
if empty(partmatches)
call feedkeys(s:l2u_esc_sequence, 'n')
let b:l2u_found_completion = 0
endif
return partmatches
endif
endfunction
function! LaTeXtoUnicode#PutLiteral(k)
call feedkeys(a:k, 'ni')
return ''
endfunction
" Function which saves the current insert-mode mapping of a key sequence `s`
" and associates it with another key sequence `k` (e.g. stores the current
" <Tab> mapping into the Fallback trigger)
function! s:L2U_SetFallbackMapping(s, k)
let mmdict = maparg(a:s, 'i', 0, 1)
if empty(mmdict)
exe 'inoremap <buffer> ' . a:k . ' ' . a:s
return
endif
let rhs = mmdict["rhs"]
if rhs =~# '^<Plug>L2U'
return
endif
let pre = '<buffer>'
if mmdict["silent"]
let pre = pre . '<silent>'
endif
if mmdict["expr"]
let pre = pre . '<expr>'
endif
if mmdict["noremap"]
let cmd = 'inoremap '
else
let cmd = 'imap '
" This is a nasty hack used to prevent infinite recursion. It's not a
" general solution.
if mmdict["expr"]
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
endif
endif
exe cmd . pre . ' ' . a:k . ' ' . rhs
endfunction
" This is the function which is mapped to <Tab>
function! LaTeXtoUnicode#Tab()
" the <Tab> is passed through to the fallback mapping if the completion
" menu is present, and it hasn't been raised by the L2U tab, and there
" isn't an exact match before the cursor when suggestions are disabled
if pumvisible() && !b:l2u_tab_completing && (get(g:, "latex_to_unicode_suggestions", 1) || !s:L2U_ismatch())
call feedkeys(s:l2u_fallback_trigger)
return ''
endif
" reset the in_fallback info
let b:l2u_in_fallback = 0
" temporary change to completeopt to use the `longest` setting, which is
" probably the only one which makes sense given that the goal of the
" completion is to substitute the final string
let b:l2u_backup_commpleteopt = &completeopt
set completeopt+=longest
set completeopt-=noinsert
" invoke omnicompletion; failure to perform LaTeX-to-Unicode completion is
" handled by the CompleteDone autocommand.
return "\<C-X>\<C-O>"
endfunction
" This function is called at every CompleteDone event, and is meant to handle
" the failures of LaTeX-to-Unicode completion by calling a fallback
function! LaTeXtoUnicode#FallbackCallback()
if !b:l2u_tab_completing
" completion was not initiated by L2U, nothing to do
return
else
" completion was initiated by L2U, restore completeopt
let &completeopt = b:l2u_backup_commpleteopt
endif
" at this point L2U tab completion is over
let b:l2u_tab_completing = 0
" if the completion was successful do nothing
if b:l2u_found_completion == 1 || b:l2u_singlebslash == 1
return
endif
" fallback
let b:l2u_in_fallback = 1
call feedkeys(s:l2u_fallback_trigger)
return
endfunction
" This is the function which is mapped to <S-Tab> in command-line mode
function! LaTeXtoUnicode#CmdTab()
" first stage
" analyse command line
let col1 = getcmdpos() - 1
let l = getcmdline()
let col0 = match(l[0:col1-1], '\\[^[:space:]\\]\+$')
let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)
" completion not found
if col0 == -1
return l
endif
let base = l[col0 : col1-1]
" search for matches
let partmatches = []
let exact_match = 0
for k in keys(g:l2u_symbols_dict)
if k ==# base
let exact_match = 1
endif
if len(k) >= len(base) && k[0 : len(base)-1] ==# base
call add(partmatches, k)
endif
endfor
if len(partmatches) == 0
return l
endif
" exact matches are replaced with Unicode
if exact_match
let unicode = g:l2u_symbols_dict[base]
if col0 > 0
let pre = l[0 : col0 - 1]
else
let pre = ''
endif
let posdiff = col1-col0 - len(unicode)
call setcmdpos(col1 - posdiff + 1)
return pre . unicode . l[col1 : -1]
endif
" no exact match: complete with the longest common prefix
let common = s:L2U_longest_common_prefix(partmatches)
if col0 > 0
let pre = l[0 : col0 - 1]
else
let pre = ''
endif
let posdiff = col1-col0 - len(common)
call setcmdpos(col1 - posdiff + 1)
return pre . common . l[col1 : -1]
endfunction
" Setup the L2U tab mapping
function! s:L2U_SetTab(wait_insert_enter)
if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled
cmap <buffer> <S-Tab> <Plug>L2UCmdTab
cnoremap <buffer> <Plug>L2UCmdTab <C-\>eLaTeXtoUnicode#CmdTab()<CR>
let b:l2u_cmdtab_set = 1
endif
if b:l2u_tab_set
return
endif
" g:did_insert_enter is set from an autocommand in ftdetect
if a:wait_insert_enter && !get(g:, "did_insert_enter", 0)
return
endif
if !get(g:, "latex_to_unicode_tab", 1) || !b:l2u_enabled
return
endif
" Backup the previous omnifunc (the check is probably not really needed)
if get(b:, "prev_omnifunc", "") != "LaTeXtoUnicode#omnifunc"
let b:prev_omnifunc = &omnifunc
endif
setlocal omnifunc=LaTeXtoUnicode#omnifunc
call s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
imap <buffer> <Tab> <Plug>L2UTab
inoremap <buffer><expr> <Plug>L2UTab LaTeXtoUnicode#Tab()
augroup L2UTab
autocmd! * <buffer>
" Every time a completion finishes, the fallback may be invoked
autocmd CompleteDone <buffer> call LaTeXtoUnicode#FallbackCallback()
augroup END
let b:l2u_tab_set = 1
endfunction
" Revert the LaTeX-to-Unicode tab mapping settings
function! s:L2U_UnsetTab()
if b:l2u_cmdtab_set
cunmap <buffer> <S-Tab>
let b:l2u_cmdtab_set = 0
endif
if !b:l2u_tab_set
return
endif
exec "setlocal omnifunc=" . get(b:, "prev_omnifunc", "")
iunmap <buffer> <Tab>
if empty(maparg("<Tab>", "i"))
call s:L2U_SetFallbackMapping(s:l2u_fallback_trigger, '<Tab>')
endif
iunmap <buffer> <Plug>L2UTab
exe 'iunmap <buffer> ' . s:l2u_fallback_trigger
augroup L2UTab
autocmd! * <buffer>
augroup END
let b:l2u_tab_set = 0
endfunction
" Function which looks for viable LaTeX-to-Unicode supstitutions as you type
function! LaTeXtoUnicode#AutoSub(...)
let vc = a:0 == 0 ? v:char : a:1
let col1 = col('.')
let lnum = line('.')
if col1 == 1
if a:0 > 1
call feedkeys(a:2, 'n')
endif
return ''
endif
let bs = (vc != "\n")
let l = getline(lnum)[0 : col1-1-bs] . v:char
let col0 = match(l, '\\\%([_^]\?[A-Za-z]\+\%' . col1 . 'c\%([^A-Za-z]\|$\)\|[_^]\%([0-9()=+-]\)\%' . col1 .'c\%(.\|$\)\)')
if col0 == -1
if a:0 > 1
call feedkeys(a:2, 'n')
endif
return ''
endif
let base = l[col0 : -1-bs]
let unicode = get(g:l2u_symbols_dict, base, '')
if empty(unicode)
if a:0 > 1
call feedkeys(a:2, 'n')
endif
return ''
endif
call feedkeys("\<C-G>u", 'n')
call feedkeys(repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence, 'nt')
call feedkeys("\<C-G>u", 'n')
return ''
endfunction
" Setup the auto as-you-type LaTeX-to-Unicode substitution
function! s:L2U_SetAutoSub(wait_insert_enter)
if b:l2u_autosub_set
return
endif
" g:did_insert_enter is set from an autocommand in ftdetect
if a:wait_insert_enter && !get(g:, "did_insert_enter", 0)
return
endif
if !get(g:, "latex_to_unicode_auto", 0) || !b:l2u_enabled
return
endif
" Viable substitutions are searched at every character insertion via the
" autocmd InsertCharPre. The <Enter> key does not seem to be catched in
" this way though, so we use a mapping for that case.
imap <buffer> <CR> <Plug>L2UAutoSub
inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "\<CR>")
augroup L2UAutoSub
autocmd! * <buffer>
autocmd InsertCharPre <buffer> call LaTeXtoUnicode#AutoSub()
augroup END
let b:l2u_autosub_set = 1
endfunction
" Revert the auto LaTeX-to-Unicode settings
function! s:L2U_UnsetAutoSub()
if !b:l2u_autosub_set
return
endif
iunmap <buffer> <CR>
iunmap <buffer> <Plug>L2UAutoSub
augroup L2UAutoSub
autocmd! * <buffer>
augroup END
let b:l2u_autosub_set = 0
endfunction
" Initialization. Can be used to re-init when global settings have changed.
function! LaTeXtoUnicode#Init(...)
let wait_insert_enter = a:0 > 0 ? a:1 : 1
if !wait_insert_enter
augroup L2UInit
autocmd!
augroup END
endif
call s:L2U_UnsetTab()
call s:L2U_UnsetAutoSub()
call s:L2U_SetTab(wait_insert_enter)
call s:L2U_SetAutoSub(wait_insert_enter)
endfunction
function! LaTeXtoUnicode#Toggle()
call s:L2U_Setup()
if b:l2u_enabled
call LaTeXtoUnicode#Disable()
echo "LaTeX-to-Unicode disabled"
else
call LaTeXtoUnicode#Enable()
echo "LaTeX-to-Unicode enabled"
endif
return
endfunction
endif

View File

@@ -152,4 +152,13 @@ function! s:DotPackagesFile() abort
return [v:false, '']
endfunction
" Prevent writes to files in the pub cache.
function! dart#setModifiable() abort
let full_path = expand('%:p')
if full_path =~# '.pub-cache' ||
\ full_path =~# 'Pub\Cache'
setlocal nomodifiable
endif
endfunction
endif

View File

@@ -1,6 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
function! fish#Indent()
let l:shiftwidth = shiftwidth()
let l:prevlnum = prevnonblank(v:lnum - 1)
if l:prevlnum ==# 0
return 0
@@ -8,15 +9,15 @@ function! fish#Indent()
let l:indent = 0
let l:prevline = getline(l:prevlnum)
if l:prevline =~# '\v^\s*switch>'
let l:indent = &shiftwidth * 2
let l:indent = l:shiftwidth * 2
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
let l:indent = &shiftwidth
let l:indent = l:shiftwidth
endif
let l:line = getline(v:lnum)
if l:line =~# '\v^\s*end>'
return indent(v:lnum) - (l:indent ==# 0 ? &shiftwidth : l:indent)
return indent(v:lnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent)
elseif l:line =~# '\v^\s*%(case|else)>'
return indent(v:lnum) - &shiftwidth
return indent(v:lnum) - l:shiftwidth
endif
return indent(l:prevlnum) + l:indent
endfunction

188
autoload/julia.vim Normal file
View File

@@ -0,0 +1,188 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
function! julia#set_syntax_version(jvers)
if &filetype != "julia"
echo "Not a Julia file"
return
endif
syntax clear
let b:julia_syntax_version = a:jvers
set filetype=julia
endfunction
function! julia#toggle_deprecated_syntax()
if &filetype != "julia"
echo "Not a Julia file"
return
endif
syntax clear
let hd = get(b:, "julia_syntax_highlight_deprecated",
\ get(g:, "julia_syntax_highlight_deprecated", 0))
let b:julia_syntax_highlight_deprecated = hd ? 0 : 1
set filetype=julia
if b:julia_syntax_highlight_deprecated
echo "Highlighting of deprecated syntax enabled"
else
echo "Highlighting of deprecated syntax disabled"
endif
endfunction
if exists("loaded_matchit")
function! julia#toggle_function_blockassign()
let sav_pos = getcurpos()
let l = getline('.')
let c = match(l, '\C\m\<function\s\+.\+(')
if c != -1
return julia#function_block2assign()
endif
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*=\s*')
if c == -1
echohl WarningMsg | echo "Not on a function definition or assignment line" | echohl None
return
endif
return julia#function_assign2block()
endfunction
function! julia#function_block2assign()
let sav_pos = getcurpos()
let l = getline('.')
let c = match(l, '\C\m\<function\s\+.\+(')
if c == -1
echohl WarningMsg | echo "Not on a function definition line" | echohl None
return
endif
let fpos = copy(sav_pos)
let fpos[2] = c+1
call setpos('.', fpos)
normal %
if line('.') != fpos[1]+2 || match(getline('.'), '\C\m^\s*end\s*$') == -1
echohl WarningMsg | echo "Only works with 3-lines functions" | echohl None
call setpos('.', sav_pos)
return
endif
call setpos('.', fpos)
normal! f(
normal %
while line('.') == fpos[1] && match(l[col('.')-1:], '\C\m)(') == 0
normal! l
normal %
endwhile
if line('.') != fpos[1] || match(l[(col('.')-1):], '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*$') != 0
echohl WarningMsg | echo "Unrecognized function definition format" | echohl None
call setpos('.', sav_pos)
return
endif
call setpos('.', fpos)
normal! dwA = J
if match(getline('.')[(col('.')-1):], '\C\mreturn\>') == 0
normal! dw
endif
if match(getline('.')[(col('.')-1):], '\C\m\s*$') == 0
normal! F=C= nothing
endif
normal! jddk^
return
endfunction
function! julia#function_assign2block()
let sav_pos = getcurpos()
let l = getline('.')
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*=\s*')
if c == -1
echohl WarningMsg | echo "Not on a function assignment-definition line" | echohl None
return
endif
normal ^
while match(l[(col('.')-1):], '\%(\S\+\.\)*@') == 0
normal! W
endwhile
normal! ifunction 
let l = getline('.')
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*\zs=\s*')
let eqpos = copy(sav_pos)
let eqpos[2] = c+1
call setpos('.', eqpos)
normal! cw
oend
normal %
s/\s*$// | noh
return
endfunction
let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" .
\ "\"#$'(,.:;=?@`\\U5B{" .
\ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF"
let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars
" the following excludes '!' since it can be used as an identifier,
" and '$' since it can be used in interpolations
" note that \U2D is '-'
let s:uniop_chars = "+\\U2D~¬√∛∜"
let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆⊈⊂⊄⊊←→∋∌⊕⊖⊞⊟∘∧⊗⊘↑↓∨⊠±"
" the following is a list of all remainig valid operator chars,
" but it's more efficient when expressed with ranges (see below)
" let s:binop_chars_extra = "↔↚↛↠↣↦↮⇎⇏⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←→" .
" \ "∝∊∍∥∦∷∺∻∽∾≁≃≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣" .
" \ "⊔∓∔∸≂≏⊎⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣" .
" \ "⊙⊚⊛⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗" .
" \ "⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯↑↓"
" same as above, but with character ranges, for performance
let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\U221D\\U2224-\\U222A\\U2237\\U2238\\U223A\\U223B\\U223D\\U223E\\U2240-\\U228B\\U228D-\\U229C\\U229E-\\U22A3\\U22A9\\U22AC\\U22AE\\U22B0-\\U22B7\\U22BB-\\U22BD\\U22C4-\\U22C7\\U22C9-\\U22D3\\U22D5-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\U27F7\\U27F9-\\U27FF\\U2900-\\U2918\\U291D-\\U2920\\U2944-\\U2970\\U29B7\\U29B8\\U29BC\\U29BE-\\U29C1\\U29E1\\U29E3-\\U29E5\\U29F4\\U29F6\\U29F7\\U29FA\\U29FB\\U2A07\\U2A08\\U2A1D\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC"
" a Julia identifier, sort of
let s:idregex = '[^' . s:nonidS_chars . '0-9!' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*'
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
\ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|:>\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
\ '\|' . '[' . s:uniop_chars . '!$]' .
\ '\|' . '\.\?[' . s:binop_chars . s:binop_chars_extra . ']' .
\ '\)'
function! julia#idundercursor()
" TODO...
let w = expand('<cword>')
" let [l,c] = [line('.'),col('.')]
" let ll = getline(l)
return w
endfunction
function! julia#gotodefinition()
let w = julia#idundercursor()
if empty(w)
return ''
endif
let [l,c] = [line('.'),col('.')]
let st = map(synstack(l,c), 'synIDattr(v:val, "name")')
let n = len(st)
if n > 0 && st[-1] =~# '^julia\%(\%(Range\|Ternary\|CTrans\)\?Operator\|\%(Possible\)\?SymbolS\?\|\%(Bl\|Rep\)\?Keyword\|Conditional\|ParDelim\|Char\|Colon\|Typedef\|Number\|Float\|Const\%(Generic\|Bool\)\|ComplexUnit\|\%(Special\|\%(Octal\|Hex\)Escape\)Char\|UniChar\%(Small\|Large\)\|Comment[LM]\|Todo\|Semicolon\)$'
return ''
endif
let comprehension = 0
let indollar = 0
for i in range(n-1, 0, -1)
if st[i] =~# '^juliaDollar\%(Var\|Par\|SqBra\)$'
let indollar = 1
endif
if !indollar && st[i] =~# '^julia\%(\a*String\|QuotedParBlockS\?\)$'
return ''
endif
if st[i] =~# '^julia\%(ParBlock\%(InRange\)\?\|SqBraBlock\|\%(Dollar\|StringVars\)\%(Par\|SqBra\)\)$'
let comprehension = 1
endif
endfor
let s1 = search('\C\<' . w . '\s*=[^=]', 'bcWzs')
return
endfunction
endif

798
autoload/julia_blocks.vim Normal file
View File

@@ -0,0 +1,798 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
" Facilities for moving around Julia blocks (e.g. if/end, function/end etc.)
" (AKA a collection of horrible hacks)
let s:default_mappings = {
\ "moveblock_n" : "]]",
\ "moveblock_N" : "][",
\ "moveblock_p" : "[[",
\ "moveblock_P" : "[]",
\
\ "move_n" : "]j",
\ "move_N" : "]J",
\ "move_p" : "[j",
\ "move_P" : "[J",
\
\ "select_a" : "aj",
\ "select_i" : "ij",
\
\ "whereami" : "",
\ }
function! s:getmapchars(function)
if exists("g:julia_blocks_mappings") && has_key(g:julia_blocks_mappings, a:function)
return s:escape(g:julia_blocks_mappings[a:function])
else
return s:escape(s:default_mappings[a:function])
endif
endfunction
function! s:map_move(function, toend, backwards)
let chars = s:getmapchars(a:function)
if empty(chars)
return
endif
let fn = "julia_blocks#" . a:function
let lhs = "<buffer> <nowait> <silent> " . chars . " "
let cnt = ":<C-U>let b:jlblk_count=v:count1"
exe "nnoremap " . lhs . cnt
\ . " <Bar> call " . fn . "()<CR>"
exe "onoremap " . lhs . cnt
\ . "<CR><Esc>:call julia_blocks#owrapper_move(v:operator, \"" . fn . "\", " . a:toend . ", " . a:backwards . ")<CR>"
exe "xnoremap " . lhs . cnt
\ . "<CR>gv<Esc>:call julia_blocks#vwrapper_move(\"" . fn . "\")<CR>"
let b:jlblk_mapped[a:function] = 1
endfunction
function! julia_blocks#owrapper_move(oper, function, toend, backwards)
let F = function(a:function)
let save_redraw = &lazyredraw
let save_select = &selection
let restore_cmds = "\<Esc>"
\ . ":let &l:selection = \"" . save_select . "\"\<CR>"
\ . ":let &l:lazyredraw = " . save_redraw . "\<CR>"
\ . ":\<BS>"
setlocal lazyredraw
let start_pos = getpos('.')
let b:jlblk_abort_calls_esc = 0
call F()
let b:jlblk_abort_calls_esc = 1
let end_pos = getpos('.')
if start_pos == end_pos
call feedkeys(restore_cmds, 'n')
endif
let &l:selection = "inclusive"
if a:backwards || !a:toend
let &l:selection = "exclusive"
endif
if a:toend && a:backwards
let end_pos[2] += 1
endif
if s:compare_pos(start_pos, end_pos) > 0
let [start_pos, end_pos] = [end_pos, start_pos]
endif
call setpos("'<", start_pos)
call setpos("'>", end_pos)
" NOTE: the 'c' operator behaves differently, for mysterious reasons. We
" simulate it with 'd' followed by 'i' instead
call feedkeys("gv" . (a:oper == "c" ? "d" : a:oper) . restore_cmds . (a:oper == "c" ? "i" : ""), 'n')
endfunction
function! julia_blocks#vwrapper_move(function)
let F = function(a:function)
let s = getpos('.')
let b1 = getpos("'<")
let b2 = getpos("'>")
let b = b1 == s ? b2 : b1
call setpos('.', s)
let b:jlblk_abort_calls_esc = 0
call F()
let b:jlblk_abort_calls_esc = 1
let e = getpos('.')
call setpos('.', b)
exe "normal " . visualmode()
call setpos('.', e)
endfunction
function! s:unmap(function)
if !get(b:jlblk_mapped, a:function, 0)
return
endif
let chars = s:getmapchars(a:function)
if empty(chars)
" shouldn't happen
return
endif
let mapids = a:function =~# "^move" ? ["n", "x", "o"] :
\ a:function =~# "^select" ? ["x", "o"] :
\ ["n"]
let fn = "julia_blocks#" . a:function
let cmd = "<buffer> " . chars
for m in mapids
exe m . "unmap " . cmd
endfor
let b:jlblk_mapped[a:function] = 0
endfunction
function! s:escape(chars)
let c = a:chars
let c = substitute(c, '|', '<Bar>', 'g')
return c
endfunction
function! s:map_select(function)
let chars = s:getmapchars(a:function)
if empty(chars)
return
endif
let fn = "julia_blocks#" . a:function
let lhs = "<buffer> <nowait> <silent> " . chars . " "
let cnt = ":<C-U>let b:jlblk_inwrapper=1<CR>:let b:jlblk_count=max([v:prevcount,1])<CR>"
exe "onoremap " . lhs . "<Esc>" . cnt
\ . ":call julia_blocks#owrapper_select(v:operator, \"" . fn . "\")<CR>"
exe "xnoremap " . lhs . cnt
\ . ":call julia_blocks#vwrapper_select(\"" . fn . "\")<CR>"
let b:jlblk_mapped[a:function] = 1
endfunction
function! julia_blocks#owrapper_select(oper, function) ", toend, backwards)
let F = function(a:function)
let save_redraw = &lazyredraw
let save_select = &selection
let restore_cmds = "\<Esc>"
\ . ":let &l:selection = \"" . save_select . "\"\<CR>"
\ . ":let &l:lazyredraw = " . save_redraw . "\<CR>"
\ . ":\<BS>"
setlocal lazyredraw
let b:jlblk_abort_calls_esc = 0
let retF = F()
let b:jlblk_abort_calls_esc = 1
if empty(retF)
let b:jlblk_inwrapper = 0
call feedkeys(restore_cmds, 'n')
return
end
let [start_pos, end_pos] = retF
if start_pos == end_pos
call feedkeys(restore_cmds, 'n')
endif
let &l:selection = "inclusive"
call setpos("'<", start_pos)
call setpos("'>", end_pos)
let b:jlblk_inwrapper = 0
" NOTE: the 'c' operator behaves differently, for mysterious reasons. We
" simulate it with 'd' followed by 'i' instead
call feedkeys("gv" . (a:oper == "c" ? "d" : a:oper) . restore_cmds . (a:oper == "c" ? "i" : ""), 'n')
endfunction
function! julia_blocks#vwrapper_select(function)
let F = function(a:function)
let b:jlblk_abort_calls_esc = 0
let retF = F()
let b:jlblk_abort_calls_esc = 1
if empty(retF)
let b:jlblk_inwrapper = 0
return
end
let [start_pos, end_pos] = retF
call setpos("'<", start_pos)
call setpos("'>", end_pos)
normal! gv
let b:jlblk_inwrapper = 0
endfunction
function! s:map_aux(function)
let chars = s:getmapchars(a:function)
if empty(chars)
return
endif
let fn = "julia_blocks#" . a:function
let lhs = "<buffer> <nowait> <silent> " . chars . " "
exe "nnoremap " . lhs . ":<C-U>echo " . fn . "()<CR>"
let b:jlblk_mapped[a:function] = 1
endfunction
let s:julia_blocks_functions = {
\ "moveblock_N": [1, 0],
\ "moveblock_n": [0, 0],
\ "moveblock_p": [0, 1],
\ "moveblock_P": [1, 1],
\
\ "move_N": [1, 0],
\ "move_n": [0, 0],
\ "move_p": [0, 1],
\ "move_P": [1, 1],
\
\ "select_a": [],
\ "select_i": [],
\
\ "whereami": [],
\ }
function! julia_blocks#init_mappings()
let b:jlblk_mapped = {}
for f in keys(s:julia_blocks_functions)
if f =~# "^move"
let [te, bw] = s:julia_blocks_functions[f]
call s:map_move(f, te, bw)
elseif f =~# "^select"
call s:map_select(f)
else
call s:map_aux(f)
endif
endfor
call julia_blocks#select_reset()
augroup JuliaBlocks
au!
au InsertEnter *.jl call julia_blocks#select_reset()
au CursorMoved *.jl call s:cursor_moved()
augroup END
" we would need some autocmd event associated with exiting from
" visual mode, but there isn't any, so we resort to this crude
" hack
" ACTUALLY this creates more problems than it solves, so the crude hack
" is just disabled
"vnoremap <buffer><silent><unique> <Esc> <Esc>:call julia_blocks#select_reset()<CR>
endfunction
function! julia_blocks#remove_mappings()
if exists("b:jlblk_mapped")
for f in keys(s:julia_blocks_functions)
call s:unmap(f)
endfor
endif
unlet! b:jlblk_save_pos b:jlblk_view b:jlblk_count b:jlblk_abort_calls_esc
unlet! b:jlblk_inwrapper b:jlblk_did_select b:jlblk_doing_select
unlet! b:jlblk_last_start_pos b:jlblk_last_end_pos b:jlblk_last_mode
augroup JuliaBlocks
au!
augroup END
augroup! JuliaBlocks
let md = maparg("<Esc>", "x", 0, 1)
if !empty(md) && md["buffer"]
vunmap <buffer> <Esc>
endif
endfunction
function! s:restore_view()
"redraw! " would ensure correct behaviour, but is annoying
let pos = getpos('.')
if pos == b:jlblk_save_pos
call winrestview(b:jlblk_view)
return
endif
let oldtopline = b:jlblk_view["topline"]
let newtopline = winsaveview()["topline"]
let l = pos[1]
if l >= oldtopline + &l:scrolloff && l <= oldtopline + winheight(0) - 1 - &l:scrolloff
if newtopline > oldtopline
exe ":normal! " . (newtopline - oldtopline) . "\<C-Y>"
elseif newtopline < oldtopline
exe ":normal! " . (oldtopline - newtopline) . "\<C-E>"
endif
" these reduce the scrolling to the minimum (which is maybe not
" standard ViM behaviour?)
elseif newtopline < oldtopline && (l - newtopline - &l:scrolloff) > 0
exe ":normal! " . (l - newtopline - &l:scrolloff) . "\<C-E>"
elseif newtopline > oldtopline && (newtopline + &l:scrolloff - l) > 0
exe ":normal! " . (l - newtopline - &l:scrolloff) . "\<C-E>"
endif
call setpos('.', pos) " make sure we didn't screw up
" (since winsaveview may not be up to date)
endfunction
function! s:abort()
call setpos('.', b:jlblk_save_pos)
call s:restore_view()
if get(b:, "jlblk_abort_calls_esc", 1)
call feedkeys("\<Esc>", 'n')
endif
return 0
endfunction
function! s:set_mark_tick(...)
" This could be a one-liner:
" call setpos("''", b:jlblk_save_pos)
" but we want to append to the jumplist,
" which setpos doesn't do
let p = getpos('.')
call setpos('.', b:jlblk_save_pos)
normal! m'
call setpos('.', p)
endfunction
function! s:get_save_pos(...)
if !exists("b:jlblk_save_pos") || (a:0 == 0) || (a:0 > 0 && a:1)
let b:jlblk_save_pos = getpos('.')
endif
let b:jlblk_view = winsaveview()
endfunction
function! s:on_end()
return getline('.')[col('.')-1] =~# '\k' && expand("<cword>") =~# b:julia_end_keywords
endfunction
function! s:on_begin()
let [l,c] = [line('.'), col('.')]
normal! ^
let patt = '\%<'.(c+1).'c\(' . b:julia_begin_keywordsm . '\)\%>'.(c-1).'c'
let n = search(patt, 'Wnc', l)
call cursor(l, c)
return n > 0
endfunction
function! s:matchit()
let lkj = exists(":lockjumps") == 2 ? "lockjumps " : ""
exe lkj . "normal %"
endfunction
function! s:move_before_begin()
call search(b:julia_begin_keywordsm, 'Wbc')
normal! h
endfunction
function! s:cycle_until_end()
let pos = getpos('.')
while !s:on_end()
call s:matchit()
let c = 0
if getpos('.') == pos || c > 1000
" shouldn't happen, but let's avoid infinite loops anyway
return 0
endif
let c += 1
endwhile
return 1
endfunction
function! s:moveto_block_delim(toend, backwards, ...)
let pattern = a:toend ? b:julia_end_keywords : b:julia_begin_keywordsm
let flags = a:backwards ? 'Wb' : 'W'
let cnt = a:0 > 0 ? a:1 : b:jlblk_count
if !a:toend && a:backwards && s:on_begin()
call s:move_before_begin()
endif
let ret = 0
for c in range(cnt)
if a:toend && a:backwards && s:on_end()
normal! l
normal! bh
endif
while 1
let searchret = search(pattern, flags)
if !searchret
return ret
endif
exe "let skip = " . b:match_skip
if !skip
let ret = 1
break
endif
endwhile
endfor
return ret
endfunction
function! s:compare_pos(pos1, pos2)
if a:pos1[1] < a:pos2[1]
return -1
elseif a:pos1[1] > a:pos2[1]
return 1
elseif a:pos1[2] < a:pos2[2]
return -1
elseif a:pos1[2] > a:pos2[2]
return 1
else
return 0
endif
endfunction
function! julia_blocks#move_N()
call s:get_save_pos()
let ret = s:moveto_block_delim(1, 0)
if !ret
return s:abort()
endif
normal! e
call s:set_mark_tick()
return 1
endfunction
function! julia_blocks#move_n()
call s:get_save_pos()
let ret = s:moveto_block_delim(0, 0)
if !ret
return s:abort()
endif
call s:set_mark_tick()
return 1
endfunction
function! julia_blocks#move_p()
call s:get_save_pos()
let ret = s:moveto_block_delim(0, 1)
if !ret
return s:abort()
endif
call s:set_mark_tick()
return 1
endfunction
function! julia_blocks#move_P()
call s:get_save_pos()
let ret = s:moveto_block_delim(1, 1)
if !ret
return s:abort()
endif
normal! e
call s:set_mark_tick()
return 1
endfunction
function! s:moveto_currentblock_end()
let flags = 'W'
if s:on_end()
let flags .= 'c'
" NOTE: using "normal! lb" fails at the end of the file (?!)
normal! l
normal! b
endif
let ret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
if ret <= 0
return s:abort()
endif
normal! e
return 1
endfunction
function! julia_blocks#moveblock_N()
call s:get_save_pos()
let ret = 0
for c in range(b:jlblk_count)
let last_seen_pos = getpos('.')
if s:on_end()
normal! hel
let save_pos = getpos('.')
let ret_start = s:moveto_block_delim(0, 0, 1)
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
call setpos('.', save_pos)
if s:on_end()
normal! h
endif
let ret_end = s:moveto_block_delim(1, 0, 1)
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
if ret_start && (!ret_end || s:compare_pos(start1_pos, end1_pos) < 0)
call setpos('.', start1_pos)
else
call setpos('.', save_pos)
endif
endif
let moveret = s:moveto_currentblock_end()
if !moveret && c == 0
let moveret = s:moveto_block_delim(0, 0, 1) && s:cycle_until_end()
if moveret
normal! e
endif
endif
if !moveret
call setpos('.', last_seen_pos)
break
endif
let ret = 1
endfor
if !ret
return s:abort()
endif
call s:set_mark_tick()
return 1
endfunction
function! julia_blocks#moveblock_n()
call s:get_save_pos()
let ret = 0
for c in range(b:jlblk_count)
let last_seen_pos = getpos('.')
call s:moveto_currentblock_end()
if s:moveto_block_delim(0, 0, 1)
let ret = 1
else
call setpos('.', last_seen_pos)
break
endif
endfor
if !ret
return s:abort()
endif
call s:set_mark_tick()
return 1
endfunction
function! julia_blocks#moveblock_p()
call s:get_save_pos()
let ret = 0
for c in range(b:jlblk_count)
let last_seen_pos = getpos('.')
if s:on_begin()
call s:move_before_begin()
if s:on_end()
normal! l
endif
let save_pos = getpos('.')
let ret_start = s:moveto_block_delim(0, 1, 1)
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
call setpos('.', save_pos)
let ret_end = s:moveto_block_delim(1, 1, 1)
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
if ret_end && (!ret_start || s:compare_pos(start1_pos, end1_pos) < 0)
call setpos('.', end1_pos)
else
call setpos('.', save_pos)
endif
endif
let moveret = s:moveto_currentblock_end()
if !moveret && c == 0
let moveret = s:moveto_block_delim(1, 1, 1)
endif
if !moveret
call setpos('.', last_seen_pos)
break
endif
call s:matchit()
let ret = 1
endfor
if !ret
return s:abort()
endif
call s:set_mark_tick()
call s:restore_view()
return 1
endfunction
function! julia_blocks#moveblock_P()
call s:get_save_pos()
let ret = 0
for c in range(b:jlblk_count)
let last_seen_pos = getpos('.')
call s:moveto_currentblock_end()
if s:on_end()
call s:matchit()
endif
if s:moveto_block_delim(1, 1, 1)
" NOTE: normal! he does not work unless &whichwrap inlcudes h
normal! h
normal! e
let ret = 1
else
call setpos('.', last_seen_pos)
endif
endfor
if !ret
return s:abort()
endif
call s:set_mark_tick()
call s:restore_view()
return 1
endfunction
function! julia_blocks#whereami()
let b:jlblk_count = v:count1
let save_redraw = &lazyredraw
setlocal lazyredraw
let pos = getpos('.')
let ret = julia_blocks#select_a('w')
if empty(ret)
call setpos('.', pos)
let &l:lazyredraw = save_redraw
return ""
end
let [start_pos, end_pos] = ret
let m = getline(start_pos[1])[start_pos[2]-1:]
" If cursor_moved was not forced from select_a, we force it now
" (TODO: this is *really* ugly)
if end_pos != pos
call s:cursor_moved(1)
endif
call setpos('.', pos)
call s:restore_view()
let &l:lazyredraw = save_redraw
return m
endfunction
" Block text objects
function! s:find_block(current_mode)
let flags = 'W'
if b:jlblk_did_select
call setpos('.', b:jlblk_last_start_pos)
if !s:cycle_until_end()
return s:abort()
endif
if !(a:current_mode[0] == 'a' && a:current_mode == b:jlblk_last_mode)
let flags .= 'c'
endif
elseif s:on_end()
let flags .= 'c'
" NOTE: using "normal! lb" fails at the end of the file (?!)
normal! l
normal! b
endif
let searchret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
if searchret <= 0
if !b:jlblk_did_select
return s:abort()
else
call setpos('.', b:jlblk_last_end_pos)
endif
endif
let end_pos = getpos('.')
" Jump to match
call s:matchit()
let start_pos = getpos('.')
let b:jlblk_last_start_pos = copy(start_pos)
let b:jlblk_last_end_pos = copy(end_pos)
return [start_pos, end_pos]
endfunction
function! s:repeated_find(ai_mode)
let repeat = b:jlblk_count + (a:ai_mode == 'i' && v:count1 > 1 ? 1 : 0)
for c in range(repeat)
let current_mode = (c < repeat - 1 ? 'a' : a:ai_mode)
let ret_find_block = s:find_block(current_mode)
if empty(ret_find_block)
return 0
endif
let [start_pos, end_pos] = ret_find_block
call setpos('.', end_pos)
let b:jlblk_last_mode = current_mode
if c < repeat - 1
let b:jlblk_doing_select = 0
let b:jlblk_did_select = 1
endif
endfor
return [start_pos, end_pos]
endfunction
function! julia_blocks#select_a(...)
let mode_flag = a:0 > 0 ? a:1 : ''
call s:get_save_pos(!b:jlblk_did_select)
let current_pos = getpos('.')
let ret_find_block = s:repeated_find('a' . mode_flag)
if empty(ret_find_block)
return 0
endif
let [start_pos, end_pos] = ret_find_block
call setpos('.', end_pos)
normal! e
let end_pos = getpos('.')
let b:jlblk_doing_select = 1
" CursorMove is only triggered if end_pos
" end_pos is different than the staring position;
" so when starting from the 'd' in 'end' we need to
" force it
if current_pos == end_pos
call s:cursor_moved(1)
endif
call s:set_mark_tick()
return [start_pos, end_pos]
endfunction
function! julia_blocks#select_i()
call s:get_save_pos(!b:jlblk_did_select)
let current_pos = getpos('.')
let ret_find_block = s:repeated_find('i')
if empty(ret_find_block)
return 0
endif
let [start_pos, end_pos] = ret_find_block
if end_pos[1] <= start_pos[1]+1
return s:abort()
endif
call setpos('.', end_pos)
let b:jlblk_doing_select = 1
let start_pos[1] += 1
call setpos('.', start_pos)
normal! ^
let start_pos = getpos('.')
let end_pos[1] -= 1
let end_pos[2] = len(getline(end_pos[1]))
" CursorMove is only triggered if end_pos
" end_pos is different than the staring position;
" so when starting from the 'd' in 'end' we need to
" force it
if current_pos == end_pos
call s:cursor_moved(1)
endif
call s:set_mark_tick()
return [start_pos, end_pos]
endfunction
function julia_blocks#select_reset()
let b:jlblk_did_select = 0
let b:jlblk_doing_select = 0
let b:jlblk_inwrapper = 0
let b:jlblk_last_mode = ""
endfunction
function! s:cursor_moved(...)
if b:jlblk_inwrapper && !(a:0 > 0 && a:1)
return
endif
let b:jlblk_did_select = b:jlblk_doing_select
let b:jlblk_doing_select = 0
endfunction
endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
crystal
a977489
Process
Web.JSON
ColorEcho
endif

View File

@@ -583,7 +583,7 @@ let g:xmldata_html5 = {
\ ],
\ 'img': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']})
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']})
\ ],
\ 'input': [
\ [],

10
build
View File

@@ -80,7 +80,7 @@ extract() {
}
copy_dir() {
for file in $(find "$1/$2" -name '*.vim'); do
for file in $(find "$1/$2" -name '*.vim' -o -name '*.vital'); do
file_path="$(dirname "${file##$1/}")"
mkdir -p "$file_path"
touch "$file_path/$(basename "$file")"
@@ -118,6 +118,7 @@ PACKS="
c++11:octol/vim-cpp-enhanced-highlight
c/c++:vim-jp/vim-cpp
caddyfile:isobit/vim-caddyfile
carp:hellerve/carp-vim
cjsx:mtscout6/vim-cjsx
clojure:guns/vim-clojure-static
cmake:pboettch/vim-cmake-syntax
@@ -151,9 +152,10 @@ PACKS="
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
json:elzr/vim-json
json5:GutenYe/json5.vim
jst:briancollins/vim-jst
jsx:mxw/vim-jsx:_ALL
julia:dcjones/julia-minimalist-vim
julia:JuliaEditorSupport/julia-vim
kotlin:udalov/kotlin-vim
latex:LaTeX-Box-Team/LaTeX-Box
less:groenewege/vim-less
@@ -179,8 +181,9 @@ PACKS="
pug:digitaltoad/vim-pug
puppet:voxpupuli/vim-puppet
purescript:purescript-contrib/purescript-vim
python:mitsuhiko/vim-python-combined
python:vim-python/python-syntax
python-compiler:aliev/vim-compiler-python
python-ident:Vimjas/vim-python-pep8-indent
qml:peterhoeg/vim-qml
r-lang:vim-scripts/R.vim
racket:wlangstroth/vim-racket
@@ -193,6 +196,7 @@ PACKS="
scala:derekwyatt/vim-scala
scss:cakebaker/scss-syntax.vim
slim:slim-template/vim-slim
slime:slime-lang/vim-slime-syntax
solidity:tomlion/vim-solidity
stylus:wavded/vim-stylus
swift:keith/swift.vim

View File

@@ -13,3 +13,5 @@ let g:filetype_euphoria = 'elixir'
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
augroup END
let g:python_highlight_all = 1

View File

@@ -13,6 +13,8 @@ let g:filetype_euphoria = 'elixir'
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
augroup END
let g:python_highlight_all = 1
augroup filetypedetect
" apiblueprint:sheerun/apiblueprint.vim
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
@@ -82,6 +84,11 @@ augroup filetypedetect
au BufNewFile,BufRead Caddyfile set ft=caddyfile
augroup END
augroup filetypedetect
" carp:hellerve/carp-vim
au BufRead,BufNewFile *.carp set filetype=carp
augroup END
augroup filetypedetect
" cjsx:mtscout6/vim-cjsx
augroup CJSX
@@ -237,7 +244,7 @@ augroup END
augroup filetypedetect
" erlang:vim-erlang/vim-erlang-runtime
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl set ft=erlang
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl,*.escript set ft=erlang
augroup END
augroup filetypedetect
@@ -395,7 +402,7 @@ augroup filetypedetect
" i3:PotatoesMaster/i3-vim-syntax
augroup i3_ftdetect
au!
au BufRead,BufNewFile *i3/config set ft=i3
au BufRead,BufNewFile *i3/config,*sway/config set ft=i3
augroup END
augroup END
@@ -439,6 +446,12 @@ augroup filetypedetect
autocmd BufNewFile,BufRead *.json setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
autocmd BufNewFile,BufRead *.template setlocal filetype=json
augroup END
augroup filetypedetect
" json5:GutenYe/json5.vim
au BufNewFile,BufRead *.json5 setfiletype json5
augroup END
augroup filetypedetect
@@ -492,13 +505,28 @@ autocmd BufNewFile,BufRead *.js
augroup END
augroup filetypedetect
" julia:dcjones/julia-minimalist-vim
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
" which doesn't define b:undo_ftplugin
" (*.jt files are recognized as lisp)
au BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
" julia:JuliaEditorSupport/julia-vim
if v:version < 704
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
" which didn't define b:undo_ftplugin on older Vim versions
" (*.jl files are recognized as lisp)
autocmd BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
endif
au BufRead,BufNewFile *.jl set filetype=julia
autocmd BufRead,BufNewFile *.jl set filetype=julia
autocmd FileType * call LaTeXtoUnicode#Refresh()
autocmd BufEnter * call LaTeXtoUnicode#Refresh()
" This autocommand is used to postpone the first initialization of LaTeXtoUnicode as much as possible,
" by calling LaTeXtoUnicode#SetTab amd LaTeXtoUnicode#SetAutoSub only at InsertEnter or later
function! s:L2UTrigger()
augroup L2UInit
autocmd!
autocmd InsertEnter * let g:did_insert_enter = 1 | call LaTeXtoUnicode#Init(0)
augroup END
endfunction
autocmd BufEnter * call s:L2UTrigger()
augroup END
augroup filetypedetect
@@ -754,7 +782,7 @@ au FileType purescript let &l:commentstring='{--%s--}'
augroup END
augroup filetypedetect
" python:mitsuhiko/vim-python-combined
" python:vim-python/python-syntax
augroup END
augroup filetypedetect
@@ -767,6 +795,10 @@ augroup filetypedetect
autocmd FileType python compiler python
augroup END
augroup filetypedetect
" python-ident:Vimjas/vim-python-pep8-indent
augroup END
augroup filetypedetect
" qml:peterhoeg/vim-qml
autocmd BufRead,BufNewFile *.qml setfiletype qml
@@ -948,6 +980,11 @@ augroup filetypedetect
autocmd BufNewFile,BufRead *.slim setfiletype slim
augroup END
augroup filetypedetect
" slime:slime-lang/vim-slime-syntax
autocmd BufNewFile,BufRead *.slime set filetype=slime
augroup END
augroup filetypedetect
" solidity:tomlion/vim-solidity
au BufNewFile,BufRead *.sol setf solidity

View File

@@ -4,6 +4,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
if exists('+regexpengine') && ('&regexpengine' == 0)
setlocal regexpengine=1
endif
set path+=./../templates,./../files
set path+=./../templates,./../files,templates,files
endif

View File

@@ -31,7 +31,7 @@ endif
" Use the 'man' wrapper function in fish to include fish's man pages.
" Have to use a script for this; 'fish -c man' would make the the man page an
" argument to fish instead of man.
execute 'setlocal keywordprg=fish\ '.expand('<sfile>:p:h:h').'/bin/man.fish'
execute 'setlocal keywordprg=fish\ '.fnameescape(expand('<sfile>:p:h:h').'/bin/man.fish')
let b:match_words =
\ escape('<%(begin|function|if|switch|while|for)>:<end>', '<>%|)')

99
ftplugin/julia.vim Normal file
View File

@@ -0,0 +1,99 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
" Vim filetype plugin file
" Language: Julia
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
" Last Change: 2014 may 29
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
setlocal include=^\\s*\\%(reload\\\|include\\)\\>
setlocal suffixesadd=.jl
setlocal comments=:#
setlocal commentstring=#=%s=#
setlocal cinoptions+=#1
setlocal define=^\\s*macro\\>
let b:julia_vim_loaded = 1
let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<"
\ . " define< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<"
\ . " | unlet! b:julia_vim_loaded"
" MatchIt plugin support
if exists("loaded_matchit")
let b:match_ignorecase = 0
" note: begin_keywords must contain all blocks in order
" for nested-structures-skipping to work properly
let b:julia_begin_keywords = '\%(\%(\.\s*\)\@<!\|\%(@\s*.\s*\)\@<=\)\<\%(\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>'
let s:macro_regex = '@\%(#\@!\S\)\+\s\+'
let s:nomacro = '\%(' . s:macro_regex . '\)\@<!'
let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+'
let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|'
\ . '\%(' . s:nomacro . b:julia_begin_keywords . '\)'
let b:julia_end_keywords = '\<end\>'
" note: this function relies heavily on the syntax file
function! JuliaGetMatchWords()
let [l,c] = [line('.'),col('.')]
let attr = synIDattr(synID(l, c, 1),"name")
let c1 = c
while attr == 'juliaMacro'
normal! W
if line('.') > l || col('.') == c1
call cursor(l, c)
return ''
endif
let attr = synIDattr(synID(l, col('.'), 1),"name")
let c1 = col('.')
endwhile
call cursor(l, c)
if attr == 'juliaConditional'
return b:julia_begin_keywordsm . ':\<\%(elseif\|else\)\>:' . b:julia_end_keywords
elseif attr =~ '\<\%(juliaRepeat\|juliaRepKeyword\)\>'
return b:julia_begin_keywordsm . ':\<\%(break\|continue\)\>:' . b:julia_end_keywords
elseif attr == 'juliaBlKeyword'
return b:julia_begin_keywordsm . ':' . b:julia_end_keywords
elseif attr == 'juliaException'
return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords
endif
return '\<\>:\<\>'
endfunction
let b:match_words = 'JuliaGetMatchWords()'
" we need to skip everything within comments, strings and
" the 'end' keyword when it is used as a range rather than as
" the end of a block
let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~ '
\ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeEnd\\|SymbolS\\?\\|Comment[LM]\\|\\%([bv]\\|ip\\|MIME\\|Shell\\|Doc\\)\\?String\\|RegEx\\)\\>"'
let b:undo_ftplugin = b:undo_ftplugin
\ . " | unlet! b:match_words b:match_skip b:match_ignorecase"
\ . " | unlet! b:julia_begin_keywords b:julia_end_keywords"
\ . " | delfunction JuliaGetMatchWords"
\ . " | call julia_blocks#remove_mappings()"
if get(g:, "julia_blocks", 1)
call julia_blocks#init_mappings()
let b:undo_ftplugin .= " | call julia_blocks#remove_mappings()"
endif
endif
if has("gui_win32")
let b:browsefilter = "Julia Source Files (*.jl)\t*.jl\n"
let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter"
endif
let &cpo = s:save_cpo
unlet s:save_cpo
endif

View File

@@ -13,6 +13,13 @@ runtime! ftplugin/html.vim
setlocal suffixesadd+=.vue
if !exists('g:no_plugin_maps') && !exists('g:no_vue_maps')
nnoremap <silent> <buffer> [[ :call search('^<\(template\<Bar>script\<Bar>style\)', 'bW')<CR>
nnoremap <silent> <buffer> ]] :call search('^<\(template\<Bar>script\<Bar>style\)', 'W')<CR>
nnoremap <silent> <buffer> [] :call search('^</\(template\<Bar>script\<Bar>style\)', 'bW')<CR>
nnoremap <silent> <buffer> ][ :call search('^</\(template\<Bar>script\<Bar>style\)', 'W')<CR>
endif
if exists('g:loaded_ale')
let g:ale_linters = get(g:, 'ale_linters', {})
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])

433
indent/cython.vim Normal file
View File

@@ -0,0 +1,433 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-ident') == -1
" PEP8 compatible Python indent file
" Language: Python
" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
" License: CC0
"
" vim-python-pep8-indent - A nicer Python indentation style for vim.
" Written in 2004 by David Bustos <bustos@caltech.edu>
" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
"
" To the extent possible under law, the author(s) have dedicated all copyright
" and related and neighboring rights to this software to the public domain
" worldwide. This software is distributed without any warranty.
" You should have received a copy of the CC0 Public Domain Dedication along
" with this software. If not, see
" <http://creativecommons.org/publicdomain/zero/1.0/>.
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal autoindent
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
if !exists('g:python_pep8_indent_multiline_string')
let g:python_pep8_indent_multiline_string = 0
endif
let s:block_rules = {
\ '^\s*elif\>': ['if', 'elif'],
\ '^\s*except\>': ['try', 'except'],
\ '^\s*finally\>': ['try', 'except', 'else']
\ }
let s:block_rules_multiple = {
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
\ }
" Pairs to look for when searching for opening parenthesis.
" The value is the maximum offset in lines.
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
else
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
endif
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" Skip strings and comments. Return 1 for chars to skip.
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
" are inserted temporarily into the buffer.
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vstring|comment|jedi\\S"'
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vcomment|jedi\\S"'
" Also ignore anything concealed.
" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
function! s:is_concealed(line, col)
let concealed = synconcealed(a:line, a:col)
return len(concealed) && concealed[0]
endfunction
if has('conceal')
let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
endif
let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "comment"'
" Use 'shiftwidth()' instead of '&sw'.
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
if exists('*shiftwidth')
function! s:sw()
return shiftwidth()
endfunction
else
function! s:sw()
return &shiftwidth
endfunction
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.
function! s:find_opening_paren(...)
" optional arguments: line and column (defaults to 1) to search around
if a:0 > 0
let view = winsaveview()
call cursor(a:1, a:0 > 1 ? a:2 : 1)
let ret = s:find_opening_paren()
call winrestview(view)
return ret
endif
" Return if cursor is in a comment.
exe 'if' s:skip_search '| return [0, 0] | endif'
let nearest = [0, 0]
for [p, maxoff] in items(s:paren_pairs)
let stopline = max([0, line('.') - maxoff, nearest[0]])
let next = searchpairpos(
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
let nearest = next
endif
endfor
return nearest
endfunction
" Find the start of a multi-line statement
function! s:find_start_of_multiline_statement(lnum)
let lnum = a:lnum
while lnum > 0
if getline(lnum - 1) =~# '\\$'
let lnum = prevnonblank(lnum - 1)
else
let [paren_lnum, _] = s:find_opening_paren(lnum)
if paren_lnum < 1
return lnum
else
let lnum = paren_lnum
endif
endif
endwhile
endfunction
" Find possible indent(s) of the block starter that matches the current line.
function! s:find_start_of_block(lnum, types, multiple)
let r = []
let types = copy(a:types)
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
let lnum = a:lnum
let last_indent = indent(lnum) + 1
while lnum > 0 && last_indent > 0
let indent = indent(lnum)
if indent < last_indent
for type in types
let re = '\v^\s*'.type.'>'
if getline(lnum) =~# re
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
endfor
let last_indent = indent(lnum)
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return r
endfunction
" Is "expr" true for every position in "lnum", beginning at "start"?
" (optionally up to a:1 / 4th argument)
function! s:match_expr_on_line(expr, lnum, start, ...)
let text = getline(a:lnum)
let end = a:0 ? a:1 : len(text)
if a:start > end
return 1
endif
let save_pos = getpos('.')
let r = 1
for i in range(a:start, end)
call cursor(a:lnum, i)
if !(eval(a:expr) || text[i-1] =~# '\s')
let r = 0
break
endif
endfor
call setpos('.', save_pos)
return r
endfunction
" Line up with open parenthesis/bracket/brace.
function! s:indent_like_opening_paren(lnum)
let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum)
if paren_lnum <= 0
return -2
endif
let text = getline(paren_lnum)
let base = indent(paren_lnum)
let nothing_after_opening_paren = s:match_expr_on_line(
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
if nothing_after_opening_paren
if starts_with_closing_paren
let res = base
else
let res = base + s:sw()
endif
else
" Indent to match position of opening paren.
let res = paren_col
endif
" If this line is the continuation of a control statement
" indent further to distinguish the continuation line
" from the next logical line.
if text =~# b:control_statement && res == base + s:sw()
return base + s:sw() * 2
else
return res
endif
endfunction
" Match indent of first block of this type.
function! s:indent_like_block(lnum)
let text = getline(a:lnum)
for [multiple, block_rules] in [
\ [0, s:block_rules],
\ [1, s:block_rules_multiple]]
for [line_re, blocks] in items(block_rules)
if text !~# line_re
continue
endif
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
if !len(indents)
return -1
endif
if len(indents) == 1
return indents[0]
endif
" Multiple valid indents, e.g. for 'else' with both try and if.
let indent = indent(a:lnum)
if index(indents, indent) != -1
" The indent is valid, keep it.
return indent
endif
" Fallback to the first/nearest one.
return indents[0]
endfor
endfor
return -2
endfunction
function! s:indent_like_previous_line(lnum)
let lnum = prevnonblank(a:lnum - 1)
" No previous line, keep current indent.
if lnum < 1
return -1
endif
let text = getline(lnum)
let start = s:find_start_of_multiline_statement(lnum)
let base = indent(start)
let current = indent(a:lnum)
" Jump to last character in previous line.
call cursor(lnum, len(text))
let ignore_last_char = eval(s:skip_special_chars)
" Search for final colon that is not inside something to be ignored.
while 1
let curpos = getpos('.')[2]
if curpos == 1 | break | endif
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
normal! h
continue
elseif text[curpos-1] ==# ':'
return base + s:sw()
endif
break
endwhile
if text =~# '\\$' && !ignore_last_char
" If this line is the continuation of a control statement
" indent further to distinguish the continuation line
" from the next logical line.
if getline(start) =~# b:control_statement
return base + s:sw() * 2
endif
" Nest (other) explicit continuations only one level deeper.
return base + s:sw()
endif
let empty = getline(a:lnum) =~# '^\s*$'
" Current and prev line are empty, next is not -> indent like next.
if empty && a:lnum > 1 &&
\ (getline(a:lnum - 1) =~# '^\s*$') &&
\ !(getline(a:lnum + 1) =~# '^\s*$')
return indent(a:lnum + 1)
endif
" If the previous statement was a stop-execution statement or a pass
if getline(start) =~# s:stop_statement
" Remove one level of indentation if the user hasn't already dedented
if empty || current > base - s:sw()
return base - s:sw()
endif
" Otherwise, trust the user
return -1
endif
if !empty && s:is_dedented_already(current, base)
return -1
endif
" In all other cases, line up with the start of the previous statement.
return base
endfunction
" If this line is dedented and the number of indent spaces is valid
" (multiple of the indentation size), trust the user.
function! s:is_dedented_already(current, base)
let dedent_size = a:current - a:base
return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
endfunction
" Is the syntax at lnum (and optionally cnum) a python string?
function! s:is_python_string(lnum, ...)
let line = getline(a:lnum)
let linelen = len(line)
if linelen < 1
let linelen = 1
endif
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
for cnum in cols
if match(map(synstack(a:lnum, cnum),
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
return 0
end
endfor
return 1
endfunction
function! GetPythonPEPIndent(lnum)
" First line has indent 0
if a:lnum == 1
return 0
endif
let line = getline(a:lnum)
let prevline = getline(a:lnum-1)
" Multilinestrings: continous, docstring or starting.
if s:is_python_string(a:lnum-1, len(prevline))
\ && (s:is_python_string(a:lnum, 1)
\ || match(line, '^\%("""\|''''''\)') != -1)
" Indent closing quotes as the line with the opening ones.
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
if match_quotes != -1
" closing multiline string
let quotes = line[match_quotes:(match_quotes+2)]
let pairpos = searchpairpos(quotes, '', quotes, 'b')
if pairpos[0] != 0
return indent(pairpos[0])
else
" TODO: test to cover this!
endif
endif
if s:is_python_string(a:lnum-1)
" Previous line is (completely) a string.
return indent(a:lnum-1)
endif
if match(prevline, '^\s*\%("""\|''''''\)') != -1
" docstring.
return indent(a:lnum-1)
endif
let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
\ get(g:, 'python_pep8_indent_multiline_string', 0))
if match(prevline, '\v%("""|'''''')$') != -1
" Opening multiline string, started in previous line.
if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
\ || match(line, '\v^\s+$') != -1
" <CR> with empty line or to split up 'foo("""bar' into
" 'foo("""' and 'bar'.
if indent_multi == -2
return indent(a:lnum-1) + s:sw()
endif
return indent_multi
endif
endif
" Keep existing indent.
if match(line, '\v^\s*\S') != -1
return -1
endif
if indent_multi != -2
return indent_multi
endif
return s:indent_like_opening_paren(a:lnum)
endif
" Parens: If we can find an open parenthesis/bracket/brace, line up with it.
let indent = s:indent_like_opening_paren(a:lnum)
if indent >= -1
return indent
endif
" Blocks: Match indent of first block of this type.
let indent = s:indent_like_block(a:lnum)
if indent >= -1
return indent
endif
return s:indent_like_previous_line(a:lnum)
endfunction
endif

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
" Language: Javascript
" Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript
" Last Change: September 18, 2017
" Last Change: December 4, 2017
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -121,11 +121,14 @@ function s:SkipFunc()
if eval(s:skip_expr)
return 1
endif
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) && eval(s:skip_expr)
let s:check_in = 1
return 1
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
if eval(s:skip_expr)
let s:check_in = 1
return 1
endif
else
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
endif
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
let [s:looksyn, s:top_col] = getpos('.')[1:2]
endfunction
@@ -242,18 +245,18 @@ function s:Continues()
endfunction
" Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum)
let [l:open, l:line] = [0, getline(a:lnum)]
let pos = match(l:line, '[][(){}]')
function s:Balanced(lnum,line)
let l:open = 0
let pos = match(a:line, '[][(){}]')
while pos != -1
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
let l:open += match(' ' . l:line[pos],'[[({]')
let l:open += match(' ' . a:line[pos],'[[({]')
if l:open < 0
return
endif
endif
let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ?
\ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1)
let pos = match(a:line, !l:open ? '[][(){}]' : '()' =~ a:line[pos] ?
\ '[()]' : '{}' =~ a:line[pos] ? '[{}]' : '[][]', pos + 1)
endwhile
return !l:open
endfunction
@@ -266,8 +269,13 @@ function s:OneScope()
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
elseif s:Token() =~# '^else$\|^do$'
return s:Pure('s:PreviousToken') != '.'
elseif strpart(getline('.'),col('.')-2,2) == '=>'
call cursor(0,col('.')-1)
if s:PreviousToken() == ')'
return s:GetPair('(', ')', 'bW', s:skip_expr)
endif
return 1
endif
return strpart(getline('.'),col('.')-2,2) == '=>'
endfunction
function s:DoWhile()
@@ -352,13 +360,11 @@ function GetJavascriptIndent()
" start with strings,comments,etc.
if s:stack[-1] =~? 'comment\|doc'
if l:line =~ '^\s*\*'
return cindent(v:lnum)
elseif l:line !~ '^\s*\/[/*]'
return -1
if l:line !~ '^\s*\/[/*]'
return l:line =~ '^\s*\*' ? cindent(v:lnum) : -1
endif
elseif s:stack[-1] =~? b:syng_str
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1,getline(v:lnum-1))
let b:js_cache[0] = v:lnum
endif
return -1
@@ -385,7 +391,7 @@ function GetJavascriptIndent()
call cursor(v:lnum,1)
let idx = index([']',')','}'],l:line[0])
if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum)
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum,pline)
call call('cursor',b:js_cache[1:])
else
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,

View File

@@ -3,13 +3,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
" Vim indent file
" Language: Julia
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
" Last Change: 2011 dec 11
" Notes: based on Bram Moneaar's indent file for vim
" Last Change: 2016 jun 16
" Notes: originally based on Bram Molenaar's indent file for vim
setlocal autoindent
setlocal indentexpr=GetJuliaIndent()
setlocal indentkeys+==end,=else,=catch,=finally
setlocal indentkeys+==end,=else,=catch,=finally,),],}
setlocal indentkeys-=0#
setlocal indentkeys-=:
setlocal indentkeys-=0{
@@ -21,12 +21,16 @@ if exists("*GetJuliaIndent")
finish
endif
let s:skipPatterns = '\<julia\%(Comment\)\>'
let s:skipPatterns = '\<julia\%(Comprehension\%(For\|If\)\|RangeEnd\|CommentL\|\%([bsv]\|ip\|big\|MIME\|Shell\|Printf\|Doc\)\=String\|RegEx\|SymbolS\?\)\>'
function JuliaMatch(lnum, str, regex, st)
function JuliaMatch(lnum, str, regex, st, ...)
let s = a:st
let e = a:0 > 0 ? a:1 : -1
while 1
let f = match(a:str, a:regex, s)
if e >= 0 && f >= e
return -1
endif
if f >= 0
let attr = synIDattr(synID(a:lnum,f+1,1),"name")
if attr =~ s:skipPatterns
@@ -39,15 +43,16 @@ function JuliaMatch(lnum, str, regex, st)
return f
endfunction
function GetJuliaNestingStruct(lnum)
function GetJuliaNestingStruct(lnum, ...)
" Auxiliary function to inspect the block structure of a line
let line = getline(a:lnum)
let s = 0
let s = a:0 > 0 ? a:1 : 0
let e = a:0 > 1 ? a:2 : -1
let blocks_stack = []
let num_closed_blocks = 0
while 1
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\=\|while\|for\|try\|catch\|finally\|function\|macro\|begin\|type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s)
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s)
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 fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e)
if fb < 0 && fe < 0
" No blocks found
@@ -128,9 +133,13 @@ function GetJuliaNestingStruct(lnum)
continue
endif
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|function\|macro\|begin\|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\)\>', s)
if i >= 0 && i == fb
let s = i+1
if match(line, '\<\%(mutable\|abstract\|primitive\)', i) != -1
let s = i+11
else
let s = i+1
endif
call add(blocks_stack, 'other')
continue
endif
@@ -158,6 +167,128 @@ function GetJuliaNestingStruct(lnum)
return [num_open_blocks, num_closed_blocks]
endfunction
function GetJuliaNestingBrackets(lnum, c)
" Auxiliary function to inspect the brackets structure of a line
let line = getline(a:lnum)[0 : (a:c - 1)]
let s = 0
let brackets_stack = []
let last_closed_bracket = -1
while 1
let fb = JuliaMatch(a:lnum, line, '[([{]', s)
let fe = JuliaMatch(a:lnum, line, '[])}]', s)
if fb < 0 && fe < 0
" No brackets found
break
end
if fb >= 0 && (fb < fe || fe < 0)
" The first occurrence is an opening bracket
let i = JuliaMatch(a:lnum, line, '(', s)
if i >= 0 && i == fb
let s = i+1
call add(brackets_stack, ['par',i])
continue
endif
let i = JuliaMatch(a:lnum, line, '\[', s)
if i >= 0 && i == fb
let s = i+1
call add(brackets_stack, ['sqbra',i])
continue
endif
let i = JuliaMatch(a:lnum, line, '{', s)
if i >= 0 && i == fb
let s = i+1
call add(brackets_stack, ['curbra',i])
continue
endif
" Note: it should be impossible to get here
break
else
" The first occurrence is a closing bracket
let i = JuliaMatch(a:lnum, line, ')', s)
if i >= 0 && i == fe
let s = i+1
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'par'
call remove(brackets_stack, -1)
else
let last_closed_bracket = i + 1
endif
continue
endif
let i = JuliaMatch(a:lnum, line, ']', s)
if i >= 0 && i == fe
let s = i+1
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'sqbra'
call remove(brackets_stack, -1)
else
let last_closed_bracket = i + 1
endif
continue
endif
let i = JuliaMatch(a:lnum, line, '}', s)
if i >= 0 && i == fe
let s = i+1
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'curbra'
call remove(brackets_stack, -1)
else
let last_closed_bracket = i + 1
endif
continue
endif
" Note: it should be impossible to get here
break
endif
" Note: it should be impossible to get here
break
endwhile
let first_open_bracket = -1
let last_open_bracket = -1
if len(brackets_stack) > 0
let first_open_bracket = brackets_stack[0][1]
let last_open_bracket = brackets_stack[-1][1]
endif
return [first_open_bracket, last_open_bracket, last_closed_bracket]
endfunction
let s:bracketBlocks = '\<julia\%(\%(\%(Printf\)\?Par\|SqBra\|CurBra\)Block\|ParBlockInRange\|StringVars\%(Par\|SqBra\|CurBra\)\|Dollar\%(Par\|SqBra\)\|QuotedParBlockS\?\)\>'
function IsInBrackets(lnum, c)
let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
call filter(stack, 'v:val =~# s:bracketBlocks')
return len(stack) > 0
endfunction
" Auxiliary function to find a line which does not start in the middle of a
" multiline bracketed expression, to be used as reference for block
" indentation.
function LastBlockIndent(lnum)
let lnum = a:lnum
let ind = 0
while lnum > 0
let ind = indent(lnum)
if ind == 0
return [lnum, 0]
endif
if !IsInBrackets(lnum, 1)
break
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return [max([lnum,1]), ind]
endfunction
function GetJuliaIndent()
let s:save_ignorecase = &ignorecase
set noignorecase
@@ -172,19 +303,81 @@ function GetJuliaIndent()
return 0
endif
let ind = indent(lnum)
let ind = -1
let st = -1
let lim = -1
" Analyse previous line
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum)
" Multiline bracketed expressions take precedence
let c = len(getline(lnum)) + 1
while IsInBrackets(lnum, c)
let [first_open_bracket, last_open_bracket, last_closed_bracket] = GetJuliaNestingBrackets(lnum, c)
" First scenario: the previous line has a hanging open bracket:
" set the indentation to match the opening bracket (plus an extra space)
if last_open_bracket != -1
let st = last_open_bracket
let ind = virtcol([lnum, st + 1])
" Second scenario: some multiline bracketed expression was closed in the
" previous line. But since we know we are still in a bracketed expression,
" we need to find the line where the bracket was open
elseif last_closed_bracket != -1 " && exists("loaded_matchit")
" we use the % command to skip back (this is buggy without matchit, and
" is potentially a disaster if % got remapped)
call cursor(lnum, last_closed_bracket)
normal %
if line(".") == lnum
" something wrong here, give up
let ind = indent(lnum)
else
let lnum = line(".")
let c = col(".") - 1
if c == 0
" uhm, give up
let ind = 0
else
" we skipped a bracket set, keep searching for an opening bracket
let lim = c
continue
endif
endif
" Third scenario: nothing special, or matchit not available: keep the indentation
else
let ind = indent(lnum)
endif
" In case the current line starts with a closing bracket, we align it with
" the opening one.
if JuliaMatch(v:lnum, getline(v:lnum), '[])}]', indent(v:lnum)) == indent(v:lnum) && ind > 0
return ind - 1
endif
break
endwhile
if ind == -1
" We are not in a multiline bracketed expression. Thus we look for a
" previous line to use as a reference
let [lnum,ind] = LastBlockIndent(lnum)
let c = len(getline(lnum)) + 1
if IsInBrackets(lnum, c)
let [first_open_bracket, last_open_bracket, last_closed_bracket] = GetJuliaNestingBrackets(lnum, c)
let lim = first_open_bracket
endif
end
" Analyse the reference line
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim)
" Increase indentation for each newly opened block
" in the previous line
" in the reference line
while num_open_blocks > 0
let ind += &sw
let num_open_blocks -= 1
endwhile
" Analyse current line
" Analyse the current line
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
" Decrease indentation for each closed block

View File

@@ -1,217 +1,433 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-ident') == -1
" PEP8 compatible Python indent file
" Language: Python
" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
" License: CC0
"
" vim-python-pep8-indent - A nicer Python indentation style for vim.
" Written in 2004 by David Bustos <bustos@caltech.edu>
" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
"
" To the extent possible under law, the author(s) have dedicated all copyright
" and related and neighboring rights to this software to the public domain
" worldwide. This software is distributed without any warranty.
" You should have received a copy of the CC0 Public Domain Dedication along
" with this software. If not, see
" <http://creativecommons.org/publicdomain/zero/1.0/>.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
setlocal expandtab
setlocal nolisp
setlocal autoindent
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
let s:maxoff = 50
if !exists('g:python_pep8_indent_multiline_string')
let g:python_pep8_indent_multiline_string = 0
endif
let s:block_rules = {
\ '^\s*elif\>': ['if', 'elif'],
\ '^\s*except\>': ['try', 'except'],
\ '^\s*finally\>': ['try', 'except', 'else']
\ }
let s:block_rules_multiple = {
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
\ }
" Pairs to look for when searching for opening parenthesis.
" The value is the maximum offset in lines.
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
else
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
endif
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" Skip strings and comments. Return 1 for chars to skip.
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
" are inserted temporarily into the buffer.
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vstring|comment|jedi\\S"'
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "\\vcomment|jedi\\S"'
" Also ignore anything concealed.
" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
function! s:is_concealed(line, col)
let concealed = synconcealed(a:line, a:col)
return len(concealed) && concealed[0]
endfunction
if has('conceal')
let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
endif
let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
\ '=~? "comment"'
" Use 'shiftwidth()' instead of '&sw'.
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
if exists('*shiftwidth')
function! s:sw()
return shiftwidth()
endfunction
else
function! s:sw()
return &shiftwidth
endfunction
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.
function! s:SearchParensPair()
let line = line('.')
let col = col('.')
function! s:find_opening_paren(...)
" optional arguments: line and column (defaults to 1) to search around
if a:0 > 0
let view = winsaveview()
call cursor(a:1, a:0 > 1 ? a:2 : 1)
let ret = s:find_opening_paren()
call winrestview(view)
return ret
endif
" Skip strings and comments and don't look too far
let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
\ '"string\\|comment"'
" Return if cursor is in a comment.
exe 'if' s:skip_search '| return [0, 0] | endif'
" Search for parentheses
call cursor(line, col)
let parlnum = searchpair('(', '', ')', 'bW', skip)
let parcol = col('.')
" Search for brackets
call cursor(line, col)
let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
let par2col = col('.')
" Search for braces
call cursor(line, col)
let par3lnum = searchpair('{', '', '}', 'bW', skip)
let par3col = col('.')
" Get the closest match
if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
let parlnum = par2lnum
let parcol = par2col
endif
if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
let parlnum = par3lnum
let parcol = par3col
endif
" Put the cursor on the match
if parlnum > 0
call cursor(parlnum, parcol)
endif
return parlnum
let nearest = [0, 0]
for [p, maxoff] in items(s:paren_pairs)
let stopline = max([0, line('.') - maxoff, nearest[0]])
let next = searchpairpos(
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
let nearest = next
endif
endfor
return nearest
endfunction
" Find the start of a multi-line statement
function! s:StatementStart(lnum)
let lnum = a:lnum
while 1
if getline(lnum - 1) =~ '\\$'
let lnum = lnum - 1
else
call cursor(lnum, 1)
let maybe_lnum = s:SearchParensPair()
if maybe_lnum < 1
return lnum
else
let lnum = maybe_lnum
endif
endif
endwhile
function! s:find_start_of_multiline_statement(lnum)
let lnum = a:lnum
while lnum > 0
if getline(lnum - 1) =~# '\\$'
let lnum = prevnonblank(lnum - 1)
else
let [paren_lnum, _] = s:find_opening_paren(lnum)
if paren_lnum < 1
return lnum
else
let lnum = paren_lnum
endif
endif
endwhile
endfunction
" Find the block starter that matches the current line
function! s:BlockStarter(lnum, block_start_re)
let lnum = a:lnum
let maxindent = 10000 " whatever
while lnum > 1
let lnum = prevnonblank(lnum - 1)
if indent(lnum) < maxindent
if getline(lnum) =~ a:block_start_re
return lnum
else
let maxindent = indent(lnum)
" It's not worth going further if we reached the top level
if maxindent == 0
return -1
" Find possible indent(s) of the block starter that matches the current line.
function! s:find_start_of_block(lnum, types, multiple)
let r = []
let types = copy(a:types)
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
let lnum = a:lnum
let last_indent = indent(lnum) + 1
while lnum > 0 && last_indent > 0
let indent = indent(lnum)
if indent < last_indent
for type in types
let re = '\v^\s*'.type.'>'
if getline(lnum) =~# re
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
endfor
let last_indent = indent(lnum)
endif
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return r
endfunction
" Is "expr" true for every position in "lnum", beginning at "start"?
" (optionally up to a:1 / 4th argument)
function! s:match_expr_on_line(expr, lnum, start, ...)
let text = getline(a:lnum)
let end = a:0 ? a:1 : len(text)
if a:start > end
return 1
endif
endwhile
return -1
let save_pos = getpos('.')
let r = 1
for i in range(a:start, end)
call cursor(a:lnum, i)
if !(eval(a:expr) || text[i-1] =~# '\s')
let r = 0
break
endif
endfor
call setpos('.', save_pos)
return r
endfunction
" Line up with open parenthesis/bracket/brace.
function! s:indent_like_opening_paren(lnum)
let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum)
if paren_lnum <= 0
return -2
endif
let text = getline(paren_lnum)
let base = indent(paren_lnum)
let nothing_after_opening_paren = s:match_expr_on_line(
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
if nothing_after_opening_paren
if starts_with_closing_paren
let res = base
else
let res = base + s:sw()
endif
else
" Indent to match position of opening paren.
let res = paren_col
endif
" If this line is the continuation of a control statement
" indent further to distinguish the continuation line
" from the next logical line.
if text =~# b:control_statement && res == base + s:sw()
return base + s:sw() * 2
else
return res
endif
endfunction
" Match indent of first block of this type.
function! s:indent_like_block(lnum)
let text = getline(a:lnum)
for [multiple, block_rules] in [
\ [0, s:block_rules],
\ [1, s:block_rules_multiple]]
for [line_re, blocks] in items(block_rules)
if text !~# line_re
continue
endif
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
if !len(indents)
return -1
endif
if len(indents) == 1
return indents[0]
endif
" Multiple valid indents, e.g. for 'else' with both try and if.
let indent = indent(a:lnum)
if index(indents, indent) != -1
" The indent is valid, keep it.
return indent
endif
" Fallback to the first/nearest one.
return indents[0]
endfor
endfor
return -2
endfunction
function! s:indent_like_previous_line(lnum)
let lnum = prevnonblank(a:lnum - 1)
" No previous line, keep current indent.
if lnum < 1
return -1
endif
let text = getline(lnum)
let start = s:find_start_of_multiline_statement(lnum)
let base = indent(start)
let current = indent(a:lnum)
" Jump to last character in previous line.
call cursor(lnum, len(text))
let ignore_last_char = eval(s:skip_special_chars)
" Search for final colon that is not inside something to be ignored.
while 1
let curpos = getpos('.')[2]
if curpos == 1 | break | endif
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
normal! h
continue
elseif text[curpos-1] ==# ':'
return base + s:sw()
endif
break
endwhile
if text =~# '\\$' && !ignore_last_char
" If this line is the continuation of a control statement
" indent further to distinguish the continuation line
" from the next logical line.
if getline(start) =~# b:control_statement
return base + s:sw() * 2
endif
" Nest (other) explicit continuations only one level deeper.
return base + s:sw()
endif
let empty = getline(a:lnum) =~# '^\s*$'
" Current and prev line are empty, next is not -> indent like next.
if empty && a:lnum > 1 &&
\ (getline(a:lnum - 1) =~# '^\s*$') &&
\ !(getline(a:lnum + 1) =~# '^\s*$')
return indent(a:lnum + 1)
endif
" If the previous statement was a stop-execution statement or a pass
if getline(start) =~# s:stop_statement
" Remove one level of indentation if the user hasn't already dedented
if empty || current > base - s:sw()
return base - s:sw()
endif
" Otherwise, trust the user
return -1
endif
if !empty && s:is_dedented_already(current, base)
return -1
endif
" In all other cases, line up with the start of the previous statement.
return base
endfunction
" If this line is dedented and the number of indent spaces is valid
" (multiple of the indentation size), trust the user.
function! s:is_dedented_already(current, base)
let dedent_size = a:current - a:base
return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
endfunction
" Is the syntax at lnum (and optionally cnum) a python string?
function! s:is_python_string(lnum, ...)
let line = getline(a:lnum)
let linelen = len(line)
if linelen < 1
let linelen = 1
endif
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
for cnum in cols
if match(map(synstack(a:lnum, cnum),
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
return 0
end
endfor
return 1
endfunction
function! GetPythonPEPIndent(lnum)
let scol = col('.')
" First line has indent 0
if a:lnum == 1
return 0
endif
" If we can find an open parenthesis/bracket/brace, line up with it.
call cursor(a:lnum, 1)
let parlnum = s:SearchParensPair()
if parlnum > 0
let parcol = col('.')
let matches = matchlist(getline(a:lnum), '^\(\s*\)[])}]')
if len(matches) == 0
let closing_paren = 0
let closing_paren_pos = 0
else
let closing_paren = 1
let closing_paren_pos = len(matches[1])
" First line has indent 0
if a:lnum == 1
return 0
endif
if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
if closing_paren
return indent(parlnum)
else
return indent(parlnum) + &shiftwidth
endif
elseif a:lnum - 1 != parlnum
if closing_paren && closing_paren_pos > scol
return indent(parlnum)
else
let lastindent = match(getline(a:lnum - 1), '\S')
if lastindent != -1 && lastindent < parcol
return lastindent
let line = getline(a:lnum)
let prevline = getline(a:lnum-1)
" Multilinestrings: continous, docstring or starting.
if s:is_python_string(a:lnum-1, len(prevline))
\ && (s:is_python_string(a:lnum, 1)
\ || match(line, '^\%("""\|''''''\)') != -1)
" Indent closing quotes as the line with the opening ones.
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
if match_quotes != -1
" closing multiline string
let quotes = line[match_quotes:(match_quotes+2)]
let pairpos = searchpairpos(quotes, '', quotes, 'b')
if pairpos[0] != 0
return indent(pairpos[0])
else
" TODO: test to cover this!
endif
endif
endif
if s:is_python_string(a:lnum-1)
" Previous line is (completely) a string.
return indent(a:lnum-1)
endif
if match(prevline, '^\s*\%("""\|''''''\)') != -1
" docstring.
return indent(a:lnum-1)
endif
let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
\ get(g:, 'python_pep8_indent_multiline_string', 0))
if match(prevline, '\v%("""|'''''')$') != -1
" Opening multiline string, started in previous line.
if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
\ || match(line, '\v^\s+$') != -1
" <CR> with empty line or to split up 'foo("""bar' into
" 'foo("""' and 'bar'.
if indent_multi == -2
return indent(a:lnum-1) + s:sw()
endif
return indent_multi
endif
endif
" Keep existing indent.
if match(line, '\v^\s*\S') != -1
return -1
endif
if indent_multi != -2
return indent_multi
endif
return s:indent_like_opening_paren(a:lnum)
endif
" If we line up with an opening column there is a special case
" we want to handle: a docstring as argument. In that case we
" don't want to line up with the paren but with the statement
" imagine foo(doc=""" as example
echo getline(parlnum)
if match(getline(parlnum), '\("""\|' . "'''" . '\)\s*$') != -1
return indent(parlnum)
" Parens: If we can find an open parenthesis/bracket/brace, line up with it.
let indent = s:indent_like_opening_paren(a:lnum)
if indent >= -1
return indent
endif
return parcol
endif
" Examine this line
let thisline = getline(a:lnum)
let thisindent = indent(a:lnum)
" If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
if thisline =~ '^\s*\(elif\|else\)\>'
let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
if bslnum > 0
return indent(bslnum)
else
return -1
" Blocks: Match indent of first block of this type.
let indent = s:indent_like_block(a:lnum)
if indent >= -1
return indent
endif
endif
" If the line starts with 'except' or 'finally', line up with 'try'
" or 'except'
if thisline =~ '^\s*\(except\|finally\)\>'
let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
if bslnum > 0
return indent(bslnum)
else
return -1
endif
endif
" Examine previous line
let plnum = a:lnum - 1
let pline = getline(plnum)
let sslnum = s:StatementStart(plnum)
" If the previous line is blank, keep the same indentation
if pline =~ '^\s*$'
return -1
endif
" If this line is explicitly joined, try to find an indentation that looks
" good.
if pline =~ '\\$'
let compound_statement = '^\s*\(if\|while\|from\|import\|for\s.*\sin\|except\)\s*'
let maybe_indent = matchend(getline(sslnum), compound_statement)
if maybe_indent != -1
return maybe_indent
else
return indent(sslnum) + &sw * 2
endif
endif
" If the previous line ended with a colon and is not a comment, indent
" relative to statement start.
if pline =~ '^[^#]*:\s*\(#.*\)\?$'
return indent(sslnum) + &sw
endif
" If the previous line was a stop-execution statement or a pass
if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
" See if the user has already dedented
if indent(a:lnum) > indent(sslnum) - &sw
" If not, recommend one dedent
return indent(sslnum) - &sw
endif
" Otherwise, trust the user
return -1
endif
" In all other cases, line up with the start of the previous statement.
return indent(sslnum)
return s:indent_like_previous_line(a:lnum)
endfunction
endif

79
indent/slime.vim Normal file
View File

@@ -0,0 +1,79 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slime') == -1
" Vim indent file
" Language: Slime
if exists("b:did_indent")
finish
endif
runtime! indent/ruby.vim
unlet! b:did_indent
let b:did_indent = 1
setlocal autoindent sw=2 et
setlocal indentexpr=GetSlimeIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
" Only define the function once.
if exists("*GetSlimeIndent")
finish
endif
let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
if !exists('g:haml_self_closing_tags')
let g:haml_self_closing_tags = 'meta|link|img|hr|br'
endif
function! GetSlimeIndent()
let lnum = prevnonblank(v:lnum-1)
if lnum == 0
return 0
endif
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
if cline =~# '\v^-\s*%(elsif|else|when)>'
let indent = cindent < indent ? cindent : indent - &sw
endif
let increase = indent + &sw
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
let group = synIDattr(synID(lnum,lastcol,1),'name')
if line =~ '^doctype'
return indent
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
return increase
elseif line =~ '^[\.#]'
return increase
elseif line =~? '^div'
return increase
elseif group == 'hamlFilter'
return increase
elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
return increase
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
return increase
elseif line == '-#'
return increase
elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^\v('.g:haml_self_closing_tags.')>'
return indent
elseif group =~? '\v^(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$'
return increase
elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter'
return GetRubyIndent()
else
return indent
endif
endfunction
" vim:set sw=2:
endif

View File

@@ -1,13 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
" Only load this file if no other indent file was loaded
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nolisp
setlocal autoindent
setlocal autoindent sw=2 ts=2
setlocal indentexpr=TerraformIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
@@ -16,29 +16,30 @@ if exists("*TerraformIndent")
endif
function! TerraformIndent(lnum)
" previous non-blank line
let prevlnum = prevnonblank(a:lnum-1)
" beginning of file?
if prevlnum == 0
" Beginning of the file should have no indent
if a:lnum == 0
return 0
endif
" previous line without comments
" Previous non-blank line should continue the indent level
let prevlnum = prevnonblank(a:lnum-1)
" Previous line without comments should continue the indent level
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
let previndent = indent(prevlnum)
let thisindent = previndent
" block open?
" Config block starting with [ { ( should increase the indent level
if prevline =~ '[\[{\(]\s*$'
let thisindent += &sw
endif
" current line without comments
" Current line without comments should continue the indent level
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
" block close?
if thisline =~ '^\s*[\)\]}]'
" Config block ending with ) } ] should get the indentation
" level from the initial config block
if thisline =~ '^\s*[\)}\]]'
let thisindent -= &sw
endif

127
syntax/carp.vim Normal file
View File

@@ -0,0 +1,127 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'carp') == -1
" Vim syntax file
" Language: Carp
" Maintainer: Veit Heller <veit@veitheller.de>
" URL: http://github.com/hellerve/carp-vim.git
" Description: Contains all of the keywords in #lang carp
if exists("b:current_syntax")
finish
endif
syn match carpError ,[]})],
if version < 600
set iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
else
setlocal iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
endif
syn keyword carpSyntax def defn let do if while ref address set! the
syn keyword carpSyntax defmacro defdynamic quote car cdr cons list array
syn keyword carpSyntax expand deftype register system-include register-type
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 cat use project-set! local-include system-include
syn keyword carpSyntax add-cflag add-lib project load reload
syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long
syn keyword carpFunc not or and + - * / = /= >= <= > < inc dec
syn keyword carpFunc println print get-line from-string mod seed random
syn keyword carpFunc random-between str mask delete append count duplicate
syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos
syn keyword carpFunc atan2 exit time srand for cond floor abs neg to-float
syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp
syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach
syn keyword carpFunc => ==> repeat nth replicate range raw aset aset! count
syn keyword carpFunc push-back pop-back sort index-of element-count
syn match carpSymbol ,\k+, contained
syn match carpTodo /\v<(FIXME|NOTE|TODO|OPTIMIZE)/ containedin=carpComment,carpString
syn cluster carpNormal contains=carpSyntax,carpFunc,carpDelimiter
syn cluster carpQuotedStuff contains=carpSymbol
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+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 region carpStruc matchgroup=Delimiter start="@("rs=s+2 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
syn region carpStruc matchgroup=Delimiter start="&("rs=s+2 matchgroup=Delimiter end=")"re=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 carpString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/
syn cluster carpNormal add=carpError,carpStruc,carpString
syn cluster carpQuotedOrNormal add=carpString
syn match carpNumber "\<[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?[lf]\?\>" contains=carpContainedNumberError
syn match carpNumber "\<[-+]\?\d\+/\d\+[lf]\?\>" contains=carpContainedNumberError
syn keyword carpBoolean true false
syn match carpChar "\<\\.\w\@!"
syn region carpQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
syn region carpQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=@carpQuotedStuff,@carpQuotedOrNormal
syn cluster carpNormal add=carpNumber,carpBoolean,carpChar
syn cluster carpQuotedOrNormal add=carpNumber,carpBoolean
syn match carpComment /;.*$/ contains=@Spell
syn region carpQuoted matchgroup=Delimiter start="#['`]"rs=s+2 end=![ \t()\[\]";]!re=e-1,me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
syn region carpQuoted matchgroup=Delimiter start="#['`]("rs=s+3 matchgroup=Delimiter end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
syn cluster carpNormal add=carpQuoted,carpComment
syn cluster carpQuotedOrNormal add=carpComment
syn sync match matchPlace grouphere NONE "^[^ \t]"
if version >= 508 || !exists("carp_syntax_init")
if version < 508
let carp_syntax_init = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink carpSyntax Statement
HiLink carpFunc Function
HiLink carpCopy Function
HiLink carpString String
HiLink carpChar Character
HiLink carpBoolean Boolean
HiLink carpNumber Number
HiLink carpNumberError Error
HiLink carpContainedNumberError Error
HiLink carpQuoted Structure
HiLink carpQuotedStruc Structure
HiLink carpSymbol Structure
HiLink carpAtom Structure
HiLink carpDelimiter Delimiter
HiLink carpConstant Constant
HiLink carpTodo Todo
HiLink carpComment Comment
HiLink carpError Error
delcommand HiLink
endif
let b:current_syntax = "carp"
endif

View File

@@ -34,7 +34,7 @@ hi def link coffeeConditional Conditional
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
hi def link coffeeException Exception
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|await\)\>/
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|default\|await\)\>/
\ display
" The `own` keyword is only a keyword after `for`.
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
@@ -109,7 +109,7 @@ hi def link coffeeFloat Float
" An error for reserved keywords, taken from the RESERVED array:
" http://coffeescript.org/documentation/docs/lexer.html#section-67
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
syn match coffeeReservedError /\<\%(case\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
\ display
hi def link coffeeReservedError Error

View File

@@ -84,8 +84,8 @@ endif
syntax cluster dartStringContains contains=@dartRawStringContains,dartInterpolation,dartSpecialChar
syntax region dartString oneline start=+\z(["']\)+ end=+\z1+ contains=@dartStringContains keepend
syntax region dartRawString oneline start=+r\z(["']\)+ end=+\z1+ contains=@dartRawStringContains keepend
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartStringContains
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartSRawtringContains
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartStringContains keepend
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartSRawtringContains keepend
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" extend
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" extend

View File

@@ -64,9 +64,10 @@ syn match elixirVariable '&\d\+'
syn keyword elixirPseudoVariable __FILE__ __DIR__ __MODULE__ __ENV__ __CALLER__
syn match elixirNumber '\<\d\(_\?\d\)*\(\.[^[:space:][:digit:]]\@!\(_\?\d\)*\)\?\([eE][-+]\?\d\(_\?\d\)*\)\?\>'
syn match elixirNumber '\<0[xX][0-9A-Fa-f]\+\>'
syn match elixirNumber '\<0[bB][01]\+\>'
syn match elixirNumber '\<-\?\d\(_\?\d\)*\(\.[^[:space:][:digit:]]\@!\(_\?\d\)*\)\?\([eE][-+]\?\d\(_\?\d\)*\)\?\>'
syn match elixirNumber '\<-\?0[xX][0-9A-Fa-f]\+\>'
syn match elixirNumber '\<-\?0[oO][0-7]\+\>'
syn match elixirNumber '\<-\?0[bB][01]\+\>'
syn match elixirRegexEscape "\\\\\|\\[aAbBcdDefGhHnrsStvVwW]\|\\\d\{3}\|\\x[0-9a-fA-F]\{2}" contained
syn match elixirRegexEscapePunctuation "?\|\\.\|*\|\\\[\|\\\]\|+\|\\^\|\\\$\|\\|\|\\(\|\\)\|\\{\|\\}" contained

View File

@@ -22,7 +22,7 @@ syntax match fishCommandSub /\v\(\s*\zs\k+>/
syntax region fishLineContinuation matchgroup=fishStatement
\ start='\v^\s*\zs\k+>' skip='\\$' end='$'
\ contains=fishSpecial,fishIdentifier,fishString,fishCharacter,fishStatement,fishCommandSub
\ contains=fishSpecial,fishIdentifier,fishString,fishCharacter,fishStatement,fishCommandSub,fishComment
highlight default link fishKeyword Keyword
highlight default link fishConditional Conditional

View File

@@ -40,6 +40,10 @@ if !exists("g:go_highlight_functions")
let g:go_highlight_functions = 0
endif
if !exists("g:go_highlight_function_arguments")
let g:go_highlight_function_arguments = 0
endif
if !exists("g:go_highlight_methods")
let g:go_highlight_methods = 0
endif
@@ -96,7 +100,7 @@ if exists("g:go_fold_enable")
if index(g:go_fold_enable, 'package_comment') == -1
let s:fold_package_comment = 0
endif
" Disabled by default.
if index(g:go_fold_enable, 'comment') > -1
let s:fold_comment = 1
@@ -231,14 +235,14 @@ endif
" var, const
if s:fold_varconst
syn region goVar start='var (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
syn region goConst start='const (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
else
syn region goVar start='var (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
syn region goVar start='var (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
syn region goConst start='const (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
endif
" Single-line var, const, and import.
@@ -345,14 +349,22 @@ endif
hi def link goOperator Operator
" Functions;
if g:go_highlight_functions != 0
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction skipwhite skipnl
syn match goReceiver /(\(\w\|[ *]\)\+)/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
syn match goReceiverVar /\w\+/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
if g:go_highlight_functions isnot 0 || g:go_highlight_function_arguments isnot 0
syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl
syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
syn match goFunction /\w\+/ nextgroup=goSimpleArguments contained skipwhite skipnl
syn match goReceiverType /\w\+/ contained
syn match goFunction /\w\+/ contained
syn match goFunctionCall /\w\+\ze(/ contains=GoBuiltins,goDeclaration
if g:go_highlight_function_arguments isnot 0
syn match goSimpleArguments /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goArgumentName nextgroup=goSimpleArguments skipwhite skipnl
syn match goArgumentName /\w\+\(\s*,\s*\w\+\)*\ze\s\+\(\w\|\.\|\*\|\[\)/ contained nextgroup=goArgumentType skipwhite skipnl
syn match goArgumentType /\([^,)]\|\_s\)\+,\?/ contained nextgroup=goArgumentName skipwhite skipnl
\ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock
hi def link goReceiverVar goArgumentName
hi def link goArgumentName Identifier
endif
syn match goReceiver /(\s*\w\+\(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
else
syn keyword goDeclaration func
endif

View File

@@ -126,6 +126,8 @@ syn keyword htmlArg contained integrity crossorigin
" <link>
syn keyword htmlArg contained prefetch
" syn keyword htmlArg contained preload
" <img>
syn keyword htmlArg contained decoding
" Custom Data Attributes
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes

View File

@@ -74,7 +74,7 @@ syntax region jsRegexpString start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blan
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
" Objects
syntax match jsObjectKey contained /\<\K\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
syntax match jsObjectColon contained /:/ skipwhite skipempty
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend

View File

@@ -103,10 +103,10 @@ if version >= 508 || !exists("did_json_syn_inits")
hi def link jsonString String
hi def link jsonTest Label
hi def link jsonEscape Special
hi def link jsonNumber Delimiter
hi def link jsonNumber Number
hi def link jsonBraces Delimiter
hi def link jsonNull Function
hi def link jsonBoolean Delimiter
hi def link jsonBoolean Boolean
hi def link jsonKeyword Label
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)

56
syntax/json5.vim Normal file
View File

@@ -0,0 +1,56 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json5') == -1
" Syntax setup {{{1
if exists('b:current_syntax') && b:current_syntax == 'json5'
finish
endif
" Syntax: Strings {{{1
syn region json5String start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=json5Escape
syn region json5String start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=json5Escape
" Syntax: Escape sequences
syn match json5Escape "\\["\\/bfnrt]" contained
syn match json5Escape "\\u\x\{4}" contained
" Syntax: Numbers {{{1
syn match json5Number "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"
syn keyword json5Number Infinity -Infinity
" Syntax: An integer part of 0 followed by other digits is not allowed.
syn match json5NumError "-\=\<0\d\.\d*\>"
" Syntax: Boolean {{{1
syn keyword json5Boolean true false
" Syntax: Null {{{1
syn keyword json5Null null
" Syntax: Braces {{{1
syn match json5Braces "[{}\[\]]"
syn match json5ObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/
" Syntax: Comment {{{1
syn region json5LineComment start=+\/\/+ end=+$+ keepend
syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold
syn region json5Comment start="/\*" end="\*/" fold
" Define the default highlighting. {{{1
hi def link json5String String
hi def link json5ObjAssign Identifier
hi def link json5Escape Special
hi def link json5Number Number
hi def link json5Braces Operator
hi def link json5Null Function
hi def link json5Boolean Boolean
hi def link json5LineComment Comment
hi def link json5Comment Comment
hi def link json5NumError Error
if !exists('b:current_syntax')
let b:current_syntax = 'json5'
endif
" vim: fdm=marker
endif

View File

@@ -1,153 +1,551 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
" Vim syntax file
" Language: julia
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
" Last Change: 2013 feb 11
if exists("b:current_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if version < 704
" this is used to disable regex syntax like `\@3<='
" on older vim versions
function! s:d(x)
return ''
endfunction
else
function! s:d(x)
return string(a:x)
endfunction
endif
scriptencoding utf-8
if !exists("b:julia_syntax_version")
let b:julia_syntax_version = get(g:, "default_julia_version", "current")
endif
if !exists("b:julia_syntax_highlight_deprecated")
let b:julia_syntax_highlight_deprecated = get(g:, "julia_syntax_highlight_deprecated", 0)
endif
if b:julia_syntax_version =~? '\<\%(curr\%(ent\)\?\|release\|6\|0\.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
echohl WarningMsg | echomsg "Unrecognized or unsupported julia syntax version: " . b:julia_syntax_version | echohl None
let b:julia_syntax_version = 6
endif
let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0)
let s:julia_spellcheck_docstrings = get(g:, "julia_spellcheck_docstrings", 1)
let s:julia_spellcheck_comments = get(g:, "julia_spellcheck_comments", 1)
let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1)
" characters which cannot be used in identifiers. This list is very incomplete:
" 1) it only cares about charactes below 256
" 2) it doesn't distinguish between what's allowed as the 1st char vs in the
" rest of an identifier (e.g. digits, `!` and `?`)
" Despite these shortcomings, it seems to do a decent job.
" note: \U5B and \U5D are '[' and ']'
let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" .
\ "\"#$'(,.:;=@`\\U5B{" .
\ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF"
let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars
" the following excludes '!' since it can be used as an identifier,
" and '$' since it can be used in interpolations
" note that \U2D is '-'
let s:uniop_chars = "+\\U2D~¬√∛∜"
let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆⊈⊂⊄⊊←→∋∌⊕⊖⊞⊟∘∧⊗⊘↑↓∨⊠±"
" the following is a list of all remainig valid operator chars,
" but it's more efficient when expressed with ranges (see below)
" let s:binop_chars_extra = "↔↚↛↠↣↦↮⇎⇏⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←→" .
" \ "∝∊∍∥∦∷∺∻∽∾≁≃≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣" .
" \ "⊔∓∔∸≂≏⊎⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣" .
" \ "⊙⊚⊛⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗" .
" \ "⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯↑↓"
" same as above, but with character ranges, for performance
let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\U221D\\U2224-\\U222A\\U2237\\U2238\\U223A\\U223B\\U223D\\U223E\\U2240-\\U228B\\U228D-\\U229C\\U229E-\\U22A3\\U22A9\\U22AC\\U22AE\\U22B0-\\U22B7\\U22BB-\\U22BD\\U22C4-\\U22C7\\U22C9-\\U22D3\\U22D5-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\U27F7\\U27F9-\\U27FF\\U2900-\\U2918\\U291D-\\U2920\\U2944-\\U2970\\U29B7\\U29B8\\U29BC\\U29BE-\\U29C1\\U29E1\\U29E3-\\U29E5\\U29F4\\U29F6\\U29F7\\U29FA\\U29FB\\U2A07\\U2A08\\U2A1D\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC"
" a Julia identifier, sort of (TODO: the special case of a lone `?` should be
" removed as soon as the Julia parser is fixed)
let s:idregex = '\%([^' . s:nonidS_chars . '0-9!?' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\|\<?\>\)'
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
\ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|:>\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
\ '\|' . '[' . s:uniop_chars . '!$]' .
\ '\|' . '\.\?[' . s:binop_chars . s:binop_chars_extra . ']' .
\ '\)'
syn case match
syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems
syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems
syn keyword juliaDirective import importall export using require include
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef
if b:julia_syntax_version == 5
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll
else
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll,@juliaBlocksItems0607
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
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 juliaTypesItems0506 contains=juliaBaseTypeRange0506,juliaBaseTypeSet0506
syntax cluster juliaTypesItems0607 contains=juliaBaseTypeBasic0607,juliaBaseTypeArray0607,juliaBaseTypeSet0607,juliaBaseTypeProcess0607,juliaBaseTypeRange0607,juliaBaseTypeTime0607
syntax cluster juliaTypesItems07 contains=juliaBaseTypeRange07,juliaBaseTypeSet07
hi def link juliaDirective Include
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstIO,juliaConstMMap,juliaConstC,juliaConstGeneric
syntax cluster juliaConstItems0506 contains=juliaConstNum0506
syntax cluster juliaConstItems07 contains=juliaPossibleEuler
if b:julia_syntax_version <= 6
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506
else
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506,@juliaConstItems07
endif
syn region juliaDeclTypeBlock transparent matchgroup=juliaDeclType start="\<\%(type\|immutable\)\>" end="\<end\>" contains=ALL
syn keyword juliaTypeAlias typealias
syn keyword juliaDeclAbstract abstract
syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra
syntax cluster juliaSymbolItems contains=juliaPossibleSymbol
syntax cluster juliaNumberItems contains=juliaNumbers
syntax cluster juliaStringItems contains=juliaChar,juliaString,juliabString,juliasString,juliavString,juliaipString,juliabigString,juliaMIMEString,juliaShellString,juliaDocString,juliaRegEx
syntax cluster juliaPrintfItems contains=juliaPrintfParBlock,juliaPrintfString
syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juliaCTransOperator,juliaTernaryRegion,juliaColon,juliaSemicolon,juliaComma
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally
hi def link juliaDeclType Structure
hi def link juliaTypeAlias Typedef
hi def link juliaDeclAbstract Structure
syntax cluster juliaSpellcheckStrings contains=@spell
syntax cluster juliaSpellcheckDocStrings contains=@spell
syntax cluster juliaSpellcheckComments contains=@spell
" Module
syn region juliaModuleBlock transparent matchgroup=juliaModule start="\<module\>" end="\<end\>" contains=ALL
if !s:julia_spellcheck_docstrings
syntax cluster juliaSpellcheckDocStrings remove=@spell
endif
if !s:julia_spellcheck_strings
syntax cluster juliaSpellcheckStrings remove=@spell
endif
if !s:julia_spellcheck_comments
syntax cluster juliaSpellcheckComments remove=@spell
endif
hi def link juliaModule Structure
syntax match juliaSemicolon display ";"
syntax match juliaComma display ","
syntax match juliaColon display ":"
syntax match juliaErrorPar display "[])}]"
syntax match juliaErrorEnd display "\<end\>"
syntax match juliaErrorElse display "\<\%(else\|elseif\)\>"
syntax match juliaErrorCatch display "\<catch\>"
syntax match juliaErrorFinally display "\<finally\>"
syntax match juliaErrorSemicol display contained ";"
syntax match juliaRangeEnd display contained "\<end\>"
syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor
syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="(" end=")" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor
syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
if b:julia_syntax_version >= 6
let s:keywords = '\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>'
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 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 juliaConditionalEBlock matchgroup=juliaConditional transparent contained start="\<else\>" end="\<end\>"me=s-1 contains=@juliaExpressions
syntax region juliaWhileBlock matchgroup=juliaRepeat start="\<while\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaForBlock matchgroup=juliaRepeat start="\<for\>" end="\<end\>" contains=@juliaExpressions,juliaOuter fold
syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="\<begin\>" 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 juliaQuoteBlock matchgroup=juliaBlKeyword start="\<quote\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaTypeBlock matchgroup=juliaBlKeyword start="\<type\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaImmutableBlock matchgroup=juliaBlKeyword start="\<immutable\>" 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 juliaLetBlock matchgroup=juliaBlKeyword start="\<let\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaDoBlock matchgroup=juliaBlKeyword start="\<do\>" end="\<end\>" contains=@juliaExpressions fold
exec 'syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\%(\%(\.\s*\)\@'.s:d(6).'<!\|\%(@\s*\.\s*\)\@'.s:d(6).'<=\)\<\%(bare\)\?module\>" end="\<end\>" contains=@juliaExpressions fold'
syntax region juliaExceptionBlock matchgroup=juliaException start="\<try\>" end="\<end\>" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold
syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="\<catch\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaFinallyBlock
syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="\<finally\>" end="\<end\>"me=s-1 contains=@juliaExpressions
syntax match juliaTypedef "\<\%(abstract\|typealias\|bitstype\)\>"
" AbstractBlock needs to come after to take precedence
syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="\<abstract type\>" end="\<end\>" fold contains=@juliaExpressions
syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="\<primitive type\>" end="\<end\>" fold contains=@juliaExpressions
exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\<for\>" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor'
syntax match juliaComprehensionIf contained "\<if\>"
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 juliaBaseTypeBasic0607 display "\<\%(UnionAll\|CodeInfo\)\>"
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\%(32\|64\|128\)\?\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>"
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 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 juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
syntax match juliaBaseTypeIter05 display "\<\%(Zip\|Filter\)\>"
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 juliaBaseTypeArray0607 display "\<\%(Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
syntax match juliaBaseTypeDict display "\<\%(WeakKey\|ObjectId\)\?Dict\>"
syntax match juliaBaseTypeSet display "\<Set\>"
syntax match juliaBaseTypeSet0506 display "\<IntSet\>"
syntax match juliaBaseTypeSet0607 display "\<AbstractSet\>"
syntax match juliaBaseTypeSet07 display "\<BitSet\>"
syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|DevNull\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"
syntax match juliaBaseTypeProcess display "\<\%(ProcessGroup\|Pipe\|Cmd\)\>"
syntax match juliaBaseTypeProcess0607 display "\<PipeBuffer\>"
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\)\>"
syntax match juliaBaseTypeRange05 display "\<FloatRange\>"
syntax match juliaBaseTypeRange0506 display "\<Range\>"
syntax match juliaBaseTypeRange0607 display "\<\%(ExponentialBackOff\|StepRangeLen\)\>"
syntax match juliaBaseTypeRange07 display "\<AbstractRange\>"
syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>"
syntax match juliaBaseTypeFact display "\<Factorization\>"
syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>"
syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Nearest\%(Ties\%(Away\|Up\)\)\?\|ToZero\|Up\)\>"
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>"
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\)\>"
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 juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)"
syntax match juliaConstNum0506 display "\%(\<\%(eu\?\|eulergamma\|γ\|catalan\|φ\|golden\)\>\)"
" Note: recognition of , which Vim does not consider a valid identifier, is
" complicated. We detect possible uses by just looking for the character (for
" performance) and then check that it's actually used by its own.
" (This also tries to detect preceding number constants; it does so in a crude
" way.)
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 . '\)"'
syntax match juliaConstBool display "\<\%(true\|false\)\>"
syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|CPU_CORES\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>"
syntax match juliaConstIO display "\<\%(STD\%(OUT\|IN\|ERR\)\)\>"
syntax match juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
exec 'syntax match juliaMacro contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"'
syntax match juliaMacro contained "@\.\ze[^0-9]"
exec 'syntax region juliaMacroCallP contained transparent start="@' . s:idregex . '\%(\.' . s:idregex . '\)*(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock'
exec 'syntax region juliaMacroCallP contained transparent start="@.(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock'
exec 'syntax region juliaMacroCall contained transparent start="\(@' . s:idregex . '\%(\.' . s:idregex . '\)*\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
exec 'syntax region juliaMacroCall contained transparent start="\(@.\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
syntax match juliaNumbers transparent "\<\d\|\.\d\|\<im\>" contains=juliaNumber,juliaFloat,juliaComplexUnit
"integer regexes
let s:dec_regex = '\d\%(_\?\d\)*\%(\>\|im\>\|\ze\D\)'
let s:hex_regex = '0x\x\%(_\?\x\)*\%(\>\|im\>\|\ze\X\)'
let s:bin_regex = '0b[01]\%(_\?[01]\)*\%(\>\|im\>\|\ze[^01]\)'
let s:oct_regex = '0o\o\%(_\?\o\)*\%(\>\|im\>\|\ze\O\)'
let s:int_regex = '\%(' . s:hex_regex .
\ '\|' . s:bin_regex .
\ '\|' . s:oct_regex .
\ '\|' . s:dec_regex .
\ '\)'
"floating point regexes
" starting with a dot, optional exponent
let s:float_regex1 = '\.\d\%(_\?\d\)*\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)'
" with dot, optional exponent
let s:float_regex2 = '\d\%(_\?\d\)*\.\%(\d\%(_\?\d\)*\)\?\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)'
" without dot, with exponent
let s:float_regex3 = '\d\%(_\?\d\)*[eEf][-+]\?\d\+\%(\>\|im\>\|\ze\D\)'
"hex floating point numbers
" starting with a dot
let s:hexfloat_regex1 = '0x\.\%\(\x\%(_\?\x\)*\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)'
" starting with a digit
let s:hexfloat_regex2 = '0x\x\%(_\?\x\)*\%\(\.\%\(\x\%(_\?\x\)*\)\?\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)'
let s:float_regex = '\%(' . s:float_regex3 .
\ '\|' . s:float_regex2 .
\ '\|' . s:float_regex1 .
\ '\|' . s:hexfloat_regex2 .
\ '\|' . s:hexfloat_regex1 .
\ '\)'
exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaComplexUnit'
exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit'
syntax match juliaComplexUnit display contained "\<im\>"
exec 'syntax match juliaOperator "' . s:operators . '"'
syntax match juliaRangeOperator display ":"
exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|^\s*:\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol'
let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$'
exec 'syntax match juliaDollarVar display contained "' . s:interp_dollar . s:idregex . '"'
exec 'syntax region juliaDollarPar matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '(" end=")" contains=@juliaExpressions'
exec 'syntax region juliaDollarSqBra matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
syntax match juliaChar "'\\\?.'" contains=juliaSpecialChar
syntax match juliaChar display "'\\\o\{3\}'" contains=juliaOctalEscapeChar
syntax match juliaChar display "'\\x\x\{2\}'" contains=juliaHexEscapeChar
syntax match juliaChar display "'\\u\x\{1,4\}'" contains=juliaUniCharSmall
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).'<!\.\?' . "'" . '"'
syntax region juliaString matchgroup=juliaStringDelim start=+\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckStrings
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 juliavString matchgroup=juliaStringDelim start=+\<v\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
syntax region juliaipString matchgroup=juliaStringDelim start=+\<ip\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
syntax region juliabigString matchgroup=juliaStringDelim start=+\<big\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
syntax region juliaMIMEString matchgroup=juliaStringDelim start=+\<MIME\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
syntax region juliaDocString matchgroup=juliaStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
exec 'syntax region juliaPrintfMacro contained transparent start="@s\?printf(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaPrintfParBlock'
syntax region juliaPrintfMacro contained transparent start="@s\?printf\s\+" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExprsPrintf,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
syntax region juliaPrintfParBlock contained matchgroup=juliaParDelim start="(" end=")" contains=@juliaExprsPrintf
syntax region juliaPrintfString contained matchgroup=juliaStringDelim start=+"+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=@juliaSpecialChars,@juliaPrintfChars
syntax region juliaShellString matchgroup=juliaStringDelim start=+`+ skip=+\%(\\\\\)*\\`+ end=+`+ contains=@juliaStringVars,juliaSpecialChar
syntax cluster juliaStringVars contains=juliaStringVarsPar,juliaStringVarsSqBra,juliaStringVarsCurBra,juliaStringVarsPla
syntax region juliaStringVarsPar contained matchgroup=juliaStringVarDelim start="$(" end=")" contains=@juliaExpressions
syntax region juliaStringVarsSqBra contained matchgroup=juliaStringVarDelim start="$\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
syntax region juliaStringVarsCurBra contained matchgroup=juliaStringVarDelim start="${" end="}" contains=@juliaExpressions
exec 'syntax match juliaStringVarsPla contained "\$' . s:idregex . '"'
" TODO improve RegEx
syntax region juliaRegEx matchgroup=juliaStringDelim start=+\<r\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1[imsx]*+
syntax cluster juliaSpecialChars contains=juliaSpecialChar,juliaOctalEscapeChar,juliaHexEscapeChar,juliaUniCharSmall,juliaUniCharLarge
syntax match juliaSpecialChar display contained "\\."
syntax match juliaOctalEscapeChar display contained "\\\o\{3\}"
syntax match juliaHexEscapeChar display contained "\\x\x\{2\}"
syntax match juliaUniCharSmall display contained "\\u\x\{1,4\}"
syntax match juliaUniCharLarge display contained "\\U\x\{1,8\}"
syntax cluster juliaPrintfChars contains=juliaErrorPrintfFmt,juliaPrintfFmt
syntax match juliaErrorPrintfFmt display contained "\\\?%."
syntax match juliaPrintfFmt display contained "%\%(\d\+\$\)\=[-+' #0]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjqzt]\|ll\|hh\)\=[aAbdiuoxXDOUfFeEgGcCsSpn]"
syntax match juliaPrintfFmt display contained "%%"
syntax match juliaPrintfFmt display contained "\\%\%(\d\+\$\)\=[-+' #0]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjqzt]\|ll\|hh\)\=[aAbdiuoxXDOUfFeEgGcCsSpn]"hs=s+1
syntax match juliaPrintfFmt display contained "\\%%"hs=s+1
" this is used to restrict the search for Symbols to when colons appear at all
" (for performance reasons)
syntax match juliaPossibleSymbol transparent ":\ze[^:]" contains=juliaSymbol,juliaQuotedParBlock,juliaQuotedQMarkPar,juliaColon
let s:quotable = '\%(' . s:idregex . '\|?\|' . s:operators . '\|' . s:float_regex . '\|' . s:int_regex . '\)'
let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . '?]\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s*\)\@'.s:d(9).'<=\)\zs:'
let s:quoting_colonS = '\s\@'.s:d(1).'<=:'
" note: juliaSymbolS only works within whitespace-sensitive contexts,
" such as in macro calls without parentheses, or within square brackets.
" It is used to override the recognition of expressions like `a :b` as
" ranges rather than symbols in those contexts.
" (Note that such `a :b` expressions only allows at most 5 spaces between
" the identifier and the colon anyway.)
exec 'syntax match juliaSymbol contained "' .s:quoting_colon . s:quotable . '"'
exec 'syntax match juliaSymbolS contained "' . s:quoting_colonS . s:quotable . '"'
" same as above for quoted expressions such as :(expr)
" (includes :(?) as a special case, although it really shouldn't work...)
exec 'syntax region juliaQuotedParBlock matchgroup=juliaQParDelim start="' . s:quoting_colon . '(" end=")" contains=@juliaExpressions'
exec 'syntax match juliaQuotedQMarkPar "' . s:quoting_colon . '(\s*?\s*)" contains=juliaQuotedQMark'
exec 'syntax region juliaQuotedParBlockS matchgroup=juliaQParDelim contained start="' . s:quoting_colonS . '(" end=")" contains=@juliaExpressions'
exec 'syntax match juliaQuotedQMarkParS contained "' . s:quoting_colonS . '(\s*?\s*)" contains=juliaQuotedQMark'
" force precedence over Symbols
syntax match juliaOperator display "::"
syntax region juliaCommentL matchgroup=juliaCommentDelim start="#\ze\%([^=]\|$\)" end="$" keepend contains=juliaTodo,@juliaSpellcheckComments
syntax region juliaCommentM matchgroup=juliaCommentDelim start="#=\ze\%([^#]\|$\)" end="=#" contains=juliaTodo,juliaCommentM,@juliaSpellcheckComments
syntax keyword juliaTodo contained TODO FIXME XXX
" Misc. blocks
syn region juliaMiscBlockBlock transparent matchgroup=juliaMiscBlock start="\<\%(quote\|do\|begin\|let\)\>" end="\<end\>" contains=ALL
" the following are disabled by default, but
" can be enabled by entering e.g.
" :hi link juliaParDelim Delimiter
hi def link juliaParDelim juliaNone
hi def link juliaSemicolon juliaNone
hi def link juliaComma juliaNone
hi def link juliaMiscBlock Repeat
" Braces and Brackets
syn region juliaBracketsBlock matchgroup=juliaBrackets start='\[' end='\]' contains=ALLBUT,juliaRepeatBlock contained
syn region juliaBracesBlock matchgroup=juliaBraces start='{' end='}' contains=ALLBUT,juliaRepeatBlock contained
" Repeat
syn region juliaRepeatBlock transparent matchgroup=juliaRepeat start="\<\%(while\|for\)\>" end="\<end\>" contains=@juliaTop
hi def link juliaRepeat Repeat
" Conditional
syn keyword juliaElse else elseif
syn region juliaIfBlock transparent matchgroup=juliaIf start="\<if\>" end="\<end\>" contains=@juliaTop
hi def link juliaElse Conditional
hi def link juliaIf Conditional
hi def link juliaColon juliaOperator
" try catch end
syn keyword juliaCatch catch contained
syn region juliaTryBlock transparent matchgroup=juliaTry start="\<try\>" end="\<end\>" contains=@juliaTop
hi def link juliaKeyword Keyword
hi def link juliaInfixKeyword Keyword
hi def link juliaRepKeyword Keyword
hi def link juliaBlKeyword Keyword
hi def link juliaConditional Conditional
hi def link juliaRepeat Repeat
hi def link juliaException Exception
hi def link juliaTypedef Keyword
exec 'hi! def link juliaOuter ' . (b:julia_syntax_version >= 7 ? 'Keyword' : 'NONE')
hi def link juliaBaseTypeBasic Type
hi def link juliaBaseTypeNum Type
hi def link juliaBaseTypeC Type
hi def link juliaBaseTypeError Type
hi def link juliaBaseTypeIter Type
hi def link juliaBaseTypeString Type
hi def link juliaBaseTypeArray Type
hi def link juliaBaseTypeDict Type
hi def link juliaBaseTypeSet Type
hi def link juliaBaseTypeIO Type
hi def link juliaBaseTypeProcess Type
hi def link juliaBaseTypeRange Type
hi def link juliaBaseTypeRegex Type
hi def link juliaBaseTypeFact Type
hi def link juliaBaseTypeSort Type
hi def link juliaBaseTypeRound Type
hi def link juliaBaseTypeSpecial Type
hi def link juliaBaseTypeRandom Type
hi def link juliaBaseTypeDisplay Type
hi def link juliaBaseTypeTime 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 ["Range", "Set"]
let h = b:julia_syntax_version <= 6 ? "Type" : "juliaDeprecated"
exec "hi! def link juliaBaseType" . t . "0506 " . h
endfor
for t in ["Range", "Set"]
let h = b:julia_syntax_version >= 7 ? "Type" : "NONE"
exec "hi! def link juliaBaseType" . t . "07 " . h
endfor
hi def link juliaTry Exception
hi def link juliaCatch Exception
" NOTE: deprecated constants are not highlighted as such. For once,
" one can still legitimately use them by importing Base.MathConstants.
" Plus, one-letter variables like `e` and `γ` can be used with other
" meanings.
hi def link juliaConstNum Constant
let h = b:julia_syntax_version <= 6 ? "Constant" : "NONE"
exec "hi! def link juliaConstNum0506 " . h
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
exec "hi! def link juliaEuler " . h
hi def link juliaConstEnv Constant
hi def link juliaConstIO Constant
hi def link juliaConstC Constant
hi def link juliaConstLimits Constant
hi def link juliaConstGeneric Constant
hi def link juliaRangeEnd Constant
hi def link juliaConstBool Boolean
" one word statements
syn keyword juliaStatement return continue break
hi def link juliaComprehensionFor Keyword
hi def link juliaComprehensionIf Keyword
hi def link juliaStatement Statement
hi def link juliaDollarVar Identifier
" misc
syn keyword juliaDeclaration const global local
syn keyword juliaComprehensionFor for
hi def link juliaMacro Macro
hi def link juliaSymbol Identifier
hi def link juliaSymbolS Identifier
hi def link juliaQParDelim Identifier
hi def link juliaQuotedQMarkPar Identifier
hi def link juliaQuotedQMarkParS Identifier
hi def link juliaQuotedQMark juliaOperatorHL
hi def link juliaDeclaration Keyword
hi def link juliaComprehensionFor Keyword
hi def link juliaNumber Number
hi def link juliaFloat Float
hi def link juliaComplexUnit Constant
" Built in types
syn keyword juliaType Uint Uint8 Uint16 Uint32 Uint64 Uint128
syn keyword juliaType Int Int8 Int16 Int32 Int64 Int128
syn keyword juliaType Float Float16 Float32 Float64
syn keyword juliaType AbstractArray AbstractMatrix AbstractVector Array Vector Matrix
syn keyword juliaType String ByteString UTF8String SubString
syn keyword juliaType Bool Nothing Union Type
hi def link juliaChar Character
hi def link juliaString String
hi def link juliabString String
hi def link juliasString String
hi def link juliavString String
hi def link juliarString String
hi def link juliaipString String
hi def link juliabigString String
hi def link juliaMIMEString String
hi def link juliaPrintfString String
hi def link juliaShellString String
hi def link juliaDocString String
hi def link juliaStringDelim String
hi def link juliaStringVarsPla Identifier
hi def link juliaStringVarDelim Identifier
hi def link juliaType Type
hi def link juliaRegEx String
hi def link juliaSpecialChar SpecialChar
hi def link juliaOctalEscapeChar SpecialChar
hi def link juliaHexEscapeChar SpecialChar
hi def link juliaUniCharSmall SpecialChar
hi def link juliaUniCharLarge SpecialChar
" Comments
syn keyword juliaTodo contained TODO FIXME XXX
syn cluster juliaCommentGroup contains=juliaTodo
syn region juliaComment start="#" end="$" contains=@juliaCommentGroup,@Spell
hi def link juliaPrintfFmt SpecialChar
hi def link juliaComment Comment
hi def link juliaTodo Todo
if s:julia_highlight_operators
hi! def link juliaOperatorHL Operator
else
hi! def link juliaOperatorHL juliaNone
endif
hi def link juliaOperator juliaOperatorHL
hi def link juliaRangeOperator juliaOperatorHL
hi def link juliaCTransOperator juliaOperatorHL
hi def link juliaTernaryOperator juliaOperatorHL
hi def link juliaCommentL Comment
hi def link juliaCommentM Comment
hi def link juliaCommentDelim Comment
hi def link juliaTodo Todo
" Strings
syn region juliaString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@juliaStringGroup,@Spell
syn region juliaTripleString start=+"""+ end=+"""+
syn region juliaCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@juliaCharacterGroup
hi def link juliaErrorPar juliaError
hi def link juliaErrorEnd juliaError
hi def link juliaErrorElse juliaError
hi def link juliaErrorCatch juliaError
hi def link juliaErrorFinally juliaError
hi def link juliaErrorSemicol juliaError
hi def link juliaErrorPrintfFmt juliaError
hi def link juliaString String
hi def link juliaTripleString String
hi def link juliaCharacter Character
hi def link juliaError Error
if b:julia_syntax_highlight_deprecated == 1
hi! def link juliaDeprecated Todo
else
hi! def link juliaDeprecated NONE
end
" Functions
syn region juliaFunctionBlock transparent matchgroup=juliaFunction start="\<\%\(function\|macro\)\>" end="\<end\>" contains=@juliaTop
hi def link juliaFunction Function
" Numbers
syn match juliaNumber "\<\d\+\([Ee]\d\+\)\?\>"
syn match juliaNumber "\<0x\x\+\>"
syn match juliaNumber "\<0\o\+\>"
syn match juliaFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
syn match juliaFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
syn match juliaFloat "\<\d\+[Ee][-+]\d\+\>"
syn keyword juliaFloatSpecial NaN Inf
hi def link juliaNumber Number
hi def link juliaFloat Float
hi def link juliaFloatSpecial Float
" Operators
syn keyword juliaIn in
hi def link juliaIn Operator
" Constants
syn keyword juliaBool true false nothing
hi def link juliaBool Boolean
syn keyword juliaIdentifierSpecial STDOUT, STDIN, STDERR
hi def link juliaIdentifierSpecial Identifier
" Macros
syn match juliaMacro display "@[_[:alpha:]][_[:alnum:]!]*\%(\.[_[:alpha:]][_[:alnum:]!]*\)*"
hi def link juliaMacro Macro
syn cluster juliaTop contains=ALLBUT,juliaComprehensionFor
" Ragel
syn include @ragel syntax/ragel.vim
syn region ragelLine start="%%" end="$" contains=@ragel
syntax sync fromstart
let b:current_syntax = "julia"
endif

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim syntax file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 18 September 2017
" Latest Revision: 23 November 2017
if exists("b:current_syntax")
finish
@@ -39,7 +39,7 @@ syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contai
syn match ktSpecialCharError "\v\\." contained
syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
syn region ktString start='"""' end='"""' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
syn match ktCharacter "\v'\\''" contains=ktSpecialChar
syn match ktCharacter "\v'[^\\]'"

View File

@@ -110,11 +110,9 @@ syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ containe
syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained
syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
syn match mkdRule /^\s*-\{3,}$/
syn match mkdRule /^\s*\*\{3,5}$/
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*\(\*\|\s\)*$/
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-\(-\|\s\)*$/
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_\(_\|\s\)*$/
" YAML frontmatter
if get(g:, 'vim_markdown_frontmatter', 0)

View File

@@ -52,7 +52,7 @@ syn keyword nimKeyword ptr
syn keyword nimKeyword raise ref return
syn keyword nimKeyword shared shl shr static
syn keyword nimKeyword try tuple type
syn keyword nimKeyword var
syn keyword nimKeyword var vtref vtptr
syn keyword nimKeyword when while with without
syn keyword nimKeyword xor
syn keyword nimKeyword yield

View File

@@ -621,8 +621,9 @@ if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc
syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment
syn match phpDocTags "@\%(abstract\|access\|api\|author\|brief\|bug\|category\|class\|copyright\|created\|date\|deprecated\|details\|example\|exception\|file\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|struct\|subpackage\|throws\|toc\|todo\|tutorial\|type\|uses\|var\|version\|warning\)" containedin=phpDocComment nextgroup=phpDocParam,phpDocIdentifier skipwhite contained
syn match phpDocParam "\s\+\zs\(|\|\\\|\h\w*\)*\h\w*" nextgroup=phpDocIdentifier skipwhite contained
syn match phpDocParam "\s\+\zs\(|\|\\\|\h\w*\)*\h\w*" nextgroup=phpDocIdentifier skipwhite contained contains=phpDocNamespaceSeparator
syn match phpDocIdentifier "\s\+\zs$\h\w*" contained
syn match phpDocNamespaceSeparator "\\" contained display
syn case match
endif
@@ -651,26 +652,26 @@ endif
" HereDoc
syn case match
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@3<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
" including HTML,JavaScript,SQL if enabled via options
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_sql_heredoc") && php_sql_heredoc)
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
" NowDoc
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
if (exists("php_sql_nowdoc") && php_sql_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
if (exists("php_html_in_nowdoc") && php_html_in_nowdoc)
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
endif
syn case ignore
@@ -695,25 +696,28 @@ syn keyword phpKeyword class contained
\ nextgroup=phpClass skipwhite skipempty
syn match phpClass /\h\w*/ contained
syn match phpClassNamespaceSeparator "\\" contained display
" Class extends
syn keyword phpKeyword extends contained
\ nextgroup=phpClassExtends skipwhite skipempty
syn match phpClassExtends /\(\\\|\h\w*\)*\h\w*/ contained
syn match phpClassExtends /\(\\\|\h\w*\)*\h\w*/ contained contains=phpClassNamespaceSeparator
" Class implements
syntax keyword phpKeyword implements contained
\ nextgroup=phpClassImplements skipwhite skipempty
syntax match phpClassImplements contained
syntax match phpClassImplements contained contains=phpClassNamespaceSeparator
\ nextgroup=phpClassDelimiter skipwhite skipempty /\(\\\|\h\w*\)*\h\w*/
syntax match phpClassDelimiter contained
\ nextgroup=phpClassImplements skipwhite skipempty /,/
" use statement
syn match phpUseNamespaceSeparator "\\" contained display
syn keyword phpInclude use contained
\ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty
syn match phpUseFunction /function\_s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword
\ nextgroup=phpUseAlias skipwhite skipempty
syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained
syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseNamespaceSeparator
\ nextgroup=phpUseAlias skipwhite skipempty
syn match phpUseAlias /as\_s\+\h\w*/ contained contains=phpUseKeyword
syn match phpUseKeyword /\(function\|as\)\_s\+/ contained contains=phpKeyword
@@ -865,6 +869,10 @@ if !exists("did_php_syn_inits")
hi def link phpClassImplements phpClass
hi def link phpClassDelimiter phpRegion
hi def link phpDocNamespaceSeparator phpComment
hi def link phpClassNamespaceSeparator phpClass
hi def link phpUseNamespaceSeparator phpRegion
endif
" Cleanup: {{{

View File

@@ -61,6 +61,7 @@ syn keyword pbRepeat optional required repeated
syn keyword pbDefault default
syn keyword pbExtend extend extensions to max reserved
syn keyword pbRPC service rpc returns
syn keyword pbStream stream
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
@@ -92,6 +93,7 @@ if version >= 508 || !exists("did_proto_syn_inits")
HiLink pbDefault Keyword
HiLink pbExtend Keyword
HiLink pbRPC Keyword
HiLink pbStream Keyword
HiLink pbType Type
HiLink pbTypedef Typedef
HiLink pbBool Boolean

View File

@@ -1,326 +1,487 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
" Vim syntax file
"
" Based on python.vim (from Vim 6.1 distribution)
" by Neil Schemenauer <nas@python.ca>
"
" Notes Armin:
"
" This version of the syntax file works better for 2.x and 3.x without
" having to switch modes.
"
" Thanks:
"
" Jeroen Ruigrok van der Werven
" for the idea of highlighting for erroneous operators
" Pedro Algarvio
" for the patch to enable spell checking only for the right spots
" (strings and comments)
"
" Options:
"
" For set option do: let OPTION_NAME = 1
" For clear option do: let OPTION_NAME = 0
"
" Option names:
"
" For highlight builtin functions:
" python_highlight_builtins
"
" For highlight standard exceptions:
" python_highlight_exceptions
"
" For highlight string formatting:
" python_highlight_string_formatting
"
" For highlight indentation errors:
" python_highlight_indent_errors
"
" For highlight trailing spaces:
" python_highlight_space_errors
"
" For highlight doc-tests:
" python_highlight_doctests
"
" If you want all possible Python highlighting:
" (This option not override previously set options)
" python_highlight_all
"
" For fast machines:
" python_slow_sync
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
" For versions greater than 6.x: Quit when a syntax file was already loaded
if v:version < 600
syntax clear
elseif exists("b:current_syntax")
elseif exists('b:current_syntax')
finish
endif
if exists("python_highlight_all") && python_highlight_all != 0
" Not override previously set options
if !exists("python_highlight_builtins")
let python_highlight_builtins = 1
"
" Commands
"
command! -buffer Python2Syntax let b:python_version_2 = 1 | let &syntax=&syntax
command! -buffer Python3Syntax let b:python_version_2 = 0 | let &syntax=&syntax
" Enable option if it's not defined
function! s:EnableByDefault(name)
if !exists(a:name)
let {a:name} = 1
endif
if !exists("python_highlight_exceptions")
let python_highlight_exceptions = 1
endfunction
" Check if option is enabled
function! s:Enabled(name)
return exists(a:name) && {a:name}
endfunction
" Is it Python 2 syntax?
function! s:Python2Syntax()
if exists('b:python_version_2')
return b:python_version_2
endif
if !exists("python_highlight_string_formatting")
let python_highlight_string_formatting = 1
endif
if !exists("python_highlight_indent_errors")
let python_highlight_indent_errors = 1
endif
if !exists("python_highlight_space_errors")
let python_highlight_space_errors = 1
endif
if !exists("python_highlight_doctests")
let python_highlight_doctests = 1
return s:Enabled('g:python_version_2')
endfunction
"
" Default options
"
call s:EnableByDefault('g:python_slow_sync')
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
if s:Enabled('g:python_highlight_all')
call s:EnableByDefault('g:python_highlight_builtins')
if s:Enabled('g:python_highlight_builtins')
call s:EnableByDefault('g:python_highlight_builtin_objs')
call s:EnableByDefault('g:python_highlight_builtin_funcs')
endif
call s:EnableByDefault('g:python_highlight_exceptions')
call s:EnableByDefault('g:python_highlight_string_formatting')
call s:EnableByDefault('g:python_highlight_string_format')
call s:EnableByDefault('g:python_highlight_string_templates')
call s:EnableByDefault('g:python_highlight_indent_errors')
call s:EnableByDefault('g:python_highlight_space_errors')
call s:EnableByDefault('g:python_highlight_doctests')
call s:EnableByDefault('g:python_print_as_function')
call s:EnableByDefault('g:python_highlight_class_vars')
call s:EnableByDefault('g:python_highlight_operators')
endif
"
" Keywords
syn keyword pythonStatement break continue del
syn keyword pythonStatement exec return
syn keyword pythonStatement pass raise
syn keyword pythonStatement global assert
syn keyword pythonStatement lambda yield
syn keyword pythonStatement async await
syn keyword pythonStatement with nonlocal True False None
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
syn keyword pythonImport import from as
syn keyword pythonException try except finally
syn keyword pythonOperator and in is not or
"
" Print keyword but only if not used as function
syn match pythonStatement "\<print\>\((\|,\|*=\)\@!" display
syn keyword pythonStatement break continue del return pass yield global assert lambda with
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
if s:Enabled('g:python_highlight_class_vars')
syn keyword pythonClassVar self cls
endif
syn keyword pythonRepeat for while
syn keyword pythonConditional if elif else
syn keyword pythonException try except finally
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
" we provide a dummy group here to avoid crashing pyrex.vim.
syn keyword pythonInclude import
syn keyword pythonImport import
syn match pythonRaiseFromStatement '\<from\>'
syn match pythonImport '^\s*\zsfrom\>'
if s:Python2Syntax()
if !s:Enabled('g:python_print_as_function')
syn keyword pythonStatement print
endif
syn keyword pythonStatement exec
syn keyword pythonImport as
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
else
syn keyword pythonStatement as nonlocal
syn match pythonStatement '\v\.@<!<await>'
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
syn match pythonStatement '\<async\s\+with\>'
syn match pythonStatement '\<async\s\+for\>'
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonBuiltinObj,pythonBuiltinFunc
endif
"
" Operators
"
syn keyword pythonOperator and in is not or
if s:Enabled('g:python_highlight_operators')
syn match pythonOperator '\V=\|-\|+\|*\|@\|/\|%\|&\||\|^\|~\|<\|>\|!='
endif
syn match pythonError '[$?]\|\([-+@%&|^~]\)\1\{1,}\|\([=*/<>]\)\2\{2,}\|\([+@/%&|^~<>]\)\3\@![-+*@/%&|^~<>]\|\*\*[*@/%&|^<>]\|=[*@/%&|^<>]\|-[+*@/%&|^~<]\|[<!>]\+=\{2,}\|!\{2,}=\+' display
"
" Decorators (new in Python 2.4)
syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
"
syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite
if s:Python2Syntax()
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained
else
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained
endif
syn match pythonDot '\.' display containedin=pythonDottedName
"
" Comments
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
syn match pythonRun "\%^#!.*$"
syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
syn keyword pythonTodo TODO FIXME XXX contained
"
syn match pythonComment '#.*$' display contains=pythonTodo,@Spell
if !s:Enabled('g:python_highlight_file_headers_as_comments')
syn match pythonRun '\%^#!.*$'
syn match pythonCoding '\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$'
endif
syn keyword pythonTodo TODO FIXME XXX contained
"
" Errors
syn match pythonError "\<\d\+\D\+\>" display
syn match pythonError "[$?]" display
syn match pythonError "[-+&|]\{2,}" display
syn match pythonError "[=]\{3,}" display
"
" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline
" statements. For now I don't know how to work around this.
if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0
syn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 display
syn match pythonError '\<\d\+[^0-9[:space:]]\+\>' display
" Mixing spaces and tabs also may be used for pretty formatting multiline
" statements
if s:Enabled('g:python_highlight_indent_errors')
syn match pythonIndentError '^\s*\%( \t\|\t \)\s*\S'me=e-1 display
endif
" Trailing space errors
if exists("python_highlight_space_errors") && python_highlight_space_errors != 0
syn match pythonSpaceError "\s\+$" display
if s:Enabled('g:python_highlight_space_errors')
syn match pythonSpaceError '\s\+$' display
endif
"
" Strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell
"
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonEscape "\\\o\o\=\o\=" display contained
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
syn match pythonEscape "\\x\x\{2}" display contained
syn match pythonEscapeError "\\x\x\=\X" display contained
syn match pythonEscape "\\$"
if s:Python2Syntax()
" Python 2 strings
syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+[bB]\="""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonString start=+[bB]\='''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
else
" Python 3 byte strings
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
syn region pythonBytes start=+[bB]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
syn region pythonBytes start=+[bB]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
" Byte-Strings
syn region pythonBString start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell
syn region pythonBString start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell
syn region pythonBString start=+[bB]"""+ end=+"""+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonBString start=+[bB]'''+ end=+'''+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn match pythonBEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonBEscape "\\\o\o\=\o\=" display contained
syn match pythonBEscapeError "\\\o\{,2}[89]" display contained
syn match pythonBEscape "\\x\x\{2}" display contained
syn match pythonBEscapeError "\\x\x\=\X" display contained
syn match pythonBEscape "\\$"
" Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn match pythonUniEscape "\\u\x\{4}" display contained
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
syn match pythonUniEscape "\\U\x\{8}" display contained
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
" Raw strings
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn match pythonRawEscape +\\['"]+ display transparent contained
" Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0
" String formatting
syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString
syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString
syn match pythonBytesError '.\+' display contained
syn match pythonBytesContent '[\u0000-\u00ff]\+' display contained contains=pythonBytesEscape,pythonBytesEscapeError
endif
if exists("python_highlight_doctests") && python_highlight_doctests != 0
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
syn match pythonBytesEscape '\\\o\o\=\o\=' display contained
syn match pythonBytesEscapeError '\\\o\{,2}[89]' display contained
syn match pythonBytesEscape '\\x\x\{2}' display contained
syn match pythonBytesEscapeError '\\x\x\=\X' display contained
syn match pythonBytesEscape '\\$'
syn match pythonUniEscape '\\u\x\{4}' display contained
syn match pythonUniEscapeError '\\u\x\{,3}\X' display contained
syn match pythonUniEscape '\\U\x\{8}' display contained
syn match pythonUniEscapeError '\\U\x\{,7}\X' display contained
syn match pythonUniEscape '\\N{[A-Z ]\+}' display contained
syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
if s:Python2Syntax()
" Python 2 Unicode strings
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonUniString start=+[uU]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonUniString start=+[uU]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
else
" Python 3 strings
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonString start=+'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonString start=+"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
syn region pythonFString start=+[fF]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonFString start=+[fF]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
endif
if s:Python2Syntax()
" Python 2 Unicode raw strings
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
syn region pythonUniRawString start=+[uU][rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
syn region pythonUniRawString start=+[uU][rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
syn match pythonUniRawEscape '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{4}' display contained
syn match pythonUniRawEscapeError '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{,3}\X' display contained
endif
" Python 2/3 raw strings
if s:Python2Syntax()
syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[bB]\=[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawString start=+[bB]\=[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
else
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawString start=+[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawString start=+[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
endif
syn match pythonRawEscape +\\['"]+ display contained
if s:Enabled('g:python_highlight_string_formatting')
" % operator string formatting
if s:Python2Syntax()
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
else
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
endif
endif
if s:Enabled('g:python_highlight_string_format')
" str.format syntax
if s:Python2Syntax()
syn match pythonStrFormat '{{\|}}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrFormat '{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString,pythonRawFString contains=pythonStrInterpRegion,@pythonExpression
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString,pythonRawFString
endif
endif
if s:Enabled('g:python_highlight_string_templates')
" string.Template format
if s:Python2Syntax()
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
else
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonRawString
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonRawString
endif
endif
if s:Enabled('g:python_highlight_doctests')
" DocTests
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
syn region pythonDocTest start='^\s*>>>' skip=+\\'+ end=+'''+he=s-1 end='^\s*$' contained
syn region pythonDocTest2 start='^\s*>>>' skip=+\\"+ end=+"""+he=s-1 end='^\s*$' contained
endif
"
" Numbers (ints, longs, floats, complex)
syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display
syn match pythonHexNumber "\<0[xX]\>" display
syn match pythonNumber "\<\d\+[lLjJ]\=\>" display
syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
"
syn match pythonOctalError "\<0\o*[89]\d*[lL]\=\>" display
syn match pythonHexError "\<0[xX]\X\+[lL]\=\>" display
if s:Python2Syntax()
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>' display
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*[lL]\=\>' display
syn match pythonBinError '\<0[bB][01]*\D\+\d*[lL]\=\>' display
if exists("python_highlight_builtins") && python_highlight_builtins != 0
" Builtin functions, types and objects
syn keyword pythonBuiltinObj Ellipsis NotImplemented
syn match pythonHexNumber '\<0[xX]\x\+[lL]\=\>' display
syn match pythonOctNumber '\<0[oO]\o\+[lL]\=\>' display
syn match pythonBinNumber '\<0[bB][01]\+[lL]\=\>' display
syn keyword pythonBuiltinFunc __import__ abs all any apply
syn keyword pythonBuiltinFunc basestring bool buffer bytearray bytes callable
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr
syn keyword pythonBuiltinfunc globals hasattr hash help hex id
syn keyword pythonBuiltinFunc input int intern isinstance
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
syn keyword pythonBuiltinFunc min object oct open ord pow property range
syn keyword pythonBuiltinFunc raw_input reduce reload repr
syn keyword pythonBuiltinFunc reversed round set setattr
syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
syn keyword pythonBuiltinFunc type unichr unicode vars xrange zip
syn match pythonNumberError '\<\d\+\D[lL]\=\>' display
syn match pythonNumber '\<\d[lL]\=\>' display
syn match pythonNumber '\<[0-9]\d\+[lL]\=\>' display
syn match pythonNumber '\<\d\+[lLjJ]\>' display
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*[lL]\=\>' display
syn match pythonBinError '\<0[bB][01]*[2-9]\d*[lL]\=\>' display
syn match pythonFloat '\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' display
syn match pythonFloat '\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=' display
else
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*\>' display
" pythonHexError comes after pythonOctError so that 0xffffl is pythonHexError
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\x*\>' display
syn match pythonBinError '\<0[bB][01]*\D\+\d*\>' display
syn match pythonHexNumber '\<0[xX][_0-9a-fA-F]*\x\>' display
syn match pythonOctNumber '\<0[oO][_0-7]*\o\>' display
syn match pythonBinNumber '\<0[bB][_01]*[01]\>' display
syn match pythonNumberError '\<\d[_0-9]*\D\>' display
syn match pythonNumberError '\<0[_0-9]\+\>' display
syn match pythonNumberError '\<0_x\S*\>' display
syn match pythonNumberError '\<0[bBxXoO][_0-9a-fA-F]*_\>' display
syn match pythonNumberError '\<\d[_0-9]*_\>' display
syn match pythonNumber '\<\d\>' display
syn match pythonNumber '\<[1-9][_0-9]*\d\>' display
syn match pythonNumber '\<\d[jJ]\>' display
syn match pythonNumber '\<[1-9][_0-9]*\d[jJ]\>' display
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*\>' display
syn match pythonBinError '\<0[bB][01]*[2-9]\d*\>' display
syn match pythonFloat '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
endif
if exists("python_highlight_exceptions") && python_highlight_exceptions != 0
" Builtin exceptions and warnings
syn keyword pythonExClass BaseException
syn keyword pythonExClass Exception StandardError ArithmeticError
syn keyword pythonExClass LookupError EnvironmentError
"
" Builtin objects and types
"
syn keyword pythonExClass AssertionError AttributeError EOFError
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
syn keyword pythonExClass ImportError IndexError KeyError
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
syn keyword pythonExClass NotImplementedError OSError OverflowError
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
syn keyword pythonExClass SyntaxError IndentationError TabError
syn keyword pythonExClass SystemError SystemExit TypeError
syn keyword pythonExClass UnboundLocalError UnicodeError
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
syn keyword pythonExClass UnicodeTranslateError ValueError
syn keyword pythonExClass WindowsError ZeroDivisionError
syn keyword pythonExClass Warning UserWarning DeprecationWarning
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
syn keyword pythonExClass RuntimeWarning FutureWarning OverflowWarning
syn keyword pythonExClass ImportWarning UnicodeWarning
if s:Enabled('g:python_highlight_builtin_objs')
syn keyword pythonNone None
syn keyword pythonBoolean True False
syn keyword pythonBuiltinObj Ellipsis NotImplemented
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
endif
if exists("python_slow_sync") && python_slow_sync != 0
"
" Builtin functions
"
if s:Enabled('g:python_highlight_builtin_funcs')
let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip'
if s:Python2Syntax()
let s:funcs_re .= '|apply|basestring|buffer|cmp|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange'
if s:Enabled('g:python_print_as_function')
let s:funcs_re .= '|print'
endif
else
let s:funcs_re .= '|ascii|exec|print'
endif
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
let s:funcs_re .= '\=@!'
endif
execute s:funcs_re . ''''
unlet s:funcs_re
endif
"
" Builtin exceptions and warnings
"
if s:Enabled('g:python_highlight_exceptions')
let s:exs_re = 'BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDepricationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning'
if s:Python2Syntax()
let s:exs_re .= '|StandardError'
else
let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
endif
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'''
unlet s:exs_re
endif
if s:Enabled('g:python_slow_sync')
syn sync minlines=2000
else
" This is fast but code inside triple quoted strings screws it up. It
" is impossible to fix because the only way to know if you are inside a
" triple quoted string is to start from the beginning of the file.
syn sync match pythonSync grouphere NONE "):$"
syn sync match pythonSync grouphere NONE '):$'
syn sync maxlines=200
endif
if version >= 508 || !exists("did_python_syn_inits")
if version <= 508
if v:version >= 508 || !exists('did_python_syn_inits')
if v:version <= 508
let did_python_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pythonStatement Statement
HiLink pythonImport Statement
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonStatement Statement
HiLink pythonRaiseFromStatement Statement
HiLink pythonImport Include
HiLink pythonFunction Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonException Exception
HiLink pythonOperator Operator
HiLink pythonDecorator Define
HiLink pythonDecorator Define
HiLink pythonDottedName Function
HiLink pythonDot Normal
HiLink pythonComment Comment
HiLink pythonCoding Special
HiLink pythonRun Special
HiLink pythonTodo Todo
HiLink pythonComment Comment
if !s:Enabled('g:python_highlight_file_headers_as_comments')
HiLink pythonCoding Special
HiLink pythonRun Special
endif
HiLink pythonTodo Todo
HiLink pythonError Error
HiLink pythonIndentError Error
HiLink pythonSpaceError Error
HiLink pythonError Error
HiLink pythonIndentError Error
HiLink pythonSpaceError Error
HiLink pythonString String
HiLink pythonBString String
HiLink pythonUniString String
HiLink pythonRawString String
HiLink pythonUniRawString String
HiLink pythonString String
HiLink pythonRawString String
HiLink pythonRawEscape Special
HiLink pythonEscape Special
HiLink pythonBEscape Special
HiLink pythonEscapeError Error
HiLink pythonBEscapeError Error
HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error
HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error
HiLink pythonUniEscape Special
HiLink pythonUniEscapeError Error
HiLink pythonStrFormat Special
if s:Python2Syntax()
HiLink pythonUniString String
HiLink pythonUniRawString String
HiLink pythonUniRawEscape Special
HiLink pythonUniRawEscapeError Error
else
HiLink pythonBytes String
HiLink pythonRawBytes String
HiLink pythonBytesContent String
HiLink pythonBytesError Error
HiLink pythonBytesEscape Special
HiLink pythonBytesEscapeError Error
HiLink pythonFString String
HiLink pythonRawFString String
HiLink pythonStrInterpRegion Special
endif
HiLink pythonDocTest Special
HiLink pythonDocTest2 Special
HiLink pythonStrFormatting Special
HiLink pythonStrFormat Special
HiLink pythonStrTemplate Special
HiLink pythonNumber Number
HiLink pythonHexNumber Number
HiLink pythonFloat Float
HiLink pythonOctalError Error
HiLink pythonHexError Error
HiLink pythonDocTest Special
HiLink pythonDocTest2 Special
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function
HiLink pythonNumber Number
HiLink pythonHexNumber Number
HiLink pythonOctNumber Number
HiLink pythonBinNumber Number
HiLink pythonFloat Float
HiLink pythonNumberError Error
HiLink pythonOctError Error
HiLink pythonHexError Error
HiLink pythonBinError Error
HiLink pythonExClass Structure
HiLink pythonBoolean Boolean
HiLink pythonNone Constant
HiLink pythonBuiltinObj Structure
HiLink pythonBuiltinFunc Function
HiLink pythonExClass Structure
HiLink pythonClassVar Identifier
delcommand HiLink
endif
let b:current_syntax = "python"
let b:current_syntax = 'python'
endif

View File

@@ -59,7 +59,7 @@ syn keyword qmlLabel case default
syn keyword qmlException try catch finally throw
syn keyword qmlMessage alert confirm prompt status
syn keyword qmlGlobal self
syn keyword qmlDeclaration property signal
syn keyword qmlDeclaration property signal readonly
syn keyword qmlReserved abstract boolean byte char class const debugger enum export extends final float goto implements import interface long native package pragma private protected public short static super synchronized throws transient volatile
if get(g:, 'qml_fold', 0)

106
syntax/slime.vim Normal file
View File

@@ -0,0 +1,106 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slime') == -1
" Vim syntax file
" Language: slime
" Maintainer: Andrew Stone <andy@stonean.com>
" Version: 1
" Last Change: 2010 Sep 25
" TODO: Feedback is welcomed.
" Quit when a syntax file is already loaded.
if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'slime'
endif
" Allows a per line syntax evaluation.
let b:elixir_no_expensive = 1
" Include Elixir syntax highlighting
syn include @slimeElixirTop syntax/elixir.vim
unlet! b:current_syntax
" Include Haml syntax highlighting
syn include @slimeHaml syntax/haml.vim
unlet! b:current_syntax
syn match slimeBegin "^\s*\(&[^= ]\)\@!" nextgroup=slimeTag,slimeClassChar,slimeIdChar,slimeElixir
syn region elixirCurlyBlock start="{" end="}" contains=@slimeElixirTop contained
syn cluster slimeElixirTop add=elixirCurlyBlock
syn cluster slimeComponent contains=slimeClassChar,slimeIdChar,slimeWrappedAttrs,slimeElixir,slimeAttr,slimeInlineTagChar
syn keyword slimeDocType contained html 5 1.1 strict frameset mobile basic transitional
syn match slimeDocTypeKeyword "^\s*\(doctype\)\s\+" nextgroup=slimeDocType
syn keyword slimeTodo FIXME TODO NOTE OPTIMIZE XXX contained
syn keyword htmlTagName contained script
syn match slimeTag "\w\+[><]*" contained contains=htmlTagName nextgroup=@slimeComponent
syn match slimeIdChar "#{\@!" contained nextgroup=slimeId
syn match slimeId "\%(\w\|-\)\+" contained nextgroup=@slimeComponent
syn match slimeClassChar "\." contained nextgroup=slimeClass
syn match slimeClass "\%(\w\|-\)\+" contained nextgroup=@slimeComponent
syn match slimeInlineTagChar "\s*:\s*" contained nextgroup=slimeTag,slimeClassChar,slimeIdChar
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimeAttr nextgroup=slimeElixir
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*\[\s*" end="\s*\]\s*" contained contains=slimeAttr nextgroup=slimeElixir
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*(\s*" end="\s*)\s*" contained contains=slimeAttr nextgroup=slimeElixir
syn match slimeAttr /\s*\%(\w\|-\)\+\s*=/me=e-1 contained contains=htmlArg nextgroup=slimeAttrAssignment
syn match slimeAttrAssignment "\s*=\s*" contained nextgroup=slimeWrappedAttrValue,slimeAttrString
syn region slimeWrappedAttrValue start="[^"']" end="\s\|$" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="{" end="}" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="\[" end="\]" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="(" end=")" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
syn region slimeInnerAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr
syn region slimeInnerAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr
syn region slimeInterpolation matchgroup=slimeInterpolationDelimiter start="#{" end="}" contains=@slimeElixirTop containedin=javascriptStringS,javascriptStringD,slimeWrappedAttrs
syn region slimeInterpolation matchgroup=slimeInterpolationDelimiter start="#{{" end="}}" contains=@slimeElixirTop containedin=javascriptStringS,javascriptStringD,slimeWrappedAttrs
syn match slimeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn region slimeElixir matchgroup=slimeElixirOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimeElixirTop keepend
syn region slimeElixir matchgroup=slimeElixirChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimeElixirTop keepend
syn match slimeComment /^\(\s*\)[/].*\(\n\1\s.*\)*/ contains=slimeTodo
syn match slimeText /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ contains=slimeInterpolation
syn match slimeFilter /\s*\w\+:\s*/ contained
syn match slimeHaml /^\(\s*\)\<haml:\>.*\(\n\1\s.*\)*/ contains=@slimeHaml,slimeFilter
syn match slimeIEConditional "\%(^\s*/\)\@<=\[\s*if\>[^]]*]" contained containedin=slimeComment
hi def link slimeAttrString String
hi def link slimeBegin String
hi def link slimeClass Type
hi def link slimeAttr Type
hi def link slimeClassChar Type
hi def link slimeComment Comment
hi def link slimeDocType Identifier
hi def link slimeDocTypeKeyword Keyword
hi def link slimeFilter Keyword
hi def link slimeIEConditional SpecialComment
hi def link slimeId Identifier
hi def link slimeIdChar Identifier
hi def link slimeInnerAttrString String
hi def link slimeInterpolationDelimiter Delimiter
hi def link slimeElixirChar Special
hi def link slimeElixirOutputChar Special
hi def link slimeText String
hi def link slimeTodo Todo
hi def link slimeWrappedAttrValueDelimiter Delimiter
hi def link slimeWrappedAttrsDelimiter Delimiter
hi def link slimeInlineTagChar Delimiter
let b:current_syntax = "slime"
endif

View File

@@ -55,9 +55,11 @@ delfunction s:CommentKeywordMatch
" Literals
" Strings
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftMultilineInterpolatedWrapper oneline
syntax region swiftMultilineString start=/"""/ end=/"""/ contains=swiftMultilineInterpolatedWrapper
syntax region swiftMultilineInterpolatedWrapper start="\v\\\(\s*" end="\v\s*\)" contained containedin=swiftMultilineString contains=swiftInterpolatedString oneline
syntax region swiftInterpolatedWrapper start="\v[^\\]\zs\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper oneline
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper,swiftMultilineInterpolatedWrapper oneline
" Numbers
syntax match swiftNumber "\v<\d+>"
@@ -222,7 +224,7 @@ syntax keyword swiftDebugIdentifier
syntax keyword swiftLineDirective #setline
syntax region swiftTypeWrapper start=":\s*\(\.\)\@!\<\u" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper transparent
syntax region swiftTypeWrapper start=":\s*\(\.\)\@!\<\u" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper,swiftMultilineInterpolatedWrapper transparent
syntax region swiftTypeCastWrapper start="\(as\|is\)\(!\|?\)\=\s\+" end="\v(\s|$|\{)" contains=swiftType,swiftCastKeyword keepend transparent oneline
syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
@@ -257,7 +259,9 @@ highlight default link swiftComment Comment
highlight default link swiftMarker Comment
highlight default link swiftString String
highlight default link swiftMultilineString String
highlight default link swiftInterpolatedWrapper Delimiter
highlight default link swiftMultilineInterpolatedWrapper Delimiter
highlight default link swiftTypeDeclaration Delimiter
highlight default link swiftNumber Number
highlight default link swiftBoolean Boolean

View File

@@ -16,13 +16,16 @@ syn keyword terraValueBool true false on off yes no
syn keyword terraDataTypeBI
\ alicloud_images
\ alicloud_instance_types
\ alicloud_key_pairs
\ alicloud_regions
\ alicloud_vpcs
\ alicloud_zones
\ archive_file
\ atlas_artifact
\ aws_acm_certificate
\ aws_alb
\ aws_alb_listener
\ aws_alb_target_group
\ aws_ami
\ aws_ami_ids
\ aws_autoscaling_groups
@@ -32,36 +35,52 @@ syn keyword terraDataTypeBI
\ aws_caller_identity
\ aws_canonical_user_id
\ aws_cloudformation_stack
\ aws_cloudtrail_service_account
\ aws_db_instance
\ aws_db_snapshot
\ aws_dynamodb_table
\ aws_ebs_snapshot
\ aws_ebs_snapshot_ids
\ aws_ebs_volume
\ aws_ecr_repository
\ aws_ecs_cluster
\ aws_ecs_container_definition
\ aws_ecs_task_definition
\ aws_efs_file_system
\ aws_efs_mount_target
\ aws_eip
\ aws_elastic_beanstalk_solution_stack
\ aws_elasticache_cluster
\ aws_elasticache_replication_group
\ aws_elb_hosted_zone_id
\ aws_elb_service_account
\ aws_iam_account_alias
\ aws_iam_group
\ aws_iam_instance_profile
\ aws_iam_policy_document
\ aws_iam_role
\ aws_iam_server_certificate
\ aws_iam_user
\ aws_instance
\ aws_instances
\ aws_internet_gateway
\ aws_ip_ranges
\ aws_kinesis_stream
\ aws_kms_alias
\ aws_kms_ciphertext
\ aws_kms_secret
\ aws_lb
\ aws_lb_listener
\ aws_lb_target_group
\ aws_nat_gateway
\ aws_partition
\ aws_prefix_list
\ aws_rds_cluster
\ aws_redshift_service_account
\ aws_region
\ aws_route53_zone
\ aws_route_table
\ aws_s3_bucket
\ aws_s3_bucket_object
\ aws_security_group
\ aws_sns_topic
@@ -73,10 +92,21 @@ syn keyword terraDataTypeBI
\ aws_vpc_endpoint_service
\ aws_vpc_peering_connection
\ aws_vpn_gateway
\ azurerm_builtin_role_definition
\ azurerm_client_config
\ azurerm_image
\ azurerm_key_vault_access_policy
\ azurerm_managed_disk
\ azurerm_platform_image
\ azurerm_public_ip
\ azurerm_resource_group
\ azurerm_role_definition
\ azurerm_snapshot
\ azurerm_subnet
\ azurerm_subscription
\ circonus_account
\ circonus_collector
\ cloudstack_template
\ consul_agent_self
\ consul_catalog_nodes
\ consul_catalog_service
@@ -84,28 +114,50 @@ syn keyword terraDataTypeBI
\ consul_keys
\ digitalocean_image
\ dns_a_record_set
\ dns_aaaa_record_set
\ dns_cname_record_set
\ dns_ns_record_set
\ dns_txt_record_set
\ docker_registry_image
\ external
\ fastly_ip_ranges
\ github_team
\ github_user
\ google_active_folder
\ google_client_config
\ google_compute_address
\ google_compute_global_address
\ google_compute_instance_group
\ google_compute_lb_ip_ranges
\ google_compute_network
\ google_compute_subnetwork
\ google_compute_zones
\ google_container_engine_versions
\ google_dns_managed_zone
\ google_iam_policy
\ google_storage_object_signed_url
\ http
\ kubernetes_service
\ kubernetes_storage_class
\ logicmonitor_collectors
\ logicmonitor_device_group
\ newrelic_application
\ ns1_datasource
\ null_data_source
\ oneandone_instance_size
\ opc_compute_image_list_entry
\ opc_compute_network_interface
\ opc_compute_storage_volume_snapshot
\ opc_compute_vnic
\ openstack_dns_zone_v2
\ openstack_images_image_v2
\ openstack_networking_network_v2
\ openstack_networking_secgroup_v2
\ openstack_networking_subnet_v2
\ opsgenie_user
\ ovh_publiccloud_region
\ ovh_publiccloud_regions
\ packet_precreated_ip_block
\ pagerduty_escalation_policy
\ pagerduty_schedule
\ pagerduty_user
@@ -113,11 +165,25 @@ syn keyword terraDataTypeBI
\ profitbricks_datacenter
\ profitbricks_image
\ profitbricks_location
\ profitbricks_resource
\ profitbricks_snapshot
\ rancher_certificate
\ rancher_environment
\ rancher_setting
\ scaleway_bootscript
\ scaleway_image
\ template_cloudinit_config
\ template_file
\ terraform_remote_state
\ triton_image
\ triton_network
\ vsphere_datacenter
\ vsphere_distributed_virtual_switch
\ vsphere_host
\ vsphere_network
\ vsphere_tag
\ vsphere_tag_category
\ vsphere_vmfs_disks
""" end data sources
""" resource
@@ -133,8 +199,13 @@ syn keyword terraResourceTypeBI
\ alicloud_ess_schedule
\ alicloud_forward_entry
\ alicloud_instance
\ alicloud_key_pair
\ alicloud_key_pair_attachment
\ alicloud_nat_gateway
\ alicloud_oss_bucket
\ alicloud_oss_bucket_object
\ alicloud_route_entry
\ alicloud_router_interface
\ alicloud_security_group
\ alicloud_security_group_rule
\ alicloud_slb
@@ -161,12 +232,14 @@ syn keyword terraResourceTypeBI
\ aws_api_gateway_client_certificate
\ aws_api_gateway_deployment
\ aws_api_gateway_domain_name
\ aws_api_gateway_gateway_response
\ aws_api_gateway_integration
\ aws_api_gateway_integration_response
\ aws_api_gateway_method
\ aws_api_gateway_method_response
\ aws_api_gateway_method_settings
\ aws_api_gateway_model
\ aws_api_gateway_request_validator
\ aws_api_gateway_resource
\ aws_api_gateway_rest_api
\ aws_api_gateway_stage
@@ -175,16 +248,22 @@ syn keyword terraResourceTypeBI
\ aws_app_cookie_stickiness_policy
\ aws_appautoscaling_policy
\ aws_appautoscaling_target
\ aws_athena_database
\ aws_athena_named_query
\ aws_autoscaling_attachment
\ aws_autoscaling_group
\ aws_autoscaling_lifecycle_hook
\ aws_autoscaling_notification
\ aws_autoscaling_policy
\ aws_autoscaling_schedule
\ aws_batch_compute_environment
\ aws_batch_job_definition
\ aws_batch_job_queue
\ aws_cloudformation_stack
\ aws_cloudfront_distribution
\ aws_cloudfront_origin_access_identity
\ aws_cloudtrail
\ aws_cloudwatch_dashboard
\ aws_cloudwatch_event_rule
\ aws_cloudwatch_event_target
\ aws_cloudwatch_log_destination
@@ -202,6 +281,8 @@ syn keyword terraResourceTypeBI
\ aws_codedeploy_deployment_group
\ aws_codepipeline
\ aws_cognito_identity_pool
\ aws_cognito_identity_pool_roles_attachment
\ aws_cognito_user_pool
\ aws_config_config_rule
\ aws_config_configuration_recorder
\ aws_config_configuration_recorder_status
@@ -227,9 +308,12 @@ syn keyword terraResourceTypeBI
\ aws_dms_replication_instance
\ aws_dms_replication_subnet_group
\ aws_dms_replication_task
\ aws_dx_connection
\ aws_dx_lag
\ aws_dynamodb_table
\ aws_ebs_snapshot
\ aws_ebs_volume
\ aws_ecr_lifecycle_policy
\ aws_ecr_repository
\ aws_ecr_repository_policy
\ aws_ecs_cluster
@@ -286,6 +370,8 @@ syn keyword terraResourceTypeBI
\ aws_inspector_resource_group
\ aws_instance
\ aws_internet_gateway
\ aws_iot_certificate
\ aws_iot_policy
\ aws_key_pair
\ aws_kinesis_firehose_delivery_stream
\ aws_kinesis_stream
@@ -296,8 +382,13 @@ syn keyword terraResourceTypeBI
\ aws_lambda_function
\ aws_lambda_permission
\ aws_launch_configuration
\ aws_lb
\ aws_lb_cookie_stickiness_policy
\ aws_lb_listener
\ aws_lb_listener_rule
\ aws_lb_ssl_negotiation_policy
\ aws_lb_target_group
\ aws_lb_target_group_attachment
\ aws_lightsail_domain
\ aws_lightsail_instance
\ aws_lightsail_key_pair
@@ -312,6 +403,7 @@ syn keyword terraResourceTypeBI
\ aws_network_acl_rule
\ aws_network_interface
\ aws_network_interface_attachment
\ aws_network_interface_sg_attachment
\ aws_opsworks_application
\ aws_opsworks_custom_layer
\ aws_opsworks_ganglia_layer
@@ -351,13 +443,16 @@ syn keyword terraResourceTypeBI
\ aws_s3_bucket_policy
\ aws_security_group
\ aws_security_group_rule
\ aws_servicecatalog_portfolio
\ aws_ses_active_receipt_rule_set
\ aws_ses_configuration_set
\ aws_ses_domain_dkim
\ aws_ses_domain_identity
\ aws_ses_event_destination
\ aws_ses_receipt_filter
\ aws_ses_receipt_rule
\ aws_ses_receipt_rule_set
\ aws_ses_template
\ aws_sfn_activity
\ aws_sfn_state_machine
\ aws_simpledb_domain
@@ -379,6 +474,7 @@ syn keyword terraResourceTypeBI
\ aws_ssm_parameter
\ aws_ssm_patch_baseline
\ aws_ssm_patch_group
\ aws_ssm_resource_data_sync
\ aws_subnet
\ aws_volume_attachment
\ aws_vpc
@@ -392,8 +488,10 @@ syn keyword terraResourceTypeBI
\ aws_vpn_connection_route
\ aws_vpn_gateway
\ aws_vpn_gateway_attachment
\ aws_vpn_gateway_route_propagation
\ aws_waf_byte_match_set
\ aws_waf_ipset
\ aws_waf_rate_based_rule
\ aws_waf_rule
\ aws_waf_size_constraint_set
\ aws_waf_sql_injection_match_set
@@ -417,25 +515,41 @@ syn keyword terraResourceTypeBI
\ azure_storage_queue
\ azure_storage_service
\ azure_virtual_network
\ azurerm_app_service
\ azurerm_app_service_plan
\ azurerm_application_gateway
\ azurerm_application_insights
\ azurerm_automation_account
\ azurerm_automation_credential
\ azurerm_automation_runbook
\ azurerm_automation_schedule
\ azurerm_availability_set
\ azurerm_cdn_endpoint
\ azurerm_cdn_profile
\ azurerm_container_group
\ azurerm_container_registry
\ azurerm_container_service
\ azurerm_cosmosdb_account
\ azurerm_dns_a_record
\ azurerm_dns_aaaa_record
\ azurerm_dns_cname_record
\ azurerm_dns_mx_record
\ azurerm_dns_ns_record
\ azurerm_dns_ptr_record
\ azurerm_dns_srv_record
\ azurerm_dns_txt_record
\ azurerm_dns_zone
\ azurerm_eventgrid_topic
\ azurerm_eventhub
\ azurerm_eventhub_authorization_rule
\ azurerm_eventhub_consumer_group
\ azurerm_eventhub_namespace
\ azurerm_express_route_circuit
\ azurerm_image
\ azurerm_key_vault
\ azurerm_key_vault_certificate
\ azurerm_key_vault_key
\ azurerm_key_vault_secret
\ azurerm_lb
\ azurerm_lb_backend_address_pool
\ azurerm_lb_nat_pool
@@ -443,19 +557,33 @@ syn keyword terraResourceTypeBI
\ azurerm_lb_probe
\ azurerm_lb_rule
\ azurerm_local_network_gateway
\ azurerm_log_analytics_workspace
\ azurerm_managed_disk
\ azurerm_mysql_configuration
\ azurerm_mysql_database
\ azurerm_mysql_firewall_rule
\ azurerm_mysql_server
\ azurerm_network_interface
\ azurerm_network_security_group
\ azurerm_network_security_rule
\ azurerm_postgresql_configuration
\ azurerm_postgresql_database
\ azurerm_postgresql_firewall_rule
\ azurerm_postgresql_server
\ azurerm_public_ip
\ azurerm_redis_cache
\ azurerm_redis_firewall_rule
\ azurerm_resource_group
\ azurerm_role_assignment
\ azurerm_role_definition
\ azurerm_route
\ azurerm_route_table
\ azurerm_search_service
\ azurerm_servicebus_namespace
\ azurerm_servicebus_queue
\ azurerm_servicebus_subscription
\ azurerm_servicebus_topic
\ azurerm_snapshot
\ azurerm_sql_database
\ azurerm_sql_elasticpool
\ azurerm_sql_firewall_rule
@@ -498,6 +626,8 @@ syn keyword terraResourceTypeBI
\ clc_public_ip
\ clc_server
\ cloudflare_record
\ cloudscale_floating_ip
\ cloudscale_server
\ cloudstack_affinity_group
\ cloudstack_disk
\ cloudstack_egress_firewall
@@ -525,6 +655,7 @@ syn keyword terraResourceTypeBI
\ cobbler_distro
\ cobbler_kickstart_file
\ cobbler_profile
\ cobbler_repo
\ cobbler_snippet
\ cobbler_system
\ consul_agent_service
@@ -535,12 +666,14 @@ syn keyword terraResourceTypeBI
\ consul_prepared_query
\ consul_service
\ datadog_downtime
\ datadog_metric_metadata
\ datadog_monitor
\ datadog_timeboard
\ datadog_user
\ digitalocean_certificate
\ digitalocean_domain
\ digitalocean_droplet
\ digitalocean_firewall
\ digitalocean_floating_ip
\ digitalocean_loadbalancer
\ digitalocean_record
@@ -551,6 +684,7 @@ syn keyword terraResourceTypeBI
\ dns_a_record_set
\ dns_aaaa_record_set
\ dns_cname_record
\ dns_ns_record_set
\ dns_ptr_record
\ dnsimple_record
\ docker_container
@@ -565,16 +699,21 @@ syn keyword terraResourceTypeBI
\ github_organization_webhook
\ github_repository
\ github_repository_collaborator
\ github_repository_deploy_key
\ github_repository_webhook
\ github_team
\ github_team_membership
\ github_team_repository
\ gitlab_deploy_key
\ gitlab_group
\ gitlab_label
\ gitlab_project
\ gitlab_project_hook
\ gitlab_user
\ google_bigquery_dataset
\ google_bigquery_table
\ google_bigtable_instance
\ google_bigtable_table
\ google_compute_address
\ google_compute_autoscaler
\ google_compute_backend_bucket
@@ -593,31 +732,59 @@ syn keyword terraResourceTypeBI
\ google_compute_instance_group_manager
\ google_compute_instance_template
\ google_compute_network
\ google_compute_network_peering
\ google_compute_project_metadata
\ google_compute_project_metadata_item
\ google_compute_region_autoscaler
\ google_compute_region_backend_service
\ google_compute_region_instance_group_manager
\ google_compute_route
\ google_compute_router
\ google_compute_router_interface
\ google_compute_router_peer
\ google_compute_shared_vpc_host_project
\ google_compute_shared_vpc_service_project
\ google_compute_snapshot
\ google_compute_ssl_certificate
\ google_compute_subnetwork
\ google_compute_target_http_proxy
\ google_compute_target_https_proxy
\ google_compute_target_pool
\ google_compute_target_ssl_proxy
\ google_compute_target_tcp_proxy
\ google_compute_url_map
\ google_compute_vpn_gateway
\ google_compute_vpn_tunnel
\ google_container_cluster
\ google_container_node_pool
\ google_dataproc_cluster
\ google_dns_managed_zone
\ google_dns_record_set
\ google_folder
\ google_folder_iam_policy
\ google_kms_crypto_key
\ google_kms_key_ring
\ google_logging_billing_account_sink
\ google_logging_folder_sink
\ google_logging_project_sink
\ google_organization_iam_custom_role
\ google_organization_policy
\ google_project
\ google_project_iam_binding
\ google_project_iam_custom_role
\ google_project_iam_member
\ google_project_iam_policy
\ google_project_service
\ google_project_services
\ google_pubsub_subscription
\ google_pubsub_topic
\ google_runtimeconfig_config
\ google_runtimeconfig_variable
\ google_service_account
\ google_service_account_key
\ google_sourcerepo_repository
\ google_spanner_database
\ google_spanner_instance
\ google_sql_database
\ google_sql_database_instance
\ google_sql_user
@@ -626,6 +793,7 @@ syn keyword terraResourceTypeBI
\ google_storage_bucket_object
\ google_storage_object_acl
\ heroku_addon
\ heroku_addon_attachment
\ heroku_app
\ heroku_app_feature
\ heroku_cert
@@ -639,10 +807,12 @@ syn keyword terraResourceTypeBI
\ icinga2_hostgroup
\ icinga2_service
\ ignition_config
\ ignition_directory
\ ignition_disk
\ ignition_file
\ ignition_filesystem
\ ignition_group
\ ignition_link
\ ignition_networkd_unit
\ ignition_raid
\ ignition_systemd_unit
@@ -656,9 +826,13 @@ syn keyword terraResourceTypeBI
\ kubernetes_namespace
\ kubernetes_persistent_volume
\ kubernetes_persistent_volume_claim
\ kubernetes_pod
\ kubernetes_replication_controller
\ kubernetes_resource_quota
\ kubernetes_secret
\ kubernetes_service
\ kubernetes_service_account
\ kubernetes_storage_class
\ librato_alert
\ librato_metric
\ librato_service
@@ -667,6 +841,9 @@ syn keyword terraResourceTypeBI
\ local_file
\ logentries_log
\ logentries_logset
\ logicmonitor_collector_group
\ logicmonitor_device
\ logicmonitor_device_group
\ mailgun_domain
\ mysql_database
\ mysql_grant
@@ -675,6 +852,7 @@ syn keyword terraResourceTypeBI
\ newrelic_alert_condition
\ newrelic_alert_policy
\ newrelic_alert_policy_channel
\ newrelic_nrql_alert_condition
\ nomad_job
\ null_resource
\ oneandone_firewall_policy
@@ -685,9 +863,37 @@ syn keyword terraResourceTypeBI
\ oneandone_server
\ oneandone_shared_storage
\ oneandone_vpn
\ opc_compute_acl
\ opc_compute_image_list
\ opc_compute_image_list_entry
\ opc_compute_instance
\ opc_compute_ip_address_association
\ opc_compute_ip_address_prefix_set
\ opc_compute_ip_address_reservation
\ opc_compute_ip_association
\ opc_compute_ip_network
\ opc_compute_ip_network_exchange
\ opc_compute_ip_reservation
\ opc_compute_route
\ opc_compute_sec_rule
\ opc_compute_security_application
\ opc_compute_security_association
\ opc_compute_security_ip_list
\ opc_compute_security_list
\ opc_compute_security_protocol
\ opc_compute_security_rule
\ opc_compute_snapshot
\ opc_compute_ssh_key
\ opc_compute_storage_volume
\ opc_compute_storage_volume_snapshot
\ opc_compute_vnic_set
\ opc_database_service_instance
\ opc_storage_container
\ opc_storage_object
\ openstack_blockstorage_volume_attach_v2
\ openstack_blockstorage_volume_v1
\ openstack_blockstorage_volume_v2
\ openstack_compute_flavor_v2
\ openstack_compute_floatingip_associate_v2
\ openstack_compute_floatingip_v2
\ openstack_compute_instance_v2
@@ -700,6 +906,8 @@ syn keyword terraResourceTypeBI
\ openstack_fw_firewall_v1
\ openstack_fw_policy_v1
\ openstack_fw_rule_v1
\ openstack_identity_project_v3
\ openstack_identity_user_v3
\ openstack_images_image_v2
\ openstack_lb_listener_v2
\ openstack_lb_loadbalancer_v2
@@ -720,6 +928,7 @@ syn keyword terraResourceTypeBI
\ openstack_networking_secgroup_v2
\ openstack_networking_subnet_v2
\ openstack_objectstorage_container_v1
\ openstack_objectstorage_object_v1
\ opsgenie_team
\ opsgenie_user
\ ovh_publiccloud_private_network
@@ -727,15 +936,20 @@ syn keyword terraResourceTypeBI
\ ovh_publiccloud_user
\ ovh_vrack_publiccloud_attachment
\ packet_device
\ packet_ip_attachment
\ packet_project
\ packet_reserved_ip_block
\ packet_ssh_key
\ packet_volume
\ packet_volume_attachment
\ pagerduty_addon
\ pagerduty_escalation_policy
\ pagerduty_maintenance_window
\ pagerduty_schedule
\ pagerduty_service
\ pagerduty_service_integration
\ pagerduty_team
\ pagerduty_team_membership
\ pagerduty_user
\ postgresql_database
\ postgresql_extension
@@ -744,11 +958,16 @@ syn keyword terraResourceTypeBI
\ powerdns_record
\ profitbricks_datacenter
\ profitbricks_firewall
\ profitbricks_group
\ profitbricks_ipblock
\ profitbricks_ipfailover
\ profitbricks_lan
\ profitbricks_loadbalancer
\ profitbricks_nic
\ profitbricks_server
\ profitbricks_share
\ profitbricks_snapshot
\ profitbricks_user
\ profitbricks_volume
\ rabbitmq_binding
\ rabbitmq_exchange
@@ -763,10 +982,13 @@ syn keyword terraResourceTypeBI
\ rancher_registration_token
\ rancher_registry
\ rancher_registry_credential
\ rancher_secret
\ rancher_stack
\ random_id
\ random_integer
\ random_pet
\ random_shuffle
\ random_string
\ rundeck_job
\ rundeck_private_key
\ rundeck_project
@@ -792,6 +1014,7 @@ syn keyword terraResourceTypeBI
\ triton_firewall_rule
\ triton_key
\ triton_machine
\ triton_snapshot
\ triton_vlan
\ ultradns_dirpool
\ ultradns_probe_http
@@ -805,10 +1028,22 @@ syn keyword terraResourceTypeBI
\ vcd_network
\ vcd_snat
\ vcd_vapp
\ vcd_vapp_vm
\ vsphere_datacenter
\ vsphere_distributed_port_group
\ vsphere_distributed_virtual_switch
\ vsphere_file
\ vsphere_folder
\ vsphere_host_port_group
\ vsphere_host_virtual_switch
\ vsphere_license
\ vsphere_nas_datastore
\ vsphere_tag
\ vsphere_tag_category
\ vsphere_virtual_disk
\ vsphere_virtual_machine
\ vsphere_virtual_machine_snapshot
\ vsphere_vmfs_datastore
""" end resources
syn keyword terraTodo contained TODO FIXME XXX BUG

View File

@@ -19,9 +19,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
" - Switch on syntax highlighting by adding "syntax enable" to .vimrc.
"
if version < 600
if v:version < 600
syntax clear
elseif exists("b:current_syntax")
elseif exists('b:current_syntax')
finish
endif
@@ -52,6 +52,7 @@ syn keyword tmuxCmds
\ confirm
\ confirm-before
\ copy-mode
\ copy-mode-vi
\ delete-buffer
\ deleteb
\ detach
@@ -327,6 +328,6 @@ hi def link tmuxTodo Todo
hi def link tmuxVariable Constant
hi def link tmuxVariableExpansion Constant
let b:current_syntax = "tmux"
let b:current_syntax = 'tmux'
endif

View File

@@ -38,7 +38,9 @@ syn match tomlBoolean /\<\%(true\|false\)\>/ display
hi def link tomlBoolean Boolean
" https://tools.ietf.org/html/rfc3339
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}/ display
syn match tomlDate /\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?/ display
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}[T ]\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)\?/ display
hi def link tomlDate Constant
syn region tomlKeyDq oneline start=/"/ end=/"/ contains=tomlEscape contained