Compare commits

...

17 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
Adam Stankiewicz
30c87b73de Automatically set vb format, closes #243 2017-11-19 21:51:43 +01:00
Adam Stankiewicz
1713d35f06 Add cmake support, closes #245 2017-11-19 21:46:44 +01:00
Adam Stankiewicz
5ddfa1ac28 Remove openscad, fixes #249 2017-11-19 21:44:15 +01:00
Adam Stankiewicz
dbe9bc927f Change nix provider, closes #244 2017-11-19 21:34:38 +01:00
Adam Stankiewicz
d219055bc8 Update 2017-11-19 21:27:05 +01:00
Adam Stankiewicz
0e9041f29a Update README.md 2017-11-16 18:47:04 +01:00
Adam Stankiewicz
a0b8a6e77f 3ms -> 17ms 2017-11-16 16:58:13 +01:00
Adam Stankiewicz
a61ab44810 Update README.md 2017-10-27 17:28:29 +02:00
Adam Stankiewicz
dd4b5cbdd6 fix typo 2017-10-19 22:37:39 +02:00
76 changed files with 9133 additions and 1388 deletions

View File

@@ -8,13 +8,13 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 100+ times faster** than 100+ packages it consist of.
- Solid syntax and indentation support. Only the best language packs.
- It **installs and updates 100+ times faster** than 100+ packages it consists of.
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
\*To be completely honest, concatenated `ftdetect` script takes around `3ms` to load.
\*To be completely honest, concatenated `ftdetect` script takes up to `17ms` to load.
## Installation
@@ -46,8 +46,10 @@ 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)
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
- [cql](https://github.com/elubow/cql-vim) (syntax)
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
@@ -77,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)
@@ -92,12 +95,11 @@ If you need full functionality of any plugin, please use it directly with your p
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin)
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, ftplugin)
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
- [openscad](https://github.com/sirtaj/vim-openscad) (syntax, ftplugin)
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
@@ -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,36 +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"
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)
@@ -68,5 +75,4 @@ if get(g:, "terraform_align", 1)
setlocal shiftwidth=2
endif
endif

View File

@@ -49,7 +49,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
" and generic Flow type annotations (http://flowtype.org/).
syn region jsxRegion
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
\ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+
\ end=+/>+

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': [
\ [],

14
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,8 +118,10 @@ 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
coffee-script:kchmck/vim-coffee-script
cryptol:victoredwardocallaghan/cryptol.vim
crystal:rhysd/vim-crystal
@@ -136,7 +138,6 @@ PACKS="
fsharp:fsharp/vim-fsharp:_BASIC
git:tpope/vim-git
gmpl:maelvalais/gmpl.vim
openscad:sirtaj/vim-openscad
glsl:tikhomirov/vim-glsl
gnuplot:vim-scripts/gnuplot-syntax-highlighting
go:fatih/vim-go:_BASIC
@@ -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
@@ -165,7 +167,7 @@ PACKS="
mathematica:rsmenon/vim-mathematica
nginx:chr4/nginx.vim
nim:zah/nim.vim:_BASIC
nix:spwhitt/vim-nix
nix:LnL7/vim-nix
objc:b4winckler/vim-objc
ocaml:jrk/vim-ocaml
octave:vim-scripts/octave.vim--
@@ -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

@@ -6,10 +6,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
"
" compiler/go.vim: Vim compiler file for Go.
if exists("current_compiler")
if exists("g:current_compiler")
finish
endif
let current_compiler = "go"
let g:current_compiler = "go"
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>

View File

@@ -9,3 +9,9 @@ if !exists('g:vim_json_syntax_conceal')
endif
let g:filetype_euphoria = 'elixir'
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
augroup END
let g:python_highlight_all = 1

View File

@@ -9,6 +9,12 @@ if !exists('g:vim_json_syntax_conceal')
endif
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
@@ -78,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
@@ -91,6 +102,10 @@ augroup filetypedetect
autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot setlocal filetype=clojure
augroup END
augroup filetypedetect
" cmake:pboettch/vim-cmake-syntax
augroup END
augroup filetypedetect
" coffee-script:kchmck/vim-coffee-script
" Language: CoffeeScript
@@ -229,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
@@ -295,12 +310,6 @@ augroup filetypedetect
au BufRead,BufNewFile *.mod set filetype=gmpl
augroup END
augroup filetypedetect
" openscad:sirtaj/vim-openscad
au BufRead,BufNewFile *.scad setfiletype openscad
an 50.80.265 &Syntax.NO.OpenSCAD :cal SetSyn("openscad")<CR>
augroup END
augroup filetypedetect
" glsl:tikhomirov/vim-glsl
" Language: OpenGL Shading Language
@@ -339,15 +348,18 @@ function! s:gofiletype_post()
let &g:fileencodings = s:current_fileencodings
endfunction
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre("go")
au BufReadPost *.go call s:gofiletype_post()
augroup vim-go-filetype
autocmd!
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre("go")
au BufReadPost *.go call s:gofiletype_post()
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post()
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post()
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
augroup end
" vim: sw=2 ts=2 et
augroup END
@@ -390,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
@@ -434,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
@@ -487,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
@@ -588,8 +621,14 @@ au BufNewFile,BufRead *.nim,*.nims set filetype=nim
augroup END
augroup filetypedetect
" nix:spwhitt/vim-nix
autocmd BufNewFile,BufRead *.nix setfiletype nix
" nix:LnL7/vim-nix
" Vim filetype detect
" Language: Nix
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
" URL: https://github.com/LnL7/vim-nix
au BufRead,BufNewFile *.nix set filetype=nix
au FileType nix setl sw=2 sts=2 et iskeyword+=-
augroup END
augroup filetypedetect
@@ -743,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
@@ -756,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
@@ -919,7 +962,7 @@ fun! s:DetectScala()
endif
endfun
au BufRead,BufNewFile *.scala set filetype=scala
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
au BufRead,BufNewFile * call s:DetectScala()
" Install vim-sbt for additional syntax highlighting.
@@ -937,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
@@ -1021,8 +1069,8 @@ augroup END
augroup filetypedetect
" toml:cespare/vim-toml
" Rust uses several TOML config files that are not named with .toml.
autocmd BufNewFile,BufRead *.toml,Cargo.lock,*/.cargo/config set filetype=toml
" Go dep and Rust use several TOML config files that are not named with .toml.
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config set filetype=toml
augroup END
augroup filetypedetect

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

@@ -1,17 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin=1
" Vim filetype plugin
" Language: Nix
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
" URL: https://github.com/LnL7/vim-nix
setlocal comments=
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
setlocal comments=:#
setlocal commentstring=#\ %s
" Nixpkgs indent settings
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
endif

View File

@@ -1,18 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
" Blatantly stolen from vim74\ftplugin\c.vim
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal fo-=t fo+=croql
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
" Win32 can filter files in the browse dialog
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "OpenSCAD Source Files (*.scad)\t*.scad\n" .
\ "All Files (*.*)\t*.*\n"
endif
endif

View File

@@ -15,7 +15,7 @@ setlocal commentstring=//\ %s
" " and insert the comment leader when hitting <CR> or using "o".
setlocal formatoptions-=t formatoptions+=croql
setlocal suffixesadd+=.ts
setlocal suffixesadd+=.ts,.tsx
let b:undo_ftplugin = "setl fo< ofu< com< cms<"

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'])

View File

@@ -19,7 +19,7 @@ let b:did_indent = 1
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim\|php\|' .
\ 'component\|slot\|prepend'
\ 'component\|slot\|prepend\|auth\|guest'
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
if exists('g:blade_custom_directives_pairs')

View File

@@ -192,11 +192,7 @@ if exists("*searchpairpos")
" Check if form is a reader conditional, that is, it is prefixed by #?
" or @#?
function! s:is_reader_conditional_special_case(position)
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
return 1
endif
return 0
return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
endfunction
" Returns 1 for opening brackets, -1 for _anything else_.
@@ -294,6 +290,19 @@ if exists("*searchpairpos")
return paren
endif
" If the keyword begins with #, check if it is an anonymous
" function or set, in which case we indent by the shiftwidth
" (minus one if g:clojure_align_subforms = 1), or if it is
" ignored, in which case we use the ( position for indent.
if w[0] == "#"
" TODO: Handle #=() and other rare reader invocations?
if w[1] == '(' || w[1] == '{'
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
elseif w[1] == '_'
return paren
endif
endif
" Test words without namespace qualifiers and leading reader macro
" metacharacters.
"

93
indent/cmake.vim Normal file
View File

@@ -0,0 +1,93 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cmake') == -1
" Vim indent file
" Language: CMake (ft=cmake)
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
" Last Change: 2017 Aug 30
"
" Licence: The CMake license applies to this file. See
" https://cmake.org/licensing
" This implies that distribution with Vim is allowed
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
let s:keepcpo= &cpo
set cpo&vim
setlocal indentexpr=CMakeGetIndent(v:lnum)
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
" Only define the function once.
if exists("*CMakeGetIndent")
finish
endif
fun! CMakeGetIndent(lnum)
let this_line = getline(a:lnum)
" Find a non-blank line above the current line.
let lnum = a:lnum
let lnum = prevnonblank(lnum - 1)
let previous_line = getline(lnum)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let ind = indent(lnum)
let or = '\|'
" Regular expressions used by line indentation function.
let cmake_regex_comment = '#.*'
let cmake_regex_identifier = '[A-Za-z][A-Za-z0-9_]*'
let cmake_regex_quoted = '"\([^"\\]\|\\.\)*"'
let cmake_regex_arguments = '\(' . cmake_regex_quoted .
\ or . '\$(' . cmake_regex_identifier . ')' .
\ or . '[^()\\#"]' . or . '\\.' . '\)*'
let cmake_indent_comment_line = '^\s*' . cmake_regex_comment
let cmake_indent_blank_regex = '^\s*$'
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
\ '\s*(' . cmake_regex_arguments .
\ '\(' . cmake_regex_comment . '\)\?$'
let cmake_indent_close_regex = '^' . cmake_regex_arguments .
\ ')\s*' .
\ '\(' . cmake_regex_comment . '\)\?$'
let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
" Add
if previous_line =~? cmake_indent_comment_line " Handle comments
let ind = ind
else
if previous_line =~? cmake_indent_begin_regex
let ind = ind + shiftwidth()
endif
if previous_line =~? cmake_indent_open_regex
let ind = ind + shiftwidth()
endif
endif
" Subtract
if this_line =~? cmake_indent_end_regex
let ind = ind - shiftwidth()
endif
if previous_line =~? cmake_indent_close_regex
let ind = ind - shiftwidth()
endif
return ind
endfun
let &cpo = s:keepcpo
unlet s:keepcpo
endif

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

@@ -8,6 +8,7 @@ if exists("b:did_indent")
endif
setlocal autoindent cindent
setlocal formatoptions+=roq
" vim:set sts=2 sw=2 :

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')
@@ -12,10 +12,6 @@ if exists('b:did_indent')
endif
let b:did_indent = 1
" indent correctly if inside <script>
" vim/vim@690afe1 for the switch from cindent
let b:html_indent_script1 = 'inc'
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent()
setlocal autoindent nolisp nosmartindent
@@ -27,13 +23,6 @@ setlocal indentkeys+=0],0)
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
" Regex of syntax group names that are or delimit string or are comments.
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
let b:syng_str = get(b:,'syng_str','string\|template\|special')
" template strings may want to be excluded when editing graphql:
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
" Only define the function once.
if exists('*GetJavascriptIndent')
finish
@@ -42,6 +31,23 @@ endif
let s:cpo_save = &cpo
set cpo&vim
" indent correctly if inside <script>
" vim/vim@690afe1 for the switch from cindent
" overridden with b:html_indent_script1
call extend(g:,{'html_indent_script1': 'inc'},'keep')
" Regex of syntax group names that are or delimit string or are comments.
let s:bvars = {
\ 'syng_strcom': 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!',
\ 'syng_str': 'string\|template\|special' }
" template strings may want to be excluded when editing graphql:
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
function s:GetVars()
call extend(b:,extend(s:bvars,{'js_cache': [0,0,0]}),'keep')
endfunction
" Get shiftwidth value
if exists('*shiftwidth')
function s:sw()
@@ -106,9 +112,7 @@ endfunction
function s:SkipFunc()
if s:top_col == 1
throw 'out of bounds'
endif
let s:top_col = 0
if s:check_in
elseif s:check_in
if eval(s:skip_expr)
return 1
endif
@@ -117,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
@@ -161,19 +168,29 @@ function s:Token()
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
endfunction
function s:PreviousToken()
let l:col = col('.')
function s:PreviousToken(...)
let [l:pos, tok] = [getpos('.'), '']
if search('\m\k\{1,}\|\S','ebW')
if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm)
if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
return s:Token()
if getline('.')[col('.')-2:col('.')-1] == '*/'
if eval(s:in_comm) && !s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
call setpos('.',l:pos)
else
let tok = s:Token()
endif
call cursor(a:firstline, l:col)
else
return s:Token()
let two = a:0 || line('.') != l:pos[1] ? strridx(getline('.')[:col('.')],'//') + 1 : 0
if two && eval(s:in_comm)
call cursor(0,two)
let tok = s:PreviousToken(1)
if tok is ''
call setpos('.',l:pos)
endif
else
let tok = s:Token()
endif
endif
endif
return ''
return tok
endfunction
function s:Pure(f,...)
@@ -217,30 +234,29 @@ let s:opfirst = '^' . get(g:,'javascript_opfirst',
let s:continuation = get(g:,'javascript_continuation',
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
function s:Continues(ln,con)
let tok = matchstr(a:con[-15:],s:continuation)
function s:Continues()
let tok = matchstr(strpart(getline('.'),col('.')-15,15),s:continuation)
if tok =~ '[a-z:]'
call cursor(a:ln, len(a:con))
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
elseif tok !~ '[/>]'
return tok isnot ''
endif
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
return s:SynAt(line('.'),col('.')) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
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
@@ -253,27 +269,38 @@ 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()
let cpos = searchpos('\m\<','cbW')
if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ?
\ 'Previous' : ''}Token() ==# 'do' && s:IsBlock()
return 1
while s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
if s:LookingAt() =~ '\a'
if s:Pure('s:IsBlock')
if s:LookingAt() ==# 'd'
return 1
endif
break
endif
elseif s:LookingAt() != '}' || !s:GetPair('{','}','bW',s:skip_expr)
break
endif
call call('cursor',cpos)
endif
endwhile
call call('cursor',cpos)
endfunction
" returns total offset from braceless contexts. 'num' is the lineNr which
" encloses the entire context, 'cont' if whether a:firstline is a continued
" expression, which could have started in a braceless context
function s:IsContOne(num,cont)
let [l:num, b_l] = [a:num + !a:num, 0]
let pind = a:num ? indent(a:num) + s:sw() : 0
function s:IsContOne(cont)
let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0]
let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0
let ind = indent('.') + !a:cont
while line('.') > l:num && ind > pind || line('.') == l:num
if indent('.') < ind && s:OneScope()
@@ -300,6 +327,7 @@ endfunction
function s:IsBlock()
let tok = s:PreviousToken()
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
let s:in_jsx = 1
return tok != '{'
elseif tok =~ '\k'
if tok ==# 'type'
@@ -324,7 +352,7 @@ function s:IsBlock()
endfunction
function GetJavascriptIndent()
let b:js_cache = get(b:,'js_cache',[0,0,0])
call s:GetVars()
let s:synid_cache = [[],[]]
let l:line = getline(v:lnum)
" use synstack as it validates syn state and works in an empty line
@@ -332,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
@@ -365,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,
@@ -386,10 +412,10 @@ function GetJavascriptIndent()
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
let [num_ind, is_op, b_l, l:switch_offset, s:in_jsx] = [s:Nat(indent(num)),0,0,0,0]
if !num || s:LookingAt() == '{' && s:IsBlock()
let ilnum = line('.')
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
if num && !s:in_jsx && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
if ilnum == num
let [num, num_ind] = [line('.'), indent('.')]
endif
@@ -403,26 +429,24 @@ function GetJavascriptIndent()
endif
endif
if idx == -1 && pline[-1:] !~ '[{;]'
call cursor(l:lnum, len(pline))
let sol = matchstr(l:line,s:opfirst)
if sol is '' || sol == '/' && s:SynAt(v:lnum,
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
if s:Continues(l:lnum,pline)
if s:Continues()
let is_op = s:sw()
endif
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$'
call cursor(l:lnum, len(pline))
if s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
\ (s:PreviousToken() == ']' || s:Token() =~ '\k' &&
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
return num_ind + s:sw()
endif
let is_op = s:sw()
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' &&
\ s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
\ (s:PreviousToken() == ']' || s:LookingAt() =~ '\k' &&
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
return num_ind + s:sw()
else
let is_op = s:sw()
endif
call cursor(l:lnum, len(pline))
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw()
let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()
endif
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
let pval = s:ParseCino('(')
@@ -438,10 +462,10 @@ function GetJavascriptIndent()
" main return
if l:line =~ '^[])}]\|^|}'
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
if l:line_raw[0] == ')'
if s:ParseCino('M')
return indent(l:lnum)
elseif &cino =~# 'm' && !s:ParseCino('m')
elseif num && &cino =~# 'm' && !s:ParseCino('m')
return virtcol('.') - 1
endif
endif

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

@@ -74,48 +74,42 @@ function GetLuaIndent()
let original_cursor_pos = getpos(".")
let i = 0
" check if the previous line opens blocks
" count how many blocks the previous line opens
call cursor(v:lnum, 1)
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
let num_prev_opens = searchpair(s:open_patt, s:middle_patt, s:close_patt,
\ 'mrb', s:skip_expr, prev_line)
if num_pairs > 0
let i += num_pairs
endif
" special case: call(with, {anon = function() -- should indent only once
if num_pairs > 1 && contents_prev =~# s:anon_func_start
let i = 1
endif
" check if current line closes blocks
" count how many blocks the current line closes
call cursor(prev_line, col([prev_line,'$']))
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
let num_cur_closes = searchpair(s:open_patt, s:middle_patt, s:close_patt,
\ 'mr', s:skip_expr, v:lnum)
if num_pairs > 0
let i -= num_pairs
endif
" special case: end}) -- end of call with anon func should unindent once
if num_pairs > 1 && contents_cur =~# s:anon_func_end
let i = -1
endif
let i = num_prev_opens - num_cur_closes
" if the previous line closed a paren, unindent (except with anon funcs)
" if the previous line closed a paren, outdent (except with anon funcs)
call cursor(prev_line - 1, col([prev_line - 1, '$']))
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
if num_pairs > 0 && contents_prev !~ s:anon_func_end
let num_prev_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
if num_prev_closed_parens > 0 && contents_prev !~# s:anon_func_end
let i -= 1
endif
" if this line closed a paren, indent (except with anon funcs)
call cursor(prev_line, col([prev_line, '$']))
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
if num_pairs > 0 && contents_cur !~ s:anon_func_end
let num_cur_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
if num_cur_closed_parens > 0 && contents_cur !~# s:anon_func_end
let i += 1
endif
" special case: call(with, {anon = function() -- should indent only once
if i > 1 && contents_prev =~# s:anon_func_start
let i = 1
endif
" special case: end}) -- end of call w/ anon func should outdent only once
if i < -1 && contents_cur =~# s:anon_func_end
let i = -1
endif
" restore cursor
call setpos(".", original_cursor_pos)

86
indent/nix.vim Normal file
View File

@@ -0,0 +1,86 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
" Vim indent file
" Language: Nix
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
" URL: https://github.com/LnL7/vim-nix
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetNixIndent()
setlocal indentkeys+=0=then,0=else,0=inherit,*<Return>
if exists("*GetNixIndent")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
let s:skip_syntax = '\%(Comment\|String\)$'
let s:block_open = '\%({\|[\)'
let s:block_close = '\%(}\|]\)'
function! GetNixIndent()
let lnum = prevnonblank(v:lnum - 1)
let ind = indent(lnum)
" At the start of the file use zero indent.
if lnum == 0
return 0
endif
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
let current_line = getline(v:lnum)
let last_line = getline(lnum)
if last_line =~ s:block_open . '\s*$'
let ind += &sw
endif
if current_line =~ '^\s*' . s:block_close
let ind -= &sw
endif
if last_line =~ '\<let\s*$'
let ind += &sw
endif
if getline(v:lnum - 1) =~ '^\<in\s*$'
let ind += &sw
endif
if current_line =~ '^\s*in\>'
let ind -= &sw
endif
endif
if synIDattr(synID(v:lnum, 1, 1), "name") =~ '^nixString'
let current_line = getline(v:lnum)
let ind = indent(v:lnum)
let bslnum = searchpair('''''', '', '''''', 'bnW',
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "InterpolationSpecial$"')
if ind <= indent(bslnum)
let ind = indent(bslnum) + &sw
endif
if current_line =~ '^\s*''''[^''\$]'
let ind = indent(bslnum)
endif
if current_line =~ '^\s*''''$'
let ind = indent(bslnum)
endif
endif
return ind
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -136,9 +136,9 @@ function! GetPerlIndent()
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let brace = strpart(line, bracepos, 1)
if brace == '(' || brace == '{' || brace == '['
let ind = ind + &sw
let ind = ind + shiftwidth()
else
let ind = ind - &sw
let ind = ind - shiftwidth()
endif
endif
let bracepos = match(line, braceclass, bracepos + 1)
@@ -151,25 +151,25 @@ function! GetPerlIndent()
\ || synid == "perlBraces"
\ || synid == "perlStatementIndirObj"
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let ind = ind - &sw
let ind = ind - shiftwidth()
endif
endif
else
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
let ind = ind + &sw
let ind = ind + shiftwidth()
endif
if cline =~ '^\s*[])}]'
let ind = ind - &sw
let ind = ind - shiftwidth()
endif
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
let ind = ind + &sw
let ind = ind + shiftwidth()
endif
elseif line =~ '^\s*\(or\|and\)\>'
let ind = ind - &sw
let ind = ind - shiftwidth()
endif
return ind

View File

@@ -16,7 +16,7 @@ let b:did_indent = 1
" smartindent is good enough for powershell
setlocal smartindent
" disable the indent removal for # marks
inoremap # X#
inoremap <buffer> # X#
let b:undo_indent = "setl si<"

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

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
" Language: QML
" Author: Robert Kieffer
" URL:
" Last Change: 2010-03-27 (Happy Birthday, Dash!)
" Last Change: 2017-10-27
"
" Improved JavaScript indent script.
@@ -22,10 +22,10 @@ if exists("*GetJsIndent")
finish
endif
" Clean up a line of code by removing trailing '//' comments, and trimming
" Clean up a line of code by removing trailing '//' and '/* */' comments, and trimming
" whitespace
function! Trim(line)
return substitute(substitute(a:line, '// .*', '', ''), '^\s*\|\s*$', '', 'g')
return substitute(substitute(substitute(a:line, '// .*', '', ''), '/\* .* \*/', '', ''), '^\s*\|\s*$', '', 'g')
endfunction
function! GetJsIndent()

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

481
syntax/cmake.vim Normal file

File diff suppressed because one or more lines are too long

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

@@ -11,17 +11,17 @@ endif
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr
if exists('crystal_space_errors')
if !exists('crystal_no_trail_space_error')
if exists('g:crystal_space_errors')
if !exists('g:crystal_no_trail_space_error')
syn match crystalSpaceError display excludenl "\s\+$"
endif
if !exists('crystal_no_tab_space_error')
if !exists('g:crystal_no_tab_space_error')
syn match crystalSpaceError display " \+\t"me=e-1
endif
endif
" Operators
if exists('crystal_operators')
if exists('g:crystal_operators')
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
@@ -170,39 +170,39 @@ syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart fold keepend
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend
if exists('main_syntax') && g:main_syntax ==# 'ecrystal'
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
let b:crystal_no_expensive = 1
end
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
" Keywords
" Note: the following keywords have already been defined:
" begin case class def do end for if module unless until while
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
syn match crystalOperator "\<defined?" display
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|as\|of\|with\)\>[?!]\@!"
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\)\>[?!]\@!" " TODO: reorganise
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
syn match crystalOperator "\<defined?" display
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!"
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
" based folding and special highlighting of module/class/method definitions
if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
@@ -246,10 +246,10 @@ if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop
syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine fold
if !exists('crystal_minlines')
let crystal_minlines = 500
if !exists('g:crystal_minlines')
let g:crystal_minlines = 500
endif
exec 'syn sync minlines=' . crystal_minlines
exec 'syn sync minlines=' . g:crystal_minlines
else
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
@@ -271,7 +271,7 @@ syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion disp
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
" Special Methods
if !exists('crystal_no_special_methods')
if !exists('g:crystal_no_special_methods')
syn keyword crystalAccess protected private
" attr is a common variable name
syn keyword crystalAttribute getter setter property abstract
@@ -293,7 +293,7 @@ syn match crystalMacro "\%({%\|%}\|{{\|}}\)" nextgroup=crystalMacroRegion skipwh
syn match crystalSharpBang "\%^#!.*" display
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
if !exists('crystal_no_comment_fold')
if !exists('g:crystal_no_comment_fold')
syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent fold keepend
endif
@@ -307,7 +307,7 @@ syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
@@ -335,7 +335,7 @@ hi def link crystalASCIICode Character
hi def link crystalFloat Float
hi def link crystalBoolean Boolean
hi def link crystalException Exception
if !exists('crystal_no_identifiers')
if !exists('g:crystal_no_identifiers')
hi def link crystalIdentifier Identifier
else
hi def link crystalIdentifier NONE

View File

@@ -72,6 +72,7 @@ syntax keyword dartTodo contained TODO FIXME XXX
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
syntax match dartShebangLine /^\%1l#!.*/
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
" Strings
@@ -83,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
@@ -110,6 +111,7 @@ highlight default link dartOperator Operator
highlight default link dartComment Comment
highlight default link dartLineComment Comment
highlight default link dartLineDocComment Comment
highlight default link dartShebangLine Comment
highlight default link dartConstant Constant
highlight default link dartTypedef Typedef
highlight default link dartTodo Todo

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
@@ -120,10 +121,10 @@ syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z('''\)+ end=
" Documentation
if exists('g:elixir_use_markdown_for_docs') && g:elixir_use_markdown_for_docs
syn include @markdown syntax/markdown.vim
syn cluster elixirDocStringContained contains=@markdown,@Spell
syn cluster elixirDocStringContained contains=@markdown,@Spell,elixirInterpolation
else
let g:elixir_use_markdown_for_docs = 0
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell,elixirInterpolation
" doctests
syn region elixirDocTest start="^\s*\%(iex\|\.\.\.\)\%((\d*)\)\?>\s" end="^\s*$" 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

@@ -15,7 +15,7 @@ syn sync minlines=50
syn include @gitDiff syntax/diff.vim
syn region gitHead start=/\%^/ end=/^$/
syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
" For git reflog and git show ...^{tree}, avoid sync issues
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/

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

@@ -4,8 +4,8 @@ if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'html'
if !exists("g:main_syntax")
let g:main_syntax = 'html'
endif
runtime! syntax/gotexttmpl.vim

View File

@@ -99,6 +99,7 @@ syn region haskellBlockComment start="{-" end="-}"
\ haskellTodo,
\ @Spell
syn region haskellPragma start="{-#" end="#-}"
syn region haskellLiquid start="{-@" end="@-}"
syn match haskellPreProc "^#.*$"
syn keyword haskellTodo TODO FIXME contained
" Treat a shebang line at the start of the file as a comment
@@ -147,6 +148,7 @@ highlight def link haskellShebang Comment
highlight def link haskellLineComment Comment
highlight def link haskellBlockComment Comment
highlight def link haskellPragma SpecialComment
highlight def link haskellLiquid SpecialComment
highlight def link haskellString String
highlight def link haskellChar String
highlight def link haskellBacktick Operator

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

@@ -35,6 +35,8 @@ syn match i3NoStartupId '--no-startup-id' contained
syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
syn keyword i3BordersSpecialParam none vertical horizontal both
syn keyword i3ModeParam dock hide invisible skipwhite
syn keyword i3GapsCommand gaps smart_gaps smart_borders
syn keyword i3GapsParam inner outer current all set plus minus no_gaps
" these are not keywords but we add them for consistency
syn keyword i3PseudoParam no false inactive
@@ -99,6 +101,7 @@ highlight link i3ColorLast Constant
highlight link i3WsSpecialParam Constant
highlight link i3BordersSpecialParam Constant
highlight link i3ModeParam Constant
highlight link i3GapsParam Constant
highlight link i3Var Identifier
highlight link i3SetVar Identifier
@@ -115,6 +118,7 @@ highlight link i3Font String
highlight link i3ExecKeyword Keyword
highlight link i3Command Keyword
highlight link i3WsKeyword Keyword
highlight link i3GapsCommand Keyword
highlight link i3ColorDef1 Define
highlight link i3ColorDef3 Define

View File

@@ -26,17 +26,17 @@ syntax sync fromstart
" syntax case ignore
syntax case match
syntax match jsNoise /[:,\;]\{1}/
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsNoise /[:,;]/
syntax match jsNoise /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
syntax match jsObjectProp contained /\<\K\k*/
syntax match jsFuncCall /\<\K\k*\ze\s*(/
syntax match jsParensError /[)}\]]/
" Program Keywords
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
syntax match jsVariableDef contained /\k\+/ skipwhite skipempty nextgroup=jsFlowDefinition
syntax match jsVariableDef contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFlowDefinition
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ skipwhite skipempty nextgroup=@jsExpression
syntax match jsOperator "[-!|&+<>=%/*~^]" skipwhite skipempty nextgroup=@jsExpression
syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression
syntax keyword jsBooleanTrue true
syntax keyword jsBooleanFalse false
@@ -44,7 +44,7 @@ syntax keyword jsBooleanFalse false
" Modules
syntax keyword jsImport import skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup,jsFlowImportType
syntax keyword jsExport export skipwhite skipempty nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword,jsFlowTypeStatement
syntax match jsModuleKeyword contained /\k\+/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
syntax match jsModuleKeyword contained /\<\K\k*/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup=@jsExpression
syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAs,jsFrom
@@ -53,44 +53,37 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
" Strings, Templates, Numbers
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
syntax keyword jsNumber Infinity
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=\d\+\)\=\>/
" Regular Expressions
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
syntax match jsSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)"
syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
syntax match jsRegexpOr contained "\v\<@!\|"
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
if v:version > 703 || v:version == 603 && has("patch1088")
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
else
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
endif
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=jsSpecial
syntax match jsRegexpBoundary contained "\v\c[$^]|\\b"
syntax match jsRegexpBackRef contained "\v\\[1-9]\d*"
syntax match jsRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1
syntax match jsRegexpOr contained "|"
syntax match jsRegexpMod contained "\v\(\?[:=!>]"lc=1
syntax region jsRegexpGroup contained start="[^\\]("lc=1 skip="\\.\|\[\(\\.\|[^]]\+\)\]" end=")" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
syntax region jsRegexpString start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blank:][:alnum:]_$]\)\s*\)\@<=/\ze[^*/]+ skip=+\\.\|\[[^]]\{1,}\]+ end=+/[gimyus]\{,6}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
" Objects
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\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=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
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
syntax match jsObjectSeparator contained /,/
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
syntax match jsObjectMethodType contained /\%(get\|set\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite skipempty nextgroup=@jsExpression'
@@ -101,8 +94,8 @@ exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
" Statement Keywords
syntax match jsBlockLabel /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
syntax match jsBlockLabelKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*\%(;\|\n\)\)\@=/
syntax match jsBlockLabel /\<\K\k*\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
syntax match jsBlockLabelKey contained /\<\K\k*\ze\s*\_[;]/
syntax keyword jsStatement contained with yield debugger
syntax keyword jsStatement contained break continue skipwhite skipempty nextgroup=jsBlockLabelKey
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
@@ -119,7 +112,7 @@ syntax keyword jsAsyncKeyword async await
syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock
" Keywords
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set WeakSet RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename
syntax match jsGlobalNodeObjects /\<require\>/ containedin=jsFuncCall
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
@@ -164,68 +157,68 @@ syntax region jsBlock matchgroup=jsBraces s
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|}\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
syntax match jsOperator /?\.\ze\_D/
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs,jsFlowFunctionGroup
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
syntax match jsFuncArgCommas contained ','
syntax keyword jsArguments contained arguments
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat
" Matches a single keyword argument with no parens
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
syntax match jsArrowFuncArgs /\<\K\k*\ze\s*=>/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
" Matches a series of arguments surrounded in parens
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
syntax match jsArrowFuncArgs /([^()]*)\ze\s*=>/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs,jsFlowFunctionGroup skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
exe 'syntax match jsArrowFunction /()\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '').(' contains=jsArrowFuncArgs')
exe 'syntax match jsArrowFunction /_\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
exe 'syntax match jsArrowFunction /()\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '')
exe 'syntax match jsArrowFunction /_\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
" Classes
syntax keyword jsClassKeyword contained class
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
syntax match jsClassNoise contained /\./
syntax match jsClassMethodType contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*[=:]\)\@=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsClassFuncName contained /\<\K\k*\ze\s*(/ skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
" Destructuring
syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/
syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue
syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
syntax match jsDestructuringPropertyValue contained /\k\+/
syntax match jsDestructuringProperty contained /\k\+\ze\s*=/ skipwhite skipempty nextgroup=jsDestructuringValue
syntax match jsDestructuringAssignment contained /\k\+\ze\s*:/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
syntax match jsDestructuringNoise contained /[,\[\]]/
syntax match jsDestructuringNoise contained /[,[\]]/
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold
" Comments
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD
syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend
syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend
syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend
syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend
syntax region jsEnvComment start=/\%^#!/ end=/$/ display
" Specialized Comments - These are special comment regexes that are used in
" odd places that maintain the proper nextgroup functionality. It sucks we
" can't make jsComment a skippable type of group for nextgroup
syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
syntax region jsCommentFunction contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
syntax region jsCommentClass contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
syntax region jsCommentIfElse contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
syntax region jsCommentIfElse contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
syntax region jsCommentRepeat contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
syntax region jsCommentRepeat contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
syntax region jsCommentFunction contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
syntax region jsCommentFunction contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
syntax region jsCommentClass contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
syntax region jsCommentClass contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
syntax region jsCommentIfElse contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
syntax region jsCommentIfElse contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
syntax region jsCommentRepeat contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
syntax region jsCommentRepeat contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
" Decorators
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
syntax match jsDecoratorFunction contained /\h[a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
if exists("javascript_plugin_jsdoc")
runtime extras/jsdoc.vim

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

@@ -13,12 +13,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
"
" Clear previous syntax settings unless this is v6 or above, in which case just
" exit without doing anything.
"
if version < 600
syn clear
elseif exists("b:current_syntax")
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
@@ -30,26 +26,16 @@ endif
" First pull in the HTML syntax.
"
if version < 600
so <sfile>:p:h/html.vim
else
runtime! syntax/html.vim
unlet b:current_syntax
endif
runtime! syntax/html.vim
unlet b:current_syntax
syn cluster htmlPreproc add=@masonTop
" Now pull in the Perl syntax.
"
if version < 600
syn include @perlTop <sfile>:p:h/perl.vim
unlet b:current_syntax
syn include @podTop <sfile>:p:h/pod.vim
else
syn include @perlTop syntax/perl.vim
unlet b:current_syntax
syn include @podTop syntax/pod.vim
endif
syn include @perlTop syntax/perl.vim
unlet b:current_syntax
syn include @podTop syntax/pod.vim
" It's hard to reduce down to the correct sub-set of Perl to highlight in some
" of these cases so I've taken the safe option of just using perlTop in all of
@@ -88,21 +74,9 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,
" Set up default highlighting. Almost all of this is done in the included
" syntax files.
"
if version >= 508 || !exists("did_mason_syn_inits")
if version < 508
let did_mason_syn_inits = 1
com -nargs=+ HiLink hi link <args>
else
com -nargs=+ HiLink hi def link <args>
endif
HiLink masonDoc Comment
HiLink masonPod Comment
HiLink masonPerlComment perlComment
delc HiLink
endif
hi def link masonDoc Comment
hi def link masonPod Comment
hi def link masonPerlComment perlComment
let b:current_syntax = "mason"

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
@@ -92,32 +92,33 @@ endif
if nim_highlight_builtins == 1
" builtin functions, types and objects, not really part of the syntax
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool
syn keyword nimBuiltin char string cstring pointer range array openarray seq
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64
syn keyword nimBuiltin bool void chr char string cstring pointer range array openarray openArray seq varargs varArgs
syn keyword nimBuiltin set Byte Natural Positive Conversion
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
syn keyword nimBuiltin CompileDate CompileTime nimversion nimVersion nimmajor nimMajor
syn keyword nimBuiltin nimminor nimMinor nimpatch nimPatch cpuendian cpuEndian hostos hostOS hostcpu hostCPU inf
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbglinehook dbgLineHook stdin
syn keyword nimBuiltin stdout stderr defined new high low sizeof succ pred
syn keyword nimBuiltin inc dec newSeq len incl excl card ord chr ze ze64
syn keyword nimBuiltin toU8 toU16 toU32 abs min max add repr
syn keyword nimBuiltin inc dec newseq newSeq len incl excl card ord chr ze ze64
syn keyword nimBuiltin tou8 toU8 tou16 toU16 tou32 toU32 abs min max add repr
syn match nimBuiltin "\<contains\>"
syn keyword nimBuiltin toFloat toBiggestFloat toInt toBiggestInt addQuitProc
syn keyword nimBuiltin copy setLen newString zeroMem copyMem moveMem
syn keyword nimBuiltin equalMem alloc alloc0 realloc dealloc setLen assert
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
syn keyword nimBuiltin tofloat toFloat tobiggestfloat toBiggestFloat toint toInt tobiggestint toBiggestInt
syn keyword nimBuiltin addquitproc addQuitProc
syn keyword nimBuiltin copy setlen setLen newstring newString zeromem zeroMem copymem copyMem movemem moveMem
syn keyword nimBuiltin equalmem equalMem alloc alloc0 realloc dealloc assert
syn keyword nimBuiltin echo swap getrefcount getRefcount getcurrentexception getCurrentException Msg
syn keyword nimBuiltin getoccupiedmem getOccupiedMem getfreemem getFreeMem gettotalmem getTotalMem isnil isNil seqtoptr seqToPtr
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
syn keyword nimBuiltin FlushFile readFile write readLine writeln writeln
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
syn keyword nimBuiltin fileHandle countdown countup items lines
syn keyword nimBuiltin FlushFile readfile readFile readline readLine write writeln writeLn writeline writeLine
syn keyword nimBuiltin getfilesize getFileSize ReadBytes ReadChars readbuffer readBuffer writebytes writeBytes
syn keyword nimBuiltin writechars writeChars writebuffer writeBuffer setfilepos setFilePos getfilepos getFilePos
syn keyword nimBuiltin filehandle fileHandle countdown countup items lines
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
endif

View File

@@ -1,131 +1,187 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
"
" Syntax file for Nix
"
" TODO:
" Emphasize :
" Deemphasize ;
" Consistent ()
" rec (red?)
" Vim syntax file
" Language: Nix
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
" URL: https://github.com/LnL7/vim-nix
if exists("b:current_syntax")
finish
finish
endif
" Operators
syn match nixOperator "\V++"
syn match nixOperator "\V+"
syn match nixOperator "\V!"
syn match nixOperator "\V=="
syn match nixOperator "\V!="
syn match nixOperator "\V&&"
syn match nixOperator "\V||"
syn match nixOperator "\V->"
syn keyword nixBoolean true false
syn keyword nixNull null
syn keyword nixRecKeyword rec
syn match nixOperator "\V-"
syn match nixOperator "\V*"
syn match nixOperator "\V/"
syn match nixOperator "\V>"
syn match nixOperator "\V<"
syn keyword nixOperator or
syn match nixOperator '!=\|!'
syn match nixOperator '<=\?'
syn match nixOperator '>=\?'
syn match nixOperator '&&'
syn match nixOperator '//\='
syn match nixOperator '=='
syn match nixOperator '?'
syn match nixOperator '||'
syn match nixOperator '++\='
syn match nixOperator '-'
syn match nixOperator '\*'
syn match nixOperator '->'
" Keywords
syn keyword nixKeyword let in or assert inherit null with rec
syn keyword nixConditional if else then
syn keyword nixBoolean true false
syn match nixParen '[()]'
syn match nixInteger '\d\+'
" Builtins
syn keyword nixBuiltin builtins abort add attrNames attrValues
\ baseNameOf compareVersions concatLists currentSystem deepSeq
\ derivation dirOf div elem elemAt filter filterSource fromJSON
\ getAttr getEnv hasAttr hashString head import intersectAttrs
\ isAttrs isList isFunction isString isInt isBool isNull length
\ lessThan listToAttrs map mul parseDrvNames pathExists readDir
\ readFile removeAttrs seq stringLength sub substring tail throw
\ toFile toJSON toPath toString toXML trace typeOf tryEval
syn keyword nixTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn match nixComment '#.*' contains=nixTodo,@Spell
syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell
syn match nixpkgs "<nixpkgs>"
syn match nixSpecialOper "\V@\|;\|,\|?\|..."
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
" Attribute Lists
"syn match nixBrace "\v[(){}\[\]]|rec\s*\{"
syn region nixSet matchgroup=nixBraces start="{" end="}" contains=ALL
syn region nixRecSet matchgroup=nixBraces start="rec\s*{" end="}" contains=ALL
syn region nixList matchgroup=nixBraces start="\[" end="\]" contains=ALLBUT,nixAttr
syn match nixAttr "\v[0-9A-Za-z\-\_]+\ze\s*\=" contained
syn match nixSimpleStringSpecial /\\["nrt\\$]/ contained
syn match nixInterpolationSpecial /''['$]/ contained
syn match nixInteger "\v<\d+>"
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$]+ end=+''+ contains=nixInterpolation,nixInterpolationSpecial
" Functions
syn match nixFuncArg "\v\zs\w+\ze\s*:"
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
" TODO: Exclude ; and other illegal characters
syn match nixPath "\v\S*/\S+|\S+/\S*"
syn match nixPath "[a-zA-Z0-9._+-]*\%(/[a-zA-Z0-9._+-]\+\)\+"
syn match nixHomePath "\~\%(/[a-zA-Z0-9._+-]\+\)\+"
syn match nixSearchPath "[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*" contained
syn match nixPathDelimiter "[<>]" contained
syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contains=nixSearchPath,nixPathDelimiter
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
" This operator is placed after nixPath to override nixPath's highlighting
syn match nixOperator "\V//"
syn match nixAttributeDot "\." contained
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'-.]\|$\)" contained
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
" Strings
syn match nixStringIndentedEscapes +'''\|''\${\|''\\n\|''\\r\|''\\t+
syn match nixStringEscapes +\\"\|\\\${\|\\n\|\\r\|\\t\|\\\\+
syn region nixStringIndented
\ start=+''+
\ skip=+'''+
\ end=+''+
\ contains=nixAntiquotation,nixStringIndentedEscapes
syn region nixString
\ start=+"+
\ skip=+\\"+
\ end=+"+
\ contains=nixAntiquotation,nixStringEscapes
syn region nixInheritAttributeScope start="(" end=")" contained contains=nixComment,nixAttributeDot
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
" If this contains nixBrace, it ignores its own closing brace and syntax gets
" thrown way off contains=ALLBUT,nixBrace
syn region nixAntiquotation start=+\${+ end=+}+ contains=nixAntiQuotation
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition
" Comments
syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+ contains=nixTodos
syn match nixEndOfLineComment "#.*$" contains=nixTodos
syntax keyword nixTodos TODO XXX FIXME NOTE TODOS contained
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn region nixArgumentDefinitionWithDefault matchgroup=nixArgumentDefinition start="[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*?\@=" matchgroup=NONE end="[,}]\@=" transparent contained contains=@nixExpr
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn match nixArgumentDefinition "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,}]\@=" contained
syn match nixArgumentEllipsis "\.\.\." contained
syn match nixArgumentSeparator "," contained
" Special (Delimiter
hi def link nixBraces Delimiter
hi def link nixpkgs Special
hi def link nixSpecialOper Special
hi def link nixStringIndentedEscapes SpecialChar
hi def link nixStringEscapes SpecialChar
hi def link nixBuiltin Special
hi def link nixOperator Operator
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn match nixArgOperator '@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:'he=s+1 contained contains=nixAttribute
" Constants
hi def link nixBoolean Boolean
hi def link nixInteger Number
hi def link nixString String
hi def link nixStringIndented String
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn match nixArgOperator '[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@'hs=e-1 contains=nixAttribute nextgroup=nixFunctionArgument
" Comments
hi def link nixMultiLineComment Comment
hi def link nixEndOfLineComment Comment
" This is a bit more complicated, because function arguments can be passed in a
" very similar form on how attribute sets are defined and two regions with the
" same start patterns will shadow each other. Instead of a region we could use a
" match on {\_.\{-\}}, which unfortunately doesn't take nesting into account.
"
" So what we do instead is that we look forward until we are sure that it's a
" function argument. Unfortunately, we need to catch comments and both vertical
" and horizontal white space, which the following regex should hopefully do:
"
" "\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*"
"
" It is also used throught the whole file and is marked with 'v's as well.
"
" Fortunately the matching rules for function arguments are much simpler than
" for real attribute sets, because we can stop when we hit the first ellipsis or
" default value operator, but we also need to paste the "whitespace & comments
" eating" regex all over the place (marked with 'v's):
"
" Region match 1: { foo ? ... } or { foo, ... } or { ... } (ellipsis)
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv {----- identifier -----}vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*\%([a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,?}]\|\.\.\.\)" end="}" contains=nixComment,nixArgumentDefinitionWithDefault,nixArgumentDefinition,nixArgumentEllipsis,nixArgumentSeparator nextgroup=nixArgOperator
" Identifiers
hi def link nixConditional Conditional
hi def link nixKeyword Keyword
hi def link nixOperator Operator
hi def link nixException Exception
hi def link nixAttr Identifier
hi def link nixFuncArg Identifier
" Now it gets more tricky, because we need to look forward for the colon, but
" there could be something like "{}@foo:", even though it's highly unlikely.
"
" Region match 2: {}
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv@vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv{----- identifier -----} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator
" PreProc
hi def link nixAntiquotation Macro
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:/\@!"
" Underlined (html links)
hi def link nixPath Underlined
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr
" Error
syn region nixLetExpr matchgroup=nixLetExprKeyword start="\<let\>" end="\<in\>" contains=nixComment,nixAttributeDefinition
syn sync maxlines=20000
syn sync minlines=50000
syn keyword nixIfExprKeyword then contained
syn region nixIfExpr matchgroup=nixIfExprKeyword start="\<if\>" end="\<else\>" contains=@nixExpr,nixIfExprKeyword
let b:current_syntax = 'nix'
syn region nixWithExpr matchgroup=nixWithExprKeyword start="\<with\>" matchgroup=NONE end=";" contains=@nixExpr
syn region nixAssertExpr matchgroup=nixAssertKeyword start="\<assert\>" matchgroup=NONE end=";" contains=@nixExpr
syn cluster nixExpr contains=nixBoolean,nixNull,nixOperator,nixParen,nixInteger,nixRecKeyword,nixConditional,nixBuiltin,nixSimpleBuiltin,nixComment,nixFunctionCall,nixFunctionArgument,nixSimpleFunctionArgument,nixPath,nixHomePath,nixSearchPathRef,nixURI,nixAttributeSet,nixList,nixSimpleString,nixString,nixLetExpr,nixIfExpr,nixWithExpr,nixAssertExpr
" These definitions override @nixExpr and have to come afterwards:
syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-9_'-]*\)*" contained
" Non-namespaced Nix builtins as of version 1.10:
syn keyword nixSimpleBuiltin
\ abort baseNameOf derivation dirOf fetchTarball import map removeAttrs
\ throw toString
" Namespaced and non-namespaced Nix builtins as of version 1.10:
syn keyword nixNamespacedBuiltin contained
\ abort add all any attrNames attrValues baseNameOf compareVersions
\ concatLists currentSystem deepSeq derivation dirOf div elem elemAt
\ fetchTarball fetchurl filter filterSource foldl' fromJSON genList
\ getAttr getEnv hasAttr hashString head import intersectAttrs isAttrs
\ isBool isFunction isInt isList isString length lessThan listToAttrs map
\ mul parseDrvName pathExists readDir readFile removeAttrs replaceStrings
\ seq sort stringLength sub substring tail throw toFile toJSON toPath
\ toString toXML trace typeOf
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
hi def link nixArgOperator Operator
hi def link nixArgumentDefinition Identifier
hi def link nixArgumentEllipsis Operator
hi def link nixAssertKeyword Keyword
hi def link nixAttribute Identifier
hi def link nixAttributeDot Operator
hi def link nixBoolean Boolean
hi def link nixBuiltin Special
hi def link nixComment Comment
hi def link nixConditional Conditional
hi def link nixHomePath Include
hi def link nixIfExprKeyword Keyword
hi def link nixInherit Keyword
hi def link nixInteger Integer
hi def link nixInterpolation Macro
hi def link nixInterpolationDelimiter Delimiter
hi def link nixInterpolationParam Macro
hi def link nixInterpolationSpecial Special
hi def link nixLetExprKeyword Keyword
hi def link nixNamespacedBuiltin Special
hi def link nixNull Constant
hi def link nixOperator Operator
hi def link nixPath Include
hi def link nixPathDelimiter Delimiter
hi def link nixRecKeyword Keyword
hi def link nixSearchPath Include
hi def link nixSimpleBuiltin Keyword
hi def link nixSimpleFunctionArgument Identifier
hi def link nixSimpleString String
hi def link nixSimpleStringSpecial SpecialChar
hi def link nixString String
hi def link nixStringDelimiter Delimiter
hi def link nixTodo Todo
hi def link nixURI Include
hi def link nixWithExprKeyword Keyword
" This could lead up to slow syntax highlighting for large files, but usually
" large files such as all-packages.nix are one large attribute set, so if we'd
" use sync patterns we'd have to go back to the start of the file anyway
syn sync fromstart
let b:current_syntax = "nix"
endif

View File

@@ -1,93 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
" Vim syntax file
" Language: OpenSCAD
" Maintainer: Sirtaj Singh Kang <sirtaj-vim@sirtaj.net>
" Last Changed: 2013 March 05
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
"syn keyword openscadFunctionDef function
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
syn match openscadFunction /\<\h\w*\>/ contained display
"syn keyword openscadModuleDef module
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
syn match openscadModule /\<\h\w*\>/ contained display
syn keyword openscadStatement echo assign let
syn keyword openscadConditional if else
syn keyword openscadRepeat for intersection_for
syn keyword openscadInclude include use
syn keyword openscadCsgKeyword union difference intersection render intersection_for
syn keyword openscadTransform scale rotate translate mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
syn keyword openscadPrimitive2D square circle polygon import_dxf text
syn keyword openscadPrimitiveImport import child children
syn match openscadSpecialVariable "\$[a-zA-Z]\+\>" display
syn match openscadModifier "^\s*[\*\!\#\%]" display
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
syn match openscadNumber "\d\+" display contained
syn match openscadNumber "\.\d\+" display contained
syn region openscadString start=/"/ skip=/\\"/ end=/"/
syn keyword openscadBoolean true false
syn keyword openscadCommentTodo TODO FIXME XXX contained display
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
syn region openscadBlock start="{" end="}" transparent fold
syn region openscadVector start="\[" end="\]" transparent fold
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
syn keyword openscadBuiltin str len search version version_num concat chr
syn keyword openscadBuiltin dxf_cross dxf_dim
hi def link openscadFunctionDef Structure
hi def link openscadFunction Function
hi def link openscadModuleDef Structure
hi def link openscadModule Function
hi def link openscadBlockComment Comment
hi def link openscadBoolean Boolean
hi def link openscadBuiltin Function
hi def link openscadConditional Conditional
hi def link openscadCsgKeyword Structure
hi def link openscadInclude Include
hi def link openscadInlineComment Comment
hi def link openscadModifier Special
hi def link openscadStatement Statement
hi def link openscadNumbers Number
hi def link openscadNumber Number
hi def link openscadPrimitiveSolid Keyword
hi def link openscadPrimitive2D Keyword
hi def link openscadPrimitiveImport Keyword
hi def link openscadRepeat Repeat
hi def link openscadSpecialVariable Special
hi def link openscadString String
hi def link openscadTransform Statement
hi def link openscadCommentTodo Todo
" Blatantly stolen from vim74\syntax\c.vim
"when wanted, highlight trailing white space
if exists("openscad_space_errors")
if !exists("openscad_no_trail_space_error")
syn match openscadSpaceError display excludenl "\s\+$"
endif
if !exists("openscad_no_tab_space_error")
syn match openscadSpaceError display " \+\t"me=e-1
endif
endif
let b:current_syntax = "openscad"
endif

View File

@@ -435,125 +435,121 @@ else
syn sync minlines=0
endif
command -nargs=+ HiLink hi def link <args>
" NOTE: If you're linking new highlight groups to perlString, please also put
" them into b:match_skip in ftplugin/perl.vim.
" The default highlighting.
HiLink perlSharpBang PreProc
HiLink perlControl PreProc
HiLink perlInclude Include
HiLink perlSpecial Special
HiLink perlString String
HiLink perlCharacter Character
HiLink perlNumber Number
HiLink perlFloat Float
HiLink perlType Type
HiLink perlIdentifier Identifier
HiLink perlLabel Label
HiLink perlStatement Statement
HiLink perlConditional Conditional
HiLink perlRepeat Repeat
HiLink perlOperator Operator
HiLink perlFunction Keyword
HiLink perlSubName Function
HiLink perlSubPrototype Type
HiLink perlSignature Type
HiLink perlSubAttributes PreProc
HiLink perlSubAttributesCont perlSubAttributes
HiLink perlComment Comment
HiLink perlTodo Todo
hi def link perlSharpBang PreProc
hi def link perlControl PreProc
hi def link perlInclude Include
hi def link perlSpecial Special
hi def link perlString String
hi def link perlCharacter Character
hi def link perlNumber Number
hi def link perlFloat Float
hi def link perlType Type
hi def link perlIdentifier Identifier
hi def link perlLabel Label
hi def link perlStatement Statement
hi def link perlConditional Conditional
hi def link perlRepeat Repeat
hi def link perlOperator Operator
hi def link perlFunction Keyword
hi def link perlSubName Function
hi def link perlSubPrototype Type
hi def link perlSignature Type
hi def link perlSubAttributes PreProc
hi def link perlSubAttributesCont perlSubAttributes
hi def link perlComment Comment
hi def link perlTodo Todo
if exists("perl_string_as_statement")
HiLink perlStringStartEnd perlStatement
hi def link perlStringStartEnd perlStatement
else
HiLink perlStringStartEnd perlString
hi def link perlStringStartEnd perlString
endif
HiLink perlVStringV perlStringStartEnd
HiLink perlList perlStatement
HiLink perlMisc perlStatement
HiLink perlVarPlain perlIdentifier
HiLink perlVarPlain2 perlIdentifier
HiLink perlArrow perlIdentifier
HiLink perlFiledescRead perlIdentifier
HiLink perlFiledescStatement perlIdentifier
HiLink perlVarSimpleMember perlIdentifier
HiLink perlVarSimpleMemberName perlString
HiLink perlVarNotInMatches perlIdentifier
HiLink perlVarSlash perlIdentifier
HiLink perlQQ perlString
HiLink perlHereDoc perlString
HiLink perlStringUnexpanded perlString
HiLink perlSubstitutionSQ perlString
HiLink perlSubstitutionGQQ perlString
HiLink perlTranslationGQ perlString
HiLink perlMatch perlString
HiLink perlMatchStartEnd perlStatement
HiLink perlFormatName perlIdentifier
HiLink perlFormatField perlString
HiLink perlPackageDecl perlType
HiLink perlStorageClass perlType
HiLink perlPackageRef perlType
HiLink perlStatementPackage perlStatement
HiLink perlStatementStorage perlStatement
HiLink perlStatementControl perlStatement
HiLink perlStatementScalar perlStatement
HiLink perlStatementRegexp perlStatement
HiLink perlStatementNumeric perlStatement
HiLink perlStatementList perlStatement
HiLink perlStatementHash perlStatement
HiLink perlStatementIOfunc perlStatement
HiLink perlStatementFiledesc perlStatement
HiLink perlStatementVector perlStatement
HiLink perlStatementFiles perlStatement
HiLink perlStatementFlow perlStatement
HiLink perlStatementInclude perlStatement
HiLink perlStatementProc perlStatement
HiLink perlStatementSocket perlStatement
HiLink perlStatementIPC perlStatement
HiLink perlStatementNetwork perlStatement
HiLink perlStatementPword perlStatement
HiLink perlStatementTime perlStatement
HiLink perlStatementMisc perlStatement
HiLink perlStatementIndirObj perlStatement
HiLink perlFunctionName perlIdentifier
HiLink perlMethod perlIdentifier
HiLink perlPostDeref perlIdentifier
HiLink perlFunctionPRef perlType
hi def link perlVStringV perlStringStartEnd
hi def link perlList perlStatement
hi def link perlMisc perlStatement
hi def link perlVarPlain perlIdentifier
hi def link perlVarPlain2 perlIdentifier
hi def link perlArrow perlIdentifier
hi def link perlFiledescRead perlIdentifier
hi def link perlFiledescStatement perlIdentifier
hi def link perlVarSimpleMember perlIdentifier
hi def link perlVarSimpleMemberName perlString
hi def link perlVarNotInMatches perlIdentifier
hi def link perlVarSlash perlIdentifier
hi def link perlQQ perlString
hi def link perlHereDoc perlString
hi def link perlStringUnexpanded perlString
hi def link perlSubstitutionSQ perlString
hi def link perlSubstitutionGQQ perlString
hi def link perlTranslationGQ perlString
hi def link perlMatch perlString
hi def link perlMatchStartEnd perlStatement
hi def link perlFormatName perlIdentifier
hi def link perlFormatField perlString
hi def link perlPackageDecl perlType
hi def link perlStorageClass perlType
hi def link perlPackageRef perlType
hi def link perlStatementPackage perlStatement
hi def link perlStatementStorage perlStatement
hi def link perlStatementControl perlStatement
hi def link perlStatementScalar perlStatement
hi def link perlStatementRegexp perlStatement
hi def link perlStatementNumeric perlStatement
hi def link perlStatementList perlStatement
hi def link perlStatementHash perlStatement
hi def link perlStatementIOfunc perlStatement
hi def link perlStatementFiledesc perlStatement
hi def link perlStatementVector perlStatement
hi def link perlStatementFiles perlStatement
hi def link perlStatementFlow perlStatement
hi def link perlStatementInclude perlStatement
hi def link perlStatementProc perlStatement
hi def link perlStatementSocket perlStatement
hi def link perlStatementIPC perlStatement
hi def link perlStatementNetwork perlStatement
hi def link perlStatementPword perlStatement
hi def link perlStatementTime perlStatement
hi def link perlStatementMisc perlStatement
hi def link perlStatementIndirObj perlStatement
hi def link perlFunctionName perlIdentifier
hi def link perlMethod perlIdentifier
hi def link perlPostDeref perlIdentifier
hi def link perlFunctionPRef perlType
if !get(g:, 'perl_include_pod', 1)
HiLink perlPOD perlComment
hi def link perlPOD perlComment
endif
HiLink perlShellCommand perlString
HiLink perlSpecialAscii perlSpecial
HiLink perlSpecialDollar perlSpecial
HiLink perlSpecialString perlSpecial
HiLink perlSpecialStringU perlSpecial
HiLink perlSpecialMatch perlSpecial
HiLink perlDATA perlComment
hi def link perlShellCommand perlString
hi def link perlSpecialAscii perlSpecial
hi def link perlSpecialDollar perlSpecial
hi def link perlSpecialString perlSpecial
hi def link perlSpecialStringU perlSpecial
hi def link perlSpecialMatch perlSpecial
hi def link perlDATA perlComment
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
" I had to remove the transparent property from the following regions
" in order to get them to highlight correctly. Feel free to remove
" these and reinstate the transparent property if you know how.
HiLink perlParensSQ perlString
HiLink perlBracketsSQ perlString
HiLink perlBracesSQ perlString
HiLink perlAnglesSQ perlString
hi def link perlParensSQ perlString
hi def link perlBracketsSQ perlString
hi def link perlBracesSQ perlString
hi def link perlAnglesSQ perlString
HiLink perlParensDQ perlString
HiLink perlBracketsDQ perlString
HiLink perlBracesDQ perlString
HiLink perlAnglesDQ perlString
hi def link perlParensDQ perlString
hi def link perlBracketsDQ perlString
hi def link perlBracesDQ perlString
hi def link perlAnglesDQ perlString
HiLink perlSpecialStringU2 perlString
hi def link perlSpecialStringU2 perlString
" Possible errors
HiLink perlNotEmptyLine Error
HiLink perlElseIfError Error
HiLink perlSubPrototypeError Error
HiLink perlSubError Error
delcommand HiLink
hi def link perlNotEmptyLine Error
hi def link perlElseIfError Error
hi def link perlSubPrototypeError Error
hi def link perlSubError Error
" Syncing to speed up processing
"

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*|\?\)\+" 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

@@ -21,11 +21,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
" Remove any old syntax stuff hanging around (this is suppressed
" automatically by ":syn include" if necessary).
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
@@ -69,28 +66,17 @@ syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_pod_syntax_inits")
if version < 508
let did_pod_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
" Only when an item doesn't have highlighting yet
HiLink podCommand Statement
HiLink podCmdText String
HiLink podOverIndent Number
HiLink podForKeywd Identifier
HiLink podFormat Identifier
HiLink podVerbatimLine PreProc
HiLink podSpecial Identifier
HiLink podEscape String
HiLink podEscape2 Number
delcommand HiLink
endif
hi def link podCommand Statement
hi def link podCmdText String
hi def link podOverIndent Number
hi def link podForKeywd Identifier
hi def link podFormat Identifier
hi def link podVerbatimLine PreProc
hi def link podSpecial Identifier
hi def link podEscape String
hi def link podEscape2 Number
if exists("perl_pod_spellcheck_headings")
" Spell-check headings

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

@@ -21,13 +21,13 @@ syn keyword purescriptBoolean true false
syn match purescriptDelimiter "[,;|.()[\]{}]"
" Constructor
syn match purescriptConstructor "\<[A-Z]\w*\>"
syn match purescriptConstructor "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>"
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
\ containedin=purescriptData,purescriptNewtype
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
" Type
syn match purescriptType "\<[A-Z]\w*\>" contained
syn match purescriptType "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>" contained
\ containedin=purescriptTypeAlias
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
@@ -36,9 +36,20 @@ syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^
\ contains=purescriptConstructor,purescriptDelimiter
" Function
syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`"
syn match purescriptFunction "\%(\<instance\s\+\|\<class\s\+\)\@18<!\<[_a-z]\(\w\|\'\)*\>" contained
" syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
syn match purescriptFunction "(\%(\<class\s\+\)\@18<!\(\W\&[^(),\"]\)\+)" contained extend
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_\.]*`"
" Class
syn region purescriptClassDecl start="^\%(\s*\)class\>"ms=e-5 end="\<where\>\|$"
\ contains=purescriptClass,purescriptClassName,purescriptOperatorType,purescriptOperator,purescriptType,purescriptWhere
\ nextgroup=purescriptClass
\ skipnl
syn match purescriptClass "\<class\>" containedin=purescriptClassDecl contained
\ nextgroup=purescriptClassName
\ skipnl
syn match purescriptClassName "\<[A-Z]\w*\>" containedin=purescriptClassDecl contained
" Module
syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl
@@ -46,8 +57,8 @@ syn match purescriptModuleKeyword "\<module\>"
syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>"
\ contains=purescriptModuleKeyword,purescriptModuleName
\ nextgroup=purescriptModuleParams skipwhite skipnl skipempty
syn region purescriptModuleParams start="(" end=")" fold contained keepend
\ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
syn region purescriptModuleParams start="(" skip="([^)]\{-})" end=")" fold contained keepend
\ contains=purescriptClassDecl,purescriptClass,purescriptClassName,purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
\ nextgroup=purescriptImportParams skipwhite
" Import
@@ -86,8 +97,9 @@ syn match purescriptForall "∀"
syn keyword purescriptConditional if then else
syn keyword purescriptStatement do case of in
syn keyword purescriptLet let
" syn keyword purescriptClass class
syn keyword purescriptWhere where
syn match purescriptStructure "\<\(data\|newtype\|type\|class\|kind\)\>"
syn match purescriptStructure "\<\(data\|newtype\|type\|kind\)\>"
\ nextgroup=purescriptType skipwhite
syn keyword purescriptStructure derive
syn keyword purescriptStructure instance
@@ -101,7 +113,7 @@ syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type
" Operators
syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
syn match purescriptOperatorType "\(::\|∷\)"
syn match purescriptOperatorType "\%(\<instance\>.*\)\@40<!\(::\|∷\)"
\ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty
syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)"
syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained
@@ -176,6 +188,8 @@ highlight def link purescriptLineComment purescriptComment
highlight def link purescriptBlockComment purescriptComment
" purescript general highlights
highlight def link purescriptClass purescriptKeyword
highlight def link purescriptClassName Type
highlight def link purescriptStructure purescriptKeyword
highlight def link purescriptKeyword Keyword
highlight def link purescriptStatement Statement

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

@@ -2,11 +2,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
" Vim syntax file
" Language: QML
" Maintainer: Warwick Allison <warwick.allison@nokia.com>
" Updaters:
" URL:
" Changes:
" Last Change: 2009 Apr 30
" Maintainer: Peter Hoeg <peter@hoeg.com>
" Updaters: Refer to CONTRIBUTORS.md
" URL: https://github.com/peterhoeg/vim-qml
" Changes: `git log` is your friend
" Last Change: 2017-11-11
"
" This file is bassed on the original work done by Warwick Allison
" <warwick.allison@nokia.com> whose did about 99% of the work here.
" Based on javascript syntax (as is QML)
@@ -26,20 +29,20 @@ endif
syn case ignore
syn cluster qmlExpr contains=qmlStringD,qmlString,SqmlCharacter,qmlNumber,qmlObjectLiteralType,qmlBoolean,qmlType,qmlJsType,qmlNull,qmlGlobal,qmlFunction
syn keyword qmlCommentTodo TODO FIXME XXX TBD contained
syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
syn match qmlSpecial "\\\d\d\d\|\\."
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
syn match qmlCharacter "'\\.'"
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@="
syn match qmlNonBindingColon "?[^;]*:"
syn region qmlTernaryColon start="?" end=":" contains=@qmlExpr,qmlBraces,qmlParens
syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:"
syn keyword qmlConditional if else switch
@@ -56,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)
@@ -122,7 +125,6 @@ if version >= 508 || !exists("did_qml_syn_inits")
HiLink qmlReserved Keyword
HiLink qmlDebug Debug
HiLink qmlConstant Label
HiLink qmlNonBindingColon NONE
HiLink qmlBindingProperty Label
HiLink qmlDeclaration Function

View File

@@ -102,9 +102,9 @@ syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtensio
syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite
syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite
syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypeDeclaration skipwhite
syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypePostDeclaration skipwhite
hi link scalaTypeTypeDeclaration Type
hi link scalaTypeTypeExtension Keyword
hi link scalaTypeTypePostDeclaration Special
@@ -113,7 +113,7 @@ hi link scalaTypeTypePostExtension Keyword
syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeDeclaration skipwhite
hi link scalaTypeDeclaration Type
hi link scalaTypeExtension Keyword
hi link scalaTypePostExtension Keyword
@@ -122,12 +122,14 @@ syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/
syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
hi link scalaTypeAnnotation Normal
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained
syn match scalaCaseFollowing /`[^`]\+`/ contained
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained contains=scalaCapitalWord
syn match scalaCaseFollowing /`[^`]\+`/ contained contains=scalaCapitalWord
hi link scalaCaseFollowing Special
syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super
syn keyword scalaKeywordModifier abstract override final lazy implicit private protected sealed null super
syn keyword scalaSpecialFunction implicitly require
hi link scalaKeywordModifier Function
hi link scalaSpecialFunction Function
syn keyword scalaSpecial this true false ne eq
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
@@ -199,7 +201,6 @@ hi link scalaDocLinks Function
hi link scalaParameterAnnotation Function
hi link scalaParamAnnotationValue Keyword
hi link scalaCommentAnnotation Function
hi link scalaCommentCodeBlockBrackets String
hi link scalaCommentCodeBlock String
hi link scalaTodo Todo

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,13 +38,21 @@ 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 match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment
syn region tomlKeyDq oneline start=/"/ end=/"/ contains=tomlEscape contained
hi def link tomlKeyDq Identifier
syn region tomlKeySq oneline start=/'/ end=/'/ contained
hi def link tomlKeySq Identifier
syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKeyDq,tomlKeySq
hi def link tomlTable Identifier
syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment
syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKeyDq,tomlKeySq
hi def link tomlTableArray Identifier
syn keyword tomlTodo TODO FIXME XXX BUG contained

View File

@@ -19,9 +19,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
" 2011 July 27: Changed all references of jinja tp twig
" 2014 December 4: Do not assume that the base filetype is HTML.
if exists('b:main_syntax')
finish
endif
if exists('b:current_syntax')
let b:main_syntax = b:current_syntax
else

View File

@@ -7,20 +7,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
" Previous: Vincent Pit <perl@profvince.com>
" Last Change: 2016-02-01
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
if exists("b:current_syntax")
finish
endif
" Read the C syntax to start with
if version < 600
source <sfile>:p:h/c.vim
else
runtime! syntax/c.vim
endif
runtime! syntax/c.vim
" Configuration:
" let xs_superseded = 0 " mark C functions superseded by Perl replacements (ex. memcpy vs Copy)
@@ -3672,29 +3663,16 @@ syn keyword xsMacro whichsig write xio_any xio_dirp xiv_iv xlv_targoff
syn keyword xsMacro xpv_len xuv_uv yystype
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_xs_syntax_inits")
if version < 508
let did_xs_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink xsPrivate Error
HiLink xsSuperseded Error
HiLink xsType Type
HiLink xsString String
HiLink xsConstant Constant
HiLink xsException Exception
HiLink xsKeyword Keyword
HiLink xsFunction Function
HiLink xsVariable Identifier
HiLink xsMacro Macro
delcommand HiLink
endif
hi def link xsPrivate Error
hi def link xsSuperseded Error
hi def link xsType Type
hi def link xsString String
hi def link xsConstant Constant
hi def link xsException Exception
hi def link xsKeyword Keyword
hi def link xsFunction Function
hi def link xsVariable Identifier
hi def link xsMacro Macro
let b:current_syntax = "xs"