Compare commits

..

13 Commits

Author SHA1 Message Date
Adam Stankiewicz
27903c5b86 Revert inlining basic language pack 2017-09-28 22:18:09 +02:00
Adam Stankiewicz
d5e38fa97b Remove graphql syntax as it causes issues, closes #236 2017-09-27 22:09:06 +02:00
Adam Stankiewicz
7673a61990 Change elm provider, closes #224 2017-09-27 20:52:13 +02:00
Adam Stankiewicz
6a12aa87f4 Add jenkinsfile syntax supports, closes #225 2017-09-27 20:46:39 +02:00
Adam Stankiewicz
5b77877888 Add syntax files from upstream vim repository 2017-09-27 20:43:42 +02:00
Adam Stankiewicz
8148255ef1 Add vifm support, closes #213 2017-09-27 20:23:42 +02:00
Adam Stankiewicz
40ddf334c9 Add F# support, closes #219 2017-09-27 20:19:38 +02:00
Adam Stankiewicz
7e10428cd6 Add autohotkey syntax, closes #220 2017-09-27 20:14:30 +02:00
Adam Stankiewicz
6a4fe34e61 Change solidity provider, closes #227 2017-09-27 20:08:01 +02:00
Adam Stankiewicz
4cd5566b40 Add gmpl and openscan, closes #232, closes #233 2017-09-27 20:00:25 +02:00
Adam Stankiewicz
8b3418cab8 Update 2017-09-27 19:57:29 +02:00
Arthur Xavier
9bfde7574a Change repo for PureScript's syntax and indentation (#223) 2017-08-21 21:43:02 +02:00
Josh Glendenning
8eab5f5403 Replace instances of "joshglendenning" with "isobit" following GitHub username change (#216) 2017-06-12 14:20:41 +02:00
92 changed files with 4285 additions and 1919 deletions

View File

@@ -41,31 +41,32 @@ If you need full functionality of any plugin, please use it directly with your p
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent)
- [asciidoc](https://github.com/asciidoc/vim-asciidoc) (syntax)
- [autohotkey](https://github.com/hnamikaw/vim-autohotkey) (indent)
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin)
- [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/joshglendenning/vim-caddyfile) (syntax, indent, ftplugin)
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
- [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)
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin)
- [css](https://github.com/JulesWang/css.vim) (syntax)
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
- [dockerfile](https://github.com/docker/docker) (syntax)
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
- [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin)
- [elm](https://github.com/ElmCast/elm-vim) (syntax, indent, autoload, ftplugin)
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
- [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
- [fsharp](https://github.com/fsharp/vim-fsharp) (syntax, indent)
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
- [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax)
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
- [graphql](https://github.com/jparise/vim-graphql) (syntax, ftplugin)
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
@@ -75,6 +76,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [i3](https://github.com/PotatoesMaster/i3-vim-syntax) (syntax, ftplugin)
- [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)
- [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)
@@ -95,6 +97,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [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)
@@ -103,7 +106,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
- [purescript](https://github.com/raichoo/purescript-vim) (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)
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
@@ -118,7 +121,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)
- [solidity](https://github.com/ethereum/vim-solidity) (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)
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
@@ -134,6 +137,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent)
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)

View File

@@ -12,7 +12,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '(:),\[:\],{:},<:>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
endif
setlocal suffixesadd+=.jsx

View File

@@ -4,6 +4,10 @@ if !exists('g:terraform_align')
let g:terraform_align = 0
endif
if !exists('g:terraform_remap_spacebar')
let g:terraform_remap_spacebar = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
@@ -31,6 +35,10 @@ function! TerraformFolds()
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
@@ -45,10 +53,13 @@ function! TerraformFoldText()
endfunction
setlocal foldtext=TerraformFoldText()
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
" Re-map the space bar to fold and unfold
if get(g:, "terraform_remap_spacebar", 1)
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
endif
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
if get(g:, "terraform_align", 1)

View File

@@ -20,9 +20,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" -----------------------------------------------------------------------------
" Highlight function names.
" -----------------------------------------------------------------------------
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
hi def link cCustomFunc Function
if !exists('g:cpp_no_function_highlight')
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
hi def link cCustomFunc Function
endif
" -----------------------------------------------------------------------------
" Highlight member variable names.

View File

@@ -36,9 +36,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" -----------------------------------------------------------------------------
" Functions
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@="
hi def link cCustomFunc Function
if !exists('g:cpp_no_function_highlight')
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@="
hi def link cCustomFunc Function
endif
" Class and namespace scope
if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight
@@ -48,6 +50,52 @@ if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight
hi def link cCustomClass Function
endif
" Clear cppStructure and replace "class" and/or "template" with matches
" based on user configuration
let s:needs_cppstructure_match = 0
if exists('g:cpp_class_decl_highlight') && g:cpp_class_decl_highlight
let s:needs_cppstructure_match += 1
endif
if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight
let s:needs_cppstructure_match += 2
endif
syn clear cppStructure
if s:needs_cppstructure_match == 0
syn keyword cppStructure typename namespace template class
elseif s:needs_cppstructure_match == 1
syn keyword cppStructure typename namespace template
elseif s:needs_cppstructure_match == 2
syn keyword cppStructure typename namespace class
elseif s:needs_cppstructure_match == 3
syn keyword cppStructure typename namespace
endif
unlet s:needs_cppstructure_match
" Class name declaration
if exists('g:cpp_class_decl_highlight') && g:cpp_class_decl_highlight
syn match cCustomClassKey "\<class\>"
hi def link cCustomClassKey cppStructure
" Clear cppAccess entirely and redefine as matches
syn clear cppAccess
syn match cCustomAccessKey "\<private\>"
syn match cCustomAccessKey "\<public\>"
syn match cCustomAccessKey "\<protected\>"
hi def link cCustomAccessKey cppAccess
" Match the parts of a class declaration
syn match cCustomClassName "\<class\_s\+\w\+\>"
\ contains=cCustomClassKey
syn match cCustomClassName "\<private\_s\+\w\+\>"
\ contains=cCustomAccessKey
syn match cCustomClassName "\<public\_s\+\w\+\>"
\ contains=cCustomAccessKey
syn match cCustomClassName "\<protected\_s\+\w\+\>"
\ contains=cCustomAccessKey
hi def link cCustomClassName Function
endif
" Template functions.
" Naive implementation that sorta works in most cases. Should correctly
" highlight everything in test/color2.cpp
@@ -79,17 +127,12 @@ elseif exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_tem
\ contains=cCustomAngleBracketStart,cCustomTemplateFunc
hi def link cCustomTemplateClass cCustomClass
" Remove 'template' from cppStructure and use a custom match
syn clear cppStructure
syn keyword cppStructure class typename namespace
syn match cCustomTemplate "\<template\>"
hi def link cCustomTemplate cppStructure
syn match cTemplateDeclare "\<template\_s*<\_[^;()]\{-}>"
\ contains=cppStructure,cCustomTemplate,cCustomAngleBracketStart
\ contains=cppStructure,cCustomTemplate,cCustomClassKey,cCustomAngleBracketStart
" Remove 'operator' from cppStructure and use a custom match
" Remove 'operator' from cppOperator and use a custom match
syn clear cppOperator
syn keyword cppOperator typeid
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
@@ -106,7 +149,7 @@ endif
"hi def link cCustomFunc Function
" Cluster for all the stdlib functions defined below
syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconstant,cppSTLnamespace,cppSTLtype,cppSTLexception,cppSTLiterator,cppSTLiterator_tagcppSTLenumcppSTLioscppSTLcast
syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconstant,cppSTLnamespace,cppSTLtype,cppSTLexception,cppSTLiterator,cppSTLiterator_tag,cppSTLenum,cppSTLios,cppSTLcast
" -----------------------------------------------------------------------------
@@ -184,6 +227,7 @@ syntax keyword cppSTLfunctional binary_negate
syntax keyword cppSTLfunctional bit_and
syntax keyword cppSTLfunctional bit_not
syntax keyword cppSTLfunctional bit_or
syntax keyword cppSTLfunctional bit_xor
syntax keyword cppSTLfunctional divides
syntax keyword cppSTLfunctional equal_to
syntax keyword cppSTLfunctional greater
@@ -699,6 +743,7 @@ syntax keyword cppSTLtype slice_array
syntax keyword cppSTLtype stack
syntax keyword cppSTLtype stream
syntax keyword cppSTLtype streambuf
syntax keyword cppSTLtype streamsize
syntax keyword cppSTLtype string
syntax keyword cppSTLtype stringbuf
syntax keyword cppSTLtype stringstream

View File

@@ -39,7 +39,7 @@ syn keyword yamlConstant TRUE True true YES Yes yes ON On on
syn keyword yamlConstant FALSE False false NO No no OFF Off off
syn match yamlKey "^\s*\zs[^ \t\"]\+\ze\s*:"
syn match yamlKey "^\s*-\s*\zs[^ \t\"]\+\ze\s*:"
syn match yamlKey "^\s*-\s*\zs[^ \t\"\']\+\ze\s*:"
syn match yamlAnchor "&\S\+"
syn match yamlAlias "*\S\+"

View File

@@ -310,7 +310,7 @@ function! crystal_lang#format(option_str) abort
try
call setreg('g', formatted, 'v')
silent normal! ggvG$"gp
silent normal! gg0vG$"gp
finally
call setreg('g', save_g_reg, save_g_regtype)
let &l:selection = sel_save

View File

@@ -24,9 +24,11 @@ function! dart#fmt(q_args) abort
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
if 0 == v:shell_error
let win_view = winsaveview()
silent % delete _
silent put=joined_lines
silent 1 delete _
let lines = split(joined_lines, "\n")
silent keepjumps call setline(1, lines)
if line('$') > len(lines)
silent keepjumps execute string(len(lines)+1).',$ delete'
endif
call winrestview(win_view)
else
let errors = split(joined_lines, "\n")[2:]

View File

@@ -1,6 +1,51 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
function! elixir#indent#debug(str)
if !exists("g:elixir_indent_max_lookbehind")
let g:elixir_indent_max_lookbehind = 30
endif
" Return the effective value of 'shiftwidth'
function! s:sw()
return &shiftwidth == 0 ? &tabstop : &shiftwidth
endfunction
function! elixir#indent#indent(lnum)
let lnum = a:lnum
let text = getline(lnum)
let prev_nb_lnum = prevnonblank(lnum-1)
let prev_nb_text = getline(prev_nb_lnum)
call s:debug("==> Indenting line " . lnum)
call s:debug("text = '" . text . "'")
let handlers = [
\'top_of_file',
\'starts_with_end',
\'starts_with_mid_or_end_block_keyword',
\'following_trailing_do',
\'following_trailing_binary_operator',
\'starts_with_pipe',
\'starts_with_close_bracket',
\'starts_with_binary_operator',
\'inside_nested_construct',
\'starts_with_comment',
\'inside_generic_block',
\'follow_prev_nb'
\]
for handler in handlers
call s:debug('testing handler elixir#indent#handle_'.handler)
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
if indent != -1
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
return indent
endif
endfor
call s:debug("defaulting")
return 0
endfunction
function! s:debug(str)
if exists("g:elixir_indent_debug") && g:elixir_indent_debug
echom a:str
endif
@@ -8,14 +53,14 @@ endfunction
" Returns 0 or 1 based on whether or not the text starts with the given
" expression and is not a string or comment
function! elixir#indent#starts_with(text, expr, lnum)
function! s:starts_with(text, expr, lnum)
let pos = match(a:text, '^\s*'.a:expr)
if pos == -1
return 0
else
" NOTE: @jbodah 2017-02-24: pos is the index of the match which is
" zero-indexed. Add one to make it the column number
if elixir#indent#is_string_or_comment(a:lnum, pos + 1)
if s:is_string_or_comment(a:lnum, pos + 1)
return 0
else
return 1
@@ -25,12 +70,12 @@ endfunction
" Returns 0 or 1 based on whether or not the text ends with the given
" expression and is not a string or comment
function! elixir#indent#ends_with(text, expr, lnum)
function! s:ends_with(text, expr, lnum)
let pos = match(a:text, a:expr.'\s*$')
if pos == -1
return 0
else
if elixir#indent#is_string_or_comment(a:lnum, pos)
if s:is_string_or_comment(a:lnum, pos)
return 0
else
return 1
@@ -38,14 +83,9 @@ function! elixir#indent#ends_with(text, expr, lnum)
end
endfunction
" Returns 0 or 1 based on whether or not the text matches the given expression
function! elixir#indent#contains(text, expr)
return a:text =~ a:expr
endfunction
" Returns 0 or 1 based on whether or not the given line number and column
" number pair is a string or comment
function! elixir#indent#is_string_or_comment(line, col)
function! s:is_string_or_comment(line, col)
return synIDattr(synID(a:line, a:col, 1), "name") =~ '\%(String\|Comment\)'
endfunction
@@ -59,35 +99,19 @@ function! elixir#indent#searchpair_back_skip()
if getline('.')[curr_col-1] == ''
let curr_col = curr_col-1
endif
return elixir#indent#is_string_or_comment(line('.'), curr_col)
endfunction
" DRY up searchpair calls
function! elixir#indent#searchpair_back(start, mid, end)
let line = line('.')
return searchpair(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
endfunction
" DRY up searchpairpos calls
function! elixir#indent#searchpairpos_back(start, mid, end)
let line = line('.')
return searchpairpos(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
return s:is_string_or_comment(line('.'), curr_col)
endfunction
" DRY up regex for keywords that 1) makes sure we only look at complete words
" and 2) ignores atoms
function! elixir#indent#keyword(expr)
function! s:keyword(expr)
return ':\@<!\<\C\%('.a:expr.'\)\>:\@!'
endfunction
function! elixir#indent#starts_with_comment(text)
return match(a:text, '^\s*#') != -1
endfunction
" Start at the end of text and search backwards looking for a match. Also peek
" ahead if we get a match to make sure we get a complete match. This means
" that the result should be the position of the start of the right-most match
function! elixir#indent#find_last_pos(lnum, text, match)
function! s:find_last_pos(lnum, text, match)
let last = len(a:text) - 1
let c = last
@@ -118,13 +142,46 @@ function! elixir#indent#handle_top_of_file(_lnum, _text, prev_nb_lnum, _prev_nb_
end
endfunction
function! elixir#indent#handle_follow_prev_nb(_lnum, _text, prev_nb_lnum, prev_nb_text)
return s:get_base_indent(a:prev_nb_lnum, a:prev_nb_text)
endfunction
" Given the line at `lnum`, returns the indent of the line that acts as the 'base indent'
" for this line. In particular it traverses backwards up things like pipelines
" to find the beginning of the expression
function! s:get_base_indent(lnum, text)
let prev_nb_lnum = prevnonblank(a:lnum - 1)
let prev_nb_text = getline(prev_nb_lnum)
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
let data_structure_close = '\%(\]\|}\|)\)'
let pipe = '|>'
if s:starts_with(a:text, binary_operator, a:lnum)
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
elseif s:starts_with(a:text, pipe, a:lnum)
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
elseif s:ends_with(prev_nb_text, binary_operator, prev_nb_lnum)
return s:get_base_indent(prev_nb_lnum, prev_nb_text)
elseif s:ends_with(a:text, data_structure_close, a:lnum)
let data_structure_open = '\%(\[\|{\|(\)'
let close_match_idx = match(a:text, data_structure_close . '\s*$')
let _move = cursor(a:lnum, close_match_idx + 1)
let [open_match_lnum, open_match_col] = searchpairpos(data_structure_open, '', data_structure_close, 'bnW')
let open_match_text = getline(open_match_lnum)
return s:get_base_indent(open_match_lnum, open_match_text)
else
return indent(a:lnum)
endif
endfunction
" TODO: @jbodah 2017-03-31: remove
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
if elixir#indent#ends_with(a:prev_nb_text, elixir#indent#keyword('do'), a:prev_nb_lnum)
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
if s:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)
if s:starts_with(a:text, s:keyword('end'), a:lnum)
return indent(a:prev_nb_lnum)
else
return indent(a:prev_nb_lnum) + &sw
return indent(a:prev_nb_lnum) + s:sw()
end
else
return -1
@@ -134,23 +191,31 @@ endfunction
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
if elixir#indent#ends_with(a:prev_nb_text, binary_operator, a:prev_nb_lnum)
return indent(a:prev_nb_lnum) + &sw
if s:ends_with(a:prev_nb_text, binary_operator, a:prev_nb_lnum)
return indent(a:prev_nb_lnum) + s:sw()
else
return -1
endif
endfunction
function! elixir#indent#handle_following_prev_end(_lnum, _text, prev_nb_lnum, prev_nb_text)
if s:ends_with(a:prev_nb_text, s:keyword('end'), a:prev_nb_lnum)
return indent(a:prev_nb_lnum)
else
return -1
endif
endfunction
function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_nb_text)
if elixir#indent#starts_with(a:text, '|>', a:lnum)
if s:starts_with(a:text, '|>', a:lnum)
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
if pos == -1
return indent(a:prev_nb_lnum)
else
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
if next_word_pos == -1
return indent(a:prev_nb_lnum) + &sw
return indent(a:prev_nb_lnum) + s:sw()
else
return pos + 1 + next_word_pos
end
@@ -161,7 +226,7 @@ function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_n
endfunction
function! elixir#indent#handle_starts_with_comment(_lnum, text, prev_nb_lnum, _prev_nb_text)
if elixir#indent#starts_with_comment(a:text)
if match(a:text, '^\s*#') != -1
return indent(a:prev_nb_lnum)
else
return -1
@@ -169,8 +234,8 @@ function! elixir#indent#handle_starts_with_comment(_lnum, text, prev_nb_lnum, _p
endfunction
function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_nb_text)
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end').'\zs')
if s:starts_with(a:text, s:keyword('end'), a:lnum)
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end').'\zs', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
return indent(pair_lnum)
else
return -1
@@ -178,8 +243,8 @@ function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_
endfunction
function! elixir#indent#handle_starts_with_mid_or_end_block_keyword(lnum, text, _prev_nb_lnum, _prev_nb_text)
if elixir#indent#starts_with(a:text, elixir#indent#keyword('catch\|rescue\|after\|else'), a:lnum)
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('with\|receive\|try\|if\|fn'), elixir#indent#keyword('catch\|rescue\|after\|else').'\zs', elixir#indent#keyword('end'))
if s:starts_with(a:text, s:keyword('catch\|rescue\|after\|else'), a:lnum)
let pair_lnum = searchpair(s:keyword('with\|receive\|try\|if\|fn'), s:keyword('catch\|rescue\|after\|else').'\zs', s:keyword('end'), 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
return indent(pair_lnum)
else
return -1
@@ -187,8 +252,8 @@ function! elixir#indent#handle_starts_with_mid_or_end_block_keyword(lnum, text,
endfunction
function! elixir#indent#handle_starts_with_close_bracket(lnum, text, _prev_nb_lnum, _prev_nb_text)
if elixir#indent#starts_with(a:text, '\%(\]\|}\|)\)', a:lnum)
let pair_lnum = elixir#indent#searchpair_back('\%(\[\|{\|(\)', '', '\%(\]\|}\|)\)')
if s:starts_with(a:text, '\%(\]\|}\|)\)', a:lnum)
let pair_lnum = searchpair('\%(\[\|{\|(\)', '', '\%(\]\|}\|)\)', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
return indent(pair_lnum)
else
return -1
@@ -198,15 +263,15 @@ endfunction
function! elixir#indent#handle_starts_with_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
if elixir#indent#starts_with(a:text, binary_operator, a:lnum)
if s:starts_with(a:text, binary_operator, a:lnum)
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
if pos == -1
return indent(a:prev_nb_lnum)
else
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
if next_word_pos == -1
return indent(a:prev_nb_lnum) + &sw
return indent(a:prev_nb_lnum) + s:sw()
else
return pos + 1 + next_word_pos
end
@@ -221,75 +286,116 @@ endfunction
" function, etc... so we need to first figure out what the innermost structure
" is then forward execution to the proper handler
function! elixir#indent#handle_inside_nested_construct(lnum, text, prev_nb_lnum, prev_nb_text)
let start_pattern = '\C\%(\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
let start_pattern = '\C\%(\<with\>\|\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
let pair_info = elixir#indent#searchpairpos_back(start_pattern, '', end_pattern)
let pair_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", max([0, a:lnum - g:elixir_indent_max_lookbehind]))
let pair_lnum = pair_info[0]
let pair_col = pair_info[1]
if pair_lnum != 0 || pair_col != 0
let pair_text = getline(pair_lnum)
let pair_char = pair_text[pair_col - 1]
if pair_char == 'f'
call elixir#indent#debug("testing elixir#indent#do_handle_inside_fn")
return elixir#indent#do_handle_inside_fn(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
call s:debug("testing s:do_handle_inside_fn")
return s:do_handle_inside_fn(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
elseif pair_char == '['
call elixir#indent#debug("testing elixir#indent#do_handle_inside_square_brace")
return elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
call s:debug("testing s:do_handle_inside_square_brace")
return s:do_handle_inside_square_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
elseif pair_char == '{'
call elixir#indent#debug("testing elixir#indent#do_handle_inside_curly_brace")
return elixir#indent#do_handle_inside_curly_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
call s:debug("testing s:do_handle_inside_curly_brace")
return s:do_handle_inside_curly_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
elseif pair_char == '('
call elixir#indent#debug("testing elixir#indent#do_handle_inside_parens")
return elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
call s:debug("testing s:do_handle_inside_parens")
return s:do_handle_inside_parens(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
elseif pair_char == 'w'
call s:debug("testing s:do_handle_inside_with")
return s:do_handle_inside_with(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
else
call elixir#indent#debug("testing elixir#indent#do_handle_inside_keyword_block")
return elixir#indent#do_handle_inside_keyword_block(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
call s:debug("testing s:do_handle_inside_keyword_block")
return s:do_handle_inside_keyword_block(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
end
else
return -1
end
endfunction
function! elixir#indent#do_handle_inside_keyword_block(pair_lnum, _pair_col, _lnum, text, prev_nb_lnum, prev_nb_text)
function! s:do_handle_inside_with(pair_lnum, pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
if a:pair_lnum == a:lnum
" This is the `with` line or an inline `with`/`do`
call s:debug("current line is `with`")
return -1
else
" Determine if in with/do, do/else|end, or else/end
let start_pattern = '\C\%(\<with\>\|\<else\>\|\<do\>\)'
let end_pattern = '\C\%(\<end\>\)'
let pair_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()")
let pair_lnum = pair_info[0]
let pair_col = pair_info[1]
let pair_text = getline(pair_lnum)
let pair_char = pair_text[pair_col - 1]
if s:starts_with(a:text, '\Cdo:', a:lnum)
call s:debug("current line is do:")
return pair_col - 1 + s:sw()
elseif s:starts_with(a:text, '\Celse:', a:lnum)
call s:debug("current line is else:")
return pair_col - 1
elseif s:starts_with(a:text, '\C\(\<do\>\|\<else\>\)', a:lnum)
call s:debug("current line is do/else")
return pair_col - 1
elseif s:starts_with(pair_text, '\C\(do\|else\):', pair_lnum)
call s:debug("inside do:/else:")
return pair_col - 1 + s:sw()
elseif pair_char == 'w'
call s:debug("inside with/do")
return pair_col + 4
elseif pair_char == 'd'
call s:debug("inside do/else|end")
return pair_col - 1 + s:sw()
else
call s:debug("inside else/end")
return s:do_handle_inside_pattern_match_block(pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
end
end
endfunction
function! s:do_handle_inside_keyword_block(pair_lnum, _pair_col, _lnum, text, prev_nb_lnum, prev_nb_text)
let keyword_pattern = '\C\%(\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<after\>\|\<catch\>\|\<rescue\>\|\<else\>\)'
if a:pair_lnum
" last line is a "receive" or something
if elixir#indent#starts_with(a:prev_nb_text, keyword_pattern, a:prev_nb_lnum)
call elixir#indent#debug("prev nb line is keyword")
return indent(a:prev_nb_lnum) + &sw
elseif elixir#indent#contains(a:text, '->')
call elixir#indent#debug("contains ->")
" TODO: @jbodah 2017-03-31: test contains ignores str + comments
return indent(a:pair_lnum) + &sw
elseif elixir#indent#contains(a:prev_nb_text, '->')
call elixir#indent#debug("prev nb line contains ->")
return indent(a:prev_nb_lnum) + &sw
if s:starts_with(a:prev_nb_text, keyword_pattern, a:prev_nb_lnum)
call s:debug("prev nb line is keyword")
return indent(a:prev_nb_lnum) + s:sw()
else
call elixir#indent#debug("doesnt start with comment or contain ->")
return indent(a:prev_nb_lnum)
return s:do_handle_inside_pattern_match_block(a:pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
end
else
return -1
endif
endfunction
function! elixir#indent#do_handle_inside_fn(pair_lnum, _pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
" Implements indent for pattern-matching blocks (e.g. case, fn, with/else)
function! s:do_handle_inside_pattern_match_block(block_start_lnum, text, prev_nb_lnum, prev_nb_text)
if a:text =~ '->'
call s:debug("current line contains ->")
return indent(a:block_start_lnum) + s:sw()
elseif a:prev_nb_text =~ '->'
call s:debug("prev nb line contains ->")
return indent(a:prev_nb_lnum) + s:sw()
else
return indent(a:prev_nb_lnum)
end
endfunction
function! s:do_handle_inside_fn(pair_lnum, _pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
if a:pair_lnum && a:pair_lnum != a:lnum
if elixir#indent#contains(a:text, '->')
return indent(a:pair_lnum) + &sw
else
if elixir#indent#ends_with(a:prev_nb_text, '->', a:prev_nb_lnum)
return indent(a:prev_nb_lnum) + &sw
else
return indent(a:prev_nb_lnum)
end
end
return s:do_handle_inside_pattern_match_block(a:pair_lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
else
return -1
endif
endfunction
function! elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
function! s:do_handle_inside_square_brace(pair_lnum, pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
" If in list...
if a:pair_lnum != 0 || a:pair_col != 0
let pair_text = getline(a:pair_lnum)
@@ -298,24 +404,24 @@ function! elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, _lnum
if indent_pos != -1
return indent_pos + a:pair_col
else
return indent(a:pair_lnum) + &sw
return indent(a:pair_lnum) + s:sw()
endif
else
return -1
end
endfunction
function! elixir#indent#do_handle_inside_curly_brace(pair_lnum, _pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
return indent(a:pair_lnum) + &sw
function! s:do_handle_inside_curly_brace(pair_lnum, _pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
return indent(a:pair_lnum) + s:sw()
endfunction
function! elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
function! s:do_handle_inside_parens(pair_lnum, pair_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
if a:pair_lnum
if elixir#indent#ends_with(a:prev_nb_text, '(', a:prev_nb_lnum)
return indent(a:prev_nb_lnum) + &sw
if s:ends_with(a:prev_nb_text, '(', a:prev_nb_lnum)
return indent(a:prev_nb_lnum) + s:sw()
elseif a:pair_lnum == a:prev_nb_lnum
" Align indent (e.g. "def add(a,")
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, '[^(]\+,')
let pos = s:find_last_pos(a:prev_nb_lnum, a:prev_nb_text, '[^(]\+,')
if pos == -1
return 0
else
@@ -330,14 +436,14 @@ function! elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, _lnum, _tex
endfunction
function! elixir#indent#handle_inside_generic_block(lnum, _text, prev_nb_lnum, prev_nb_text)
let pair_lnum = searchpair(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end'), 'bW', "line('.') == ".a:lnum." || elixir#indent#is_string_or_comment(line('.'), col('.'))")
let pair_lnum = searchpair(s:keyword('do\|fn'), '', s:keyword('end'), 'bW', "line('.') == ".a:lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:lnum - g:elixir_indent_max_lookbehind]))
if pair_lnum
" TODO: @jbodah 2017-03-29: this should probably be the case in *all*
" blocks
if elixir#indent#ends_with(a:prev_nb_text, ',', a:prev_nb_lnum)
return indent(pair_lnum) + 2 * &sw
if s:ends_with(a:prev_nb_text, ',', a:prev_nb_lnum)
return indent(pair_lnum) + 2 * s:sw()
else
return indent(pair_lnum) + &sw
return indent(pair_lnum) + s:sw()
endif
else
return -1

382
autoload/elm.vim Normal file
View File

@@ -0,0 +1,382 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
let s:errors = []
function! s:elmOracle(...) abort
let l:project = finddir('elm-stuff/..', '.;')
if len(l:project) == 0
echoerr '`elm-stuff` not found! run `elm-package install` for autocomplete.'
return []
endif
let l:filename = expand('%:p')
if a:0 == 0
let l:oldiskeyword = &iskeyword
" Some non obvious values used in 'iskeyword':
" @ = all alpha
" 48-57 = numbers 0 to 9
" @-@ = character @
" 124 = |
setlocal iskeyword=@,48-57,@-@,_,-,~,!,#,$,%,&,*,+,=,<,>,/,?,.,\\,124,^
let l:word = expand('<cword>')
let &iskeyword = l:oldiskeyword
else
let l:word = a:1
endif
let l:infos = elm#Oracle(l:filename, l:word)
if v:shell_error != 0
call elm#util#EchoError("elm-oracle failed:\n\n", l:infos)
return []
endif
let l:d = split(l:infos, '\n')
if len(l:d) > 0
return elm#util#DecodeJSON(l:d[0])
endif
return []
endf
" Vim command to format Elm files with elm-format
function! elm#Format() abort
" check for elm-format
if elm#util#CheckBin('elm-format', 'https://github.com/avh4/elm-format') ==# ''
return
endif
" save cursor position, folds and many other things
let l:curw = {}
try
mkview!
catch
let l:curw = winsaveview()
endtry
" save our undo file to be restored after we are done.
let l:tmpundofile = tempname()
exe 'wundo! ' . l:tmpundofile
" write current unsaved buffer to a temporary file
let l:tmpname = tempname() . '.elm'
call writefile(getline(1, '$'), l:tmpname)
" call elm-format on the temporary file
let l:out = system('elm-format ' . l:tmpname . ' --output ' . l:tmpname)
" if there is no error
if v:shell_error == 0
try | silent undojoin | catch | endtry
" replace current file with temp file, then reload buffer
let l:old_fileformat = &fileformat
call rename(l:tmpname, expand('%'))
silent edit!
let &fileformat = l:old_fileformat
let &syntax = &syntax
elseif g:elm_format_fail_silently == 0
call elm#util#EchoLater('EchoError', 'elm-format:', l:out)
endif
" save our undo history
silent! exe 'rundo ' . l:tmpundofile
call delete(l:tmpundofile)
" restore our cursor/windows positions, folds, etc..
if empty(l:curw)
silent! loadview
else
call winrestview(l:curw)
endif
endf
" Query elm-oracle and echo the type and docs for the word under the cursor.
function! elm#ShowDocs() abort
" check for the elm-oracle binary
if elm#util#CheckBin('elm-oracle', 'https://github.com/elmcast/elm-oracle') ==# ''
return
endif
let l:response = s:elmOracle()
if len(l:response) > 0
let l:info = l:response[0]
redraws! | echohl Identifier | echon l:info.fullName | echohl None | echon ' : ' | echohl Function | echon l:info.signature | echohl None | echon "\n\n" . l:info.comment
else
call elm#util#Echo('elm-oracle:', '...no match found')
endif
endf
" Query elm-oracle and open the docs for the word under the cursor.
function! elm#BrowseDocs() abort
" check for the elm-oracle binary
if elm#util#CheckBin('elm-oracle', 'https://github.com/elmcast/elm-oracle') ==# ''
return
endif
let l:response = s:elmOracle()
if len(l:response) > 0
let l:info = l:response[0]
call elm#util#OpenBrowser(l:info.href)
else
call elm#util#Echo('elm-oracle:', '...no match found')
endif
endf
function! elm#Syntastic(input) abort
let l:fixes = []
let l:bin = 'elm-make'
let l:format = '--report=json'
let l:input = shellescape(a:input)
let l:output = '--output=' . shellescape(syntastic#util#DevNull())
let l:command = l:bin . ' ' . l:format . ' ' . l:input . ' ' . l:output
let l:reports = s:ExecuteInRoot(l:command)
for l:report in split(l:reports, '\n')
if l:report[0] ==# '['
for l:error in elm#util#DecodeJSON(l:report)
if g:elm_syntastic_show_warnings == 0 && l:error.type ==? 'warning'
else
if a:input == l:error.file
call add(s:errors, l:error)
call add(l:fixes, {'filename': l:error.file,
\'valid': 1,
\'bufnr': bufnr('%'),
\'type': (l:error.type ==? 'error') ? 'E' : 'W',
\'lnum': l:error.region.start.line,
\'col': l:error.region.start.column,
\'text': l:error.overview})
endif
endif
endfor
endif
endfor
return l:fixes
endf
function! elm#Build(input, output, show_warnings) abort
let s:errors = []
let l:fixes = []
let l:rawlines = []
let l:bin = 'elm-make'
let l:format = '--report=json'
let l:input = shellescape(a:input)
let l:output = '--output=' . shellescape(a:output)
let l:command = l:bin . ' ' . l:format . ' ' . l:input . ' ' . l:output
let l:reports = s:ExecuteInRoot(l:command)
for l:report in split(l:reports, '\n')
if l:report[0] ==# '['
for l:error in elm#util#DecodeJSON(l:report)
if a:show_warnings == 0 && l:error.type ==? 'warning'
else
call add(s:errors, l:error)
call add(l:fixes, {'filename': l:error.file,
\'valid': 1,
\'type': (l:error.type ==? 'error') ? 'E' : 'W',
\'lnum': l:error.region.start.line,
\'col': l:error.region.start.column,
\'text': l:error.overview})
endif
endfor
else
call add(l:rawlines, l:report)
endif
endfor
let l:details = join(l:rawlines, "\n")
let l:lines = split(l:details, "\n")
if !empty(l:lines)
let l:overview = l:lines[0]
else
let l:overview = ''
endif
if l:details ==# '' || l:details =~? '^Successfully.*'
else
call add(s:errors, {'overview': l:details, 'details': l:details})
call add(l:fixes, {'filename': expand('%', 1),
\'valid': 1,
\'type': 'E',
\'lnum': 0,
\'col': 0,
\'text': l:overview})
endif
return l:fixes
endf
" Make the given file, or the current file if none is given.
function! elm#Make(...) abort
if elm#util#CheckBin('elm-make', 'http://elm-lang.org/install') ==# ''
return
endif
call elm#util#Echo('elm-make:', 'building...')
let l:input = (a:0 == 0) ? expand('%:p') : a:1
let l:fixes = elm#Build(l:input, g:elm_make_output_file, g:elm_make_show_warnings)
if len(l:fixes) > 0
call elm#util#EchoWarning('', 'found ' . len(l:fixes) . ' errors')
call setqflist(l:fixes, 'r')
cwindow
if get(g:, 'elm_jump_to_error', 1)
ll 1
endif
else
call elm#util#EchoSuccess('', 'Sucessfully compiled')
call setqflist([])
cwindow
endif
endf
" Show the detail of the current error in the quickfix window.
function! elm#ErrorDetail() abort
if !empty(filter(tabpagebuflist(), 'getbufvar(v:val, "&buftype") ==? "quickfix"'))
exec ':copen'
let l:linenr = line('.')
exec ':wincmd p'
if len(s:errors) > 0
let l:detail = s:errors[l:linenr-1].details
if l:detail ==# ''
let l:detail = s:errors[l:linenr-1].overview
endif
echo l:detail
endif
endif
endf
" Open the elm repl in a subprocess.
function! elm#Repl() abort
" check for the elm-repl binary
if elm#util#CheckBin('elm-repl', 'http://elm-lang.org/install') ==# ''
return
endif
if has('nvim')
term('elm-repl')
else
!elm-repl
endif
endf
function! elm#Oracle(filepath, word) abort
let l:bin = 'elm-oracle'
let l:filepath = shellescape(a:filepath)
let l:word = shellescape(a:word)
let l:command = l:bin . ' ' . l:filepath . ' ' . l:word
return s:ExecuteInRoot(l:command)
endfunction
let s:fullComplete = ''
" Complete the current token using elm-oracle
function! elm#Complete(findstart, base) abort
" a:base is unused, but the callback function for completion expects 2 arguments
if a:findstart
let l:line = getline('.')
let l:idx = col('.') - 1
let l:start = 0
while l:idx > 0 && l:line[l:idx - 1] =~# '[a-zA-Z0-9_\.]'
if l:line[l:idx - 1] ==# '.' && l:start == 0
let l:start = l:idx
endif
let l:idx -= 1
endwhile
if l:start == 0
let l:start = l:idx
endif
let s:fullComplete = l:line[l:idx : col('.')-2]
return l:start
else
" check for the elm-oracle binary
if elm#util#CheckBin('elm-oracle', 'https://github.com/elmcast/elm-oracle') ==# ''
return []
endif
let l:res = []
let l:response = s:elmOracle(s:fullComplete)
let l:detailed = get(g:, 'elm_detailed_complete', 0)
for l:r in l:response
let l:menu = ''
if l:detailed
let l:menu = ': ' . l:r.signature
endif
call add(l:res, {'word': l:r.name, 'menu': l:menu})
endfor
return l:res
endif
endf
" If the current buffer contains a consoleRunner, run elm-test with it.
" Otherwise run elm-test in the root of your project which deafults to
" running 'elm-test tests/TestRunner'.
function! elm#Test() abort
if elm#util#CheckBin('elm-test', 'https://github.com/rtfeldman/node-elm-test') ==# ''
return
endif
if match(getline(1, '$'), 'consoleRunner') < 0
let l:out = s:ExecuteInRoot('elm-test')
call elm#util#EchoSuccess('elm-test', l:out)
else
let l:filepath = shellescape(expand('%:p'))
let l:out = s:ExecuteInRoot('elm-test ' . l:filepath)
call elm#util#EchoSuccess('elm-test', l:out)
endif
endf
" Returns the closest parent with an elm-package.json file.
function! elm#FindRootDirectory() abort
let l:elm_root = getbufvar('%', 'elmRoot')
if empty(l:elm_root)
let l:current_file = expand('%:p')
let l:dir_current_file = fnameescape(fnamemodify(l:current_file, ':h'))
let l:match = findfile('elm-package.json', l:dir_current_file . ';')
if empty(l:match)
let l:elm_root = ''
else
let l:elm_root = fnamemodify(l:match, ':p:h')
endif
if !empty(l:elm_root)
call setbufvar('%', 'elmRoot', l:elm_root)
endif
endif
return l:elm_root
endfunction
" Executes a command in the project directory.
function! s:ExecuteInRoot(cmd) abort
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let l:current_dir = getcwd()
let l:root_dir = elm#FindRootDirectory()
try
execute l:cd . fnameescape(l:root_dir)
let l:out = system(a:cmd)
finally
execute l:cd . fnameescape(l:current_dir)
endtry
return l:out
endfunction
endif

View File

@@ -1,12 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
" System IO
" Craft a system command and run it, returning the output.
function! elm#io#system(program, args)
let cmd ="which " . a:program . " && " . a:program . " " . a:args
return system(cmd)
endfunction
endif

178
autoload/elm/util.vim Normal file
View File

@@ -0,0 +1,178 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
" IsWin returns 1 if current OS is Windows or 0 otherwise
fun! elm#util#IsWin() abort
let l:win = ['win16', 'win32', 'win32unix', 'win64', 'win95']
for l:w in l:win
if (has(l:w))
return 1
endif
endfor
return 0
endf
fun! elm#util#CheckBin(bin, url) abort
let l:binpath = substitute(a:bin, '^\s*\(.\{-}\)\s*$', '\1', '')
if executable(l:binpath)
return l:binpath
endif
call elm#util#EchoWarning('elm-vim:', 'could not find ' . l:binpath . ' [' . a:url . ']')
return ''
endf
" Determines the browser command to use
fun! s:get_browser_command() abort
let l:elm_browser_command = get(g:, 'elm_browser_command', '')
if l:elm_browser_command ==? ''
if elm#util#IsWin()
let l:elm_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin'
let l:elm_browser_command = 'open %URL%'
elseif executable('xdg-open')
let l:elm_browser_command = 'xdg-open %URL%'
elseif executable('firefox')
let l:elm_browser_command = 'firefox %URL% &'
else
let l:elm_browser_command = ''
endif
endif
return l:elm_browser_command
endf
" OpenBrowser opens a url in the default browser
fun! elm#util#OpenBrowser(url) abort
let l:cmd = s:get_browser_command()
if len(l:cmd) == 0
redraw
echohl WarningMsg
echo "It seems that you don't have general web browser. Open URL below."
echohl None
echo a:url
return
endif
if l:cmd =~? '^!'
let l:cmd = substitute(l:cmd, '%URL%', '\=shellescape(a:url)', 'g')
silent! exec l:cmd
elseif l:cmd =~# '^:[A-Z]'
let l:cmd = substitute(l:cmd, '%URL%', '\=a:url', 'g')
exec l:cmd
else
let l:cmd = substitute(l:cmd, '%URL%', '\=shellescape(a:url)', 'g')
call system(l:cmd)
endif
endf
" DecodeJSON decodes a string of json into a viml object
fun! elm#util#DecodeJSON(s) abort
let l:true = 1
let l:false = 0
let l:null = 0
return eval(a:s)
endf
" Remove ANSI escape characters used for highlighting purposes
fun! s:strip_color(msg) abort
return substitute(a:msg, '\e\[[0-9;]\+[mK]', '', 'g')
endf
" Print functions
fun! elm#util#Echo(title, msg) abort
redraws! | echon a:title . ' ' | echohl Identifier | echon s:strip_color(a:msg) | echohl None
endf
fun! elm#util#EchoSuccess(title, msg) abort
redraws! | echon a:title . ' ' | echohl Function | echon s:strip_color(a:msg) | echohl None
endf
fun! elm#util#EchoWarning(title, msg) abort
redraws! | echon a:title . ' ' | echohl WarningMsg | echon s:strip_color(a:msg) | echohl None
endf
fun! elm#util#EchoError(title, msg) abort
redraws! | echon a:title . ' ' | echohl ErrorMsg | echon s:strip_color(a:msg) | echohl None
endf
fun! elm#util#EchoLater(func_name, title, msg) abort
let s:echo_func_name = a:func_name
let s:echo_title = a:title
let s:echo_msg = a:msg
endf
fun! elm#util#EchoStored() abort
if exists('s:echo_func_name') && exists('s:echo_title') && exists('s:echo_msg')
call elm#util#{s:echo_func_name}(s:echo_title, s:echo_msg)
unlet s:echo_func_name
unlet s:echo_title
unlet s:echo_msg
endif
endf
function! elm#util#GoToModule(name)
if empty(a:name) | return | endif
if empty(matchstr(a:name, '^Native\.'))
let l:extension = '.elm'
else
let l:extension = '.js'
endif
let l:rel_path = substitute(a:name, '\.', '/', 'g') . l:extension
let l:root = elm#FindRootDirectory()
let l:module_file = s:findLocalModule(l:rel_path, l:root)
if !filereadable(l:module_file)
let l:module_file = s:findDependencyModule(l:rel_path, l:root)
endif
if filereadable(l:module_file)
exec 'edit ' . fnameescape(l:module_file)
else
return s:error("Can't find module \"" . a:name . "\"")
endif
endfunction
function! s:findLocalModule(rel_path, root)
let l:package_json = a:root . '/elm-package.json'
if exists('*json_decode')
let l:package = json_decode(readfile(l:package_json))
let l:source_roots = l:package['source-directories']
else
" This is a fallback for vim's which do not support json_decode.
" It simply only looks in the 'src' subdirectory and fails otherwise.
let l:source_roots = ['src']
end
for l:source_root in l:source_roots
let l:file_path = a:root . '/' . l:source_root . '/' . a:rel_path
if !filereadable(l:file_path)
continue
endif
return l:file_path
endfor
endfunction
function! s:findDependencyModule(rel_path, root)
" If we are a dependency ourselves, we need to check our siblings.
" This is because elm package doesn't install dependencies recursively.
let l:root = substitute(a:root, '\/elm-stuff/packages.\+$', '', '')
" We naively craws the dependencies dir for any fitting module name.
" If it exists, we'll find it. If multiple filenames match,
" there's a chance we return the wrong one.
let l:module_paths = glob(l:root . '/elm-stuff/packages/**/' . a:rel_path, 0, 1)
if len(l:module_paths) > 0
return l:module_paths[0]
endif
endfunction
" Using the built-in :echoerr prints a stacktrace, which isn't that nice.
" From: https://github.com/moll/vim-node/blob/master/autoload/node.vim
function! s:error(msg)
echohl ErrorMsg
echomsg a:msg
echohl NONE
let v:errmsg = a:msg
endfunction
endif

View File

@@ -3,6 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Author: Kevin Ballard
" Description: Helper functions for Rust commands/mappings
" Last Modified: May 27, 2014
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
" Jump {{{1
@@ -408,11 +409,15 @@ function! rust#Play(count, line1, line2, ...) abort
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
let url = res.content
if exists('g:rust_clip_command')
call system(g:rust_clip_command, url)
endif
redraw | echomsg 'Done: '.url
endfunction
" }}}1
" vim: set noet sw=4 ts=4:
" vim: set noet sw=8 ts=8:
endif

View File

@@ -3,6 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Author: Stephen Sugden <stephen@stephensugden.com>
"
" Adapted from https://github.com/fatih/vim-go
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if !exists("g:rustfmt_autosave")
let g:rustfmt_autosave = 0

18
autoload/vifm/edit.vim Normal file
View File

@@ -0,0 +1,18 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" common functions for vifm command-line editing buffer filetype plugins
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: August 18, 2013
" Prepare buffer
function! vifm#edit#Init()
" Mappings for quick leaving the buffer (behavior similar to Command line
" buffer in Vim)
nnoremap <buffer> <cr> :copy 0 \| wq<cr>
imap <buffer> <cr> <esc><cr>
" Start buffer editing in insert mode
startinsert
endfunction
endif

View File

@@ -587,7 +587,7 @@ let g:xmldata_html5 = {
\ ],
\ 'input': [
\ [],
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': autofill_tokens, 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': autofill_tokens, 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
\ ],
\ 'ins': [
\ flow_elements,

16
build
View File

@@ -113,31 +113,33 @@ PACKS="
yaml:stephpy/vim-yaml
ansible:pearofducks/ansible-vim
arduino:sudar/vim-arduino-syntax
autohotkey:hnamikaw/vim-autohotkey
blade:jwalton512/vim-blade
c++11:octol/vim-cpp-enhanced-highlight
c/c++:vim-jp/vim-cpp
caddyfile:joshglendenning/vim-caddyfile
caddyfile:isobit/vim-caddyfile
cjsx:mtscout6/vim-cjsx
clojure:guns/vim-clojure-static
coffee-script:kchmck/vim-coffee-script
cryptol:victoredwardocallaghan/cryptol.vim
crystal:rhysd/vim-crystal
cql:elubow/cql-vim
css:JulesWang/css.vim
cucumber:tpope/vim-cucumber
dart:dart-lang/dart-vim-plugin
dockerfile:docker/docker::/contrib/syntax/vim/
elixir:elixir-lang/vim-elixir
elm:lambdatoast/elm.vim
elm:ElmCast/elm-vim
emberscript:yalesov/vim-ember-script
emblem:yalesov/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
fish:dag/vim-fish
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
graphql:jparise/vim-graphql
groovy:vim-scripts/groovy.vim
haml:sheerun/vim-haml
handlebars:mustache/vim-mustache-handlebars
@@ -147,6 +149,7 @@ PACKS="
i3:PotatoesMaster/i3-vim-syntax
jasmine:glanotte/vim-jasmine
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
json:elzr/vim-json
jst:briancollins/vim-jst
jsx:mxw/vim-jsx:_ALL
@@ -175,7 +178,7 @@ PACKS="
protobuf:uarun/vim-protobuf
pug:digitaltoad/vim-pug
puppet:voxpupuli/vim-puppet
purescript:raichoo/purescript-vim
purescript:purescript-contrib/purescript-vim
python:mitsuhiko/vim-python-combined
python-compiler:aliev/vim-compiler-python
qml:peterhoeg/vim-qml
@@ -190,7 +193,7 @@ PACKS="
scala:derekwyatt/vim-scala
scss:cakebaker/scss-syntax.vim
slim:slim-template/vim-slim
solidity:ethereum/vim-solidity
solidity:tomlion/vim-solidity
stylus:wavded/vim-stylus
swift:keith/swift.vim
sxhkd:baskerville/vim-sxhkdrc
@@ -206,6 +209,7 @@ PACKS="
vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim
vcl:smerrill/vcl-vim-plugin
vifm:vifm/vifm.vim
vue:posva/vim-vue
vm:lepture/vim-velocity
xls:vim-scripts/XSLT-syntax

View File

@@ -4,6 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Compiler: Cargo Compiler
" Maintainer: Damien Radtke <damienradtke@gmail.com>
" Latest Revision: 2014 Sep 24
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists('current_compiler')
finish
@@ -11,6 +12,9 @@ endif
runtime compiler/rustc.vim
let current_compiler = "cargo"
let s:save_cpo = &cpo
set cpo&vim
if exists(':CompilerSet') != 2
command -nargs=* CompilerSet setlocal <args>
endif
@@ -27,6 +31,11 @@ CompilerSet errorformat+=
\%-G%\\s%#Compiling%.%#,
\%-G%\\s%#Finished%.%#,
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
\%-G%\\s%#To\ learn\ more\\,%.%#
\%-G%\\s%#To\ learn\ more\\,%.%#,
\%-Gnote:\ Run\ with\ \`RUST_BACKTRACE=%.%#,
\%.%#panicked\ at\ \\'%m\\'\\,\ %f:%l
let &cpo = s:save_cpo
unlet s:save_cpo
endif

View File

@@ -24,10 +24,10 @@ CompilerSet errorformat=
\%D(in\ %f),
\%\\s%#from\ %f:%l:%m,
\%\\s%#from\ %f:%l:,
\%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%.%#,
\%\\s%##\ %f:%l%\\&%.%#%\\D:%.%#,
\%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
\%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
\%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%#:%.%#,
\%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%#,
\%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%#:%.%#,
\%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%#:%.%#,
\%\\s%#%f:%l:,
\%m\ [%f:%l]:,
\%+Erake\ aborted!,

View File

@@ -4,6 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Compiler: Rust Compiler
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Latest Revision: 2013 Jul 12
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists("current_compiler")
finish

View File

@@ -17,8 +17,18 @@ if exists(":CompilerSet") != 2
command! -nargs=* CompilerSet setlocal <args>
endif
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
let s:cpo_save = &cpo
set cpo-=C
execute 'CompilerSet makeprg='
\ . escape(g:typescript_compiler_binary, ' ')
\ . '\ '
\ . escape(g:typescript_compiler_options, ' ')
\ . '\ $*\ %'
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -2,9 +2,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster
syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster,jsComment fold
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster,jsComment fold
syntax region jsFlowExactObject contained matchgroup=jsFlowNoise start=/{|/ end=/|}/ contains=@jsFlowCluster,jsComment fold
syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster keepend fold
syntax match jsFlowNoise contained /[:;,<>]/
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array Function object array bool class
syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType
@@ -12,18 +13,18 @@ syntax match jsFlowTypeCustom contained /[0-9a-zA-Z_.]*/ skipwhite skipemp
syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster
syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments,jsFlowObject,jsFlowReturnObject
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
syntax keyword jsFlowImportType contained type skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup
syntax match jsFlowWildcard contained /*/
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster,jsFlowArrow,jsFlowReturnParens
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp fold
syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp fold
syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp,jsFlowReturnArrow fold
syntax match jsFlowReturnArrow contained /=>/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax match jsFlowReturnKeyword contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword
syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword,jsFlowReturnObject
syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax match jsFlowWildcardReturn contained /*/ skipwhite skipempty nextgroup=jsFuncBlock
@@ -32,7 +33,8 @@ syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ e
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
syntax region jsFlowTypeStatement start=/type\%(\s\+\k\)\@=/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
syntax region jsFlowTypeValue contained start=/=/ end=/[;\n]/ contains=@jsExpression,jsFlowGroup,jsFlowMaybe
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/=/ end=/[\n;]/ contains=@jsFlowCluster,jsFlowGroup,jsFlowMaybe
syntax match jsFlowTypeOperator contained /=/ containedin=jsFlowTypeValue
syntax match jsFlowTypeOperator contained /=/
syntax keyword jsFlowTypeKeyword contained type
@@ -42,12 +44,18 @@ syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)
syntax region jsFlowModule contained start=/module/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowDeclareBlock contains=jsString
syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise fold
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend
" NOTE: It appears the nextgroup was causing a ton of breakages... testing it
" witout a nextgroup, but keeping this arround for reference incase something breaks
" syntax match jsFlowMaybe contained /?/ nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments,jsFlowObject,jsFlowReturnObject extend keepend
syntax match jsFlowMaybe contained /?/
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend fold
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator,jsFlowWildcard
syntax region jsFlowParenAnnotation contained start=/:/ end=/[,=)]\@=/ containedin=jsParen contains=@jsFlowCluster
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn,jsFlowReturnArrow
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowExactObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator,jsFlowWildcard
if version >= 508 || !exists("did_javascript_syn_inits")
if version < 508
@@ -64,9 +72,11 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFlowTypeof PreProc
HiLink jsFlowArray PreProc
HiLink jsFlowObject PreProc
HiLink jsFlowExactObject PreProc
HiLink jsFlowParens PreProc
HiLink jsFlowGroup PreProc
HiLink jsFlowReturn PreProc
HiLink jsFlowParenAnnotation PreProc
HiLink jsFlowReturnObject jsFlowReturn
HiLink jsFlowReturnArray jsFlowArray
HiLink jsFlowReturnParens jsFlowParens
@@ -75,9 +85,10 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFlowClassGroup PreProc
HiLink jsFlowArrowArguments PreProc
HiLink jsFlowArrow PreProc
HiLink jsFlowReturnArrow PreProc
HiLink jsFlowTypeStatement PreProc
HiLink jsFlowTypeKeyword PreProc
HiLink jsFlowTypeOperator PreProc
HiLink jsFlowTypeOperator Operator
HiLink jsFlowMaybe PreProc
HiLink jsFlowReturnMaybe PreProc
HiLink jsFlowClassProperty jsClassProperty
@@ -86,10 +97,12 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFlowInterface PreProc
HiLink jsFlowNoise Noise
HiLink jsFlowObjectKey jsObjectKey
HiLink jsFlowOrOperator PreProc
HiLink jsFlowOrOperator jsOperator
HiLink jsFlowReturnOrOp jsFlowOrOperator
HiLink jsFlowWildcard PreProc
HiLink jsFlowWildcardReturn PreProc
HiLink jsFlowImportType PreProc
HiLink jsFlowTypeValue PreProc
delcommand HiLink
endif

View File

@@ -12,7 +12,7 @@ syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|
" tags containing references
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
" other tags (no extra syntax)
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|async\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam

View File

@@ -56,6 +56,10 @@ augroup filetypedetect
au BufRead,BufNewFile *.ino,*.pde set filetype=arduino
augroup END
augroup filetypedetect
" autohotkey:hnamikaw/vim-autohotkey
augroup END
augroup filetypedetect
" blade:jwalton512/vim-blade
autocmd BufNewFile,BufRead *.blade.php set filetype=blade
@@ -70,7 +74,7 @@ augroup filetypedetect
augroup END
augroup filetypedetect
" caddyfile:joshglendenning/vim-caddyfile
" caddyfile:isobit/vim-caddyfile
au BufNewFile,BufRead Caddyfile set ft=caddyfile
augroup END
@@ -146,10 +150,6 @@ if has("autocmd")
endif
augroup END
augroup filetypedetect
" css:JulesWang/css.vim
augroup END
augroup filetypedetect
" cucumber:tpope/vim-cucumber
" Cucumber
@@ -183,8 +183,10 @@ endfunction
augroup END
augroup filetypedetect
" elm:lambdatoast/elm.vim
au BufNewFile,BufRead *.elm set filetype=elm
" elm:ElmCast/elm-vim
" detection for Elm (http://elm-lang.org/)
au BufRead,BufNewFile *.elm set filetype=elm
augroup END
augroup filetypedetect
@@ -257,6 +259,12 @@ autocmd BufNewFile ~/.config/fish/functions/*.fish
\ 2
augroup END
augroup filetypedetect
" fsharp:fsharp/vim-fsharp:_BASIC
" F#, fsharp
autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp
augroup END
augroup filetypedetect
" git:tpope/vim-git
" Git
@@ -282,14 +290,25 @@ autocmd BufNewFile,BufRead *
\ endif
augroup END
augroup filetypedetect
" gmpl:maelvalais/gmpl.vim
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
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
" Extensions supported by Khronos reference compiler
" Extensions supported by Khronos reference compiler (with one exception, ".glsl")
" https://github.com/KhronosGroup/glslang
autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.geom,*.frag,*.comp set filetype=glsl
autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.glsl,*.geom,*.frag,*.comp set filetype=glsl
" vim:set sts=2 sw=2 :
augroup END
@@ -333,11 +352,6 @@ au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
" vim: sw=2 ts=2 et
augroup END
augroup filetypedetect
" graphql:jparise/vim-graphql
au BufRead,BufNewFile *.graphql,*.gql setfiletype graphql
augroup END
augroup filetypedetect
" groovy:vim-scripts/groovy.vim
augroup END
@@ -387,7 +401,7 @@ augroup END
augroup filetypedetect
" javascript:pangloss/vim-javascript:_JAVASCRIPT
au BufNewFile,BufRead *.{js,jsm,es,es6},Jakefile setf javascript
au BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setf javascript
fun! s:SourceFlowSyntax()
if !exists('javascript_plugin_flow') && !exists('b:flow_active') &&
@@ -406,6 +420,15 @@ endfun
au BufNewFile,BufRead * call s:SelectJavascript()
augroup END
augroup filetypedetect
" jenkins:martinda/Jenkinsfile-vim-syntax
" Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile
augroup END
augroup filetypedetect
" json:elzr/vim-json
autocmd BufNewFile,BufRead *.json setlocal filetype=json
@@ -442,15 +465,16 @@ if !exists('g:jsx_pragma_required')
let g:jsx_pragma_required = 0
endif
if g:jsx_pragma_required
" Look for the @jsx pragma. It must be included in a docblock comment before
" anything else in the file (except whitespace).
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
" Whether to set the JSX filetype on *.js files.
fu! <SID>EnableJSX()
if g:jsx_pragma_required && !exists('b:jsx_ext_found')
" Look for the @jsx pragma. It must be included in a docblock comment
" before anything else in the file (except whitespace).
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
if g:jsx_ext_required && !exists('b:jsx_ext_found') | return 0 | endif
return 1
@@ -524,6 +548,16 @@ augroup END
augroup filetypedetect
" mako:sophacles/vim-bundle-mako
if !exists("g:mako_detect_lang_from_ext")
let g:mako_detect_lang_from_ext = 1
endif
if g:mako_detect_lang_from_ext
au BufNewFile *.*.mako execute "do BufNewFile filetypedetect " . expand("<afile>:r") | let b:mako_outer_lang = &filetype
" it's important to get this before any of the normal BufRead autocmds execute
" for this file, otherwise a mako tag at the start of the file can cause the
" filetype to be set to mason
au BufReadPre *.*.mako execute "do BufRead filetypedetect " . expand("<afile>:r") | let b:mako_outer_lang = &filetype
endif
au BufRead,BufNewFile *.mako set filetype=mako
augroup END
@@ -703,7 +737,7 @@ au! BufRead,BufNewFile Puppetfile setfiletype ruby
augroup END
augroup filetypedetect
" purescript:raichoo/purescript-vim
" purescript:purescript-contrib/purescript-vim
au BufNewFile,BufRead *.purs setf purescript
au FileType purescript let &l:commentstring='{--%s--}'
augroup END
@@ -755,7 +789,7 @@ augroup filetypedetect
" Support functions {{{
function! s:setf(filetype) abort
if &filetype !=# a:filetype
if &filetype !~# '\<'.a:filetype.'\>'
let &filetype = a:filetype
endif
endfunction
@@ -904,7 +938,7 @@ autocmd BufNewFile,BufRead *.slim setfiletype slim
augroup END
augroup filetypedetect
" solidity:ethereum/vim-solidity
" solidity:tomlion/vim-solidity
au BufNewFile,BufRead *.sol setf solidity
augroup END
@@ -1024,6 +1058,17 @@ augroup filetypedetect
au BufRead,BufNewFile *.vcl set filetype=vcl
augroup END
augroup filetypedetect
" vifm:vifm/vifm.vim
autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename
augroup END
augroup filetypedetect
" vifm:vifm/vifm.vim
autocmd BufRead,BufNewFile vifmrc :set filetype=vifm
autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm
augroup END
augroup filetypedetect
" vue:posva/vim-vue
au BufNewFile,BufRead *.vue setf vue

View File

@@ -1,86 +1,101 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
" elm.vim - Plugin for the Elm programming language
" Maintainer: Alexander Noriega <http://lambdatoast.com/>
" Version: 0.4.3
" plugin for Elm (http://elm-lang.org/)
" Plugin setup stuff
if exists("b:did_ftplugin")
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
" Compilation
" Settings
if !exists('g:elm_jump_to_error')
let g:elm_jump_to_error = 0
endif
function! ElmMake(file)
let args = a:file
return elm#io#system("elm-make", args)
endfunction
if !exists('g:elm_make_output_file')
let g:elm_make_output_file = 'elm.js'
endif
function! ElmMakeCurrentFile()
echo ElmMake(expand("%"))
endfunction
if !exists('g:elm_make_show_warnings')
let g:elm_make_show_warnings = 0
endif
function! ElmMakeMain()
echo ElmMake("Main.elm")
endfunction
if !exists('g:elm_syntastic_show_warnings')
let g:elm_syntastic_show_warnings = 0
endif
function! ElmMakeFile(file)
echo ElmMake(a:file)
endfunction
if !exists('g:elm_format_autosave')
let g:elm_format_autosave = 1
endif
" REPL
if !exists('g:elm_format_fail_silently')
let g:elm_format_fail_silently = 0
endif
function! ElmRepl()
!elm-repl
endfunction
if !exists('g:elm_setup_keybindings')
let g:elm_setup_keybindings = 1
endif
" Evaluation
function! ElmEvalLine()
return ElmEval(getline("."))
endfunction
function! ElmEvalSelection()
let savedReg = @z
normal! `<v`>"zy
let res = ElmEval(substitute(getreg("z"), "\n", "\\\n", "g"))
let @z = savedReg
normal! gv
endfunction
function! ElmEval(sourceCode)
let currentLine = a:sourceCode
let args = "echo '" . currentLine . "' | elm-repl"
let result = elm#io#system("echo", args)
let cleanResult = "-- " . join(s:Filtered(function("s:IsUsefulReplOutput"), split(result, "\n")), "")
put =cleanResult
endfunction
function! s:IsUsefulReplOutput(str)
return a:str !~ "^Elm REPL" && a:str !~ "Type :help" && a:str !~ ">\\s*$"
endfunction
" List processing
function! s:Filtered(fn, l)
let new_list = deepcopy(a:l)
call filter(new_list, string(a:fn) . '(v:val)')
return new_list
endfunction
command -buffer ElmEvalLine call ElmEvalLine()
command -buffer ElmEvalSelection call ElmEvalSelection()
command -buffer ElmMakeMain call ElmMakeMain()
command -buffer -nargs=1 ElmMakeFile call ElmMakeFile <args>
command -buffer ElmMakeCurrentFile call ElmMakeCurrentFile()
command -buffer ElmRepl call ElmRepl()
" Define comment convention
setlocal omnifunc=elm#Complete
setlocal comments=:--
setlocal commentstring=--%s
setlocal commentstring=--\ %s
" Commands
command -buffer -nargs=? -complete=file ElmMake call elm#Make(<f-args>)
command -buffer ElmMakeMain call elm#Make("Main.elm")
command -buffer -nargs=? -complete=file ElmTest call elm#Test(<f-args>)
command -buffer ElmRepl call elm#Repl()
command -buffer ElmErrorDetail call elm#ErrorDetail()
command -buffer ElmShowDocs call elm#ShowDocs()
command -buffer ElmBrowseDocs call elm#BrowseDocs()
command -buffer ElmFormat call elm#Format()
if get(g:, 'elm_setup_keybindings', 1)
nmap <buffer> <LocalLeader>m <Plug>(elm-make)
nmap <buffer> <LocalLeader>b <Plug>(elm-make-main)
nmap <buffer> <LocalLeader>t <Plug>(elm-test)
nmap <buffer> <LocalLeader>r <Plug>(elm-repl)
nmap <buffer> <LocalLeader>e <Plug>(elm-error-detail)
nmap <buffer> <LocalLeader>d <Plug>(elm-show-docs)
nmap <buffer> <LocalLeader>w <Plug>(elm-browse-docs)
endif
" Better gf command
nmap <buffer> gf :call elm#util#GoToModule(expand('<cfile>'))<CR>
" Elm code formatting on save
if get(g:, 'elm_format_autosave', 1)
augroup elmFormat
autocmd!
autocmd BufWritePre *.elm call elm#Format()
autocmd BufWritePost *.elm call elm#util#EchoStored()
augroup END
endif
if has('win32')
set viewdir=$HOME/vimfiles/views/
endif
" Enable go to file under cursor from module name
" Based on: https://github.com/elixir-lang/vim-elixir/blob/bd66ed134319d1e390f3331e8c4d525109f762e8/ftplugin/elixir.vim#L22-L56
function! GetElmFilename(word)
let l:word = a:word
" replace module dots with slash
let l:word = substitute(l:word,'\.','/','g')
return l:word
endfunction
let &l:path =
\ join([
\ elm#FindRootDirectory().'/src',
\ elm#FindRootDirectory().'/elm-stuff/packages/**/src',
\ &g:path
\ ], ',')
setlocal includeexpr=GetElmFilename(v:fname)
setlocal include=^\\s*import\\s\\+
setlocal suffixesadd=.elm
endif

24
ftplugin/elm/tagbar.vim Normal file
View File

@@ -0,0 +1,24 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
if !executable('ctags')
finish
elseif globpath(&runtimepath, 'plugin/tagbar.vim') ==? ''
finish
endif
function! s:SetTagbar()
if !exists('g:tagbar_type_elm')
let g:tagbar_type_elm = {
\ 'ctagstype' : 'elm',
\ 'kinds' : [
\ 'c:constants',
\ 'f:functions',
\ 'p:ports'
\ ]
\ }
endif
endfunction
call s:SetTagbar()
endif

View File

@@ -29,7 +29,7 @@ elseif !exists("b:eruby_subtype")
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
if b:eruby_subtype == ''
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
endif
if b:eruby_subtype == 'rhtml'
let b:eruby_subtype = 'html'
@@ -47,7 +47,7 @@ elseif !exists("b:eruby_subtype")
endif
endif
if exists("b:eruby_subtype") && b:eruby_subtype != ''
if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim"
else
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim

View File

@@ -28,11 +28,12 @@ function! s:cycle()
call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick'))
endfunction
command! -buffer -bar Pick :call s:choose('pick')
command! -buffer -bar Squash :call s:choose('squash')
command! -buffer -bar Edit :call s:choose('edit')
command! -buffer -bar Reword :call s:choose('reword')
command! -buffer -bar Fixup :call s:choose('fixup')
command! -buffer -bar -range Pick :<line1>,<line2>call s:choose('pick')
command! -buffer -bar -range Squash :<line1>,<line2>call s:choose('squash')
command! -buffer -bar -range Edit :<line1>,<line2>call s:choose('edit')
command! -buffer -bar -range Reword :<line1>,<line2>call s:choose('reword')
command! -buffer -bar -range Fixup :<line1>,<line2>call s:choose('fixup')
command! -buffer -bar -range Drop :<line1>,<line2>call s:choose('drop')
command! -buffer -bar Cycle :call s:cycle()
" The above are more useful when they are mapped; for example:
"nnoremap <buffer> <silent> S :Cycle<CR>

View File

@@ -1,17 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Vim filetype plugin
" Language: GraphQL
" Maintainer: Jon Parise <jon@indelible.org>
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
setlocal comments=:#
setlocal commentstring=#\ %s
setlocal formatoptions-=t
setlocal iskeyword+=$,@-@
endif

66
ftplugin/mail_vifm.vim Normal file
View File

@@ -0,0 +1,66 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" Mail file type extension to pick files for attachments via vifm
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: January 23, 2016
" Insert attachment picked via vifm after 'Subject' header
function! s:AddMailAttacments()
" TODO: reduce duplication between this file and plugins/vifm.vim
let l:listf = tempname()
if !has('nvim')
if has('gui_running')
execute 'silent !' g:vifm_term g:vifm_exec
\ '--choose-files' shellescape(l:listf, 1)
\ g:vifm_exec_args
else
execute 'silent !' g:vifm_exec
\ '--choose-files' shellescape(l:listf, 1)
\ g:vifm_exec_args
endif
redraw!
call s:HandleRunResults(v:shell_error, l:listf)
else
" Work around handicapped neovim...
let callback = { 'listf': l:listf }
function! callback.on_exit(id, code)
buffer #
silent! bdelete! #
call s:HandleRunResults(a:code, self.listf)
endfunction
enew
call termopen(g:vifm_exec . ' --choose-files ' . shellescape(l:listf, 1)
\. ' ' . g:vifm_exec_args, callback)
startinsert
endif
endfunction
function! s:HandleRunResults(exitcode, listf)
if a:exitcode != 0
echohl WarningMsg
echo 'Got non-zero code from vifm: ' . a:exitcode
echohl None
call delete(a:listf)
return
endif
let l:insert_pos = search('^Subject:', 'nw')
if filereadable(a:listf) && l:insert_pos != 0
for line in readfile(a:listf)
call append(l:insert_pos, 'Attach: '.line)
let l:insert_pos += 1
endfor
endif
call delete(a:listf)
endfunction
nnoremap <buffer> <silent> <localleader>a :call <sid>AddMailAttacments()<cr>
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

18
ftplugin/openscad.vim Normal file
View File

@@ -0,0 +1,18 @@
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

@@ -19,8 +19,6 @@ setlocal formatoptions=tcqro
" Enable autocompletion of hyphenated PowerShell commands,
" e.g. Get-Content or Get-ADUser
setlocal iskeyword+=-
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
setlocal bomb
" Change the browse dialog on Win32 to show mainly PowerShell-related files
if has("gui_win32")

View File

@@ -16,8 +16,6 @@ let b:did_ftplugin = 1
setlocal tw=0
setlocal commentstring=#%s
setlocal formatoptions=tcqro
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
setlocal bomb
" Change the browse dialog on Win32 to show mainly PowerShell-related files
if has("gui_win32")

View File

@@ -1,5 +1,42 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
setlocal include=^import
setlocal includeexpr=printf('%s.purs',substitute(v:fname,'\\.','/','g'))
let s:PS = []
fun! InitPureScript()
let dirs = map(
\ findfile("psc-package.json", expand("%:p:h") . ";/", -1),
\ { idx, val -> fnamemodify(val, ":p:h") }
\ )
if empty(dirs)
let dirs = map(
\ findfile("bower.json", expand("%:p:h") . ";/", -1),
\ { idx, val -> fnamemodify(val, ":p:h") }
\ )
if empty(dirs)
return
endif
endif
let path = expand("%:p")
for p in s:PS
if stridx(path, p[0], 0) == 0
let &l:path=p[1]
return
endif
endfor
let dir = dirs[len(dirs) - 1]
let gp = globpath(dir, "src/**/*.purs", v:true, v:true)
if empty(gp)
return
endif
let &l:path=join([dir, dir . "/bower_components/**", dir . "/src/**"], ",")
call add(s:PS, [dir, &l:path])
endfun
call InitPureScript()
endif

View File

@@ -365,6 +365,7 @@ function! RubyCursorFile() abort
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
if s:synid() ==# hlID('rubyConstant')
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
let cfile = substitute(cfile,'^::','','')
let cfile = substitute(cfile,'::','/','g')
let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')

View File

@@ -1,10 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Language: Rust
" Description: Vim syntax file for Rust
" Description: Vim ftplugin for Rust
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Maintainer: Kevin Ballard <kevin@sb.org>
" Last Change: June 08, 2016
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists("b:did_ftplugin")
finish
@@ -193,19 +194,13 @@ endif
augroup END
" %-matching. <:> is handy for generics.
set matchpairs+=<:>
" There are two minor issues with it; (a) comparison operators in expressions,
" where a less-than may match a greater-than later on—this is deemed a trivial
" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the
" highlighting perspective (built into Vim), but the actual % functionality
" can be fixed by this use of matchit.vim.
" For matchit.vim (rustArrow stops `Fn() -> X` messing things up)
let b:match_skip = 's:comment\|string\|rustArrow'
source $VIMRUNTIME/macros/matchit.vim
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set noet sw=4 ts=4:
" vim: set noet sw=8 ts=8:
endif

5
ftplugin/solidity.vim Normal file
View File

@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'solidity') == -1
setlocal commentstring=//\ %s
endif

23
ftplugin/vifm-cmdedit.vim Normal file
View File

@@ -0,0 +1,23 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm command-line editing buffer filetype plugin
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: August 18, 2013
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
" Behave as vifm script file
runtime! ftplugin/vifm.vim
" Use vifm script highlighting
set syntax=vifm
call vifm#edit#Init()
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

17
ftplugin/vifm-edit.vim Normal file
View File

@@ -0,0 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm command-line editing buffer filetype plugin
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: August 18, 2013
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
call vifm#edit#Init()
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

62
ftplugin/vifm-rename.vim Normal file
View File

@@ -0,0 +1,62 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" Filetype plugin for vifm rename buffer
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: October 05, 2014
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
" Copy list of original file names
let s:files = getline(1, '$')
" Closes window/tab/Vim when buffer is left alone in there
function! s:QuitIfOnlyWindow()
" Boil out if there is more than one window
if winbufnr(2) != -1
return
endif
" Just close tab with this single window or quit Vim with last tab
if tabpagenr('$') == 1
bdelete
quit
else
close
endif
endfunction
" Create a vertical split window for original file names and configure it
belowright vsplit __VifmRenameOrig__
enew
call setline(1, s:files)
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal nobuflisted
setlocal cursorbind
setlocal scrollbind
setlocal nocursorline
" Free now useless list of file names
unlet s:files
" Setup a hook in auxiliary local window to do not leave it alone, when it's
" useless
augroup VifmRenameAutoCmds
autocmd! * <buffer>
autocmd BufEnter <buffer> call s:QuitIfOnlyWindow()
augroup END
" Go back to the original window and ensure it will remain synchronized with
" the auxiliary one
wincmd w
setlocal cursorbind
setlocal scrollbind
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

50
ftplugin/vifm.vim Normal file
View File

@@ -0,0 +1,50 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifmrc filetype plugin
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: July 08, 2016
" Based On: Vim file type file by Bram Moolenaar
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo-=C
let b:undo_ftplugin = "setlocal formatoptions< comments< textwidth< commentstring<"
" Break comment lines but not other lines
setlocal formatoptions-=t formatoptions+=croql
" Set comment character
setlocal comments=:\"
" Format comments to be up to 78 characters long
if &textwidth == 0
setlocal textwidth=78
endif
" Comments start with a double quote
setlocal commentstring=\"%s
" Move around comments
nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
" Let the matchit plugin know what items can be matched.
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words = '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>'
endif
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

5
indent/Jenkinsfile.vim Normal file
View File

@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1
runtime indent/groovy.vim
endif

223
indent/autohotkey.vim Normal file
View File

@@ -0,0 +1,223 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'autohotkey') == -1
" Vim indent file
" Language: AutoHotkey
" Maintainer: Hirotoshi Namikawa <hnamikaw1@gmail.com>
" URL: http://github.com/hnamikaw/vim-autohotkey
" License: Same as Vim.
if exists('b:did_indent')
finish
endif
setlocal autoindent
setlocal indentexpr=GetAutoHotkeyIndent()
setlocal indentkeys=!^F,o,O,0{,0},=if,=else,=return
setlocal expandtab
let b:undo_indent = 'setlocal '.join([
\ 'autoindent<',
\ 'indentexpr<',
\ 'indentkeys<',
\ 'expandtab<',
\ ])
let s:TRUE = !0
let s:FALSE = 0
" Check BEGIN BLOCK
" TRUE:
" {
" { ; with comment
" if {
" if { ; with comment
"
" FALSE:
" ; if { comment
" sleep 1000 ; {
function! IsBeginBlockByStr(str)
return a:str =~? '^[^;]*{\s*\(;.*\)\?$' ? s:TRUE : s:FALSE
endfunction
" Check END BLOCK
" TRUE:
" }
" } ; with comment
" } else {
" } else { ; with comment
"
" FALSE:
" ; } else {
function! IsEndBlockByStr(str)
return a:str =~? '^\s*}.*\(;.*\)\?$' ? s:TRUE : s:FALSE
endfunction
" Check DOUBLE CORON
" TRUE:
" LAlt up::
" LAlt up:: ; with comment
"
" FALSE:
" ; LAlt up::
" sleep 1000 ; ::
function! IsDoubleCoronByStr(str)
return a:str =~? '^[^;]*::\s*\(;.*\)\?$' ? s:TRUE : s:FALSE
endfunction
" Check RETURN
" TRUE:
" return
" return 1
" return ; with comment
"
" FALSE:
" ; return
function! IsReturnByStr(str)
return a:str =~? '^\s*return.*\(;.*\)\?$' ? s:TRUE : s:FALSE
endfunction
" Check IF STATEMENT(without BLOCK)
" TRUE:
" if
" if ; with comment
" else
" else ; with comment
"
" FALSE:
" if {
" else {
function! IsIfStatementByStr(str)
return a:str =~? '^\s*\(if\|else\)[^{]*\(;.*\)\?$' ? s:TRUE : s:FALSE
endfunction
" Check inside of BLOCK.
" TRUE:
" if {
" hogehoge
" fugafuga <--- line_num
" }
"
" FALSE:
" foobar <--- line_num
function! IsInsideOfBlockByNum(line_num)
let block_indent_level = 0
for scan_line_num in range(1, a:line_num)
if IsBeginBlockByStr(getline(scan_line_num)) == s:TRUE
let block_indent_level += 1
endif
if IsEndBlockByStr(getline(scan_line_num)) == s:TRUE
let block_indent_level -= 1
endif
endfor
return block_indent_level >= 1 ? s:TRUE : s:FALSE
endfunction
function! AddIndentByInd(indent)
return a:indent + &l:shiftwidth
endfunction
function! UnIndentByInd(indent)
return a:indent - &l:shiftwidth
endfunction
function! GetAutoHotkeyIndent()
let l0_num = v:lnum
let l1_num = v:lnum - 1
let pl1_num = prevnonblank(l1_num)
let pl2_num = prevnonblank(pl1_num - 1)
let l0_str = getline(l0_num)
let pl1_str = getline(pl1_num)
let pl2_str = getline(pl2_num)
let pl1_ind = indent(pl1_num)
let pl2_ind = indent(pl2_num)
" Case: Next line of IF STATEMENT(without BLOCK)
" if bar = 1
" callFunc1() <--- AddIndent
"
" if bar = 1
" { <--- No! AddIndent
if IsIfStatementByStr(pl1_str) == s:TRUE && IsBeginBlockByStr(l0_str) == s:FALSE
return AddIndentByInd(pl1_ind)
endif
" Case: End of IF STATEMENT(without BLOCK)
" if bar = 1
" callFunc1()
" if bar = 2 <--- UnIndent
"
" Case: End of IF STATEMENT(without BLOCK) and END BLOCK(of outer block)
" if foo
" {
" if bar = 3
" callFunc3()
" } <--- UnIndent (2level)
if IsIfStatementByStr(pl2_str) == s:TRUE && IsBeginBlockByStr(pl1_str) == s:FALSE
if IsEndBlockByStr(l0_str) == s:FALSE
return UnIndentByInd(pl1_ind)
else
return UnIndentByInd(pl2_ind)
endif
endif
" Case: Next line of BEGIN BLOCK
" Swap(ByRef Left, ByRef Right)
" {
" temp := Left <--- AddIndent
" Left := Right
" Right := temp
" }
if IsBeginBlockByStr(pl1_str) == s:TRUE
return AddIndentByInd(pl1_ind)
endif
" Case: END BLOCK
" Swap(ByRef Left, ByRef Right)
" {
" temp := Left
" Left := Right
" Right := temp
" } <--- UnIndent
if IsEndBlockByStr(l0_str) == s:TRUE
return UnIndentByInd(pl1_ind)
endif
" Case: Next line of DOUBLE CORON
" #n::
" Run Notepad <--- AddIndent
" return
if IsDoubleCoronByStr(pl1_str) == s:TRUE
return AddIndentByInd(pl1_ind)
endif
" Case: RETURN
" Note: It is not nothing if in the BLOCK.
" #n::
" Run Notepad
" return <--- UnIndent
" ~~~
" if foo
" {
" callFunc1()
" return <--- No! UnIndent
" }
if IsReturnByStr(l0_str) == s:TRUE && IsInsideOfBlockByNum(l0_num) == s:FALSE
return UnIndentByInd(pl1_ind)
endif
" Case: Top line.
if pl1_num == 0
return 0
endif
" Case: It does not match anything.
return pl1_ind
endfunction
let b:did_indent = 1
endif

View File

@@ -7,42 +7,13 @@ let b:did_indent = 1
setlocal indentexpr=elixir#indent(v:lnum)
setlocal indentkeys+=0=end,0=catch,0=rescue,0=after,0=else,=->,0},0],0),0=\|>,0=<>
setlocal indentkeys+==after,=catch,=do,=else,=end,=rescue,
setlocal indentkeys+=*<Return>,=->,=\|>,=<>,0},0],0)
" TODO: @jbodah 2017-02-27: all operators should cause reindent when typed
function! elixir#indent(lnum)
let lnum = a:lnum
let text = getline(lnum)
let prev_nb_lnum = prevnonblank(lnum-1)
let prev_nb_text = getline(prev_nb_lnum)
call elixir#indent#debug("==> Indenting line " . lnum)
call elixir#indent#debug("text = '" . text . "'")
let handlers = [
\'top_of_file',
\'starts_with_end',
\'starts_with_mid_or_end_block_keyword',
\'following_trailing_do',
\'following_trailing_binary_operator',
\'starts_with_pipe',
\'starts_with_close_bracket',
\'starts_with_binary_operator',
\'inside_nested_construct',
\'starts_with_comment',
\'inside_generic_block'
\]
for handler in handlers
call elixir#indent#debug('testing handler elixir#indent#handle_'.handler)
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
if indent != -1
call elixir#indent#debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
return indent
endif
endfor
call elixir#indent#debug("defaulting")
return 0
return elixir#indent#indent(a:lnum)
endfunction
endif

View File

@@ -1,129 +1,115 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
" Vim indent file
" Language: Haskell
" Maintainer: lilydjwg <lilydjwg@gmail.com>
" Version: 1.0
" References: http://en.wikibooks.org/wiki/Haskell/Indentation
" http://book.realworldhaskell.org/read/
" See Also: The Align plugin http://www.vim.org/scripts/script.php?script_id=294
" indentation for Elm (http://elm-lang.org/)
" 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 indentexpr=HaskellIndent()
for i in split('0{,:,0#,e', ',')
exec "setlocal indentkeys-=" . i
endfor
setlocal indentkeys+=0=else,0=in,0=where,0),0<bar>
setlocal tabstop=8
" Local defaults
setlocal expandtab
setlocal indentexpr=GetElmIndent()
setlocal indentkeys+=0=else,0=if,0=of,0=import,0=then,0=type,0\|,0},0\],0),=-},0=in
setlocal nolisp
setlocal nosmartindent
if !exists('g:Haskell_no_mapping')
inoremap <silent> <BS> <C-R>=<SID>HaskellDedent(1)<CR>
inoremap <silent> <C-D> <C-R>=<SID>HaskellDedent(0)<CR>
endif
" Comment formatting
setlocal comments=s1fl:{-,mb:\ ,ex:-},:--
" Only define the functions once.
if exists("*HaskellIndent")
" Only define the function once.
if exists('*GetElmIndent')
finish
endif
let s:align_map = {
\ 'in': '\<let\>',
\ '\<else\>': '\<then\>',
\ ',': '\v%(\s|\w|^)@<=[[{]%(\s|\w|"|$)@='
\ }
let s:indent_self = ['=']
let s:indent_next = ['let', 'in', 'where', 'do', 'if']
let s:indent_if_final = ['=', 'do', '->', 'of', 'where']
function HaskellIndent()
let lnum = v:lnum - 1
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let ind = indent(lnum)
let prevline = getline(lnum)
let curline = getline(v:lnum)
let curwords = split(curline)
if len(curwords) > 0
if has_key(s:align_map, curwords[0])
let word = s:align_map[curwords[0]]
let m = -1
let line = v:lnum
while m == -1
let line -= 1
if line <= 0
return -1
endif
let m = match(getline(line), word)
endwhile
return m
elseif index(s:indent_self, curwords[0]) != -1
return ind + &sw
elseif curwords[0] == '|'
return match(prevline, '\v%(\s|\w|^)@<=[|=]%(\s|\w)@=')
elseif index([')', '}'], curwords[0]) != -1
return ind - &sw
elseif curwords[0] == 'where'
if prevline =~ '\v^\s+\|%(\s|\w)@='
return ind - 1
endif
endif
endif
let prevwords = split(prevline)
if len(prevwords) == 0
return 0
endif
if prevwords[-1] == 'where' && prevwords[0] == 'module'
return 0
elseif index(s:indent_if_final, prevwords[-1]) != -1
return ind + &sw
elseif prevwords[-1] =~ '\v%(\s|\w|^)@<=[[{(]$'
return ind + &sw
else
for word in reverse(prevwords)
if index(s:indent_next, word) != -1
return match(prevline, '\<'.word.'\>') + len(word) + 1
endif
endfor
endif
if len(curwords) > 0 && curwords[0] == 'where'
return ind + &sw
endif
return ind
" Indent pairs
function! s:FindPair(pstart, pmid, pend)
"call search(a:pend, 'bW')
return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
endfunction
function s:HaskellDedent(isbs)
if a:isbs && strpart(getline('.'), 0, col('.')-1) !~ '^\s\+$'
return "\<BS>"
function! GetElmIndent()
let l:lnum = v:lnum - 1
" Ident 0 if the first line of the file:
if l:lnum == 0
return 0
endif
let curind = indent('.')
let line = line('.') - 1
while curind > 0 && line > 0
let ind = indent(line)
if ind >= curind
let line -= 1
else
echomsg curind ind
call setline('.', repeat(' ', ind) .
\ substitute(getline('.'), '^\s\+', '', ''))
return ''
let l:ind = indent(l:lnum)
let l:lline = getline(l:lnum)
let l:line = getline(v:lnum)
" Indent if current line begins with '}':
if l:line =~? '^\s*}'
return s:FindPair('{', '', '}')
" Indent if current line begins with 'else':
elseif l:line =~# '^\s*else\>'
if l:lline !~# '^\s*\(if\|then\)\>'
return s:FindPair('\<if\>', '', '\<else\>')
endif
endwhile
return a:isbs ? "\<BS>" : ''
endfunction
" Indent if current line begins with 'then':
elseif l:line =~# '^\s*then\>'
if l:lline !~# '^\s*\(if\|else\)\>'
return s:FindPair('\<if\>', '', '\<then\>')
endif
" HACK: Indent lines in case with nearest case clause:
elseif l:line =~# '->' && l:line !~# ':' && l:line !~# '\\'
return indent(search('^\s*case', 'bWn')) + &shiftwidth
" HACK: Don't change the indentation if the last line is a comment.
elseif l:lline =~# '^\s*--'
return l:ind
" Align the end of block comments with the start
elseif l:line =~# '^\s*-}'
return indent(search('{-', 'bWn'))
" Indent double shift after let with an empty rhs
elseif l:lline =~# '\<let\>.*\s=$'
return l:ind + 4 + &shiftwidth
" Align 'in' with the parent let.
elseif l:line =~# '^\s*in\>'
return indent(search('^\s*let', 'bWn'))
" Align bindings with the parent let.
elseif l:lline =~# '\<let\>'
return l:ind + 4
" Align bindings with the parent in.
elseif l:lline =~# '^\s*in\>'
return l:ind + 4
endif
" Add a 'shiftwidth' after lines ending with:
if l:lline =~# '\(|\|=\|->\|<-\|(\|\[\|{\|\<\(of\|else\|if\|then\)\)\s*$'
let l:ind = l:ind + &shiftwidth
" Add a 'shiftwidth' after lines starting with type ending with '=':
elseif l:lline =~# '^\s*type' && l:line =~# '^\s*='
let l:ind = l:ind + &shiftwidth
" Back to normal indent after comments:
elseif l:lline =~# '-}\s*$'
call search('-}', 'bW')
let l:ind = indent(searchpair('{-', '', '-}', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"'))
" Ident some operators if there aren't any starting the last line.
elseif l:line =~# '^\s*\(!\|&\|(\|`\|+\||\|{\|[\|,\)=' && l:lline !~# '^\s*\(!\|&\|(\|`\|+\||\|{\|[\|,\)=' && l:lline !~# '^\s*$'
let l:ind = l:ind + &shiftwidth
elseif l:lline ==# '' && getline(l:lnum - 1) !=# ''
let l:ind = indent(search('^\s*\S+', 'bWn'))
endif
return l:ind
endfunc
endif

View File

@@ -14,7 +14,7 @@ runtime! indent/ruby.vim
unlet! b:did_indent
setlocal indentexpr=
if exists("b:eruby_subtype")
if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby'
exe "runtime! indent/".b:eruby_subtype.".vim"
else
runtime! indent/html.vim

253
indent/fsharp.vim Normal file
View File

@@ -0,0 +1,253 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1
" Vim indent file
" Language: FSharp
" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org>
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus.mottl@gmail.com>
" Rudi Grinberg <rudi.grinberg@gmail.com>
" Gregor Uhlenheuer <kongo2002@gmail.com>
" Last Change: 2013 Jun 29
" 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
" 2013 June - commented textwidth (Marc Weber)
" 2014 August - Ported to F#
" 2014 August - F# specific cleanup
"
" Marc Weber's comment: This file may contain a lot of (very custom) stuff
" which eventually should be moved somewhere else ..
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetFsharpIndent()
setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0;;,0>\],0\|\],0>},0\|,0},0\],0)
" Only define the function once.
if exists("*GetFsharpIndent")
finish
endif
" Skipping pattern, for comments
function! s:GetLineWithoutFullComment(lnum)
let lnum = prevnonblank(a:lnum - 1)
let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '')
while lline =~ '^\s*$' && lnum > 0
let lnum = prevnonblank(lnum - 1)
let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '')
endwhile
return lnum
endfunction
" Indent for ';;' to match multiple 'let'
function! s:GetInd(lnum, pat, lim)
let llet = search(a:pat, 'bW')
let old = indent(a:lnum)
while llet > 0
let old = indent(llet)
let nb = s:GetLineWithoutFullComment(llet)
if getline(nb) =~ a:lim
return old
endif
let llet = search(a:pat, 'bW')
endwhile
return old
endfunction
" Indent pairs
function! s:FindPair(pstart, pmid, pend)
call search(a:pend, 'bW')
return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
endfunction
" Indent 'let'
function! s:FindLet(pstart, pmid, pend)
call search(a:pend, 'bW')
return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ s:beflet'))
endfunction
function! GetFsharpIndent()
" Find a non-commented line above the current line.
let lnum = s:GetLineWithoutFullComment(v:lnum)
" At the start of the file use zero indent.
if lnum == 0
return 0
endif
let ind = indent(lnum)
let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '')
" " Return single 'shiftwidth' after lines matching:
" if lline =~ '^\s*|.*->\s*$'
" return ind + &sw
" endif
let line = getline(v:lnum)
" Indent if current line begins with 'end':
if line =~ '^\s*end\>'
return s:FindPair(s:module, '','\<end\>')
" Indent if current line begins with 'done' for 'do':
elseif line =~ '^\s*done\>'
return s:FindPair('\<do\>', '','\<done\>')
" Indent if current line begins with '}' or '>}':
elseif line =~ '^\s*\(\|>\)}'
return s:FindPair('{', '','}')
" Indent if current line begins with ']', '|]' or '>]':
elseif line =~ '^\s*\(\||\|>\)\]'
return s:FindPair('\[', '','\]')
" Indent if current line begins with ')':
elseif line =~ '^\s*)'
return s:FindPair('(', '',')')
" Indent if current line begins with 'let':
elseif line =~ '^\s*let\>'
if lline !~ s:lim . '\|' . s:letlim . '\|' . s:beflet
return s:FindLet(s:type, '','\<let\s*$')
endif
" Indent if current line begins with 'class' or 'type':
elseif line =~ '^\s*\(class\|type\)\>'
if lline !~ s:lim . '\|\<and\s*$\|' . s:letlim
return s:FindLet(s:type, '','\<\(class\|type\)\s*$')
endif
" Indent for pattern matching:
elseif line =~ '^\s*|'
if lline !~ '^\s*\(|[^\]]\|\(match\|type\|with\)\>\)\|\<\(function\|private\|with\)\s*$'
call search('|', 'bW')
return indent(searchpair('^\s*\(match\|type\)\>\|\<\(function\|private\|with\)\s*$', '', '^\s*|', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") !~ "^\\s*|.*->"'))
endif
" Indent if current line begins with ';;':
elseif line =~ '^\s*;;'
if lline !~ ';;\s*$'
return s:GetInd(v:lnum, s:letpat, s:letlim)
endif
" Indent if current line begins with 'in':
elseif line =~ '^\s*in\>'
if lline !~ '^\s*\(let\|and\)\>'
return s:FindPair('\<let\>', '', '\<in\>')
endif
" Indent if current line begins with 'else':
elseif line =~ '^\s*else\>'
if lline !~ '^\s*\(if\|then\)\>'
return s:FindPair('\<if\>', '', '\<else\>')
endif
" Indent if current line begins with 'then':
elseif line =~ '^\s*then\>'
if lline !~ '^\s*\(if\|else\)\>'
return s:FindPair('\<if\>', '', '\<then\>')
endif
" Indent if current line begins with 'and':
elseif line =~ '^\s*and\>'
if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
return ind - &sw
endif
" Indent if current line begins with 'with':
elseif line =~ '^\s*with\>'
if lline !~ '^\s*\(match\|try\)\>'
return s:FindPair('\<\%(match\|try\)\>', '','\<with\>')
endif
" Indent if current line begins with 'exception', 'external', 'include' or
" 'open':
elseif line =~ '^\s*\(exception\|external\|include\|open\)\>'
if lline !~ s:lim . '\|' . s:letlim
call search(line)
return indent(search('^\s*\(\(exception\|external\|include\|open\|type\)\>\|val\>.*:\)', 'bW'))
endif
" Indent if current line begins with 'val':
elseif line =~ '^\s*val\>'
if lline !~ '^\s*\(exception\|external\|include\|open\)\>\|' . s:obj . '\|' . s:letlim
return indent(search('^\s*\(\(exception\|include\|initializer\|method\|open\|type\|val\)\>\|external\>.*:\)', 'bW'))
endif
" Indent if current line begins with 'constraint', 'inherit', 'initializer'
" or 'method':
elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>'
if lline !~ s:obj
return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + &sw
endif
endif
" Add a 'shiftwidth' after lines ending with:
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
let ind = ind + &sw
" Back to normal indent after lines ending with ';;':
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
let ind = s:GetInd(v:lnum, s:letpat, s:letlim)
" Back to normal indent after lines ending with 'end':
elseif lline =~ '\<end\s*$'
let ind = s:FindPair(s:module, '','\<end\>')
" Back to normal indent after lines ending with 'in':
elseif lline =~ '\<in\s*$' && lline !~ '^\s*in\>'
let ind = s:FindPair('\<let\>', '', '\<in\>')
" Back to normal indent after lines ending with 'done':
elseif lline =~ '\<done\s*$'
let ind = s:FindPair('\<do\>', '','\<done\>')
" Back to normal indent after lines ending with '}' or '>}':
elseif lline =~ '\(\|>\)}\s*$'
let ind = s:FindPair('{', '','}')
" Back to normal indent after lines ending with ']', '|]' or '>]':
elseif lline =~ '\(\||\|>\)\]\s*$'
let ind = s:FindPair('\[', '','\]')
" Back to normal indent after comments:
elseif lline =~ '\*)\s*$'
call search('\*)', 'bW')
let ind = indent(searchpair('(\*', '', '\*)', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"'))
" Back to normal indent after lines ending with ')':
elseif lline =~ ')\s*$'
let ind = s:FindPair('(', '',')')
" If this is a multiline comment then align '*':
elseif lline =~ '^\s*(\*' && line =~ '^\s*\*'
let ind = ind + 1
else
" Don't change indentation of this line
" for new lines (indent==0) use indentation of previous line
" This is for preventing removing indentation of these args:
" let f x =
" let y = x + 1 in
" Printf.printf
" "o" << here
" "oeuth" << don't touch indentation
let i = indent(v:lnum)
return i == 0 ? ind : i
endif
return ind
endfunction
" vim: sw=4 et sts=4
endif

View File

@@ -36,9 +36,18 @@ endif
if !exists('g:haskell_indent_let')
" let x = 0 in
" >>>>x
"
" let x = 0
" y = 1
let g:haskell_indent_let = 4
endif
if !exists('g:haskell_indent_let_no_in')
" let x = 0
" x
let g:haskell_indent_let_no_in = 4
endif
if !exists('g:haskell_indent_where')
" where f :: Int -> Int
" >>>>>>f x = x
@@ -210,6 +219,9 @@ function! GetHaskellIndent()
"
" let x = 1
" >>>>y = 2
"
" let x = 1
" y 2
if l:prevline =~ '\C\<let\>\s\+.\+$'
if l:line =~ '\C^\s*\<let\>'
let l:s = match(l:prevline, '\C\<let\>')
@@ -221,11 +233,16 @@ function! GetHaskellIndent()
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_in
endif
else
elseif l:line =~ '\s=\s'
let l:s = match(l:prevline, '\C\<let\>')
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_let
endif
else
let l:s = match(l:prevline, '\C\<let\>')
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_let_no_in
endif
endif
endif

View File

@@ -260,20 +260,28 @@ let s:html_indent_tags = '[a-z_][a-z0-9_.-]*'
let s:cpo_save = &cpo
set cpo-=C
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum, pattern)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
func! <SID>HtmlIndentPatternCount(content, pattern)
let s = substitute('x'.a:content, a:pattern, "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum, pattern)
return <SID>HtmlIndentPatternCount(getline(a:lnum),
\ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)')
endfun
" [-- count indent-decreasing tags of line a:lnum --]
fun! <SID>HtmlIndentClose(lnum, pattern)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
return <SID>HtmlIndentPatternCount(getline(a:lnum),
\ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)')
endfun
" [-- count self close tags of line a:lnum --]
fun! <SID>HtmlIndentSelfClose(lnum, pattern)
return <SID>HtmlIndentPatternCount(getline(a:lnum),
\ '.\{-}\(\(<\('.a:pattern.'\).*\)\@<!\/>\)')
endfun
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
@@ -292,8 +300,9 @@ fun! <SID>HtmlIndentSum(lnum, style)
if a:style == match(getline(a:lnum), '^\s*</\<\('.s:html_indent_tags.'\)\>')
let open = <SID>HtmlIndentOpen(a:lnum, s:html_indent_tags) - <SID>HtmlIndentOpen(a:lnum, s:html_noindent_tags)
let close = <SID>HtmlIndentClose(a:lnum, s:html_indent_tags) - <SID>HtmlIndentClose(a:lnum, s:html_noindent_tags)
if 0 != open || 0 != close
return open - close
let self_close = <SID>HtmlIndentSelfClose(a:lnum, s:html_noindent_tags)
if 0 != open || 0 != close || 0 != self_close
return open - close - self_close
endif
endif
endif
@@ -310,6 +319,13 @@ fun! <SID>HtmlIndentSum(lnum, style)
endfun
fun! HtmlIndentGet(lnum)
" Get shiftwidth value.
if exists('*shiftwidth')
let sw = shiftwidth()
else
let sw = &sw
endif
" Find a non-empty line above the current line.
let lnum = prevnonblank(a:lnum - 1)
@@ -396,7 +412,7 @@ fun! HtmlIndentGet(lnum)
endif
if 0 == match(getline(a:lnum), '^\s*</')
return indent(preline) - (1*&sw)
return indent(preline) - (1*sw)
else
return indent(preline)
endif
@@ -417,7 +433,7 @@ fun! HtmlIndentGet(lnum)
" let tags_exp = '<\(' . join(tags, '\|') . '\)>'
" let close_tags_exp = '</\(' . join(tags, '\|') . '\)>'
" if getline(a:lnum) =~ tags_exp
" let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
" let block_start = search('^'.repeat(' ', lind + (sw * ind - 1)).'\S' , 'bnW')
" let prev_tag = search(tags_exp, 'bW', block_start)
" let prev_closetag = search(close_tags_exp, 'W', a:lnum)
" if prev_tag && !prev_closetag
@@ -426,7 +442,7 @@ fun! HtmlIndentGet(lnum)
" endif
" if getline(a:lnum) =~ '</\w\+>'
" let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
" let block_start = search('^'.repeat(' ', lind + (sw * ind - 1)).'\S' , 'bnW')
" let prev_tag = search(tags_exp, 'bW', block_start)
" let prev_closetag = search(close_tags_exp, 'W', a:lnum)
" if prev_tag && !prev_closetag
@@ -439,7 +455,7 @@ fun! HtmlIndentGet(lnum)
setlocal noic
endif
return lind + (&sw * ind)
return lind + (sw * ind)
endfun
let &cpo = s:cpo_save

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: May 16, 2017
" Last Change: September 18, 2017
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -57,343 +57,303 @@ endif
" matches before pos.
let s:z = has('patch-7.4.984') ? 'z' : ''
let s:syng_com = 'comment\|doc'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "s:syn_at(line('.'),col('.')) =~? b:syng_strcom"
let s:skip_expr = "s:SynAt(line('.'),col('.')) =~? b:syng_strcom"
let s:in_comm = s:skip_expr[:-14] . "'comment\\|doc'"
let s:rel = has('reltime')
" searchpair() wrapper
if has('reltime')
function s:GetPair(start,end,flags,skip,time,...)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time)
if s:rel
function s:GetPair(start,end,flags,skip)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1,a:skip ==# 's:SkipFunc()' ? 2000 : 200)
endfunction
else
function s:GetPair(start,end,flags,skip,...)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)]))
function s:GetPair(start,end,flags,skip)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1)
endfunction
endif
function s:syn_at(l,c)
let pos = join([a:l,a:c],',')
if has_key(s:synId_cache,pos)
return s:synId_cache[pos]
function s:SynAt(l,c)
let byte = line2byte(a:l) + a:c - 1
let pos = index(s:synid_cache[0], byte)
if pos == -1
let s:synid_cache[:] += [[byte], [synIDattr(synID(a:l, a:c, 0), 'name')]]
endif
let s:synId_cache[pos] = synIDattr(synID(a:l,a:c,0),'name')
return s:synId_cache[pos]
return s:synid_cache[1][pos]
endfunction
function s:parse_cino(f)
let [cin, divider, n] = [strridx(&cino,a:f), 0, '']
if cin == -1
return
endif
let [sign, cstr] = &cino[cin+1] ==# '-' ? [-1, &cino[cin+2:]] : [1, &cino[cin+1:]]
function s:ParseCino(f)
let [divider, n, cstr] = [0] + matchlist(&cino,
\ '\%(.*,\)\=\%(\%d'.char2nr(a:f).'\(-\)\=\([.s0-9]*\)\)\=')[1:2]
for c in split(cstr,'\zs')
if c ==# '.' && !divider
if c == '.' && !divider
let divider = 1
elseif c ==# 's'
if n is ''
let n = s:W
else
let n = str2nr(n) * s:W
if n !~ '\d'
return n . s:sw() + 0
endif
let n = str2nr(n) * s:sw()
break
elseif c =~ '\d'
let [n, divider] .= [c, 0]
else
break
let [n, divider] .= [c, 0]
endif
endfor
return sign * str2nr(n) / max([str2nr(divider),1])
return str2nr(n) / max([str2nr(divider),1])
endfunction
" Optimized {skip} expr, used only once per GetJavascriptIndent() call
function s:skip_func()
if s:topCol == 1 || line('.') < s:scriptTag
return {} " E728, used as limit condition for loops and searchpair()
" Optimized {skip} expr, only callable from the search loop which
" GetJavascriptIndent does to find the containing [[{(] (side-effects)
function s:SkipFunc()
if s:top_col == 1
throw 'out of bounds'
endif
let s:topCol = col('.')
if getline('.') =~ '\%<'.s:topCol.'c\/.\{-}\/\|\%>'.s:topCol.'c[''"]\|\\$'
let s:top_col = 0
if s:check_in
if eval(s:skip_expr)
let s:topCol = 0
return 1
endif
return !s:topCol
elseif s:checkIn || search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
let s:checkIn = eval(s:skip_expr)
if s:checkIn
let s:topCol = 0
let s:check_in = 0
elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
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
endif
let s:looksyn = line('.')
return s:checkIn
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
let [s:looksyn, s:top_col] = getpos('.')[1:2]
endfunction
function s:alternatePair()
let [l:pos, pat, l:for] = [getpos('.'), '[][(){};]', 3]
while search('\m'.pat,'bW')
if s:skip_func() | continue | endif
let idx = stridx('])};',s:looking_at())
if idx is 3
if l:for is 1
return s:GetPair('{','}','bW','s:skip_func()',2000) > 0 || setpos('.',l:pos)
endif
let [pat, l:for] = ['[{}();]', l:for - 1]
elseif idx + 1
if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000) < 1
break
endif
else
function s:AlternatePair()
let [pat, l:for] = ['[][(){};]', 2]
while s:SearchLoop(pat,'bW','s:SkipFunc()')
if s:LookingAt() == ';'
if !l:for
if s:GetPair('{','}','bW','s:SkipFunc()')
return
endif
break
else
let [pat, l:for] = ['[{}();]', l:for - 1]
endif
else
let idx = stridx('])}',s:LookingAt())
if idx == -1
return
elseif !s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
break
endif
endif
endwhile
call setpos('.',l:pos)
throw 'out of bounds'
endfunction
function s:looking_at()
function s:Nat(int)
return a:int * (a:int > 0)
endfunction
function s:LookingAt()
return getline('.')[col('.')-1]
endfunction
function s:token()
return s:looking_at() =~ '\k' ? expand('<cword>') : s:looking_at()
function s:Token()
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
endfunction
function s:previous_token()
let l:pos = getpos('.')
function s:PreviousToken()
let l:col = col('.')
if search('\m\k\{1,}\|\S','ebW')
if (strpart(getline('.'),col('.')-2,2) == '*/' || line('.') != l:pos[1] &&
\ getline('.')[:col('.')-1] =~ '\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com
while search('\m\S\ze\_s*\/[/*]','bW')
if s:syn_at(line('.'),col('.')) !~? s:syng_com
return s:token()
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()
endif
endwhile
call cursor(a:firstline, l:col)
else
return s:token()
return s:Token()
endif
call setpos('.',l:pos)
endif
return ''
endfunction
for s:__ in ['__previous_token','__IsBlock']
function s:{s:__}(...)
let l:pos = getpos('.')
try
return call('s:'.matchstr(expand('<sfile>'),'.*__\zs\w\+'),a:000)
catch
finally
call setpos('.',l:pos)
endtry
endfunction
endfor
function s:Pure(f,...)
return eval("[call(a:f,a:000),cursor(a:firstline,".col('.').")][0]")
endfunction
function s:expr_col()
function s:SearchLoop(pat,flags,expr)
return s:GetPair(a:pat,'\_$.',a:flags,a:expr)
endfunction
function s:ExprCol()
if getline('.')[col('.')-2] == ':'
return 1
endif
let [bal, l:pos] = [0, getpos('.')]
while bal < 1 && search('\m[{}?:;]','bW',s:scriptTag)
if eval(s:skip_expr)
let bal = 0
while s:SearchLoop('[{}?:]','bW',s:skip_expr)
if s:LookingAt() == ':'
if getline('.')[col('.')-2] == ':'
call cursor(0,col('.')-1)
continue
elseif s:looking_at() == ':'
let bal -= strpart(getline('.'),col('.')-2,3) !~ '::'
elseif s:looking_at() == '?'
endif
let bal -= 1
elseif s:LookingAt() == '?'
if getline('.')[col('.'):col('.')+1] =~ '^\.\d\@!'
continue
elseif !bal
return 1
endif
let bal += 1
elseif s:looking_at() == '{' && getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()
let bal = 1
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
elseif s:LookingAt() == '{'
return !s:IsBlock()
elseif !s:GetPair('{','}','bW',s:skip_expr)
break
endif
endwhile
call setpos('.',l:pos)
return max([bal,0])
endfunction
" configurable regexes that define continuation lines, not including (, {, or [.
let s:opfirst = '^' . get(g:,'javascript_opfirst',
\ '\C\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)')
\ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)')
let s:continuation = get(g:,'javascript_continuation',
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
function s:continues(ln,con)
let token = matchstr(a:con[-15:],s:continuation)
if strlen(token)
call cursor(a:ln,strlen(a:con))
if token =~ '[/>]'
return s:syn_at(a:ln,col('.')) !~? (token == '>' ? 'jsflow\|^html' : 'regex')
elseif token =~ '\l'
return s:previous_token() != '.'
elseif token == ':'
return s:expr_col()
function s:Continues(ln,con)
let tok = matchstr(a:con[-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 1
endif
endfunction
function s:Trim(ln)
let pline = substitute(getline(a:ln),'\s*$','','')
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
while l:max != -1 && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com
let pline = pline[: l:max]
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
let pline = substitute(pline[:-2],'\s*$','','')
endwhile
return pline
endfunction
" Find line above 'lnum' that isn't empty or in a comment
function s:PrevCodeLine(lnum)
let l:n = prevnonblank(a:lnum)
while l:n
if getline(l:n) =~ '^\s*\/[/*]'
if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') &&
\ s:syn_at(l:n,1) =~? b:syng_str
break
endif
let l:n = prevnonblank(l:n-1)
elseif stridx(getline(l:n), '*/') + 1 && s:syn_at(l:n,1) =~? s:syng_com
let l:pos = getpos('.')
call cursor(l:n,1)
let l:n = search('\m\S\_s*\/\*','nbW')
call setpos('.',l:pos)
else
break
endif
endwhile
return l:n
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
endfunction
" Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum)
let l:open = 0
let l:line = getline(a:lnum)
let pos = match(l:line, '[][(){}]', 0)
let [l:open, l:line] = [0, getline(a:lnum)]
let pos = match(l:line, '[][(){}]')
while pos != -1
if s:syn_at(a:lnum,pos + 1) !~? b:syng_strcom
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
let l:open += match(' ' . l:line[pos],'[[({]')
if l:open < 0
return
endif
endif
let pos = match(l:line, (l:open ?
\ '['.matchstr(['][','()','{}'],l:line[pos]).']' :
\ '[][(){}]'), pos + 1)
let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ?
\ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1)
endwhile
return !l:open
endfunction
function s:OneScope(lnum)
let pline = s:Trim(a:lnum)
call cursor(a:lnum,strlen(pline))
let kw = 'else do'
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
if s:previous_token() =~# '^\%(await\|each\)$'
call s:previous_token()
let kw = 'for'
function s:OneScope()
if s:LookingAt() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr)
let tok = s:PreviousToken()
return (count(split('for if let while with'),tok) ||
\ tok =~# '^await$\|^each$' && s:PreviousToken() ==# 'for') &&
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
elseif s:Token() =~# '^else$\|^do$'
return s:Pure('s:PreviousToken') != '.'
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
endif
call call('cursor',cpos)
endif
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
let ind = indent('.') + !a:cont
while line('.') > l:num && ind > pind || line('.') == l:num
if indent('.') < ind && s:OneScope()
let b_l += 1
elseif !a:cont || b_l || ind < indent(a:firstline)
break
else
let kw = 'for if let while with'
call cursor(0,1)
endif
endif
return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 &&
\ s:__previous_token() != '.' && !s:doWhile()
endfunction
function s:doWhile()
if expand('<cword>') ==# 'while'
let [bal, l:pos] = [0, getpos('.')]
call search('\m\<','cbW')
while bal < 1 && search('\m\C[{}]\|\<\%(do\|while\)\>','bW')
if eval(s:skip_expr)
continue
elseif s:looking_at() ==# 'd'
let bal += s:__IsBlock(1)
elseif s:looking_at() ==# 'w'
let bal -= s:__previous_token() != '.'
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
let ind = min([ind, indent('.')])
if s:PreviousToken() is ''
break
endif
endwhile
call setpos('.',l:pos)
return max([bal,0])
endif
return b_l
endfunction
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
" a continued expression, which could have started in a braceless context
function s:iscontOne(i,num,cont)
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
let pind = a:num ? indent(l:num) + s:W : 0
let ind = indent(l:i) + (a:cont ? 0 : s:W)
while l:i >= l:num && (ind > pind || l:i == l:num)
if indent(l:i) < ind && s:OneScope(l:i)
let bL += s:W
let l:i = line('.')
elseif !a:cont || bL || ind < indent(a:i)
break
endif
let ind = min([ind, indent(l:i)])
let l:i = s:PrevCodeLine(l:i - 1)
endwhile
return bL
function s:IsSwitch()
call call('cursor',b:js_cache[1:])
return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z)
endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
function s:IsBlock(...)
if a:0 || s:looking_at() == '{'
let l:n = line('.')
let char = s:previous_token()
if match(s:stack,'\cxml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx'
return char != '{'
elseif char =~ '\k'
if char ==# 'type'
return s:__previous_token() !~# '^\%(im\|ex\)port$'
function s:IsBlock()
let tok = s:PreviousToken()
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
return tok != '{'
elseif tok =~ '\k'
if tok ==# 'type'
return s:Pure('eval',"s:PreviousToken() !~# '^\\%(im\\|ex\\)port$' || s:PreviousToken() == '.'")
elseif tok ==# 'of'
return s:Pure('eval',"!s:GetPair('[[({]','[])}]','bW',s:skip_expr) || s:LookingAt() != '(' ||"
\ ."s:{s:PreviousToken() ==# 'await' ? 'Previous' : ''}Token() !=# 'for' || s:PreviousToken() == '.'")
endif
return index(split('return const let import export extends yield default delete var await void typeof throw case new of in instanceof')
\ ,char) < (line('.') != l:n) || s:__previous_token() == '.'
elseif char == '>'
return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? 'jsflow\|^html'
elseif char == '*'
return s:__previous_token() == ':'
elseif char == ':'
return !s:expr_col()
elseif char == '/'
return s:syn_at(line('.'),col('.')) =~? 'regex'
endif
return char !~ '[=~!<,.?^%|&([]' &&
\ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char)
return index(split('return const let import export extends yield default delete var await void typeof throw case new in instanceof')
\ ,tok) < (line('.') != a:firstline) || s:Pure('s:PreviousToken') == '.'
elseif tok == '>'
return getline('.')[col('.')-2] == '=' || s:SynAt(line('.'),col('.')) =~? 'jsflow\|^html'
elseif tok == '*'
return s:Pure('s:PreviousToken') == ':'
elseif tok == ':'
return s:Pure('eval',"s:PreviousToken() =~ '^\\K\\k*$' && !s:ExprCol()")
elseif tok == '/'
return s:SynAt(line('.'),col('.')) =~? 'regex'
elseif tok !~ '[=~!<,.?^%|&([]'
return tok !~ '[-+]' || line('.') != a:firstline && getline('.')[col('.')-2] == tok
endif
endfunction
function GetJavascriptIndent()
let b:js_cache = get(b:,'js_cache',[0,0,0])
let s:synId_cache = {}
" Get the current line.
call cursor(v:lnum,1)
let l:line = getline('.')
let s:synid_cache = [[],[]]
let l:line = getline(v:lnum)
" use synstack as it validates syn state and works in an empty line
let s:stack = map(synstack(v:lnum,1),"synIDattr(v:val,'name')")
let syns = get(s:stack,-1,'')
let s:stack = [''] + map(synstack(v:lnum,1),"synIDattr(v:val,'name')")
" start with strings,comments,etc.
if syns =~? s:syng_com
if s:stack[-1] =~? 'comment\|doc'
if l:line =~ '^\s*\*'
return cindent(v:lnum)
elseif l:line !~ '^\s*\/[/*]'
return -1
endif
elseif syns =~? b:syng_str
elseif s:stack[-1] =~? b:syng_str
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
let b:js_cache[0] = v:lnum
endif
return -1
endif
let l:lnum = s:PrevCodeLine(v:lnum - 1)
if !l:lnum
let s:l1 = max([0,prevnonblank(v:lnum) - (s:rel ? 2000 : 1000),
\ get(get(b:,'hi_indent',{}),'blocklnr')])
call cursor(v:lnum,1)
if s:PreviousToken() is ''
return
endif
let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]]
let l:line = substitute(l:line,'^\s*','','')
let l:line_raw = l:line
if l:line[:1] == '/*'
let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
endif
@@ -402,57 +362,94 @@ function GetJavascriptIndent()
endif
" the containing paren, bracket, or curly. Many hacks for performance
let [ s:scriptTag, idx ] = [ get(get(b:,'hi_indent',{}),'blocklnr'),
\ index([']',')','}'],l:line[0]) ]
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
call call('cursor',b:js_cache[2] ? b:js_cache[1:] : [0,0])
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)
call call('cursor',b:js_cache[1:])
else
let [s:looksyn, s:checkIn, s:topCol] = [v:lnum - 1, 0, 0]
if idx + 1
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000)
elseif getline(v:lnum) !~ '^\S' && syns =~? 'block'
call s:GetPair('{','}','bW','s:skip_func()',2000)
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
\ max([s:l1, &smc ? search('\m^.\{'.&smc.',}','nbW',s:l1 + 1) + 1 : 0])]
try
if idx != -1
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
elseif getline(v:lnum) !~ '^\S' && s:stack[-1] =~? 'block\|^jsobject$'
call s:GetPair('{','}','bW','s:SkipFunc()')
else
call s:alternatePair()
call s:AlternatePair()
endif
catch /^\Cout of bounds$/
call cursor(v:lnum,1)
endtry
let b:js_cache[1:] = line('.') == v:lnum ? [0,0] : getpos('.')[1:2]
endif
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [s:scriptTag,0] : getpos('.')[1:2])
let num = b:js_cache[1]
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0]
if !b:js_cache[2] || s:IsBlock()
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
if !num || s:LookingAt() == '{' && s:IsBlock()
let ilnum = line('.')
let pline = s:Trim(l:lnum)
if b:js_cache[2] && s:looking_at() == ')' && s:GetPair('(',')','bW',s:skip_expr,100) > 0
let num = ilnum == num ? line('.') : num
if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.'
let switch_offset = &cino !~ ':' ? s:W : max([-indent(num),s:parse_cino(':')])
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
if ilnum == num
let [num, num_ind] = [line('.'), indent('.')]
endif
if idx == -1 && s:PreviousToken() ==# 'switch' && s:IsSwitch()
let l:switch_offset = &cino !~ ':' ? s:sw() : s:ParseCino(':')
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
return indent(num) + switch_offset
return s:Nat(num_ind + l:switch_offset)
elseif &cino =~ '='
let l:case_offset = s:ParseCino('=')
endif
endif
endif
if idx < 0 && pline[-1:] !~ '[{;]'
let isOp = (l:line =~# s:opfirst || s:continues(l:lnum,pline)) * s:W
let bL = s:iscontOne(l:lnum,b:js_cache[1],isOp)
let bL -= (bL && l:line[0] == '{') * s:W
if idx == -1 && pline[-1:] !~ '[{;]'
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)
let is_op = s:sw()
endif
elseif idx < 0 && getline(b:js_cache[1])[b:js_cache[2]-1] == '(' && &cino =~ '('
let pval = s:parse_cino('(')
return !pval || !search('\m\S','nbW',num) && !s:parse_cino('U') ?
\ (s:parse_cino('w') ? 0 : -!!search('\m\S','W'.s:z,num)) + virtcol('.') :
\ max([indent('.') + pval + s:GetPair('(',')','nbrmW',s:skip_expr,100,num) * s:W,0])
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()
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()
endif
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
let pval = s:ParseCino('(')
if !pval
let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
if search('\m\S','W',num)
return s:ParseCino('w') ? vcol : virtcol('.')-1
endif
return Wval ? s:Nat(num_ind + Wval) : vcol
endif
return s:Nat(num_ind + pval + searchpair('\m(','','\m)','nbrmW',s:skip_expr,num) * s:sw())
endif
" main return
if l:line =~ '^[])}]\|^|}'
return max([indent(num),0])
elseif num
return indent(num) + s:W + switch_offset + bL + isOp
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
if s:ParseCino('M')
return indent(l:lnum)
elseif &cino =~# 'm' && !s:ParseCino('m')
return virtcol('.') - 1
endif
return bL + isOp
endif
return num_ind
elseif num
return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
endif
return b_l + is_op
endfunction
let &cpo = s:cpo_save

View File

@@ -3,13 +3,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim indent file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 27 June 2015
" Latest Revision: 15 July 2017
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal cinoptions& cinoptions+=j1,L0
setlocal indentexpr=GetKotlinIndent()
setlocal indentkeys=0},0),!^F,o,O,e,<CR>
setlocal autoindent " TODO ?
@@ -25,6 +26,21 @@ function! GetKotlinIndent()
let prev_indent = indent(prev_num)
let cur = getline(v:lnum)
if cur =~ '^\s*\*'
return cindent(v:lnum)
endif
if prev =~ '^\s*\*/'
let st = prev
while st > 1
if getline(st) =~ '^\s*/\*'
break
endif
let st = st - 1
endwhile
return indent(st)
endif
let prev_open_paren = prev =~ '^.*(\s*$'
let cur_close_paren = cur =~ '^\s*).*$'

View File

@@ -24,21 +24,21 @@ endif
" Variables -----------------------------------------------{{{1
let s:open_patt = '\%(\<\%(function\|if\|repeat\|do\)\>\|(\|{\)'
let s:middle_patt = '\<\%(else\|elseif\)\>'
let s:close_patt = '\%(\<\%(end\|until\)\>\|)\|}\)'
let s:open_patt = '\C\%(\<\%(function\|if\|repeat\|do\)\>\|(\|{\)'
let s:middle_patt = '\C\<\%(else\|elseif\)\>'
let s:close_patt = '\C\%(\<\%(end\|until\)\>\|)\|}\)'
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ 'luaComment\\|luaString'"
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~# 'luaComment\\|luaString'"
" Auxiliary Functions -------------------------------------{{{1
function s:IsInCommentOrString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ 'luaCommentLong\|luaStringLong'
\ && !(getline(a:lnum) =~ '^\s*\%(--\)\?\[=*\[') " opening tag is not considered 'in'
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# 'luaCommentLong\|luaStringLong'
\ && !(getline(a:lnum) =~# '^\s*\%(--\)\?\[=*\[') " opening tag is not considered 'in'
endfunction
" Find line above 'lnum' that isn't blank, in a comment or string.
@@ -85,7 +85,7 @@ function GetLuaIndent()
endif
" special case: call(with, {anon = function() -- should indent only once
if num_pairs > 1 && contents_prev =~ s:anon_func_start
if num_pairs > 1 && contents_prev =~# s:anon_func_start
let i = 1
endif
@@ -98,7 +98,7 @@ function GetLuaIndent()
endif
" special case: end}) -- end of call with anon func should unindent once
if num_pairs > 1 && contents_cur =~ s:anon_func_end
if num_pairs > 1 && contents_cur =~# s:anon_func_end
let i = -1
endif

View File

@@ -44,8 +44,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
" 0.1 - 06 June 2009
" - Initial public release of mako indent file
let sw=2 " default shiftwidth of 2 spaces
if exists("b:did_indent")
finish
endif
@@ -55,6 +53,9 @@ setlocal nosmartindent
setlocal noautoindent
setlocal nocindent
setlocal nolisp
setlocal expandtab
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal indentexpr=GetMakoIndent()
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:

View File

@@ -19,7 +19,7 @@ let s:incIndent =
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
\ '^\s*title\s*$\|' .
\ '^\s*skinparam\>.*{\s*$\|' .
\ '^\s*\%(state\|class\|partition\|rectangle\|enum\|interface\|namespace\)\>.*{'
\ '^\s*\%(state\|class\|partition\|rectangle\|enum\|interface\|namespace\|object\)\>.*{'
let s:decIndent = '^\s*\%(end\|else\|}\)'

View File

@@ -37,9 +37,16 @@ if !exists('g:purescript_indent_let')
let g:purescript_indent_let = 4
endif
if !exists('g:purescript_indent_in')
" let x = 0
" >in
let g:purescript_indent_in = 1
endif
if !exists('g:purescript_indent_where')
" where f :: Int -> Int
" >>>>>>f x = x
" where
" >>f :: Int -> Int
" >>f x = x
let g:purescript_indent_where = 6
endif
@@ -49,16 +56,29 @@ if !exists('g:purescript_indent_do')
let g:purescript_indent_do = 3
endif
if !exists('g:purescript_indent_dot')
" f
" :: forall a
" >. String
" -> String
let g:purescript_indent_dot = 1
endif
setlocal indentexpr=GetPurescriptIndent()
setlocal indentkeys=!^F,o,O,},=where,=in
setlocal indentkeys=!^F,o,O,},=where,=in,=::,=->,=,==>,=
function! s:GetSynStack(lnum, col)
return map(synstack(a:lnum, a:col), { key, val -> synIDattr(val, "name") })
endfunction
function! GetPurescriptIndent()
let ppline = getline(v:lnum - 2)
let prevline = getline(v:lnum - 1)
let line = getline(v:lnum)
if line =~ '^\s*\<where\>'
let s = match(prevline, '\S')
return s + 2
let s = indent(v:lnum - 1)
return max([s, &l:shiftwidth])
endif
if line =~ '^\s*\<in\>'
@@ -67,72 +87,191 @@ function! GetPurescriptIndent()
while s <= 0 && n > 0
let n = n - 1
let s = match(getline(n),'\<let\>')
let s = match(getline(n), '\<let\>')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') != -1
let s = -1
endif
endwhile
return s + 1
return s + g:purescript_indent_in
endif
if prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
let s = match(prevline, '^\s*\zs\(--\|import\)')
if s >= 0
" comments
" imports
return s
endif
if prevline =~ '^\S.*::' && line !~ '^\s*\(\.\|->\|→\|=>\|⇒\)' && !~ '^instance'
" f :: String
" -> String
return 0
endif
let s = match(prevline, '[[:alnum:][:blank:]]\@<=|[[:alnum:][:blank:]$]')
if s >= 0 && prevline !~ '^class\>' && index(s:GetSynStack(v:lnum - 1, s), "purescriptFunctionDecl") == -1
" ident pattern guards but not if we are in a type declaration
" what we detect using syntax groups
if prevline =~ '|\s*otherwise\>'
return indent(search('^\s*\k', 'bnW'))
" somehow this pattern does not work :/
" return indent(search('^\(\s*|\)\@!', 'bnW'))
else
return s
endif
endif
let s = match(line, '\%(\\.\{-}\)\@<=->')
if s >= 0
" inline lambda
return indent(v:lnum)
endif
" indent rules for -> (lambdas and case expressions)
let s = match(line, '->')
let p = match(prevline, '\\')
" protect that we are not in a type signature
" and not in a case expression
if s >= 0 && index(s:GetSynStack(s == 0 ? v:lnum - 1 : v:lnum, max([1, s])), "purescriptFunctionDecl") == -1
\ && p >= 0 && index(s:GetSynStack(v:lnum - 1, p), "purescriptString") == -1
return p
endif
if prevline =~ '^\S'
" start typing signature, function body, data & newtype on next line
return &l:shiftwidth
endif
if ppline =~ '^\S' && prevline =~ '^\s*$'
return 0
endif
if line =~ '^\s*\%(::\|∷\)'
return match(prevline, '\S') + &l:shiftwidth
endif
if prevline =~ '^\s*\(::\|∷\)\s*forall'
return match(prevline, '\S') + g:purescript_indent_dot
endif
let s = match(prevline, '^\s*\zs\%(::\|∷\|=>\|⇒\|->\|→\)')
let r = match(prevline, '^\s*\zs\.')
if s >= 0 || r >= 0
if s >= 0
if line !~ '^\s*\%(::\|∷\|=>\|⇒\|->\|→\)' && line !~ '^\s*$'
return s - 2
else
return s
endif
elseif r >= 0
if line !~ '^\s\%(::\|∷\|=>\|⇒\|->\|→\)'
return r - g:purescript_indent_dot
else
return r
endif
endif
endif
if prevline =~ '[!#$%&*+./<>?@\\^~-]\s*$'
let s = match(prevline, '=')
if s > 0
return s + 2
return s + &l:shiftwidth
endif
let s = match(prevline, ':')
let s = match(prevline, '\<:\>')
if s > 0
return s + 3
return s + &l:shiftwidth
else
return match(prevline, '\S')
return match(prevline, '\S') + &l:shiftwidth
endif
endif
if prevline =~ '[{([][^})\]]\+$'
echom "return 1"
return match(prevline, '[{([]')
endif
if prevline =~ '\<let\>\s\+.\+\(\<in\>\)\?\s*$'
return match(prevline, '\<let\>') + g:purescript_indent_let
endif
if prevline !~ '\<else\>'
let s = match(prevline, '\<if\>.*\&.*\zs\<then\>')
if s > 0
let s = match(prevline, '\<let\>\s\+\zs\S')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return s
endif
let s = match(prevline, '\<if\>')
let s = match(prevline, '\<let\>\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return s + g:purescript_indent_let
endif
let s = match(prevline, '\<let\>\s\+.\+\(\<in\>\)\?\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\<let\>') + g:purescript_indent_let
endif
let s = searchpairpos('\%(--.\{-}\)\@<!\<if\>', '\<then\>', '\<else\>.*\zs$', 'bnrc')[0]
if s > 0
return s + g:purescript_indent_if
" this rule ensures that using `=` in visual mode will correctly indent
" `if then else`, but it does not handle lines after `then` and `else`
if line =~ '\<\%(then\|else\)\>'
return match(getline(s), '\<if\>') + &l:shiftwidth
endif
endif
if prevline =~ '\(\<where\>\|\<do\>\|=\|[{([]\)\s*$'
return match(prevline, '\S') + &shiftwidth
let p = match(prevline, '\<if\>\%(.\{-}\<then\>.\{-}\<else\>\)\@!')
if p > 0
return p + &l:shiftwidth
endif
if prevline =~ '\<where\>\s\+\S\+.*$'
return match(prevline, '\<where\>') + g:purescript_indent_where
let s = match(prevline, '=\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\S') + &l:shiftwidth
endif
if prevline =~ '\<do\>\s\+\S\+.*$'
return match(prevline, '\<do\>') + g:purescript_indent_do
let s = match(prevline, '[{([]\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\S') + (line !~ '^\s*[})]]' ? 0 : &l:shiftwidth)
endif
if prevline =~ '^\s*\<data\>\s\+[^=]\+\s\+=\s\+\S\+.*$'
if prevline =~ '^class'
return &l:shiftwidth
endif
let s = match(prevline, '\<where\>\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\S') + g:purescript_indent_where
endif
let s = match(prevline, '\<where\>\s\+\zs\S\+.*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return s
endif
let s = match(prevline, '\<do\>\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\S') + g:purescript_indent_do
endif
let s = match(prevline, '\<do\>\s\+\zs\S\+.*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return s
endif
let s = match(prevline, '^\s*\<data\>\s\+[^=]\+\s\+=\s\+\S\+.*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '=')
endif
if prevline =~ '\<case\>\s\+.\+\<of\>\s*$'
let s = match(prevline, '\<case\>\s\+.\+\<of\>\s*$')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\<case\>') + g:purescript_indent_case
endif
if prevline =~ '^\s*\<\data\>\s\+\S\+\s*$'
return match(prevline, '\<data\>') + &shiftwidth
return match(prevline, '\<data\>') + &l:shiftwidth
endif
if (line =~ '^\s*}\s*' && prevline !~ '^\s*;')
return match(prevline, '\S') - &shiftwidth
let s = match(prevline, '^\s*[}\]]')
if s >= 0 && index(s:GetSynStack(v:lnum - 1, s), 'purescriptString') == -1
return match(prevline, '\S') - &l:shiftwidth
endif
return match(prevline, '\S')

View File

@@ -3,7 +3,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Vim indent file
" Language: Rust
" Author: Chris Morgan <me@chrismorgan.info>
" Last Change: 2016 Jul 15
" Last Change: 2017 Mar 21
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -15,7 +16,7 @@ setlocal cindent
setlocal cinoptions=L0,(0,Ws,J1,j1
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
" Don't think cinwords will actually do anything at all... never mind
setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern,macro
" Some preliminary settings
setlocal nolisp " Make sure lisp indenting doesn't supersede us
@@ -30,6 +31,9 @@ if exists("*GetRustIndent")
finish
endif
let s:save_cpo = &cpo
set cpo&vim
" Come here when loading the script the first time.
function! s:get_line_trimmed(lnum)
@@ -207,4 +211,7 @@ function GetRustIndent(lnum)
return cindent(a:lnum)
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
endif

View File

@@ -51,7 +51,7 @@ endfunction
function! s:IsCommentLine(lnum)
return synIDattr(synID(a:lnum,
\ match(getline(a:lnum), "\S") + 1, 0), "name")
\ match(getline(a:lnum), "\\S") + 1, 0), "name")
\ ==# "swiftComment"
endfunction
@@ -227,8 +227,8 @@ function! SwiftIndent(...)
if numOpenParens > 0
let savePosition = getcurpos()
" Must be at EOL because open paren has to be above (left of) the cursor
call cursor(previousNum, col("$"))
let previousParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
call cursor(previousNum, [previousNum, col("$")])
let previousParen = searchpair("(", "", ")", "cbWn", "s:IsExcludedFromIndent()")
call setpos(".", savePosition)
return indent(previousParen) + shiftwidth()
endif

View File

@@ -30,7 +30,7 @@ function! TerraformIndent(lnum)
let thisindent = previndent
" block open?
if prevline =~ '[\[{]\s*$'
if prevline =~ '[\[{\(]\s*$'
let thisindent += &sw
endif
@@ -38,7 +38,7 @@ function! TerraformIndent(lnum)
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
" block close?
if thisline =~ '^\s*[\]}]'
if thisline =~ '^\s*[\)\]}]'
let thisindent -= &sw
endif

View File

@@ -25,10 +25,10 @@ let s:languages = [
\ { 'name': 'javascript', 'pairs': ['<script', '</script>'] },
\ ]
for language in s:languages
for s:language in s:languages
" Set 'indentexpr' if the user has an indent file installed for the language
if strlen(globpath(&rtp, 'indent/'. language.name .'.vim'))
let language.indentexpr = s:get_indentexpr(language.name)
if strlen(globpath(&rtp, 'indent/'. s:language.name .'.vim'))
let s:language.indentexpr = s:get_indentexpr(s:language.name)
endif
endfor

27
syntax/Jenkinsfile.vim Normal file
View File

@@ -0,0 +1,27 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1
runtime syntax/groovy.vim
syn keyword jenkinsfileBuiltInVariable currentBuild
syn keyword jenkinsfileCoreStep checkout
syn keyword jenkinsfileCoreStep node
syn keyword jenkinsfileCoreStep scm
syn keyword jenkinsfileCoreStep sh
syn keyword jenkinsfileCoreStep stage
syn keyword jenkinsfileCoreStep step
syn keyword jenkinsfileCoreStep tool
syn keyword jenkinsfilePluginStep docker
syn keyword jenkinsfilePluginStep emailext
syn keyword jenkinsfilePluginStep exwsAllocate
syn keyword jenkinsfilePluginStep exws
syn keyword jenkinsfilePluginStep httpRequest
syn keyword jenkinsfilePluginStep junit
hi link jenkinsfileCoreStep Function
hi link jenkinsfilePluginStep Include
hi link jenkinsfileBuiltInVariable Identifier
let b:current_syntax = "Jenkinsfile"
endif

View File

@@ -47,6 +47,58 @@ highlight link yamlFlowString NONE
" but it does make sense we visualize quotes easily
highlight link yamlFlowStringDelimiter Delimiter
fun! s:normal_keywords_highlight(name)
if a:name == 'Comment'
highlight link ansible_normal_keywords Comment
elseif a:name == 'Constant'
highlight link ansible_normal_keywords Constant
elseif a:name == 'Identifier'
highlight link ansible_normal_keywords Identifier
elseif a:name == 'Statement'
highlight link ansible_normal_keywords Statement
elseif a:name == 'PreProc'
highlight link ansible_normal_keywords PreProc
elseif a:name == 'Type'
highlight link ansible_normal_keywords Type
elseif a:name == 'Special'
highlight link ansible_normal_keywords Special
elseif a:name == 'Underlined'
highlight link ansible_normal_keywords Underlined
elseif a:name == 'Ignore'
highlight link ansible_normal_keywords Ignore
elseif a:name == 'Error'
highlight link ansible_normal_keywords Error
elseif a:name == 'Todo'
highlight link ansible_normal_keywords Todo
endif
endfun
fun! s:with_keywords_highlight(name)
if a:name == 'Comment'
highlight link ansible_with_keywords Comment
elseif a:name == 'Constant'
highlight link ansible_with_keywords Constant
elseif a:name == 'Identifier'
highlight link ansible_with_keywords Identifier
elseif a:name == 'Statement'
highlight link ansible_with_keywords Statement
elseif a:name == 'PreProc'
highlight link ansible_with_keywords PreProc
elseif a:name == 'Type'
highlight link ansible_with_keywords Type
elseif a:name == 'Special'
highlight link ansible_with_keywords Special
elseif a:name == 'Underlined'
highlight link ansible_with_keywords Underlined
elseif a:name == 'Ignore'
highlight link ansible_with_keywords Ignore
elseif a:name == 'Error'
highlight link ansible_with_keywords Error
elseif a:name == 'Todo'
highlight link ansible_with_keywords Todo
endif
endfun
fun! s:attribute_highlight(attributes)
if a:attributes =~ 'a'
syn match ansible_attributes "\v\w+\=" containedin=yamlPlainScalar
@@ -85,11 +137,19 @@ if exists("g:ansible_extra_keywords_highlight")
highlight link ansible_extra_special_keywords Statement
endif
syn keyword ansible_special_keywords include until retries delay when only_if become become_user block rescue always notify containedin=yamlBlockMappingKey contained
highlight link ansible_special_keywords Statement
syn keyword ansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin=yamlBlockMappingKey contained
if exists("g:ansible_normal_keywords_highlight")
call s:normal_keywords_highlight(g:ansible_normal_keywords_highlight)
else
highlight link ansible_normal_keywords Statement
endif
syn match ansible_with_keywords "\vwith_.+" containedin=yamlBlockMappingKey contained
highlight link ansible_with_keywords Statement
if exists("g:ansible_with_keywords_highlight")
call s:with_keywords_highlight(g:ansible_with_keywords_highlight)
else
highlight link ansible_with_keywords Statement
endif
let b:current_syntax = "ansible"

View File

@@ -4,7 +4,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
" Last Change: 2016 Oct 28
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -50,7 +49,7 @@ endif
if !exists("cpp_no_cpp14")
syn case ignore
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn case match
endif

View File

@@ -1,669 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'css') == -1
" Vim syntax file
" Language: Cascading Style Sheets
" Previous Contributor List:
" Claudio Fleiner <claudio@fleiner.com> (Maintainer)
" Yeti (Add full CSS2, HTML4 support)
" Nikolai Weibull (Add CSS2 support)
" Maintainer: Jules Wang <w.jq0722@gmail.com>
" URL: https://github.com/JulesWang/css.vim
" Last Change: 2015 Aug.25
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'css'
elseif exists("b:current_syntax") && b:current_syntax == "css"
finish
endif
let s:cpo_save = &cpo
set cpo&vim
syn case ignore
" HTML4 tags
syn keyword cssTagName abbr address area a b base
syn keyword cssTagName bdo blockquote body br button
syn keyword cssTagName caption cite code col colgroup dd del
syn keyword cssTagName dfn div dl dt em fieldset form
syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i
syn keyword cssTagName iframe input ins isindex kbd label legend li
syn keyword cssTagName link map menu meta noscript ol optgroup
syn keyword cssTagName option p param pre q s samp script small
syn keyword cssTagName span strong sub sup tbody td
syn keyword cssTagName textarea tfoot th thead title tr ul u var
syn keyword cssTagName object svg
syn match cssTagName /\<select\>\|\<style\>\|\<table\>/
" 34 HTML5 tags
syn keyword cssTagName article aside audio bdi canvas command data
syn keyword cssTagName datalist details dialog embed figcaption figure footer
syn keyword cssTagName header hgroup keygen main mark menuitem meter nav
syn keyword cssTagName output progress rt rp ruby section
syn keyword cssTagName source summary time track video wbr
" Tags not supported in HTML5
" acronym applet basefont big center dir
" font frame frameset noframes strike tt
syn match cssTagName "\*"
" selectors
syn match cssSelectorOp "[,>+~]"
syn match cssSelectorOp2 "[~|^$*]\?=" contained
syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
" .class and #id
syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot
syn match cssClassNameDot contained '\.'
try
syn match cssIdentifier "#[A-Za-z<>-<2D>_@][A-Za-z<>-<2D>0-9_@-]*"
catch /^.*/
syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
endtry
" digits and units
syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=%\=" contains=cssUnitDecorators
syn match cssValue contained transparent "[-+]\=\d\+\(\.\d*\)\=\([a-z]\+\)\=\>" contains=cssUnitDecorators,cssValueNumber
syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained
" @media
syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock
syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl
syn keyword cssMediaKeyword only not and contained
syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssTagName,cssClassName,cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,cssAttributeSelector fold
syn match cssMediaComma "," skipwhite skipnl contained
" Reference: http://www.w3.org/TR/css3-mediaqueries/
syn keyword cssMediaProp contained width height orientation scan grid
syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/
syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/
syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/
syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/
syn keyword cssMediaAttr contained portrait landscape progressive interlace
" @page
" http://www.w3.org/TR/css3-page/
syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl
syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl
syn region cssPageWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssPageMargin,cssPageProp,cssAttrRegion,css.*Prop,cssComment,cssValue,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks
syn match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl
syn keyword cssPageProp contained content size
" http://www.w3.org/TR/CSS2/page.html#break-inside
syn keyword cssPageProp contained orphans widows
" @keyframe
" http://www.w3.org/TR/css3-animations/#keyframes
syn match cssKeyFrame "@\(-[a-z]\+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent
syn region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector
syn match cssKeyFrameSelector /\([-+]\=\d\+\(\.\d*\)\=%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition
" @import
syn region cssInclude start=/@import\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType
syn region cssInclude start=/@charset\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword
syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword
" @font-face
" http://www.w3.org/TR/css3-fonts/#at-font-face-rule
syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl
syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssCommonAttr,cssFontDescriptorProp,cssValue,cssFontDescriptorFunction,cssFontDescriptorAttr,cssNoise
syn match cssFontDescriptorProp contained "\<font-family\>"
syn keyword cssFontDescriptorProp contained src
syn match cssFontDescriptorProp contained "\<font-\(style\|weight\|stretch\)\>"
syn match cssFontDescriptorProp contained "\<unicode-range\>"
syn match cssFontDescriptorProp contained "\<font-\(variant\|feature-settings\)\>"
" src functions
syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend
" font-sytle and font-weight attributes
syn keyword cssFontDescriptorAttr contained normal italic oblique bold
" font-stretch attributes
syn match cssFontDescriptorAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
" unicode-range attributes
syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+"
syn match cssFontDescriptorAttr contained "U+\x\+-\x\+"
" font-feature-settings attributes
syn keyword cssFontDescriptorAttr contained on off
" The 16 basic color names
syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
" 130 more color names
syn keyword cssColor contained aliceblue antiquewhite aquamarine azure
syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood
syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan
syn match cssColor contained /\<dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)\>/
syn match cssColor contained /\<dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)\>/
syn match cssColor contained /\<darkslate\(blue\|gray\|grey\)\>/
syn match cssColor contained /\<dark\(turquoise\|violet\)\>/
syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick
syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold
syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink
syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen
syn keyword cssColor contained lemonchiffon limegreen linen magenta
syn match cssColor contained /\<light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)\>/
syn match cssColor contained /\<light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)\>/
syn match cssColor contained /\<light\(slategray\|slategrey\|steelblue\)\>/
syn match cssColor contained /\<medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)\>/
syn match cssColor contained /\<medium\(slateblue\|springgreen\|turquoise\|violetred\)\>/
syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite
syn keyword cssColor contained oldlace olivedrab orange orangered orchid
syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/
syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue
syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon
syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue
syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan
syn keyword cssColor contained thistle tomato turquoise violet wheat
syn keyword cssColor contained whitesmoke yellowgreen
" FIXME: These are actually case-insensitive too, but (a) specs recommend using
" mixed-case (b) it's hard to highlight the word `Background' correctly in
" all situations
syn case match
syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
syn case ignore
syn match cssImportant contained "!\s*important\>"
syn match cssColor contained "\<transparent\>"
syn match cssColor contained "\<currentColor\>"
syn match cssColor contained "\<white\>"
syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators
syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" contains=cssUnitDecorators
syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline contains=cssValue,cssFunctionComma
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline contains=cssColor,cssValue,cssFunctionComma,cssFunction
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\)\=\gradient\s*(" end=")" oneline contains=cssColor,cssValue,cssFunction,cssGradientAttr,cssFunctionComma
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(matrix\(3d\)\=\|scale\(3d\|X\|Y\|Z\)\=\|translate\(3d\|X\|Y\|Z\)\=\|skew\(X\|Y\)\=\|rotate\(3d\|X\|Y\|Z\)\=\|perspective\)\s*(" end=")" oneline contains=cssValueInteger,cssValue,cssFunctionComma
syn keyword cssGradientAttr contained top bottom left right cover center middle ellipse at
syn match cssFunctionComma contained ","
" Common Prop and Attr
syn keyword cssCommonAttr contained auto none inherit all default normal
syn keyword cssCommonAttr contained top bottom center stretch hidden visible
"------------------------------------------------
" CSS Animations
" http://www.w3.org/TR/css3-animations/
syn match cssAnimationProp contained "\<animation\(-\(delay\|direction\|duration\|fill-mode\|name\|play-state\|timing-function\|iteration-count\)\)\=\>"
" animation-direction attributes
syn keyword cssAnimationAttr contained alternate reverse
syn match cssAnimationAttr contained "\<alternate-reverse\>"
" animation-fill-mode attributes
syn keyword cssAnimationAttr contained forwards backwards both
" animation-play-state attributes
syn keyword cssAnimationAttr contained running paused
" animation-iteration-count attributes
syn keyword cssAnimationAttr contained infinite
"------------------------------------------------
" CSS Backgrounds and Borders Module Level 3
" http://www.w3.org/TR/css3-background/
syn match cssBackgroundProp contained "\<background\(-\(attachment\|clip\|color\|image\|origin\|position\|repeat\|size\)\)\=\>"
" background-attachment attributes
syn keyword cssBackgroundAttr contained scroll fixed local
" background-position attributes
syn keyword cssBackgroundAttr contained left center right top bottom
" background-repeat attributes
syn match cssBackgroundAttr contained "\<no-repeat\>"
syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>"
" background-size attributes
syn keyword cssBackgroundAttr contained cover contain
syn match cssBorderProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>"
syn match cssBorderProp contained "\<border\(-\(top\|bottom\)-\(left\|right\)\)\=-radius\>"
syn match cssBorderProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>"
syn match cssBorderProp contained "\<box-decoration-break\>"
syn match cssBorderProp contained "\<box-shadow\>"
" border-image attributes
syn keyword cssBorderAttr contained stretch round fill
" border-style attributes
syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset
" border-width attributes
syn keyword cssBorderAttr contained thin thick medium
" box-decoration-break attributes
syn keyword cssBorderAttr contained clone slice
"------------------------------------------------
syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
syn keyword cssBoxAttr contained visible hidden scroll auto
syn match cssBoxAttr contained "\<no-\(display\|content\)\>"
syn keyword cssColorProp contained opacity
syn match cssColorProp contained "\<color-profile\>"
syn match cssColorProp contained "\<rendering-intent\>"
syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>"
syn keyword cssDimensionProp contained height
syn keyword cssDimensionProp contained width
" CSS Flexible Box Layout Module Level 1
" http://www.w3.org/TR/css3-flexbox/
" CSS Box Alignment Module Level 3
" http://www.w3.org/TR/css-align-3/
syn match cssFlexibleBoxProp contained "\<flex\(-\(direction\|wrap\|flow\|grow\|shrink\|basis\)\)\=\>"
syn match cssFlexibleBoxProp contained "\<\(align\|justify\)\(-\(items\|self\|content\)\)\=\>"
syn keyword cssFlexibleBoxProp contained order
syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>"
syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center
syn match cssFlexibleBoxAttr contained "\<flex\(-\(start\|end\)\)\=\>"
syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\)\)\=\>"
" CSS Fonts Module Level 3
" http://www.w3.org/TR/css-fonts-3/
syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
" font attributes
syn keyword cssFontAttr contained icon menu caption
syn match cssFontAttr contained "\<small-\(caps\|caption\)\>"
syn match cssFontAttr contained "\<message-box\>"
syn match cssFontAttr contained "\<status-bar\>"
syn keyword cssFontAttr contained larger smaller
syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>"
" font-family attributes
syn match cssFontAttr contained "\<\(sans-\)\=serif\>"
syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Verdana Webdings Wingdings York Zapf
syn keyword cssFontAttr contained cursive fantasy monospace
" font-feature-settings attributes
syn keyword cssFontAttr contained on off
" font-stretch attributes
syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
" font-style attributes
syn keyword cssFontAttr contained italic oblique
" font-synthesis attributes
syn keyword cssFontAttr contained weight style
" font-weight attributes
syn keyword cssFontAttr contained bold bolder lighter
" TODO: font-variant-* attributes
"------------------------------------------------
" Webkit specific property/attributes
syn match cssFontProp contained "\<font-smooth\>"
syn match cssFontAttr contained "\<\(subpixel-\)\=\antialiased\>"
" CSS Multi-column Layout Module
" http://www.w3.org/TR/css3-multicol/
syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>"
syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>"
syn keyword cssMultiColumnProp contained columns
syn keyword cssMultiColumnAttr contained balance medium
syn keyword cssMultiColumnAttr contained always left right page column
syn match cssMultiColumnAttr contained "\<avoid\(-\(page\|column\)\)\=\>"
" http://www.w3.org/TR/css3-break/#page-break
syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
" http://www.w3.org/TR/SVG11/interact.html
syn match cssInteractProp contained "\<pointer-events\>"
syn match cssInteractAttr contained "\<\(visible\)\=\(Painted\|Fill\|Stroke\)\=\>"
" TODO find following items in w3c docs.
syn keyword cssGeneratedContentProp contained quotes crop
syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
syn match cssGeneratedContentProp contained "\<move-to\>"
syn match cssGeneratedContentProp contained "\<page-policy\>"
syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
syn match cssGridProp contained "\<grid-\(columns\|rows\)\>"
syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>"
syn match cssListProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
syn match cssListAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
syn match cssListAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
syn match cssListAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
syn keyword cssListAttr contained disc circle square hebrew armenian georgian
syn keyword cssListAttr contained inside outside
syn keyword cssPositioningProp contained bottom clear clip display float left
syn keyword cssPositioningProp contained position right top visibility
syn match cssPositioningProp contained "\<z-index\>"
syn keyword cssPositioningAttr contained block compact
syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
syn keyword cssPositioningAttr contained left right both
syn match cssPositioningAttr contained "\<list-item\>"
syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\)\)\=\>"
syn keyword cssPositioningAttr contained static relative absolute fixed
syn keyword cssPrintAttr contained landscape portrait crop cross always
syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>"
syn keyword cssTableAttr contained fixed collapse separate show hide once always
syn keyword cssTextProp contained color direction
syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
syn match cssTextProp contained "\<text-\(justify\|outline\|warp\|align-last\|size-adjust\|rendering\|stroke\|indent\)\>"
syn match cssTextProp contained "\<word-\(break\|\wrap\)\>"
syn match cssTextProp contained "\<white-space\>"
syn match cssTextProp contained "\<hanging-punctuation\>"
syn match cssTextProp contained "\<punctuation-trim\>"
syn match cssTextAttr contained "\<line-through\>"
syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
syn keyword cssTextAttr contained ltr rtl embed nowrap
syn keyword cssTextAttr contained underline overline blink sub super middle
syn keyword cssTextAttr contained capitalize uppercase lowercase
syn keyword cssTextAttr contained justify baseline sub super
syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed
syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>"
syn match cssTextAttr contained "\<\(allow\|force\)-end\>"
syn keyword cssTextAttr contained start end adjacent
syn match cssTextAttr contained "\<inter-\(word\|ideographic\|cluster\)\>"
syn keyword cssTextAttr contained distribute kashida first last
syn keyword cssTextAttr contained clip ellipsis unrestricted suppress
syn match cssTextAttr contained "\<break-all\>"
syn match cssTextAttr contained "\<break-word\>"
syn keyword cssTextAttr contained hyphenate
syn match cssTextAttr contained "\<bidi-override\>"
syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>"
syn match cssTransformProp contained "\<perspective\(-origin\)\=\>"
syn match cssTransformProp contained "\<backface-visibility\>"
" CSS Transitions
" http://www.w3.org/TR/css3-transitions/
syn match cssTransitionProp contained "\<transition\(-\(delay\|duration\|property\|timing-function\)\)\=\>"
" transition-time-function attributes
syn match cssTransitionAttr contained "\<linear\(-gradient\)\@!\>"
syn match cssTransitionAttr contained "\<ease\(-\(in-out\|out\|in\)\)\=\>"
syn match cssTransitionAttr contained "\<step\(-start\|-end\)\=\>"
"------------------------------------------------
" CSS Basic User Interface Module Level 3 (CSS3 UI)
" http://www.w3.org/TR/css3-ui/
syn match cssUIProp contained "\<box-sizing\>"
syn match cssUIAttr contained "\<\(content\|padding\|border\)\(-box\)\=\>"
syn keyword cssUIProp contained cursor
syn match cssUIAttr contained "\<\(\([ns]\=[ew]\=\)\|col\|row\|nesw\|nwse\)-resize\>"
syn keyword cssUIAttr contained crosshair help move pointer alias copy
syn keyword cssUIAttr contained progress wait text cell move
syn match cssUIAttr contained "\<context-menu\>"
syn match cssUIAttr contained "\<no-drop\>"
syn match cssUIAttr contained "\<not-allowed\>"
syn match cssUIAttr contained "\<all-scroll\>"
syn match cssUIAttr contained "\<\(vertical-\)\=text\>"
syn match cssUIAttr contained "\<zoom\(-in\|-out\)\=\>"
syn match cssUIProp contained "\<ime-mode\>"
syn keyword cssUIAttr contained active inactive disabled
syn match cssUIProp contained "\<nav-\(down\|index\|left\|right\|up\)\=\>"
syn match cssUIProp contained "\<outline\(-\(width\|style\|color\|offset\)\)\=\>"
syn keyword cssUIAttr contained invert
syn keyword cssUIProp contained icon resize
syn keyword cssUIAttr contained both horizontal vertical
syn match cssUIProp contained "\<text-overflow\>"
syn keyword cssUIAttr contained clip ellipsis
syn match cssUIProp contained "\<image-rendering\>"
syn keyword cssUIAttr contained pixellated
syn match cssUIAttr contained "\<crisp-edges\>"
" Already highlighted Props: font content
"------------------------------------------------
" Webkit/iOS specific attributes
syn match cssUIAttr contained '\(preserve-3d\)'
" IE specific attributes
syn match cssIEUIAttr contained '\(bicubic\)'
" Webkit/iOS specific properties
syn match cssUIProp contained '\(tap-highlight-color\|user-select\|touch-callout\)'
" IE specific properties
syn match cssIEUIProp contained '\(interpolation-mode\|zoom\|filter\)'
" Webkit/Firebox specific properties/attributes
syn keyword cssUIProp contained appearance
syn keyword cssUIAttr contained window button field icon document menu
syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numeral\|header\)\)\=\)\>"
syn keyword cssAuralProp contained volume during azimuth elevation stress richness
syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
syn keyword cssAuralAttr contained silent
syn match cssAuralAttr contained "\<spell-out\>"
syn keyword cssAuralAttr contained non mix
syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
syn keyword cssAuralAttr contained leftwards rightwards behind
syn keyword cssAuralAttr contained below level above lower higher
syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\|low\|high\)\>"
syn keyword cssAuralAttr contained faster slower
syn keyword cssAuralAttr contained male female child code digits continuous
" mobile text
syn match cssMobileTextProp contained "\<text-size-adjust\>"
syn match cssBraces contained "[{}]"
syn match cssError contained "{@<>"
syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssAttrRegion,css.*Prop,cssComment,cssValue,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold
syn match cssBraceError "}"
syn match cssAttrComma ","
" Pseudo class
" http://www.w3.org/TR/css3-selectors/
syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn
syn keyword cssPseudoClassId contained link visited active hover before after left right
syn keyword cssPseudoClassId contained root empty target enable disabled checked invalid
syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")"
" ------------------------------------
" Vendor specific properties
syn match cssPseudoClassId contained "\<selection\>"
syn match cssPseudoClassId contained "\<focus\(-inner\)\=\>"
syn match cssPseudoClassId contained "\<\(input-\)\=placeholder\>"
" Misc highlight groups
syntax match cssUnitDecorators /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained
syntax match cssNoise contained /\(:\|;\|\/\)/
" Comment
syn region cssComment start="/\*" end="\*/" contains=@Spell fold
syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
syn match cssSpecialCharQQ +\\\\\|\\"+ contained
syn match cssSpecialCharQ +\\\\\|\\'+ contained
syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
" Vendor Prefix
syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)"
" Various CSS Hack characters
" In earlier versions of IE (6 and 7), one can prefix property names
" with a _ or * to isolate those definitions to particular versions of IE
" This is purely decorative and therefore we assign to the same highlight
" group to cssVendor, for more information:
" http://www.paulirish.com/2009/browser-specific-css-hacks/
syn match cssHacks contained /\(_\|*\)/
" Attr Enhance
" Some keywords are both Prop and Attr, so we have to handle them
syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Attr,cssColor,cssImportant,cssValue,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
" Hack for transition
" 'transition' has Props after ':'.
syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
if main_syntax == "css"
syn sync minlines=10
endif
" 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_css_syn_inits")
if version < 508
let did_css_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink cssComment Comment
HiLink cssVendor Comment
HiLink cssHacks Comment
HiLink cssTagName Statement
HiLink cssDeprecated Error
HiLink cssSelectorOp Special
HiLink cssSelectorOp2 Special
HiLink cssAttrComma Special
HiLink cssAnimationProp cssProp
HiLink cssAuralProp cssProp
HiLink cssBackgroundProp cssProp
HiLink cssBorderProp cssProp
HiLink cssBoxProp cssProp
HiLink cssColorProp cssProp
HiLink cssContentForPagedMediaProp cssProp
HiLink cssDimensionProp cssProp
HiLink cssFlexibleBoxProp cssProp
HiLink cssFontProp cssProp
HiLink cssGeneratedContentProp cssProp
HiLink cssGridProp cssProp
HiLink cssHyerlinkProp cssProp
HiLink cssIEUIProp cssProp
HiLink cssInteractProp cssProp
HiLink cssLineboxProp cssProp
HiLink cssListProp cssProp
HiLink cssMarqueeProp cssProp
HiLink cssMobileTextProp cssProp
HiLink cssMultiColumnProp cssProp
HiLink cssPagedMediaProp cssProp
HiLink cssPositioningProp cssProp
HiLink cssPrintProp cssProp
HiLink cssRenderProp cssProp
HiLink cssRubyProp cssProp
HiLink cssSpeechProp cssProp
HiLink cssTableProp cssProp
HiLink cssTextProp cssProp
HiLink cssTransformProp cssProp
HiLink cssTransitionProp cssProp
HiLink cssUIProp cssProp
HiLink cssAnimationAttr cssAttr
HiLink cssAuralAttr cssAttr
HiLink cssBackgroundAttr cssAttr
HiLink cssBorderAttr cssAttr
HiLink cssBoxAttr cssAttr
HiLink cssContentForPagedMediaAttr cssAttr
HiLink cssCommonAttr cssAttr
HiLink cssDimensionAttr cssAttr
HiLink cssFlexibleBoxAttr cssAttr
HiLink cssFontAttr cssAttr
HiLink cssGeneratedContentAttr cssAttr
HiLink cssGridAttr cssAttr
HiLink cssHyerlinkAttr cssAttr
HiLink cssIEUIAttr cssAttr
HiLink cssInteractAttr cssAttr
HiLink cssLineboxAttr cssAttr
HiLink cssListAttr cssAttr
HiLink cssMarginAttr cssAttr
HiLink cssMarqueeAttr cssAttr
HiLink cssMultiColumnAttr cssAttr
HiLink cssPaddingAttr cssAttr
HiLink cssPagedMediaAttr cssAttr
HiLink cssPositioningAttr cssAttr
HiLink cssGradientAttr cssAttr
HiLink cssPrintAttr cssAttr
HiLink cssRenderAttr cssAttr
HiLink cssRubyAttr cssAttr
HiLink cssSpeechAttr cssAttr
HiLink cssTableAttr cssAttr
HiLink cssTextAttr cssAttr
HiLink cssTransformAttr cssAttr
HiLink cssTransitionAttr cssAttr
HiLink cssUIAttr cssAttr
HiLink cssPseudoClassId PreProc
HiLink cssPseudoClassLang Constant
HiLink cssValueNumber Number
HiLink cssFunction Constant
HiLink cssURL String
HiLink cssFunctionName Function
HiLink cssFunctionComma Function
HiLink cssColor Constant
HiLink cssIdentifier Function
HiLink cssInclude Include
HiLink cssIncludeKeyword atKeyword
HiLink cssImportant Special
HiLink cssBraces Function
HiLink cssBraceError Error
HiLink cssError Error
HiLink cssUnicodeEscape Special
HiLink cssStringQQ String
HiLink cssStringQ String
HiLink cssAttributeSelector String
HiLink cssMedia atKeyword
HiLink cssMediaType Special
HiLink cssMediaComma Normal
HiLink cssMediaKeyword Statement
HiLink cssMediaProp cssProp
HiLink cssMediaAttr cssAttr
HiLink cssPage atKeyword
HiLink cssPagePseudo PreProc
HiLink cssPageMargin atKeyword
HiLink cssPageProp cssProp
HiLink cssKeyFrame atKeyword
HiLink cssKeyFrameSelector Constant
HiLink cssFontDescriptor Special
HiLink cssFontDescriptorFunction Constant
HiLink cssFontDescriptorProp cssProp
HiLink cssFontDescriptorAttr cssAttr
HiLink cssUnicodeRange Constant
HiLink cssClassName Function
HiLink cssClassNameDot Function
HiLink cssProp StorageClass
HiLink cssAttr Constant
HiLink cssUnitDecorators Number
HiLink cssNoise Noise
HiLink atKeyword PreProc
delcommand HiLink
endif
let b:current_syntax = "css"
if main_syntax == 'css'
unlet main_syntax
endif
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8
endif

View File

@@ -18,6 +18,8 @@ endif
" Ensure long multiline strings are highlighted.
syntax sync fromstart
syntax case match
" keyword definitions
syntax keyword dartConditional if else switch
syntax keyword dartRepeat do while for
@@ -26,14 +28,14 @@ syntax keyword dartConstant null
syntax keyword dartTypedef this super class typedef enum
syntax keyword dartOperator new is as in
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
syntax keyword dartType void var bool int double num dynamic
syntax keyword dartType void var bool int double num dynamic covariant
syntax keyword dartStatement return
syntax keyword dartStorageClass static abstract final const factory
syntax keyword dartExceptions throw rethrow try on catch finally
syntax keyword dartAssert assert
syntax keyword dartClassDecl extends with implements
syntax keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite
syntax keyword dartKeyword get set operator call external async await yield sync
syntax keyword dartKeyword get set operator call external async await yield sync native
syntax match dartUserLabelRef "\k\+" contained
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
@@ -47,6 +49,24 @@ syntax match dartLibrary "^\(library\|part of\|part\)\>"
syntax match dartMetadata "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>"
" Numbers
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
" Core libraries
if !exists('dart_corelib_highlight') || dart_corelib_highlight
syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime
\ Duration Expando Function Invocation Iterable Iterator List Map Match
\ Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String
\ StringBuffer StringSink Symbol Type
syntax keyword dartCoreTypedefs Comparator
syntax keyword dartCoreExceptions AbstractClassInstantiationError
\ ArgumentError AssertionError CastError ConcurrentModificationError
\ Error Exception FallThroughError FormatException
\ IntegerDivisionByZeroException NoSuchMethodError NullThrownError
\ OutOfMemoryError RangeError RuntimeError StackOverflowError StateError
\ TypeError UnimplementedError UnsupportedError
endif
" Comments
syntax keyword dartTodo contained TODO FIXME XXX
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
@@ -55,21 +75,18 @@ syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
" Strings
syntax region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
syntax region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)"
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)"
" Numbers
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
" TODO(antonm): consider conditional highlighting of corelib classes.
syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime Duration Expando Function Invocation Iterable Iterator List Map Match Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String StringBuffer StringSink Symbol Type
syntax keyword dartCoreTypedefs Comparator
syntax keyword dartCoreExceptions AbstractClassInstantiationError ArgumentError AssertionError CastError ConcurrentModificationError Error Exception FallThroughError FormatException IntegerDivisionByZeroException NoSuchMethodError NullThrownError OutOfMemoryError RangeError RuntimeError StackOverflowError StateError TypeError UnimplementedError UnsupportedError
syntax cluster dartRawStringContains contains=@Spell
if exists('dart_html_in_strings') && dart_html_in_strings
syntax include @HTML syntax/html.vim
syntax cluster dartRawStringContains add=@HTML
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 match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" extend
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" extend
" The default highlighting.
highlight default link dartBranch Conditional

View File

@@ -18,26 +18,27 @@ syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDec
syn match elixirComment '#.*' contains=elixirTodo,@Spell
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>'
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable,elixirKernelFunction
syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|send\)\>'
syn match elixirKeyword '\(\.\)\@<!\<\(exit\|raise\|throw\|after\|rescue\|catch\|else\)\>'
syn match elixirKeyword '\(\.\)\@<!\<\(quote\|unquote\|super\|spawn\|spawn_link\|spawn_monitor\)\>'
" Kernel functions
syn match elixirKernelFunction contained containedin=elixirGuard '\<\(is_atom\|is_binary\|is_bitstring\|is_boolean\|is_float\|is_function\|is_integer\|is_list\|is_map\|is_nil\|is_number\|is_pid\|is_port\)\>\([ (]\)\@='
syn match elixirKernelFunction contained containedin=elixirGuard '\<\(is_record\|is_reference\|is_tuple\|is_exception\|abs\|bit_size\|byte_size\|div\|elem\|hd\|length\|map_size\|node\|rem\|round\|tl\|trunc\|tuple_size\)\>\([ (]\)\@='
syn match elixirGuard '.*when.*' contains=ALLBUT,@elixirNotTop
syn keyword elixirKernelFunction contained is_atom is_binary is_bitstring is_boolean is_float
syn keyword elixirKernelFunction contained is_function is_integer is_list is_map is_nil
syn keyword elixirKernelFunction contained is_number is_pid is_port is_reference is_tuple
syn keyword elixirKernelFunction contained abs binary_part bit_size byte_size div elem hd length
syn keyword elixirKernelFunction contained map_size node rem round tl trunc tuple_size
syn keyword elixirInclude import require alias use
syn keyword elixirSelf self
" This unfortunately also matches function names in function calls
syn match elixirUnusedVariable contained '\<_\w*\>'
syn match elixirUnusedVariable contained '\v%(^|[^.])@<=<_\w*>'
syn keyword elixirOperator and not or in
syn match elixirOperator '\v\.@<!<%(and|or|in|not)>'
syn match elixirOperator '!==\|!=\|!'
syn match elixirOperator '=\~\|===\|==\|='
syn match elixirOperator '<<<\|<<\|<=\|<-\|<'
@@ -54,8 +55,6 @@ syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
syn match elixirBlockInline "\<\(do\|else\)\>:\@="
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*'
syn keyword elixirBoolean true false nil
@@ -84,10 +83,10 @@ syn region elixirStruct matchgroup=elixirStructDelimiter start="%\(\w\+{\)\@=" e
syn region elixirMap matchgroup=elixirMapDelimiter start="%{" end="}" contains=ALLBUT,@elixirNotTop
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@Spell,@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=@Spell,@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ contains=@Spell,@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ contains=@Spell,@elixirStringContained
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirKernelFunction,elixirComment,@elixirNotTop
syn match elixirAtomInterpolated ':\("\)\@=' contains=elixirString
@@ -97,7 +96,7 @@ syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do
syn region elixirElseBlock matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,elixirKernelFunction,@elixirNotTop fold
syn region elixirAnonymousFunction matchgroup=elixirBlockDefinition start="\<fn\>" end="\<end\>" contains=ALLBUT,elixirKernelFunction,@elixirNotTop fold
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter,elixirAnonymousFunction
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigil,elixirAnonymousFunction
syn match elixirDelimEscape "\\[(<{\[)>}\]/\"'|]" transparent display contained contains=NONE
@@ -174,7 +173,6 @@ syn match elixirExUnitMacro "\(^\s*\)\@<=\<\(test\|describe\|setup\|setup_all\|
syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(assert\|assert_in_delta\|assert_raise\|assert_receive\|assert_received\|catch_error\)\>"
syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(catch_exit\|catch_throw\|flunk\|refute\|refute_in_delta\|refute_receive\|refute_received\)\>"
hi def link elixirBlockInline Keyword
hi def link elixirBlockDefinition Keyword
hi def link elixirDefine Define
hi def link elixirPrivateDefine Define

View File

@@ -1,81 +1,73 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
" Vim syntax file
" Language: Elm (http://elm-lang.org/)
" Maintainer: Alexander Noriega
" Latest Revision: 19 April 2015
" syntax highlighting for Elm (http://elm-lang.org/)
if exists("b:current_syntax")
if exists('b:current_syntax')
finish
endif
" Keywords
syn keyword elmKeyword alias as case else exposing if import in let module of port then type where
syn keyword elmConditional case else if of then
syn keyword elmAlias alias
syn keyword elmTypedef type port let in
syn keyword elmImport exposing as import module where
" Builtin operators
syn match elmBuiltinOp "\~"
syn match elmBuiltinOp "||"
syn match elmBuiltinOp "|>"
syn match elmBuiltinOp "|"
syn match elmBuiltinOp "`"
syn match elmBuiltinOp "\^"
syn match elmBuiltinOp "\\"
syn match elmBuiltinOp ">>"
syn match elmBuiltinOp ">="
syn match elmBuiltinOp ">"
syn match elmBuiltinOp "=="
syn match elmBuiltinOp "="
syn match elmBuiltinOp "<\~"
syn match elmBuiltinOp "<|"
syn match elmBuiltinOp "<="
syn match elmBuiltinOp "<<"
syn match elmBuiltinOp "<-"
syn match elmBuiltinOp "<"
syn match elmBuiltinOp "::"
syn match elmBuiltinOp ":"
syn match elmBuiltinOp "/="
syn match elmBuiltinOp "//"
syn match elmBuiltinOp "/"
syn match elmBuiltinOp "\.\."
syn match elmBuiltinOp "\."
syn match elmBuiltinOp "->"
syn match elmBuiltinOp "-"
syn match elmBuiltinOp "++"
syn match elmBuiltinOp "+"
syn match elmBuiltinOp "*"
syn match elmBuiltinOp "&&"
syn match elmBuiltinOp "%"
" Special names
syntax match specialName "^main "
" Comments
syn match elmTodo "[tT][oO][dD][oO]\|FIXME\|XXX" contained
syn match elmLineComment "--.*" contains=elmTodo,@spell
syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell
" String literals
syn region elmString start="\"" skip="\\\"" end="\"" contains=elmStringEscape
syn match elmStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match elmStringEscape "\\[nrfvbt\\\"]" contained
" Number literals
syn match elmNumber "\(\<\d\+\>\)"
syn match elmNumber "\(\<\d\+\.\d\+\>\)"
" Operators
syn match elmOperator "\([-!#$%`&\*\+./<=>\?@\\^|~:]\|\<_\>\)"
" Types
syn match elmType "\<[A-Z][0-9A-Za-z_'-]*"
syn keyword elmNumberType number
let b:current_syntax = "elm"
" Delimiters
syn match elmDelimiter "[,;]"
syn match elmBraces "[()[\]{}]"
hi def link elmKeyword Keyword
hi def link elmBuiltinOp Special
hi def link elmType Type
" Functions
syn match elmTupleFunction "\((,\+)\)"
" Comments
syn keyword elmTodo TODO FIXME XXX contained
syn match elmLineComment "--.*" contains=elmTodo,@spell
syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell
" Strings
syn match elmStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match elmStringEscape "\\[nrfvbt\\\"]" contained
syn region elmString start="\"" skip="\\\"" end="\"" contains=elmStringEscape,@spell
syn region elmTripleString start="\"\"\"" skip="\\\"" end="\"\"\"" contains=elmStringEscape,@spell
syn match elmChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
" Numbers
syn match elmInt "-\?\<\d\+\>\|0[xX][0-9a-fA-F]\+\>"
syn match elmFloat "\(\<\d\+\.\d\+\>\)"
" Identifiers
syn match elmTopLevelDecl "^\s*[a-zA-Z][a-zA-z0-9_]*\('\)*\s\+:\s\+" contains=elmOperator
hi def link elmTopLevelDecl Function
hi def link elmTupleFunction Normal
hi def link elmTodo Todo
hi def link elmLineComment Comment
hi def link elmComment Comment
hi def link elmLineComment Comment
hi def link elmString String
hi def link elmNumber Number
hi def link specialName Special
hi def link elmTripleString String
hi def link elmChar String
hi def link elmStringEscape Special
hi def link elmInt Number
hi def link elmFloat Float
hi def link elmDelimiter Delimiter
hi def link elmBraces Delimiter
hi def link elmTypedef TypeDef
hi def link elmImport Include
hi def link elmConditional Conditional
hi def link elmAlias Delimiter
hi def link elmOperator Operator
hi def link elmType Identifier
hi def link elmNumberType Identifier
syn sync minlines=500
let b:current_syntax = 'elm'
endif

View File

@@ -118,14 +118,14 @@ syn keyword erlangBIF garbage_collect get get_keys group_leader contained
syn keyword erlangBIF halt hd integer_to_binary integer_to_list contained
syn keyword erlangBIF iolist_to_binary iolist_size is_alive contained
syn keyword erlangBIF is_atom is_binary is_bitstring is_boolean contained
syn keyword erlangBIF is_float is_function is_integer is_list contained
syn keyword erlangBIF is_float is_function is_integer is_list is_map contained
syn keyword erlangBIF is_number is_pid is_port is_process_alive contained
syn keyword erlangBIF is_record is_reference is_tuple length link contained
syn keyword erlangBIF list_to_atom list_to_binary contained
syn keyword erlangBIF list_to_bitstring list_to_existing_atom contained
syn keyword erlangBIF list_to_float list_to_integer list_to_pid contained
syn keyword erlangBIF list_to_tuple load_module make_ref max min contained
syn keyword erlangBIF module_loaded monitor monitor_node node contained
syn keyword erlangBIF list_to_tuple load_module make_ref map_size max contained
syn keyword erlangBIF min module_loaded monitor monitor_node node contained
syn keyword erlangBIF nodes now open_port pid_to_list port_close contained
syn keyword erlangBIF port_command port_connect pre_loaded contained
syn keyword erlangBIF process_flag process_flag process_info contained

View File

@@ -24,7 +24,7 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby'
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
if b:eruby_subtype == ''
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
endif
if b:eruby_subtype == 'rhtml'
let b:eruby_subtype = 'html'
@@ -49,7 +49,7 @@ if !b:eruby_nest_level
let b:eruby_nest_level = 1
endif
if exists("b:eruby_subtype") && b:eruby_subtype != ''
if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
exe "runtime! syntax/".b:eruby_subtype.".vim"
unlet! b:current_syntax
endif

269
syntax/fsharp.vim Normal file
View File

@@ -0,0 +1,269 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1
" Vim syntax file
" Language: F#
" Last Change: Sun 19 Oct 2014 11:11:44 PM CEST
" Maintainer: Gregor Uhlenheuer <kongo2002@googlemail.com>
"
" Note: This syntax file is a complete rewrite of the original version
" of fs.vim from Choy Rim <choy.rim@gmail.com> and a slight
" modified version from Thomas Schank <ThomasSchank@gmail.com>
if version < 600
syntax clear
elseif exists('b:current_syntax')
finish
endif
" F# is case sensitive.
syn case match
" reset 'iskeyword' setting
setl isk&vim
" Scripting/preprocessor directives
syn match fsharpSScript "^\s*#\S\+" transparent contains=fsharpScript,fsharpRegion,fsharpPreCondit
syn match fsharpScript contained "#"
syn keyword fsharpScript contained quitlabels warnings directory cd load use
syn keyword fsharpScript contained install_printer remove_printer requirethread
syn keyword fsharpScript contained trace untrace untrace_all print_depth
syn keyword fsharpScript contained print_length define undef if elif else endif
syn keyword fsharpScript contained line error warning light nowarn
" comments
syn match fsharpSingleLineComment "//.*$" contains=fsharpTodo,@Spell
syn region fsharpDocComment start="///" end="$" contains=fsharpTodo,fsharpXml,@Spell keepend oneline
syn region fsharpXml matchgroup=fsharpXmlDoc start="<[^>]\+>" end="</[^>]\+>" contained contains=fsharpXml
" Double-backtick identifiers
syn region fsharpDoubleBacktick start="``" end="``" keepend oneline
" symbol names
syn match fsharpSymbol "\%(let\|use\|mutable\|rec\|and\|private\)\@<=!\=\s\+\zs\w\+\ze\s*[^=:]*[=:]"
syn match fsharpSymbol "\%(member\)\@<=\s\+\w\+\.\zs\w\+"
" types
syn match fsharpTypeName "\%(\<type\s\+\)\@<=\w\+"
" errors
syn match fsharpBraceErr "}"
syn match fsharpBrackErr "\]"
syn match fsharpParenErr ")"
syn match fsharpArrErr "|]"
syn match fsharpCommentErr "\*)"
" enclosing delimiters
syn region fsharpEncl transparent matchgroup=fsharpKeyword start="(" matchgroup=fsharpKeyword end=")" contains=ALLBUT,fsharpParenErr,fsharpScript
syn region fsharpEncl transparent matchgroup=fsharpKeyword start="{" matchgroup=fsharpKeyword end="}" contains=ALLBUT,fsharpBraceErr,fsharpScript
syn region fsharpEncl transparent matchgroup=fsharpKeyword start="\[" matchgroup=fsharpKeyword end="\]" contains=ALLBUT,fsharpBrackErr,fsharpScript
syn region fsharpEncl transparent matchgroup=fsharpKeyword start="\[|" matchgroup=fsharpKeyword end="|\]" contains=ALLBUT,fsharpArrErr,fsharpScript
" comments
syn region fsharpMultiLineComment start="(\*" end="\*)" contains=fsharpTodo
syn keyword fsharpTodo contained TODO FIXME XXX NOTE
" keywords
syn keyword fsharpKeyword abstract as assert base begin class default delegate
syn keyword fsharpKeyword do done downcast downto elif else end exception
syn keyword fsharpKeyword extern for fun function global if in inherit inline
syn keyword fsharpKeyword interface lazy let match member module mutable
syn keyword fsharpKeyword namespace new of override rec static struct then
syn keyword fsharpKeyword to type upcast use val void when while with
syn keyword fsharpKeyword async atomic break checked component const constraint
syn keyword fsharpKeyword constructor continue decimal eager event external
syn keyword fsharpKeyword fixed functor include method mixin object parallel
syn keyword fsharpKeyword process pure return seq tailcall trait
" additional operator keywords (Microsoft.FSharp.Core.Operators)
syn keyword fsharpKeyword box hash sizeof typeof typedefof unbox ref fst snd
syn keyword fsharpKeyword stdin stdout stderr
" math operators (Microsoft.FSharp.Core.Operators)
syn keyword fsharpKeyword abs acos asin atan atan2 ceil cos cosh exp floor log
syn keyword fsharpKeyword log10 pown round sign sin sinh sqrt tan tanh
syn keyword fsharpOCaml asr land lor lsl lsr lxor mod sig
if !exists('g:fsharp_no_linq') || g:fsharp_no_linq == 0
syn keyword fsharpLinq orderBy select where yield
endif
" open
syn keyword fsharpOpen open
" exceptions
syn keyword fsharpException try failwith failwithf finally invalid_arg raise
syn keyword fsharpException rethrow
" modifiers
syn keyword fsharpModifier abstract const extern internal override private
syn keyword fsharpModifier protected public readonly sealed static virtual
syn keyword fsharpModifier volatile
" constants
syn keyword fsharpConstant null
syn keyword fsharpBoolean false true
" types
syn keyword fsharpType array bool byte char decimal double enum exn float
syn keyword fsharpType float32 int int16 int32 int64 lazy_t list nativeint
syn keyword fsharpType obj option sbyte single string uint uint32 uint64
syn keyword fsharpType uint16 unativeint unit
" core classes
syn match fsharpCore "\u\a*\." transparent contains=fsharpCoreClass
syn keyword fsharpCoreClass Array Async Directory File List Option Path Map Set contained
syn keyword fsharpCoreClass String Seq Tuple contained
syn keyword fsharpCoreMethod printf printfn sprintf eprintf eprintfn fprintf
syn keyword fsharpCoreMethod fprintfn
" options
syn keyword fsharpOption Some None
" operators
syn keyword fsharpOperator not and or
syn match fsharpFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bscdiuxXoEefFgGMOAat]\|\[\^\=.[^]]*\]\)" contained
syn match fsharpCharacter "'\\\d\d\d'\|'\\[\'ntbr]'\|'.'"
syn match fsharpCharErr "'\\\d\d'\|'\\\d'"
syn match fsharpCharErr "'\\[^\'ntbr]'"
syn region fsharpString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=fsharpFormat
syn region fsharpString start=+"""+ skip=+\\\\\|\\"+ end=+"""+ contains=fsharpFormat
syn region fsharpString start=+@"+ skip=+""+ end=+"+ contains=fsharpFormat
syn match fsharpFunDef "->"
syn match fsharpRefAssign ":="
syn match fsharpTopStop ";;"
syn match fsharpOperator "\^"
syn match fsharpOperator "::"
syn match fsharpLabel "\<_\>"
syn match fsharpOperator "&&"
syn match fsharpOperator "<"
syn match fsharpOperator ">"
syn match fsharpOperator "|>"
syn match fsharpOperator ":>"
syn match fsharpOperator ":?>"
syn match fsharpOperator "&&&"
syn match fsharpOperator "|||"
syn match fsharpOperator "\.\."
syn match fsharpKeyChar "|[^\]]"me=e-1
syn match fsharpKeyChar ";"
syn match fsharpKeyChar "\~"
syn match fsharpKeyChar "?"
syn match fsharpKeyChar "\*"
syn match fsharpKeyChar "+"
syn match fsharpKeyChar "="
syn match fsharpKeyChar "|"
syn match fsharpKeyChar "(\*)"
syn match fsharpOperator "<-"
syn match fsharpNumber "\<\d\+"
syn match fsharpNumber "\<-\=\d\(_\|\d\)*\(u\|u\?[yslLn]\|UL\)\?\>"
syn match fsharpNumber "\<-\=0[x|X]\(\x\|_\)\+\(u\|u\?[yslLn]\|UL\)\?\>"
syn match fsharpNumber "\<-\=0[o|O]\(\o\|_\)\+\(u\|u\?[yslLn]\|UL\)\?\>"
syn match fsharpNumber "\<-\=0[b|B]\([01]\|_\)\+\(u\|u\?[yslLn]\|UL\)\?\>"
syn match fsharpFloat "\<-\=\d\(_\|\d\)*\.\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
syn match fsharpFloat "\<-\=\d\(_\|\d\)*\.\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
syn match fsharpFloat "\<\d\+\.\d*"
" modules
syn match fsharpModule "\%(\<open\s\+\)\@<=[a-zA-Z.]\+"
" attributes
syn region fsharpAttrib matchgroup=fsharpAttribute start="\[<" end=">]"
" regions
syn region fsharpRegion matchgroup=fsharpPreCondit start="\%(end\)\@<!region.*$"
\ end="endregion" fold contains=ALL contained
if version >= 508 || !exists("did_fs_syntax_inits")
if version < 508
let did_fs_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink fsharpBraceErr Error
HiLink fsharpBrackErr Error
HiLink fsharpParenErr Error
HiLink fsharpArrErr Error
HiLink fsharpCommentErr Error
HiLink fsharpSingleLineComment Comment
HiLink fsharpMultiLineComment Comment
HiLink fsharpDocComment Comment
HiLink fsharpXml Comment
HiLink fsharpDoubleBacktick String
HiLink fsharpOpen Include
HiLink fsharpModPath Include
HiLink fsharpScript Include
HiLink fsharpPreCondit Include
HiLink fsharpKeyword Keyword
HiLink fsharpCoreMethod Keyword
HiLink fsharpOCaml Statement
HiLink fsharpLinq Statement
HiLink fsharpSymbol Function
HiLink fsharpFunDef Operator
HiLink fsharpRefAssign Operator
HiLink fsharpTopStop Operator
HiLink fsharpKeyChar Operator
HiLink fsharpOperator Operator
HiLink fsharpBoolean Boolean
HiLink fsharpConstant Constant
HiLink fsharpCharacter Character
HiLink fsharpNumber Number
HiLink fsharpFloat Float
HiLink fsharpString String
HiLink fsharpFormat Special
HiLink fsharpModifier StorageClass
HiLink fsharpException Exception
HiLink fsharpLabel Identifier
HiLink fsharpOption Identifier
HiLink fsharpTypeName Identifier
HiLink fsharpModule Identifier
HiLink fsharpType Type
HiLink fsharpCoreClass Typedef
HiLink fsharpAttrib Typedef
HiLink fsharpXmlDoc Typedef
HiLink fsharpTodo Todo
HiLink fsharpEncl Delimiter
HiLink fsharpAttribute Delimiter
delcommand HiLink
endif
let b:current_syntax = 'fsharp'
" vim: sw=4 et sts=4
endif

View File

@@ -13,7 +13,7 @@ syn keyword glslRepeat for while do
syn keyword glslStatement discard return break continue
" Comments
syn keyword glslTodo contained TODO FIXME XXX
syn keyword glslTodo contained TODO FIXME XXX NOTE
syn region glslCommentL start="//" skip="\\$" end="$" keepend contains=glslTodo,@Spell
syn region glslComment matchgroup=glslCommentStart start="/\*" end="\*/" extend contains=glslTodo,@Spell
@@ -28,15 +28,15 @@ syn region glslPreProc start="^\s*#\s*\(error\|pragma\|extension\|versi
syn keyword glslBoolean true false
" Integer Numbers
syn match glslDecimalInt display "\(0\|[1-9]\d*\)[uU]\?"
syn match glslOctalInt display "0\o\+[uU]\?"
syn match glslHexInt display "0[xX]\x\+[uU]\?"
syn match glslDecimalInt display "\<\(0\|[1-9]\d*\)[uU]\?"
syn match glslOctalInt display "\<0\o\+[uU]\?"
syn match glslHexInt display "\<0[xX]\x\+[uU]\?"
" Float Numbers
syn match glslFloat display "\d\+\.\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\d\+[eE][+-]\=\d\+\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\d\+\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\<\d\+\.\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\<\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\<\d\+[eE][+-]\=\d\+\(lf\|LF\|f\|F\)\="
syn match glslFloat display "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
" Swizzles
syn match glslSwizzle display /\.[xyzw]\{1,4\}\>/
@@ -44,10 +44,9 @@ syn match glslSwizzle display /\.[rgba]\{1,4\}\>/
syn match glslSwizzle display /\.[stpq]\{1,4\}\>/
" Structure
syn keyword glslStructure struct
syn keyword glslStructure struct nextgroup=glslIdentifier skipwhite skipempty
" This prevents numbers at ends of identifies from being highlighted as numbers
syn match glslIdentifier display "\I\i*"
syn match glslIdentifier contains=glslIdentifierPrime "\%([a-zA-Z_]\)\%([a-zA-Z0-9_]\)*" display contained
" Types
syn keyword glslType atomic_uint
@@ -171,6 +170,7 @@ syn keyword glslType vec4
syn keyword glslType void
" Qualifiers
syn keyword glslQualifier align
syn keyword glslQualifier attribute
syn keyword glslQualifier binding
syn keyword glslQualifier buffer
@@ -276,16 +276,22 @@ syn keyword glslQualifier varying
syn keyword glslQualifier vertices
syn keyword glslQualifier volatile
syn keyword glslQualifier writeonly
syn keyword glslQualifier xfb_buffer
syn keyword glslQualifier xfb_stride
syn keyword glslQualifier xfb_offset
" Built-in Constants
syn keyword glslBuiltinConstant gl_CullDistance
syn keyword glslBuiltinConstant gl_MaxAtomicCounterBindings
syn keyword glslBuiltinConstant gl_MaxAtomicCounterBufferSize
syn keyword glslBuiltinConstant gl_MaxClipDistances
syn keyword glslBuiltinConstant gl_MaxClipPlanes
syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounterBuffers
syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounters
syn keyword glslBuiltinConstant gl_MaxCombinedClipAndCullDistances
syn keyword glslBuiltinConstant gl_MaxCombinedImageUniforms
syn keyword glslBuiltinConstant gl_MaxCombinedImageUnitsAndFragmentOutputs
syn keyword glslBuiltinConstant gl_MaxCombinedShaderOutputResources
syn keyword glslBuiltinConstant gl_MaxCombinedTextureImageUnits
syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounterBuffers
syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounters
@@ -294,6 +300,7 @@ syn keyword glslBuiltinConstant gl_MaxComputeTextureImageUnits
syn keyword glslBuiltinConstant gl_MaxComputeUniformComponents
syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupCount
syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupSize
syn keyword glslBuiltinConstant gl_MaxCullDistances
syn keyword glslBuiltinConstant gl_MaxDrawBuffers
syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounterBuffers
syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounters
@@ -317,6 +324,7 @@ syn keyword glslBuiltinConstant gl_MaxImageUnits
syn keyword glslBuiltinConstant gl_MaxLights
syn keyword glslBuiltinConstant gl_MaxPatchVertices
syn keyword glslBuiltinConstant gl_MaxProgramTexelOffset
syn keyword glslBuiltinConstant gl_MaxSamples
syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounterBuffers
syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounters
syn keyword glslBuiltinConstant gl_MaxTessControlImageUniforms
@@ -337,6 +345,8 @@ syn keyword glslBuiltinConstant gl_MaxTessPatchComponents
syn keyword glslBuiltinConstant gl_MaxTextureCoords
syn keyword glslBuiltinConstant gl_MaxTextureImageUnits
syn keyword glslBuiltinConstant gl_MaxTextureUnits
syn keyword glslBuiltinConstant gl_MaxTransformFeedbackBuffers
syn keyword glslBuiltinConstant gl_MaxTransformFeedbackInterleavedComponents
syn keyword glslBuiltinConstant gl_MaxVaryingComponents
syn keyword glslBuiltinConstant gl_MaxVaryingFloats
syn keyword glslBuiltinConstant gl_MaxVaryingVectors
@@ -382,6 +392,7 @@ syn keyword glslBuiltinVariable gl_FrontLightProduct
syn keyword glslBuiltinVariable gl_FrontMaterial
syn keyword glslBuiltinVariable gl_FrontSecondaryColor
syn keyword glslBuiltinVariable gl_GlobalInvocationID
syn keyword glslBuiltinVariable gl_HelperInvocation
syn keyword glslBuiltinVariable gl_InstanceID
syn keyword glslBuiltinVariable gl_InvocationID
syn keyword glslBuiltinVariable gl_Layer
@@ -483,7 +494,11 @@ syn keyword glslBuiltinFunction cos
syn keyword glslBuiltinFunction cosh
syn keyword glslBuiltinFunction cross
syn keyword glslBuiltinFunction dFdx
syn keyword glslBuiltinFunction dFdxCoarse
syn keyword glslBuiltinFunction dFdxFine
syn keyword glslBuiltinFunction dFdy
syn keyword glslBuiltinFunction dFdyCoarse
syn keyword glslBuiltinFunction dFdyFine
syn keyword glslBuiltinFunction degrees
syn keyword glslBuiltinFunction determinant
syn keyword glslBuiltinFunction distance
@@ -502,6 +517,8 @@ syn keyword glslBuiltinFunction fract
syn keyword glslBuiltinFunction frexp
syn keyword glslBuiltinFunction ftransform
syn keyword glslBuiltinFunction fwidth
syn keyword glslBuiltinFunction fwidthCoarse
syn keyword glslBuiltinFunction fwidthFine
syn keyword glslBuiltinFunction greaterThan
syn keyword glslBuiltinFunction greaterThanEqual
syn keyword glslBuiltinFunction groupMemoryBarrier
@@ -643,13 +660,15 @@ hi def link glslOctalInt glslInteger
hi def link glslHexInt glslInteger
hi def link glslInteger Number
hi def link glslFloat Float
hi def link glslIdentifierPrime glslIdentifier
hi def link glslIdentifier Identifier
hi def link glslStructure Structure
hi def link glslType Type
hi def link glslQualifier StorageClass
hi def link glslBuiltinConstant Constant
hi def link glslBuiltinFunction Function
hi def link glslBuiltinVariable Identifier
hi def link glslSwizzle SpecialChar
hi def link glslSwizzle Identifier
if !exists("b:current_syntax")
let b:current_syntax = "glsl"

122
syntax/gmpl.vim Normal file
View File

@@ -0,0 +1,122 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gmpl') == -1
" Vim syntax file
" Language: GMPL
" Maintainer: Mark Mba Wright
" Latest Revision: 9 July 2012
if exists("b:current_syntax")
finish
endif
syn sync fromstart
syn match gmplArithmeticSetOperator "\.\."
" Integer with - + or nothing in front
syn match gmplNumber '\d\+'
syn match gmplNumber '[-+]\d\+'
" Floating point gmplNumber with decimal no E or e (+,-)
syn match gmplNumber '\d*\.\d\+'
syn match gmplNumber '[-+]\d*\.\d\+'
" Floating point like gmplNumber with E and no decimal point (+,-)
syn match gmplNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+'
syn match gmplNumber '\d[[:digit:]]*[eE][\-+]\=\d\+'
" Floating point like gmplNumber with E and decimal point (+,-)
syn match gmplNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match gmplNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
syn match gmplIndex /\<\%(in\>\)\@!\w*/ contained contains=gmplKeyword,gmplNumber
syn match gmplLabel '[a-zA-Z][a-zA-Z0-9_]*'
syn match gmplArithmeticOperator "[-+]"
syn match gmplArithmeticOperator "\.\=[*/\\^]"
syn match gmplRelationalOperator "[=~]="
syn match gmplRelationalOperator "[<>]=\="
" syn match gmplLogicalOperator "[&|~]
" match indeces
" comments
syn match gmplComment /\/\*.\{-}\*\//
syn region gmplComment start="/\*" end="\*/"
syn match gmplComment '#.\{-}$'
" strings
syn region gmplString start="\"" end="\""
syn region gmplString start="\'" end="\'" contains=gmplStringToken
syn match gmplStringToken '\%[a-z]' contained
" Keywords
syn keyword gmplKeyword and else by if cross in diff inter div less mod union not within or symdiff then
syn keyword gmplKeyword minimize maximize solve
syn keyword gmplType set var param nextgroup=gmplLabel skipwhite
" Regions
syn region gmplIndexExpression start="{" end="}" transparent contains=gmplIndex,gmplIndexExpression
syn region gmplIndexGroup start="\[" end="\]" transparent contains=gmplIndex
" syn region gmplParen start="(" end=")"
"" catch errors caused by wrong parenthesis
syn match gmplParensError ")\|}\|\]"
syn match gmplParensErrA contained "\]"
syn match gmplParensErrC contained "}"
hi level1c ctermfg=brown guifg=brown
hi level2c ctermfg=darkgreen guifg=darkgreen gui=bold
hi level3c ctermfg=Darkblue guifg=Darkblue
hi level4c ctermfg=darkmagenta guifg=darkmagenta gui=bold
hi level5c ctermfg=darkcyan guifg=darkcyan
hi level6c ctermfg=white guifg=white gui=bold
hi level7c ctermfg=darkred guifg=darkred
hi level8c ctermfg=blue guifg=blue gui=bold
hi level9c ctermfg=darkgray guifg=darkgray
hi level10c ctermfg=brown guifg=brown gui=bold
hi level11c ctermfg=darkgreen guifg=darkgreen
hi level12c ctermfg=Darkblue guifg=Darkblue gui=bold
hi level13c ctermfg=darkmagenta guifg=darkmagenta
hi level14c ctermfg=darkcyan guifg=darkcyan gui=bold
hi level15c ctermfg=gray guifg=gray
" These are the regions for each pair.
" This could be improved, perhaps, by makeing them match [ and { also,
" but I'm not going to take the time to figure out haw to make the
" end pattern match only the proper type.
syn region level1 matchgroup=level1c start=/(/ end=/)/ contains=TOP,level1,level2,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level2 matchgroup=level2c start=/(/ end=/)/ contains=TOP,level2,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level3 matchgroup=level3c start=/(/ end=/)/ contains=TOP,level3,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level4 matchgroup=level4c start=/(/ end=/)/ contains=TOP,level4,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level5 matchgroup=level5c start=/(/ end=/)/ contains=TOP,level5,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level6 matchgroup=level6c start=/(/ end=/)/ contains=TOP,level6,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level7 matchgroup=level7c start=/(/ end=/)/ contains=TOP,level7,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level8 matchgroup=level8c start=/(/ end=/)/ contains=TOP,level8,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level9 matchgroup=level9c start=/(/ end=/)/ contains=TOP,level9,level10,level11,level12,level13,level14,level15, NoInParens
syn region level10 matchgroup=level10c start=/(/ end=/)/ contains=TOP,level10,level11,level12,level13,level14,level15, NoInParens
syn region level11 matchgroup=level11c start=/(/ end=/)/ contains=TOP,level11,level12,level13,level14,level15, NoInParens
syn region level12 matchgroup=level12c start=/(/ end=/)/ contains=TOP,level12,level13,level14,level15, NoInParens
syn region level13 matchgroup=level13c start=/(/ end=/)/ contains=TOP,level13,level14,level15, NoInParens
syn region level14 matchgroup=level14c start=/(/ end=/)/ contains=TOP,level14,level15, NoInParens
syn region level15 matchgroup=level15c start=/(/ end=/)/ contains=TOP,level15, NoInParens
let b:current_syntax = "gmpl"
hi def link gmplKeyword Keyword
hi def link gmplParensError Error
hi def link gmplParensErrA Error
hi def link gmplParensErrB Error
hi def link gmplParensErrC Error
" hi def link gmplIndexExpression Label
" hi def link gmplParen Label
" hi def link gmplIndexGroup Label
hi def link gmplIndex Identifier
hi def link gmplNumber Number
hi def link gmplComment Comment
hi def link gmplType Type
hi def link gmplLabel Keyword
hi def link gmplString String
hi def link gmplStringToken Special
endif

View File

@@ -5,36 +5,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
" license that can be found in the LICENSE file.
"
" go.vim: Vim syntax file for Go.
"
" Options:
" There are some options for customizing the highlighting; the recommended
" settings are the default values, but you can write:
" let OPTION_NAME = 0
" in your ~/.vimrc file to disable particular options. You can also write:
" let OPTION_NAME = 1
" to enable particular options. At present, all options default to off:
"
" - go_highlight_array_whitespace_error
" Highlights white space after "[]".
" - go_highlight_chan_whitespace_error
" Highlights white space around the communications operator that don't follow
" the standard style.
" - go_highlight_extra_types
" Highlights commonly used library types (io.Reader, etc.).
" - go_highlight_space_tab_error
" Highlights instances of tabs following spaces.
" - go_highlight_trailing_whitespace_error
" Highlights trailing white space.
" - go_highlight_string_spellcheck
" Specifies that strings should be spell checked
" - go_highlight_format_strings
" Highlights printf-style operators inside string literals.
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Set settings to default values.
if !exists("g:go_highlight_array_whitespace_error")
let g:go_highlight_array_whitespace_error = 0
endif
@@ -91,12 +68,52 @@ if !exists("g:go_highlight_generate_tags")
let g:go_highlight_generate_tags = 0
endif
if !exists("g:go_highlight_variable_assignments")
let g:go_highlight_variable_assignments = 0
endif
if !exists("g:go_highlight_variable_declarations")
let g:go_highlight_variable_declarations = 0
endif
let s:fold_block = 1
let s:fold_import = 1
let s:fold_varconst = 1
let s:fold_package_comment = 1
let s:fold_comment = 0
if exists("g:go_fold_enable")
" Enabled by default.
if index(g:go_fold_enable, 'block') == -1
let s:fold_block = 0
endif
if index(g:go_fold_enable, 'import') == -1
let s:fold_import = 0
endif
if index(g:go_fold_enable, 'varconst') == -1
let s:fold_varconst = 0
endif
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
endif
endif
syn case match
syn keyword goDirective package import
syn keyword goDeclaration var const
syn keyword goPackage package
syn keyword goImport import contained
syn keyword goVar var contained
syn keyword goConst const contained
hi def link goDirective Statement
hi def link goPackage Statement
hi def link goImport Statement
hi def link goVar Keyword
hi def link goConst Keyword
hi def link goDeclaration Keyword
" Keywords within functions
@@ -137,8 +154,14 @@ hi def link goPredefinedIdentifiers goBoolean
" Comments; their contents
syn keyword goTodo contained TODO FIXME XXX BUG
syn cluster goCommentGroup contains=goTodo
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell
if s:fold_comment
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold
syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold
else
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
endif
hi def link goComment Comment
hi def link goTodo Todo
@@ -191,8 +214,35 @@ syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=
hi def link goCharacter Character
" Regions
syn region goBlock start="{" end="}" transparent fold
syn region goParen start='(' end=')' transparent
if s:fold_block
syn region goBlock start="{" end="}" transparent fold
else
syn region goBlock start="{" end="}" transparent
endif
" import
if s:fold_import
syn region goImport start='import (' end=')' transparent fold contains=goImport,goString,goComment
else
syn region goImport start='import (' end=')' transparent contains=goImport,goString,goComment
endif
" var, const
if s:fold_varconst
syn region goVar start='var (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
syn region goConst start='const (' end='^\s*)$' transparent fold
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
else
syn region goVar start='var (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
syn region goConst start='const (' end='^\s*)$' transparent
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
endif
" Single-line var, const, and import.
syn match goSingleDecl /\(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst
" Integers
syn match goDecimalInt "\<-\=\d\+\%([Ee][-+]\=\d\+\)\=\>"
@@ -323,10 +373,10 @@ hi def link goField Identifier
" Structs & Interfaces;
if g:go_highlight_types != 0
syn match goTypeConstructor /\<\w\+{/he=e-1
syn match goTypeConstructor /\<\w\+{\@=/
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
syn match goDeclType /\<interface\|struct\>/ skipwhite skipnl
syn match goDeclType /\<\(interface\|struct\)\>/ skipwhite skipnl
hi def link goReceiverType Type
else
syn keyword goDeclType struct interface
@@ -337,6 +387,18 @@ hi def link goTypeName Type
hi def link goTypeDecl Keyword
hi def link goDeclType Keyword
" Variable Assignments
if g:go_highlight_variable_assignments != 0
syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&]|\*|\<\<|\>\>|\&\^)?\=[^=])/
hi def link goVarAssign Special
endif
" Variable Declarations
if g:go_highlight_variable_declarations != 0
syn match goVarDefs /\v\w+(,\s*\w+)*\ze(\s*:\=)/
hi def link goVarDefs Special
endif
" Build Constraints
if g:go_highlight_build_constraints != 0
syn match goBuildKeyword display contained "+build"
@@ -358,15 +420,22 @@ if g:go_highlight_build_constraints != 0
hi def link goBuildCommentStart Comment
hi def link goBuildDirectives Type
hi def link goBuildKeyword PreProc
endif
if g:go_highlight_build_constraints != 0 || s:fold_package_comment
" One or more line comments that are followed immediately by a "package"
" declaration are treated like package documentation, so these must be
" matched as comments to avoid looking like working build constraints.
" The he, me, and re options let the "package" itself be highlighted by
" the usual rules.
syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/
\ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7
\ contains=@goCommentGroup,@Spell
exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/'
\ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
\ . ' contains=@goCommentGroup,@Spell'
\ . (s:fold_package_comment ? ' fold' : '')
exe 'syn region goPackageComment start=/\v\/\*.*\n(.*\n)*\s*\*\/\npackage/'
\ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
\ . ' contains=@goCommentGroup,@Spell'
\ . (s:fold_package_comment ? ' fold' : '')
hi def link goPackageComment Comment
endif

View File

@@ -1,64 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Vim syntax file
" Language: GraphQL
" Maintainer: Jon Parise <jon@indelible.org>
if exists("b:current_syntax")
finish
endif
syn match graphqlComment "#.*$" contains=@Spell
syn match graphqlOperator "="
syn match graphqlOperator "!"
syn match graphqlOperator "|"
syn match graphqlOperator "\M..."
syn keyword graphqlBoolean true false
syn keyword graphqlNull null
syn match graphqlNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"
syn region graphqlString start=+"+ skip=+\\\\\|\\"+ end=+"\|$+
syn keyword graphqlStructure enum scalar type union nextgroup=graphqlType skipwhite
syn keyword graphqlStructure input interface subscription nextgroup=graphqlType skipwhite
syn keyword graphqlStructure implements on nextgroup=graphqlType skipwhite
syn keyword graphqlStructure query mutation fragment nextgroup=graphqlIdentifier skipwhite
syn keyword graphqlStructure directive nextgroup=graphqlDirective skipwhite
syn keyword graphqlStructure extend nextgroup=graphqlStructure skipwhite
syn match graphqlDirective "\<@\h\w*\>" display
syn match graphqlVariable "\<\$\h\w*\>" display
syn match graphqlIdentifier "\<\h\w*\>" display contained
syn match graphqlType "\<_*\u\w*\>" display contained
syn match graphqlConstant "\<[A-Z_]\+\>" display contained
syn keyword graphqlMetaFields __schema __type __typename
syn region graphqlFold matchgroup=graphqlBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold contains=ALLBUT,graphqlStructure
syn region graphqlList matchgroup=graphqlBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent contains=ALLBUT,graphqlDirective,graphqlStructure
hi def link graphqlComment Comment
hi def link graphqlOperator Operator
hi def link graphqlBraces Delimiter
hi def link graphqlBoolean Boolean
hi def link graphqlNull Keyword
hi def link graphqlNumber Number
hi def link graphqlString String
hi def link graphqlConstant Constant
hi def link graphqlDirective PreProc
hi def link graphqlIdentifier Identifier
hi def link graphqlMetaFields Special
hi def link graphqlStructure Structure
hi def link graphqlType Type
hi def link graphqlVariable Identifier
syn sync minlines=500
let b:current_syntax = "graphql"
endif

View File

@@ -20,14 +20,14 @@ endif
syn spell notoplevel
syn match haskellRecordField contained containedin=haskellBlock
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\_s\+::\s"
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\_s\+::\_s"
\ contains=
\ haskellIdentifier,
\ haskellOperators,
\ haskellSeparator,
\ haskellParens
syn match haskellTypeSig
\ "^\s*\(where\s\+\|let\s\+\|default\s\+\)\?[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\_s\+::\s"
\ "^\s*\(where\s\+\|let\s\+\|default\s\+\)\?[_a-z][a-zA-Z0-9_']*#\?\(,\s*[_a-z][a-zA-Z0-9_']*#\?\)*\_s\+::\_s"
\ contains=
\ haskellWhere,
\ haskellLet,

View File

@@ -106,7 +106,7 @@ syn keyword htmlArg contained form autocomplete autofocus list min max step
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
syn keyword htmlArg contained required placeholder pattern
" <command>, <details>, <time>
syn keyword htmlArg contained label icon open datetime pubdate
syn keyword htmlArg contained label icon open datetime-local pubdate
" <script>
syn keyword htmlArg contained async
" <content>

View File

@@ -27,7 +27,7 @@ syntax sync fromstart
syntax case match
syntax match jsNoise /[:,\;]\{1}/
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype
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 jsParensError /[)}\]]/
@@ -43,14 +43,14 @@ 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
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 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
syntax keyword jsModuleAs contained as skipwhite skipempty nextgroup=jsModuleKeyword,jsExportDefaultGroup
syntax keyword jsFrom contained from skipwhite skipempty nextgroup=jsString
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
" Strings, Templates, Numbers
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
@@ -143,7 +143,7 @@ syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus
" Code blocks
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression,jsSpreadExpression extend fold
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsExpression extend fold nextgroup=jsFlowDefinition
syntax region jsParenDecorator contained matchgroup=jsParensDecorator start=/(/ end=/)/ contains=@jsAll extend fold
syntax region jsParenIfElse contained matchgroup=jsParensIfElse start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentIfElse,jsIfElseBlock extend fold
syntax region jsParenRepeat contained matchgroup=jsParensRepeat start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentRepeat,jsRepeatBlock extend fold
@@ -161,12 +161,12 @@ syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces s
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression,jsComment extend fold
syntax region jsObject contained matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsDecorator,jsAsyncKeyword extend fold
syntax region jsBlock matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsSpreadExpression extend fold
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment skipwhite skipempty nextgroup=jsFrom
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 match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs
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 region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
syntax match jsFuncArgCommas contained ','
@@ -178,7 +178,7 @@ syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArg
" Matches a series of arguments surrounded in parens
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
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 : '')
@@ -188,8 +188,8 @@ 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 region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue
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 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
@@ -239,8 +239,8 @@ if exists("javascript_plugin_flow")
runtime extras/flow.vim
endif
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword,jsNoise,jsBlockLabel
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo,jsForAwait,jsAsyncKeyword,jsStatement
syntax cluster jsAll contains=@jsExpression,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsException,jsTry,jsNoise,jsBlockLabel
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already

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: 29 December 2016
" Latest Revision: 18 September 2017
if exists("b:current_syntax")
finish
@@ -21,7 +21,7 @@ syn keyword ktException try catch finally throw
syn keyword ktInclude import package
syn keyword ktType Any Boolean Byte Char Double Float Int Long Nothing Short Unit
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic header impl
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic header impl expect actual
syn keyword ktStructure class object interface typealias fun val var constructor init
syn keyword ktReservedKeyword typeof
@@ -51,9 +51,9 @@ syn match ktLabel "\v\w+\@"
syn match ktSimpleInterpolation "\v\$\h\w*" contained
syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation
syn match ktNumber "\v<\d+[LFf]?"
syn match ktNumber "\v<0[Xx]\x+L?"
syn match ktNumber "\v<0[Bb]\d+L?"
syn match ktNumber "\v<\d+[_[:digit:]]*[LFf]?"
syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*L?"
syn match ktNumber "\v<0[Bb][01]+[_01]*L?"
syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?"
syn match ktEscapedName "\v`.*`"

View File

@@ -21,16 +21,27 @@ elseif exists("b:current_syntax")
finish
endif
if !exists("b:mako_outer_lang")
if exists("g:mako_default_outer_lang")
let b:mako_outer_lang = g:mako_default_outer_lang
else
let b:mako_outer_lang = "html"
endif
endif
if !exists("main_syntax")
let main_syntax = "html"
let main_syntax = b:mako_outer_lang
endif
"Source the html syntax file
ru! syntax/html.vim
unlet b:current_syntax
"Source the outer syntax file
execute "ru! syntax/" . b:mako_outer_lang . ".vim"
if exists("b:current_syntax")
unlet b:current_syntax
endif
" tell html.vim what syntax groups should take precedence (see :help html.vim)
syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
if b:mako_outer_lang == "html"
" tell html.vim what syntax groups should take precedence (see :help html.vim)
syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
endif
"Put the python syntax file in @pythonTop
syn include @pythonTop syntax/python.vim
@@ -91,6 +102,6 @@ if version >= 508 || !exists("did_mako_syn_inits")
delc HiLink
endif
let b:current_syntax = "html"
let b:current_syntax = b:mako_outer_lang
endif

View File

@@ -707,8 +707,10 @@ if !exists('g:loaded_sslsecure')
syn match ngxSSLCipherInsecure '[^!]\zsALL'
syn match ngxSSLCipherInsecure '[^!]\zsCOMPLEMENTOFALL'
syn match ngxSSLCipherInsecure '[^!]\zsSHA\ze\D' " Match SHA1 without matching SHA256+
syn match ngxSSLCipherInsecure '[^!]\zsSHA1'
" SHA ciphers are only used in HMAC with all known OpenSSL/ LibreSSL cipher suites and MAC
" usage is still considered safe
" syn match ngxSSLCipherInsecure '[^!]\zsSHA\ze\D' " Match SHA1 without matching SHA256+
" syn match ngxSSLCipherInsecure '[^!]\zsSHA1'
syn match ngxSSLCipherInsecure '[^!]\zsMD5'
syn match ngxSSLCipherInsecure '[^!]\zsRC2'
syn match ngxSSLCipherInsecure '[^!]\zsRC4'

93
syntax/openscad.vim Normal file
View File

@@ -0,0 +1,93 @@
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

@@ -36,10 +36,12 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'php') == -1
"
" Options: php_sql_query = 1 for SQL syntax highlighting inside strings (default: 0)
" php_sql_heredoc = 1 for SQL syntax highlighting inside heredocs (default: 1)
" php_sql_nowdoc = 1 for SQL syntax highlighting inside nowdocs (default: 1)
" b:sql_type_override = 'postgresql' for PostgreSQL syntax highlighting in current buffer (default: 'mysql')
" g:sql_type_default = 'postgresql' to set global SQL syntax highlighting language default (default: 'mysql')"
" php_html_in_strings = 1 for HTML syntax highlighting inside strings (default: 0)
" php_html_in_heredoc = 1 for HTML syntax highlighting inside heredocs (default: 1)
" php_html_in_nowdoc = 1 for HTML syntax highlighting inside nowdocs (default: 1)
" php_html_load = 1 for loading the HTML syntax at all. Overwrites php_html_in_strings and php_html_in_heredoc (default: 1)
" php_ignore_phpdoc = 0 for not highlighting parts of phpDocs
" php_parent_error_close = 1 for highlighting parent error ] or ) (default: 0)
@@ -102,6 +104,10 @@ if (exists("php_html_load") && php_html_load)
let php_html_in_heredoc=1
endif
if !exists("php_html_in_nowdoc")
let php_html_in_nowdoc=1
endif
runtime! syntax/html.vim
unlet! b:current_syntax
" HTML syntax file turns on spelling for all top level words, we attempt to turn off
@@ -110,9 +116,10 @@ if (exists("php_html_load") && php_html_load)
syn cluster htmlPreproc add=phpRegion
else
" If it is desired that the HTML syntax file not be loaded at all, set the options for highlighting it in string
" and heredocs to false.
" heredocs and nowdocs to false.
let php_html_in_strings=0
let php_html_in_heredoc=0
let php_html_in_nowdoc=0
endif
if (exists("php_html_in_strings") && php_html_in_strings)
@@ -132,7 +139,11 @@ if !exists("php_sql_heredoc")
let php_sql_heredoc=1
endif
if ((exists("php_sql_query") && php_sql_query) || (exists("php_sql_heredoc") && php_sql_heredoc))
if !exists("php_sql_nowdoc")
let php_sql_nowdoc=1
endif
if ((exists("php_sql_query") && php_sql_query) || (exists("php_sql_heredoc") && php_sql_heredoc) || (exists("php_sql_nowdoc") && php_sql_nowdoc))
" Use MySQL as the default SQL syntax file.
" See https://github.com/StanAngeloff/php.vim/pull/1
if !exists('b:sql_type_override') && !exists('g:sql_type_default')
@@ -553,12 +564,18 @@ syn region phpIdentifierArray matchgroup=phpParent start="\[" end="]" contain
syn keyword phpBoolean true false contained
" Number
syn match phpNumber "-\=\<\d\+\>" contained display
syn match phpNumber "\<\d\+\>" contained display
syn match phpNumber "-\d\+\>" contained display
syn match phpNumber "\<0x\x\{1,8}\>" contained display
syn match phpNumber "-0x\x\{1,8}\>" contained display
syn match phpNumber "\<0b[01]\+\>" contained display
syn match phpNumber "-0b[01]\+\>" contained display
syn match phpNumber "\<\d\+\%([eE][+-]\=\d\+\)\=\>" contained display
syn match phpNumber "-\d\+\%([eE][+-]\=\d\+\)\=\>" contained display
" Float
syn match phpNumber "\(-\=\<\d+\|-\=\)\.\d\+\>" contained display
syn match phpNumber "\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>" contained display
syn match phpNumber "-\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>" contained display
" SpecialChar
syn match phpSpecialChar "\\[fnrtv\\]" contained display
@@ -648,6 +665,14 @@ endif
" NowDoc
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\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
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
endif
syn case ignore
" Parent

View File

@@ -20,10 +20,10 @@ let b:current_syntax = 'plantuml'
syntax sync minlines=100
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(define|definelong|else|enddefinelong|endif|ifdef|ifndef|include|pragma|undef\)\s*.*/ contains=plantumlDir
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(define|definelong|else|enddefinelong|endif|if|ifdef|ifndef|include|pragma|undef\)\s*.*/ contains=plantumlDir
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
syntax keyword plantumlTypeKeyword abstract actor agent artifact boundary card cloud component control
syntax keyword plantumlTypeKeyword abstract actor agent archimate artifact boundary card cloud component control
syntax keyword plantumlTypeKeyword database entity enum file folder frame node object package participant
syntax keyword plantumlTypeKeyword queue rectangle stack state storage usecase
@@ -39,26 +39,27 @@ syntax keyword plantumlKeyword then detach sprite
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/
syntax keyword plantumlColor AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond
syntax keyword plantumlColor Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral
syntax keyword plantumlColor CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray
syntax keyword plantumlColor DarkGreen DarkGrey DarkKhaki DarkMagenta DarkOliveGreen DarkOrchid DarkRed
syntax keyword plantumlColor DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkSlateGrey DarkTurquoise
syntax keyword plantumlColor DarkViolet Darkorange DeepPink DeepSkyBlue DimGray DimGrey DodgerBlue FireBrick
syntax keyword plantumlColor FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod Gray Green
syntax keyword plantumlColor GreenYellow Grey HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender
syntax keyword plantumlColor LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan
syntax keyword plantumlColor LightGoldenRodYellow LightGray LightGreen LightGrey LightPink LightSalmon
syntax keyword plantumlColor LightSeaGreen LightSkyBlue LightSlateGray LightSlateGrey LightSteelBlue
syntax keyword plantumlColor LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine MediumBlue
syntax keyword plantumlColor MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen
syntax keyword plantumlColor MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin
syntax keyword plantumlColor NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod
syntax keyword plantumlColor PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum
syntax keyword plantumlColor PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen
syntax keyword plantumlColor SeaShell Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen
syntax keyword plantumlColor SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow
syntax keyword plantumlColor YellowGreen
syntax keyword plantumlColor APPLICATION AliceBlue AntiqueWhite Aqua Aquamarine Azure BUSINESS Beige Bisque
syntax keyword plantumlColor Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse
syntax keyword plantumlColor Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan
syntax keyword plantumlColor DarkGoldenRod DarkGray DarkGreen DarkGrey DarkKhaki DarkMagenta DarkOliveGreen
syntax keyword plantumlColor DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray
syntax keyword plantumlColor DarkSlateGrey DarkTurquoise DarkViolet Darkorange DeepPink DeepSkyBlue DimGray
syntax keyword plantumlColor DimGrey DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro
syntax keyword plantumlColor GhostWhite Gold GoldenRod Gray Green GreenYellow Grey HoneyDew HotPink
syntax keyword plantumlColor IMPLEMENTATION IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen
syntax keyword plantumlColor LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow LightGray
syntax keyword plantumlColor LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue
syntax keyword plantumlColor LightSlateGray LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen
syntax keyword plantumlColor MOTIVATION Magenta Maroon MediumAquaMarine MediumBlue MediumOrchid MediumPurple
syntax keyword plantumlColor MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed
syntax keyword plantumlColor MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy OldLace Olive
syntax keyword plantumlColor OliveDrab Orange OrangeRed Orchid PHYSICAL PaleGoldenRod PaleGreen PaleTurquoise
syntax keyword plantumlColor PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red
syntax keyword plantumlColor RosyBrown RoyalBlue STRATEGY SaddleBrown Salmon SandyBrown SeaGreen SeaShell
syntax keyword plantumlColor Sienna Silver SkyBlue SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue
syntax keyword plantumlColor TECHNOLOGY Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke
syntax keyword plantumlColor Yellow YellowGreen
" Arrows - Differentiate between horizontal and vertical arrows
syntax match plantumlHorizontalArrow /\%([-\.]\%(|>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\|\%(<|\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[\.-]\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
@@ -67,8 +68,12 @@ syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained
" Note
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart
syntax match plantumlNoteMultiLineStart /\%(^\s*[rh]\?note\)\@<=\s\%([^:]\+$\)/ contained contains=plantumlKeyword,plantumlColor,plantumlString
" Class
syntax region plantumlClass start=/\%(class\s[^{]\+\)\@<=\zs{/ end=/^\s*}/ contains=plantumlClassArrows,
syntax region plantumlClass start=/\%(\%(class\|interface\|object\)\s[^{]\+\)\@<=\zs{/ end=/^\s*}/ contains=plantumlClassArrows,
\ plantumlClassKeyword,
\ @plantumlClassOp,
\ plantumlClassSeparator,
@@ -101,6 +106,7 @@ syntax match plantumlStereotype /<<.\{-1,}>>/ contains=plantumlSpecialString
" Activity diagram
syntax match plantumlActivityThing /([^)]*)/
syntax match plantumlActivitySynch /===[^=]\+===/
syntax match plantumlActivityLabel /\%(^\%(#\S\+\)\?\)\@<=:\_[^;|<>/\]}]\+[;|<>/\]}]$/ contains=plantumlSpecialString
" Sequence diagram
syntax match plantumlSequenceDivider /^\s*==[^=]\+==\s*$/
@@ -235,8 +241,8 @@ syntax keyword plantumlSkinparamKeyword SwimlaneBorderColor SwimlaneBorderThickn
syntax keyword plantumlSkinparamKeyword SwimlaneTitleFontName SwimlaneTitleFontSize SwimlaneTitleFontStyle TabSize
syntax keyword plantumlSkinparamKeyword TitleBackgroundColor TitleBorderColor TitleBorderRoundCorner
syntax keyword plantumlSkinparamKeyword TitleBorderThickness TitleFontColor TitleFontName TitleFontSize TitleFontStyle
syntax keyword plantumlSkinparamKeyword UsecaseBackgroundColor UsecaseBorderColor UsecaseFontColor UsecaseFontName
syntax keyword plantumlSkinparamKeyword UsecaseFontSize UsecaseFontStyle UsecaseStereotypeFontColor
syntax keyword plantumlSkinparamKeyword UsecaseBackgroundColor UsecaseBorderColor UsecaseBorderThickness UsecaseFontColor
syntax keyword plantumlSkinparamKeyword UsecaseFontName UsecaseFontSize UsecaseFontStyle UsecaseStereotypeFontColor
syntax keyword plantumlSkinparamKeyword UsecaseStereotypeFontName UsecaseStereotypeFontSize UsecaseStereotypeFontStyle
" Not in 'java - jar plantuml.jar - language' output
syntax keyword plantumlSkinparamKeyword activityArrowColor activityArrowFontColor activityArrowFontName
@@ -300,7 +306,9 @@ highlight default link plantumlMultilineComment Comment
highlight default link plantumlColonLine Comment
highlight default link plantumlActivityThing Type
highlight default link plantumlActivitySynch Type
highlight default link plantumlActivityLabel String
highlight default link plantumlSkinparamKeyword Identifier
highlight default link plantumlNoteMultiLine String
highlight default link plantumlUsecaseActor String
highlight default link plantumlStereotype Type

View File

@@ -65,18 +65,29 @@ syn match purescriptImportParams "hiding" contained
\ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite
" Function declaration
syn region purescriptFunctionDecl excludenl start="^\z(\s*\)\(foreign\s\+import\_s\+\)\?[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)" end="^\z1\=\S"me=s-1,re=s-1 keepend
syn region purescriptFunctionDecl
\ excludenl start="^\z(\s*\)\(\(foreign\s\+import\)\_s\+\)\?[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)"
\ end="^\z1\=\S"me=s-1,re=s-1 keepend
\ contains=purescriptFunctionDeclStart,purescriptForall,purescriptOperatorType,purescriptOperatorTypeSig,purescriptType,purescriptTypeVar,purescriptDelimiter,@purescriptComment
syn match purescriptFunctionDeclStart "^\s*\(foreign\s\+import\_s\+\)\?\([_a-z]\(\w\|\'\)*\)\_s\{-}\(::\|∷\)" contained
\ contains=purescriptImportKeyword,purescriptFunction,purescriptOperatorType
syn region purescriptFunctionDecl
\ excludenl start="^\z(\s*\)where\z(\s\+\)[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)"
\ end="^\(\z1\s\{5}\z2\)\=\S"me=s-1,re=s-1 keepend
\ contains=purescriptFunctionDeclStart,purescriptForall,purescriptOperatorType,purescriptOperatorTypeSig,purescriptType,purescriptTypeVar,purescriptDelimiter,@purescriptComment
syn region purescriptFunctionDecl
\ excludenl start="^\z(\s*\)let\z(\s\+\)[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)"
\ end="^\(\z1\s\{3}\z2\)\=\S"me=s-1,re=s-1 keepend
\ contains=purescriptFunctionDeclStart,purescriptForall,purescriptOperatorType,purescriptOperatorTypeSig,purescriptType,purescriptTypeVar,purescriptDelimiter,@purescriptComment
syn match purescriptFunctionDeclStart "^\s*\(\(foreign\s\+import\|let\|where\)\_s\+\)\?\([_a-z]\(\w\|\'\)*\)\_s\{-}\(::\|∷\)" contained
\ contains=purescriptImportKeyword,purescriptWhere,purescriptLet,purescriptFunction,purescriptOperatorType
syn keyword purescriptForall forall
syn match purescriptForall "∀"
" Keywords
syn keyword purescriptConditional if then else
syn keyword purescriptStatement do case of let in
syn keyword purescriptStatement do case of in
syn keyword purescriptLet let
syn keyword purescriptWhere where
syn match purescriptStructure "\<\(data\|newtype\|type\|class\)\>"
syn match purescriptStructure "\<\(data\|newtype\|type\|class\|kind\)\>"
\ nextgroup=purescriptType skipwhite
syn keyword purescriptStructure derive
syn keyword purescriptStructure instance
@@ -168,6 +179,7 @@ highlight def link purescriptBlockComment purescriptComment
highlight def link purescriptStructure purescriptKeyword
highlight def link purescriptKeyword Keyword
highlight def link purescriptStatement Statement
highlight def link purescriptLet Statement
highlight def link purescriptOperator Operator
highlight def link purescriptFunction Function
highlight def link purescriptType Type

View File

@@ -47,7 +47,7 @@ function! s:foldable(...) abort
return 0
endfunction " }}}
syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo
syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo,rubyModuleName,rubyClassName,rubySymbolDelimiter
" Whitespace Errors {{{1
if exists("ruby_space_errors")
@@ -124,23 +124,24 @@ syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained
syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained
syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
syn match rubySymbolDelimiter ":" contained
syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" contains=rubySymbolDelimiter
syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" contains=rubySymbolDelimiter
syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contains=rubySymbolDelimiter
syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" contains=rubySymbolDelimiter
if s:foldable(':')
syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
else
syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape
syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial
syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape
syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial
endif
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="
@@ -279,31 +280,51 @@ else
endif
" Here Document {{{1
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
syn match rubyStringDelimiter +\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+
syn match rubyStringDelimiter +\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+
syn match rubyStringDelimiter +\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+
syn match rubyStringDelimiter +\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+
if s:foldable('<<')
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\).*$\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<"\z([^"]*\)".*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<'\z([^']*\)'.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<`\z([^`]*\)`.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\>.*$\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)".*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ keepend fold
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)$+ end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs"\z([^"]*\)"$+ end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs'\z([^']*\)'$+ end=+^\z1$+ keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs`\z([^`]*\)`$+ end=+^\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs"\z([^"]*\)"$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs'\z([^']*\)'$+ end=+^\s*\zs\z1$+ keepend fold
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs`\z([^`]*\)`$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend fold
else
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\).*$\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<"\z([^"]*\)".*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<'\z([^']*\)'.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<`\z([^`]*\)`.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart keepend
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\>.*$\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)".*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ keepend
syn region rubyString start=+\%(^.*\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`.*\)\@<=\n+ matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)$+ end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs"\z([^"]*\)"$+ end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs'\z([^']*\)'$+ end=+^\z1$+ keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<\zs`\z([^`]*\)`$+ end=+^\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs"\z([^"]*\)"$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs'\z([^']*\)'$+ end=+^\s*\zs\z1$+ keepend
syn region rubyString matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\zs`\z([^`]*\)`$+ end=+^\s*\zs\z1$+ contains=@rubyStringSpecial keepend
endif
" eRuby Config {{{1
@@ -381,8 +402,6 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
if s:foldable('[')
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold
else
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop
endif
" statements without 'do'
@@ -441,10 +460,12 @@ if !exists("ruby_no_special_methods")
syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)"
syn keyword rubyEval eval class_eval instance_eval module_eval
syn keyword rubyException raise fail catch throw
" false positive with 'include?'
syn match rubyInclude "\<include\>[?!]\@!"
syn keyword rubyInclude autoload extend load prepend refine require require_relative using
syn keyword rubyInclude autoload gem load require require_relative
syn keyword rubyKeyword callcc caller lambda proc
" false positive with 'include?'
syn match rubyMacro "\<include\>[?!]\@!"
syn keyword rubyMacro extend prepend refine using
syn keyword rubyMacro alias_method define_method define_singleton_method remove_method undef_method
endif
" Comments and Documentation {{{1
@@ -465,7 +486,7 @@ syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*
" More Symbols {{{1
syn match rubySymbol "\%([{(,]\_s*\)\zs\l\w*[!?]\=::\@!"he=e-1
syn match rubySymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1
syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1
syn match rubySymbol "\%([{(,]\_s*\)\zs[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1
@@ -481,6 +502,9 @@ hi def link rubyClass rubyDefine
hi def link rubyModule rubyDefine
hi def link rubyMethodExceptional rubyDefine
hi def link rubyDefine Define
hi def link rubyAccess rubyMacro
hi def link rubyAttribute rubyMacro
hi def link rubyMacro Macro
hi def link rubyFunction Function
hi def link rubyConditional Conditional
hi def link rubyConditionalModifier rubyConditional
@@ -505,7 +529,6 @@ hi def link rubyConstant Type
hi def link rubyClassName rubyConstant
hi def link rubyModuleName rubyConstant
hi def link rubyGlobalVariable rubyIdentifier
hi def link rubyBlockParameter rubyIdentifier
hi def link rubyInstanceVariable rubyIdentifier
hi def link rubyPredefinedIdentifier rubyIdentifier
hi def link rubyPredefinedConstant rubyPredefinedIdentifier
@@ -514,8 +537,6 @@ hi def link rubySymbol Constant
hi def link rubyKeyword Keyword
hi def link rubyOperator Operator
hi def link rubyBeginEnd Statement
hi def link rubyAccess Statement
hi def link rubyAttribute Statement
hi def link rubyEval Statement
hi def link rubyPseudoVariable Constant
hi def link rubyCapitalizedMethod rubyLocalVariableOrMethod

View File

@@ -6,6 +6,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: Feb 24, 2016
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if version < 600
syntax clear
@@ -31,10 +32,13 @@ syn keyword rustKeyword continue
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
syn keyword rustKeyword in impl let
syn keyword rustKeyword macro
syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty
syn keyword rustKeyword return
syn keyword rustKeyword yield
syn keyword rustSuper super
syn keyword rustKeyword unsafe where
syn keyword rustKeyword where
syn keyword rustUnsafeKeyword unsafe
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
" FIXME: Scoped impl's name is also fallen in this category
syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipempty
@@ -68,7 +72,7 @@ syn match rustMacroRepeatCount ".\?[*+]" contained
syn match rustMacroVariable "$\w\+"
" Reserved (but not yet used) keywords {{{2
syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro
syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized abstract virtual final override
" Built-in types {{{2
syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32
@@ -139,7 +143,7 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic
syn match rustEscapeError display contained /\\./
syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/
syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/
syn match rustEscapeUnicode display contained /\\u{\%(\x_*\)\{1,6}}/
syn match rustStringContinuation display contained /\\\n\s*/
syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell
@@ -169,7 +173,7 @@ syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
" For the benefit of delimitMate
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\x\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\%(\x_*\)\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
@@ -180,7 +184,7 @@ syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII).
syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\%(\x_*\)\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid
syn match rustShebang /\%^#![^[].*/
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
@@ -248,6 +252,7 @@ hi def link rustUnion rustStructure
hi def link rustPubScopeDelim Delimiter
hi def link rustPubScopeCrate rustKeyword
hi def link rustSuper rustKeyword
hi def link rustUnsafeKeyword Exception
hi def link rustReservedKeyword Error
hi def link rustRepeat Conditional
hi def link rustConditional Conditional

View File

@@ -10,16 +10,85 @@ if exists("b:current_syntax")
endif
" basic
syn keyword solKeyword break case const continue default delete do else for if in mapping
syn keyword solKeyword new private public return returns struct switch this var while constant
syn keyword solKeyword modifier suicide enum memory
syn keyword solConstant true false wei szabo finny ether
syn keyword solBuiltinType mapping real string text msg block tx ureal address bool bytes
" contract, library and event are defined at bottom of file
syn keyword solKeyword abstract anonymous as assembly break case catch constant continue default
syn keyword solKeyword delete do else enum external final for function if import in indexed inline
syn keyword solKeyword interface internal is let match memory modifier new of payable pragma private public pure
syn keyword solKeyword relocatable return returns static storage struct switch throw try type typeof using
syn keyword solKeyword var view while
syn keyword solConstant true false wei szabo finney ether seconds minutes hours days weeks years now
syn keyword solConstant block msg now tx sha3 keccak256 sha256 ripemd160 ecerecover addmod mulmod this super selfdestruct
syn keyword solBuiltinType mapping address bool
syn keyword solBuiltinType int int8 int16 int24 int32 int40 int48 int56 int64 int72 int80 int88 int96 int104 int112 int120 int128 int136 int144 int152 int160 int168 int178 int184 int192 int200 int208 int216 int224 int232 int240 int248 int256
syn keyword solBuiltinType uint uint8 uint16 uint24 uint32 uint40 uint48 uint56 uint64 uint72 uint80 uint88 uint96 uint104 uint112 uint120 uint128 uint136 uint144 uint152 uint160 uint168 uint178 uint184 uint192 uint200 uint208 uint216 uint224 uint232 uint240 uint248 uint256
syn keyword solBuiltinType hash hash8 hash16 hash24 hash32 hash40 hash48 hash56 hash64 hash72 hash80 hash88 hash96 hash104 hash112 hash120 hash128 hash136 hash144 hash152 hash160 hash168 hash178 hash184 hash192 hash200 hash208 hash216 hash224 hash232 hash240 hash248 hash256
syn keyword solBuiltinType string1 string2 string3 string4 string5 string6 string7 string8 string9 string10 string11 string12 string13 string14 string15 string16 string17 string18 string19 string20 string21 string22 string23 string24 string25 string26 string27 string28 string29 string30 string31 string32
syn keyword solBuiltinType bytes1 bytes2 bytes3 bytes4 bytes5 bytes6 bytes7 bytes8 bytes9 bytes10 bytes11 bytes12 bytes13 bytes14 bytes15 bytes16 bytes17 bytes18 bytes19 bytes20 bytes21 bytes22 bytes23 bytes24 bytes25 bytes26 bytes27 bytes28 bytes29 bytes30 bytes31 bytes32
syn keyword solBuiltinType fixed
syn keyword solBuiltinType fixed0x8 fixed0x16 fixed0x24 fixed0x32 fixed0x40 fixed0x48 fixed0x56 fixed0x64 fixed0x72 fixed0x80 fixed0x88 fixed0x96 fixed0x104 fixed0x112 fixed0x120 fixed0x128 fixed0x136 fixed0x144 fixed0x152 fixed0x160 fixed0x168 fixed0x178 fixed0x184 fixed0x192 fixed0x200 fixed0x208 fixed0x216 fixed0x224 fixed0x232 fixed0x240 fixed0x248 fixed0x256
syn keyword solBuiltinType fixed8x8 fixed8x16 fixed8x24 fixed8x32 fixed8x40 fixed8x48 fixed8x56 fixed8x64 fixed8x72 fixed8x80 fixed8x88 fixed8x96 fixed8x104 fixed8x112 fixed8x120 fixed8x128 fixed8x136 fixed8x144 fixed8x152 fixed8x160 fixed8x168 fixed8x178 fixed8x184 fixed8x192 fixed8x200 fixed8x208 fixed8x216 fixed8x224 fixed8x232 fixed8x240 fixed8x248
syn keyword solBuiltinType fixed16x8 fixed16x16 fixed16x24 fixed16x32 fixed16x40 fixed16x48 fixed16x56 fixed16x64 fixed16x72 fixed16x80 fixed16x88 fixed16x96 fixed16x104 fixed16x112 fixed16x120 fixed16x128 fixed16x136 fixed16x144 fixed16x152 fixed16x160 fixed16x168 fixed16x178 fixed16x184 fixed16x192 fixed16x200 fixed16x208 fixed16x216 fixed16x224 fixed16x232 fixed16x240
syn keyword solBuiltinType fixed24x8 fixed24x16 fixed24x24 fixed24x32 fixed24x40 fixed24x48 fixed24x56 fixed24x64 fixed24x72 fixed24x80 fixed24x88 fixed24x96 fixed24x104 fixed24x112 fixed24x120 fixed24x128 fixed24x136 fixed24x144 fixed24x152 fixed24x160 fixed24x168 fixed24x178 fixed24x184 fixed24x192 fixed24x200 fixed24x208 fixed24x216 fixed24x224 fixed24x232
syn keyword solBuiltinType fixed32x8 fixed32x16 fixed32x24 fixed32x32 fixed32x40 fixed32x48 fixed32x56 fixed32x64 fixed32x72 fixed32x80 fixed32x88 fixed32x96 fixed32x104 fixed32x112 fixed32x120 fixed32x128 fixed32x136 fixed32x144 fixed32x152 fixed32x160 fixed32x168 fixed32x178 fixed32x184 fixed32x192 fixed32x200 fixed32x208 fixed32x216 fixed32x224
syn keyword solBuiltinType fixed40x8 fixed40x16 fixed40x24 fixed40x32 fixed40x40 fixed40x48 fixed40x56 fixed40x64 fixed40x72 fixed40x80 fixed40x88 fixed40x96 fixed40x104 fixed40x112 fixed40x120 fixed40x128 fixed40x136 fixed40x144 fixed40x152 fixed40x160 fixed40x168 fixed40x178 fixed40x184 fixed40x192 fixed40x200 fixed40x208 fixed40x216
syn keyword solBuiltinType fixed48x8 fixed48x16 fixed48x24 fixed48x32 fixed48x40 fixed48x48 fixed48x56 fixed48x64 fixed48x72 fixed48x80 fixed48x88 fixed48x96 fixed48x104 fixed48x112 fixed48x120 fixed48x128 fixed48x136 fixed48x144 fixed48x152 fixed48x160 fixed48x168 fixed48x178 fixed48x184 fixed48x192 fixed48x200 fixed48x208
syn keyword solBuiltinType fixed56x8 fixed56x16 fixed56x24 fixed56x32 fixed56x40 fixed56x48 fixed56x56 fixed56x64 fixed56x72 fixed56x80 fixed56x88 fixed56x96 fixed56x104 fixed56x112 fixed56x120 fixed56x128 fixed56x136 fixed56x144 fixed56x152 fixed56x160 fixed56x168 fixed56x178 fixed56x184 fixed56x192 fixed56x200
syn keyword solBuiltinType fixed64x8 fixed64x16 fixed64x24 fixed64x32 fixed64x40 fixed64x48 fixed64x56 fixed64x64 fixed64x72 fixed64x80 fixed64x88 fixed64x96 fixed64x104 fixed64x112 fixed64x120 fixed64x128 fixed64x136 fixed64x144 fixed64x152 fixed64x160 fixed64x168 fixed64x178 fixed64x184 fixed64x192
syn keyword solBuiltinType fixed72x8 fixed72x16 fixed72x24 fixed72x32 fixed72x40 fixed72x48 fixed72x56 fixed72x64 fixed72x72 fixed72x80 fixed72x88 fixed72x96 fixed72x104 fixed72x112 fixed72x120 fixed72x128 fixed72x136 fixed72x144 fixed72x152 fixed72x160 fixed72x168 fixed72x178 fixed72x184
syn keyword solBuiltinType fixed80x8 fixed80x16 fixed80x24 fixed80x32 fixed80x40 fixed80x48 fixed80x56 fixed80x64 fixed80x72 fixed80x80 fixed80x88 fixed80x96 fixed80x104 fixed80x112 fixed80x120 fixed80x128 fixed80x136 fixed80x144 fixed80x152 fixed80x160 fixed80x168 fixed80x178
syn keyword solBuiltinType fixed88x8 fixed88x16 fixed88x24 fixed88x32 fixed88x40 fixed88x48 fixed88x56 fixed88x64 fixed88x72 fixed88x80 fixed88x88 fixed88x96 fixed88x104 fixed88x112 fixed88x120 fixed88x128 fixed88x136 fixed88x144 fixed88x152 fixed88x160 fixed88x168
syn keyword solBuiltinType fixed96x8 fixed96x16 fixed96x24 fixed96x32 fixed96x40 fixed96x48 fixed96x56 fixed96x64 fixed96x72 fixed96x80 fixed96x88 fixed96x96 fixed96x104 fixed96x112 fixed96x120 fixed96x128 fixed96x136 fixed96x144 fixed96x152 fixed96x160
syn keyword solBuiltinType fixed104x8 fixed104x16 fixed104x24 fixed104x32 fixed104x40 fixed104x48 fixed104x56 fixed104x64 fixed104x72 fixed104x80 fixed104x88 fixed104x96 fixed104x104 fixed104x112 fixed104x120 fixed104x128 fixed104x136 fixed104x144 fixed104x152
syn keyword solBuiltinType fixed112x8 fixed112x16 fixed112x24 fixed112x32 fixed112x40 fixed112x48 fixed112x56 fixed112x64 fixed112x72 fixed112x80 fixed112x88 fixed112x96 fixed112x104 fixed112x112 fixed112x120 fixed112x128 fixed112x136 fixed112x144
syn keyword solBuiltinType fixed120x8 fixed120x16 fixed120x24 fixed120x32 fixed120x40 fixed120x48 fixed120x56 fixed120x64 fixed120x72 fixed120x80 fixed120x88 fixed120x96 fixed120x104 fixed120x112 fixed120x120 fixed120x128 fixed120x136
syn keyword solBuiltinType fixed128x8 fixed128x16 fixed128x24 fixed128x32 fixed128x40 fixed128x48 fixed128x56 fixed128x64 fixed128x72 fixed128x80 fixed128x88 fixed128x96 fixed128x104 fixed128x112 fixed128x120 fixed128x128
syn keyword solBuiltinType fixed136x8 fixed136x16 fixed136x24 fixed136x32 fixed136x40 fixed136x48 fixed136x56 fixed136x64 fixed136x72 fixed136x80 fixed136x88 fixed136x96 fixed136x104 fixed136x112 fixed136x120
syn keyword solBuiltinType fixed144x8 fixed144x16 fixed144x24 fixed144x32 fixed144x40 fixed144x48 fixed144x56 fixed144x64 fixed144x72 fixed144x80 fixed144x88 fixed144x96 fixed144x104 fixed144x112
syn keyword solBuiltinType fixed152x8 fixed152x16 fixed152x24 fixed152x32 fixed152x40 fixed152x48 fixed152x56 fixed152x64 fixed152x72 fixed152x80 fixed152x88 fixed152x96 fixed152x104
syn keyword solBuiltinType fixed160x8 fixed160x16 fixed160x24 fixed160x32 fixed160x40 fixed160x48 fixed160x56 fixed160x64 fixed160x72 fixed160x80 fixed160x88 fixed160x96
syn keyword solBuiltinType fixed168x8 fixed168x16 fixed168x24 fixed168x32 fixed168x40 fixed168x48 fixed168x56 fixed168x64 fixed168x72 fixed168x80 fixed168x88
syn keyword solBuiltinType fixed176x8 fixed176x16 fixed176x24 fixed176x32 fixed176x40 fixed176x48 fixed176x56 fixed176x64 fixed176x72 fixed176x80
syn keyword solBuiltinType fixed184x8 fixed184x16 fixed184x24 fixed184x32 fixed184x40 fixed184x48 fixed184x56 fixed184x64 fixed184x72
syn keyword solBuiltinType fixed192x8 fixed192x16 fixed192x24 fixed192x32 fixed192x40 fixed192x48 fixed192x56 fixed192x64
syn keyword solBuiltinType fixed200x8 fixed200x16 fixed200x24 fixed200x32 fixed200x40 fixed200x48 fixed200x56
syn keyword solBuiltinType fixed208x8 fixed208x16 fixed208x24 fixed208x32 fixed208x40 fixed208x48
syn keyword solBuiltinType fixed216x8 fixed216x16 fixed216x24 fixed216x32 fixed216x40
syn keyword solBuiltinType fixed224x8 fixed224x16 fixed224x24 fixed224x32
syn keyword solBuiltinType fixed232x8 fixed232x16 fixed232x24
syn keyword solBuiltinType fixed240x8 fixed240x16
syn keyword solBuiltinType fixed248x8
syn keyword solBuiltinType ufixed
syn keyword solBuiltinType ufixed0x8 ufixed0x16 ufixed0x24 ufixed0x32 ufixed0x40 ufixed0x48 ufixed0x56 ufixed0x64 ufixed0x72 ufixed0x80 ufixed0x88 ufixed0x96 ufixed0x104 ufixed0x112 ufixed0x120 ufixed0x128 ufixed0x136 ufixed0x144 ufixed0x152 ufixed0x160 ufixed0x168 ufixed0x178 ufixed0x184 ufixed0x192 ufixed0x200 ufixed0x208 ufixed0x216 ufixed0x224 ufixed0x232 ufixed0x240 ufixed0x248 ufixed0x256
syn keyword solBuiltinType ufixed8x8 ufixed8x16 ufixed8x24 ufixed8x32 ufixed8x40 ufixed8x48 ufixed8x56 ufixed8x64 ufixed8x72 ufixed8x80 ufixed8x88 ufixed8x96 ufixed8x104 ufixed8x112 ufixed8x120 ufixed8x128 ufixed8x136 ufixed8x144 ufixed8x152 ufixed8x160 ufixed8x168 ufixed8x178 ufixed8x184 ufixed8x192 ufixed8x200 ufixed8x208 ufixed8x216 ufixed8x224 ufixed8x232 ufixed8x240 ufixed8x248
syn keyword solBuiltinType ufixed16x8 ufixed16x16 ufixed16x24 ufixed16x32 ufixed16x40 ufixed16x48 ufixed16x56 ufixed16x64 ufixed16x72 ufixed16x80 ufixed16x88 ufixed16x96 ufixed16x104 ufixed16x112 ufixed16x120 ufixed16x128 ufixed16x136 ufixed16x144 ufixed16x152 ufixed16x160 ufixed16x168 ufixed16x178 ufixed16x184 ufixed16x192 ufixed16x200 ufixed16x208 ufixed16x216 ufixed16x224 ufixed16x232 ufixed16x240
syn keyword solBuiltinType ufixed24x8 ufixed24x16 ufixed24x24 ufixed24x32 ufixed24x40 ufixed24x48 ufixed24x56 ufixed24x64 ufixed24x72 ufixed24x80 ufixed24x88 ufixed24x96 ufixed24x104 ufixed24x112 ufixed24x120 ufixed24x128 ufixed24x136 ufixed24x144 ufixed24x152 ufixed24x160 ufixed24x168 ufixed24x178 ufixed24x184 ufixed24x192 ufixed24x200 ufixed24x208 ufixed24x216 ufixed24x224 ufixed24x232
syn keyword solBuiltinType ufixed32x8 ufixed32x16 ufixed32x24 ufixed32x32 ufixed32x40 ufixed32x48 ufixed32x56 ufixed32x64 ufixed32x72 ufixed32x80 ufixed32x88 ufixed32x96 ufixed32x104 ufixed32x112 ufixed32x120 ufixed32x128 ufixed32x136 ufixed32x144 ufixed32x152 ufixed32x160 ufixed32x168 ufixed32x178 ufixed32x184 ufixed32x192 ufixed32x200 ufixed32x208 ufixed32x216 ufixed32x224
syn keyword solBuiltinType ufixed40x8 ufixed40x16 ufixed40x24 ufixed40x32 ufixed40x40 ufixed40x48 ufixed40x56 ufixed40x64 ufixed40x72 ufixed40x80 ufixed40x88 ufixed40x96 ufixed40x104 ufixed40x112 ufixed40x120 ufixed40x128 ufixed40x136 ufixed40x144 ufixed40x152 ufixed40x160 ufixed40x168 ufixed40x178 ufixed40x184 ufixed40x192 ufixed40x200 ufixed40x208 ufixed40x216
syn keyword solBuiltinType ufixed48x8 ufixed48x16 ufixed48x24 ufixed48x32 ufixed48x40 ufixed48x48 ufixed48x56 ufixed48x64 ufixed48x72 ufixed48x80 ufixed48x88 ufixed48x96 ufixed48x104 ufixed48x112 ufixed48x120 ufixed48x128 ufixed48x136 ufixed48x144 ufixed48x152 ufixed48x160 ufixed48x168 ufixed48x178 ufixed48x184 ufixed48x192 ufixed48x200 ufixed48x208
syn keyword solBuiltinType ufixed56x8 ufixed56x16 ufixed56x24 ufixed56x32 ufixed56x40 ufixed56x48 ufixed56x56 ufixed56x64 ufixed56x72 ufixed56x80 ufixed56x88 ufixed56x96 ufixed56x104 ufixed56x112 ufixed56x120 ufixed56x128 ufixed56x136 ufixed56x144 ufixed56x152 ufixed56x160 ufixed56x168 ufixed56x178 ufixed56x184 ufixed56x192 ufixed56x200
syn keyword solBuiltinType ufixed64x8 ufixed64x16 ufixed64x24 ufixed64x32 ufixed64x40 ufixed64x48 ufixed64x56 ufixed64x64 ufixed64x72 ufixed64x80 ufixed64x88 ufixed64x96 ufixed64x104 ufixed64x112 ufixed64x120 ufixed64x128 ufixed64x136 ufixed64x144 ufixed64x152 ufixed64x160 ufixed64x168 ufixed64x178 ufixed64x184 ufixed64x192
syn keyword solBuiltinType ufixed72x8 ufixed72x16 ufixed72x24 ufixed72x32 ufixed72x40 ufixed72x48 ufixed72x56 ufixed72x64 ufixed72x72 ufixed72x80 ufixed72x88 ufixed72x96 ufixed72x104 ufixed72x112 ufixed72x120 ufixed72x128 ufixed72x136 ufixed72x144 ufixed72x152 ufixed72x160 ufixed72x168 ufixed72x178 ufixed72x184
syn keyword solBuiltinType ufixed80x8 ufixed80x16 ufixed80x24 ufixed80x32 ufixed80x40 ufixed80x48 ufixed80x56 ufixed80x64 ufixed80x72 ufixed80x80 ufixed80x88 ufixed80x96 ufixed80x104 ufixed80x112 ufixed80x120 ufixed80x128 ufixed80x136 ufixed80x144 ufixed80x152 ufixed80x160 ufixed80x168 ufixed80x178
syn keyword solBuiltinType ufixed88x8 ufixed88x16 ufixed88x24 ufixed88x32 ufixed88x40 ufixed88x48 ufixed88x56 ufixed88x64 ufixed88x72 ufixed88x80 ufixed88x88 ufixed88x96 ufixed88x104 ufixed88x112 ufixed88x120 ufixed88x128 ufixed88x136 ufixed88x144 ufixed88x152 ufixed88x160 ufixed88x168
syn keyword solBuiltinType ufixed96x8 ufixed96x16 ufixed96x24 ufixed96x32 ufixed96x40 ufixed96x48 ufixed96x56 ufixed96x64 ufixed96x72 ufixed96x80 ufixed96x88 ufixed96x96 ufixed96x104 ufixed96x112 ufixed96x120 ufixed96x128 ufixed96x136 ufixed96x144 ufixed96x152 ufixed96x160
syn keyword solBuiltinType ufixed104x8 ufixed104x16 ufixed104x24 ufixed104x32 ufixed104x40 ufixed104x48 ufixed104x56 ufixed104x64 ufixed104x72 ufixed104x80 ufixed104x88 ufixed104x96 ufixed104x104 ufixed104x112 ufixed104x120 ufixed104x128 ufixed104x136 ufixed104x144 ufixed104x152
syn keyword solBuiltinType ufixed112x8 ufixed112x16 ufixed112x24 ufixed112x32 ufixed112x40 ufixed112x48 ufixed112x56 ufixed112x64 ufixed112x72 ufixed112x80 ufixed112x88 ufixed112x96 ufixed112x104 ufixed112x112 ufixed112x120 ufixed112x128 ufixed112x136 ufixed112x144
syn keyword solBuiltinType ufixed120x8 ufixed120x16 ufixed120x24 ufixed120x32 ufixed120x40 ufixed120x48 ufixed120x56 ufixed120x64 ufixed120x72 ufixed120x80 ufixed120x88 ufixed120x96 ufixed120x104 ufixed120x112 ufixed120x120 ufixed120x128 ufixed120x136
syn keyword solBuiltinType ufixed128x8 ufixed128x16 ufixed128x24 ufixed128x32 ufixed128x40 ufixed128x48 ufixed128x56 ufixed128x64 ufixed128x72 ufixed128x80 ufixed128x88 ufixed128x96 ufixed128x104 ufixed128x112 ufixed128x120 ufixed128x128
syn keyword solBuiltinType ufixed136x8 ufixed136x16 ufixed136x24 ufixed136x32 ufixed136x40 ufixed136x48 ufixed136x56 ufixed136x64 ufixed136x72 ufixed136x80 ufixed136x88 ufixed136x96 ufixed136x104 ufixed136x112 ufixed136x120
syn keyword solBuiltinType ufixed144x8 ufixed144x16 ufixed144x24 ufixed144x32 ufixed144x40 ufixed144x48 ufixed144x56 ufixed144x64 ufixed144x72 ufixed144x80 ufixed144x88 ufixed144x96 ufixed144x104 ufixed144x112
syn keyword solBuiltinType ufixed152x8 ufixed152x16 ufixed152x24 ufixed152x32 ufixed152x40 ufixed152x48 ufixed152x56 ufixed152x64 ufixed152x72 ufixed152x80 ufixed152x88 ufixed152x96 ufixed152x104
syn keyword solBuiltinType ufixed160x8 ufixed160x16 ufixed160x24 ufixed160x32 ufixed160x40 ufixed160x48 ufixed160x56 ufixed160x64 ufixed160x72 ufixed160x80 ufixed160x88 ufixed160x96
syn keyword solBuiltinType ufixed168x8 ufixed168x16 ufixed168x24 ufixed168x32 ufixed168x40 ufixed168x48 ufixed168x56 ufixed168x64 ufixed168x72 ufixed168x80 ufixed168x88
syn keyword solBuiltinType ufixed176x8 ufixed176x16 ufixed176x24 ufixed176x32 ufixed176x40 ufixed176x48 ufixed176x56 ufixed176x64 ufixed176x72 ufixed176x80
syn keyword solBuiltinType ufixed184x8 ufixed184x16 ufixed184x24 ufixed184x32 ufixed184x40 ufixed184x48 ufixed184x56 ufixed184x64 ufixed184x72
syn keyword solBuiltinType ufixed192x8 ufixed192x16 ufixed192x24 ufixed192x32 ufixed192x40 ufixed192x48 ufixed192x56 ufixed192x64
syn keyword solBuiltinType ufixed200x8 ufixed200x16 ufixed200x24 ufixed200x32 ufixed200x40 ufixed200x48 ufixed200x56
syn keyword solBuiltinType ufixed208x8 ufixed208x16 ufixed208x24 ufixed208x32 ufixed208x40 ufixed208x48
syn keyword solBuiltinType ufixed216x8 ufixed216x16 ufixed216x24 ufixed216x32 ufixed216x40
syn keyword solBuiltinType ufixed224x8 ufixed224x16 ufixed224x24 ufixed224x32
syn keyword solBuiltinType ufixed232x8 ufixed232x16 ufixed232x24
syn keyword solBuiltinType ufixed240x8 ufixed240x16
syn keyword solBuiltinType ufixed248x8
syn keyword solBuiltinType string string1 string2 string3 string4 string5 string6 string7 string8 string9 string10 string11 string12 string13 string14 string15 string16 string17 string18 string19 string20 string21 string22 string23 string24 string25 string26 string27 string28 string29 string30 string31 string32
syn keyword solBuiltinType byte bytes bytes1 bytes2 bytes3 bytes4 bytes5 bytes6 bytes7 bytes8 bytes9 bytes10 bytes11 bytes12 bytes13 bytes14 bytes15 bytes16 bytes17 bytes18 bytes19 bytes20 bytes21 bytes22 bytes23 bytes24 bytes25 bytes26 bytes27 bytes28 bytes29 bytes30 bytes31 bytes32
hi def link solKeyword Keyword
hi def link solConstant Constant
@@ -39,16 +108,18 @@ hi def link solString String
" Function
syn match solFunction /\<function\>/ nextgroup=solFuncName,solFuncArgs skipwhite
syn match solFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solFuncArgs skipwhite
syn region solFuncArgs contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas,solBuiltinType nextgroup=solFuncBlock,solFuncModifier keepend skipwhite skipempty
syn match solFuncModifier contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ skipwhite
syn region solFuncArgs contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas,solBuiltinType nextgroup=solModifierName,solFuncReturns keepend skipwhite skipempty
syn match solModifierName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solModifierArgs,solModifierName skipwhite
syn region solModifierArgs contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas nextgroup=solModifierName,solFuncReturns skipwhite
syn region solFuncReturns contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas,solBuiltinType
syn match solFuncArgCommas contained ','
hi def link solFunction Type
hi def link solFuncName Function
hi def link solFuncModifier Function
hi def link solModifierName Function
" Contract
syn match solContract /\<contract\>/ nextgroup=solContractName skipwhite
syn match solContract /\<\%(contract\|library\|interface\)\>/ nextgroup=solContractName skipwhite
syn match solContractName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solContractParent skipwhite
syn region solContractParent contained start='is' end='{' contains=solContractName,solContractNoise,solContractCommas skipwhite skipempty
syn match solContractNoise contained 'is' containedin=solContractParent

View File

@@ -86,14 +86,13 @@ syntax match swiftOperator "\v\+"
syntax match swiftOperator "\v\="
syntax match swiftOperator "\v\|"
syntax match swiftOperator "\v\/"
syntax match swiftOperator "\v\."
syntax match swiftOperator "\v\<"
syntax match swiftOperator "\v\>"
syntax match swiftOperator "\v\?\?"
" Methods/Functions/Properties
syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@="
syntax match swiftProperty "\(\.\)\@<=\<\w\+\>(\@!"
syntax match swiftMethod "\.\@<=\<\D\w*\>\ze("
syntax match swiftProperty "\.\@<=\<\D\w*\>(\@!"
" Swift closure arguments
syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?"
@@ -188,6 +187,7 @@ syntax keyword swiftAttributes
\ @available
\ @convention
\ @discardableResult
\ @escaping
\ @exported
\ @IBAction
\ @IBDesignable
@@ -222,7 +222,7 @@ syntax keyword swiftDebugIdentifier
syntax keyword swiftLineDirective #setline
syntax region swiftTypeWrapper start="\v:\s*" 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 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

View File

@@ -24,6 +24,7 @@ syn keyword terraDataTypeBI
\ aws_alb
\ aws_alb_listener
\ aws_ami
\ aws_ami_ids
\ aws_autoscaling_groups
\ aws_availability_zone
\ aws_availability_zones
@@ -32,12 +33,17 @@ syn keyword terraDataTypeBI
\ aws_canonical_user_id
\ aws_cloudformation_stack
\ aws_db_instance
\ aws_db_snapshot
\ aws_ebs_snapshot
\ aws_ebs_snapshot_ids
\ aws_ebs_volume
\ aws_ecs_cluster
\ aws_ecs_container_definition
\ aws_ecs_task_definition
\ aws_efs_file_system
\ aws_eip
\ aws_elastic_beanstalk_solution_stack
\ aws_elasticache_cluster
\ aws_elb_hosted_zone_id
\ aws_elb_service_account
\ aws_iam_account_alias
@@ -46,6 +52,9 @@ syn keyword terraDataTypeBI
\ aws_iam_server_certificate
\ aws_instance
\ aws_ip_ranges
\ aws_kinesis_stream
\ aws_kms_alias
\ aws_kms_ciphertext
\ aws_kms_secret
\ aws_partition
\ aws_prefix_list
@@ -56,6 +65,7 @@ syn keyword terraDataTypeBI
\ aws_s3_bucket_object
\ aws_security_group
\ aws_sns_topic
\ aws_ssm_parameter
\ aws_subnet
\ aws_subnet_ids
\ aws_vpc
@@ -64,6 +74,7 @@ syn keyword terraDataTypeBI
\ aws_vpc_peering_connection
\ aws_vpn_gateway
\ azurerm_client_config
\ azurerm_public_ip
\ circonus_account
\ circonus_collector
\ consul_agent_self
@@ -71,20 +82,30 @@ syn keyword terraDataTypeBI
\ consul_catalog_service
\ consul_catalog_services
\ consul_keys
\ digitalocean_image
\ dns_a_record_set
\ dns_cname_record_set
\ dns_txt_record_set
\ docker_registry_image
\ external
\ fastly_ip_ranges
\ github_team
\ github_user
\ google_compute_network
\ google_compute_subnetwork
\ google_compute_zones
\ google_container_engine_versions
\ google_iam_policy
\ google_storage_object_signed_url
\ http
\ newrelic_application
\ ns1_datasource
\ null_data_source
\ openstack_images_image_v2
\ openstack_networking_network_v2
\ opsgenie_user
\ ovh_publiccloud_region
\ ovh_publiccloud_regions
\ pagerduty_escalation_policy
\ pagerduty_schedule
\ pagerduty_user
@@ -106,6 +127,11 @@ syn keyword terraResourceTypeBI
\ alicloud_disk_attachment
\ alicloud_eip
\ alicloud_eip_association
\ alicloud_ess_scaling_configuration
\ alicloud_ess_scaling_group
\ alicloud_ess_scaling_rule
\ alicloud_ess_schedule
\ alicloud_forward_entry
\ alicloud_instance
\ alicloud_nat_gateway
\ alicloud_route_entry
@@ -113,6 +139,7 @@ syn keyword terraResourceTypeBI
\ alicloud_security_group_rule
\ alicloud_slb
\ alicloud_slb_attachment
\ alicloud_snat_entry
\ alicloud_subnet
\ alicloud_vpc
\ alicloud_vswitch
@@ -174,6 +201,7 @@ syn keyword terraResourceTypeBI
\ aws_codedeploy_deployment_config
\ aws_codedeploy_deployment_group
\ aws_codepipeline
\ aws_cognito_identity_pool
\ aws_config_config_rule
\ aws_config_configuration_recorder
\ aws_config_configuration_recorder_status
@@ -184,10 +212,15 @@ syn keyword terraResourceTypeBI
\ aws_db_option_group
\ aws_db_parameter_group
\ aws_db_security_group
\ aws_db_snapshot
\ aws_db_subnet_group
\ aws_default_network_acl
\ aws_default_route_table
\ aws_default_security_group
\ aws_default_subnet
\ aws_default_vpc
\ aws_default_vpc_dhcp_options
\ aws_devicefarm_project
\ aws_directory_service_directory
\ aws_dms_certificate
\ aws_dms_endpoint
@@ -224,6 +257,7 @@ syn keyword terraResourceTypeBI
\ aws_elb_attachment
\ aws_emr_cluster
\ aws_emr_instance_group
\ aws_emr_security_configuration
\ aws_flow_log
\ aws_glacier_vault
\ aws_iam_access_key
@@ -277,6 +311,7 @@ syn keyword terraResourceTypeBI
\ aws_network_acl
\ aws_network_acl_rule
\ aws_network_interface
\ aws_network_interface_attachment
\ aws_opsworks_application
\ aws_opsworks_custom_layer
\ aws_opsworks_ganglia_layer
@@ -338,6 +373,12 @@ syn keyword terraResourceTypeBI
\ aws_ssm_activation
\ aws_ssm_association
\ aws_ssm_document
\ aws_ssm_maintenance_window
\ aws_ssm_maintenance_window_target
\ aws_ssm_maintenance_window_task
\ aws_ssm_parameter
\ aws_ssm_patch_baseline
\ aws_ssm_patch_group
\ aws_subnet
\ aws_volume_attachment
\ aws_vpc
@@ -358,6 +399,8 @@ syn keyword terraResourceTypeBI
\ aws_waf_sql_injection_match_set
\ aws_waf_web_acl
\ aws_waf_xss_match_set
\ aws_wafregional_byte_match_set
\ aws_wafregional_ipset
\ azure_affinity_group
\ azure_data_disk
\ azure_dns_server
@@ -391,6 +434,7 @@ syn keyword terraResourceTypeBI
\ azurerm_eventhub_authorization_rule
\ azurerm_eventhub_consumer_group
\ azurerm_eventhub_namespace
\ azurerm_express_route_circuit
\ azurerm_key_vault
\ azurerm_lb
\ azurerm_lb_backend_address_pool
@@ -413,6 +457,7 @@ syn keyword terraResourceTypeBI
\ azurerm_servicebus_subscription
\ azurerm_servicebus_topic
\ azurerm_sql_database
\ azurerm_sql_elasticpool
\ azurerm_sql_firewall_rule
\ azurerm_sql_server
\ azurerm_storage_account
@@ -493,6 +538,7 @@ syn keyword terraResourceTypeBI
\ datadog_monitor
\ datadog_timeboard
\ datadog_user
\ digitalocean_certificate
\ digitalocean_domain
\ digitalocean_droplet
\ digitalocean_floating_ip
@@ -513,6 +559,7 @@ syn keyword terraResourceTypeBI
\ docker_volume
\ dyn_record
\ fastly_service_v1
\ github_branch_protection
\ github_issue_label
\ github_membership
\ github_organization_webhook
@@ -522,8 +569,15 @@ syn keyword terraResourceTypeBI
\ github_team
\ github_team_membership
\ github_team_repository
\ gitlab_deploy_key
\ gitlab_group
\ gitlab_project
\ gitlab_project_hook
\ google_bigquery_dataset
\ google_bigquery_table
\ google_compute_address
\ google_compute_autoscaler
\ google_compute_backend_bucket
\ google_compute_backend_service
\ google_compute_disk
\ google_compute_firewall
@@ -542,6 +596,10 @@ syn keyword terraResourceTypeBI
\ google_compute_project_metadata
\ google_compute_region_backend_service
\ google_compute_route
\ google_compute_router
\ google_compute_router_interface
\ google_compute_router_peer
\ google_compute_snapshot
\ google_compute_ssl_certificate
\ google_compute_subnetwork
\ google_compute_target_http_proxy
@@ -569,9 +627,13 @@ syn keyword terraResourceTypeBI
\ google_storage_object_acl
\ heroku_addon
\ heroku_app
\ heroku_app_feature
\ heroku_cert
\ heroku_domain
\ heroku_drain
\ heroku_pipeline
\ heroku_pipeline_coupling
\ heroku_space
\ icinga2_checkcommand
\ icinga2_host
\ icinga2_hostgroup
@@ -589,14 +651,20 @@ syn keyword terraResourceTypeBI
\ influxdb_database
\ influxdb_user
\ kubernetes_config_map
\ kubernetes_horizontal_pod_autoscaler
\ kubernetes_limit_range
\ kubernetes_namespace
\ kubernetes_persistent_volume
\ kubernetes_persistent_volume_claim
\ kubernetes_resource_quota
\ kubernetes_secret
\ kubernetes_service
\ librato_alert
\ librato_metric
\ librato_service
\ librato_space
\ librato_space_chart
\ local_file
\ logentries_log
\ logentries_logset
\ mailgun_domain
@@ -609,6 +677,14 @@ syn keyword terraResourceTypeBI
\ newrelic_alert_policy_channel
\ nomad_job
\ null_resource
\ oneandone_firewall_policy
\ oneandone_loadbalancer
\ oneandone_monitoring_policy
\ oneandone_private_network
\ oneandone_public_ip
\ oneandone_server
\ oneandone_shared_storage
\ oneandone_vpn
\ openstack_blockstorage_volume_attach_v2
\ openstack_blockstorage_volume_v1
\ openstack_blockstorage_volume_v2
@@ -619,6 +695,8 @@ syn keyword terraResourceTypeBI
\ openstack_compute_secgroup_v2
\ openstack_compute_servergroup_v2
\ openstack_compute_volume_attach_v2
\ openstack_dns_recordset_v2
\ openstack_dns_zone_v2
\ openstack_fw_firewall_v1
\ openstack_fw_policy_v1
\ openstack_fw_rule_v1
@@ -644,6 +722,10 @@ syn keyword terraResourceTypeBI
\ openstack_objectstorage_container_v1
\ opsgenie_team
\ opsgenie_user
\ ovh_publiccloud_private_network
\ ovh_publiccloud_private_network_subnet
\ ovh_publiccloud_user
\ ovh_vrack_publiccloud_attachment
\ packet_device
\ packet_project
\ packet_ssh_key
@@ -701,6 +783,7 @@ syn keyword terraResourceTypeBI
\ spotinst_healthcheck
\ spotinst_subscription
\ statuscake_test
\ template_dir
\ tls_cert_request
\ tls_locally_signed_cert
\ tls_private_key
@@ -713,9 +796,11 @@ syn keyword terraResourceTypeBI
\ ultradns_dirpool
\ ultradns_probe_http
\ ultradns_probe_ping
\ ultradns_rdpool
\ ultradns_record
\ ultradns_tcpool
\ vcd_dnat
\ vcd_edgegateway_vpn
\ vcd_firewall_rules
\ vcd_network
\ vcd_snat
@@ -764,9 +849,13 @@ syn match terraBraces "[{}\[\]]"
""" skip \" in strings.
""" we may also want to pass \\" into a function to escape quotes.
syn region terraValueString start=/"/ skip=/\\\+"/ end=/"/ contains=terraStringInterp
syn region terraStringInterp matchgroup=terraBrackets start=/\${/ end=/}/ contains=terraValueFunction contained
syn region terraStringInterp matchgroup=terraBrackets start=/\${/ end=/}/ contains=terraValueFunction,terraValueVarSubscript,terraStringInterp contained
syn region terraHereDocText start=/<<\z([A-Z]\+\)/ end=/^\z1/ contains=terraStringInterp
"" TODO match keywords here, not a-z+
syn region terraValueFunction matchgroup=terraBrackets start=/[0-9a-z]\+(/ end=/)/ contains=terraValueString,terraValueFunction contained
syn region terraValueFunction matchgroup=terraBrackets start=/[a-z]\+(/ end=/)/ contains=terraValueString,terraValueFunction,terraValueVarSubscript contained
" User variables or module outputs can be lists or maps, and accessed with
" var.map["foo"]
syn region terraValueVarSubscript start=/\(\<var\|\<module\)\.[a-z0-9_-]\+\[/ end=/\]/ contains=terraValueString,terraValueFunction,terraValueVarSubscript contained
hi def link terraComment Comment
hi def link terraTodo Todo
@@ -788,11 +877,13 @@ hi def link terraValueBool Boolean
hi def link terraValueDec Number
hi def link terraValueHexaDec Number
hi def link terraValueString String
hi def link terraHereDocText String
hi def link terraProvisioner Structure
hi def link terraProvisionerName String
hi def link terraModule Structure
hi def link terraModuleName String
hi def link terraValueFunction Identifier
hi def link terraValueVarSubscript Identifier
let b:current_syntax = "terraform"

View File

@@ -53,6 +53,8 @@ hi def link tomlTodo Todo
syn match tomlComment /#.*/ contains=@Spell,tomlTodo
hi def link tomlComment Comment
syn sync minlines=500
let b:current_syntax = "toml"
endif

View File

@@ -58,7 +58,7 @@ syn match valaOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\|?\)=\
" Delimiters
syn match valaDelimiter display "(\|)\|\[\|\]\|,\|;\|:\|{\|}\|\k\@<!_\k\@!\|[[:punct:]]\@<!@[[:punct:]]\@!"
" Enum Fields
syn match valaEnumField "\.\([A-Z_]\)\+\([A-Z_]\)\+"hs=s+1 " ensure there are at least 2 CAPS
syn match valaEnumField "\.\([A-Z_]\)\+\([A-Z_0-9]\)\+"hs=s+1 " ensure there are at least 2 CAPS or 1 CAP and 1 number
" Comments
syn cluster valaCommentGroup contains=valaTodo
@@ -160,7 +160,6 @@ endif
exec "syn sync ccomment valaComment minlines=" . b:vala_minlines
" code folding
set foldmethod=syntax
syn region valaBlock start="{" end="}" transparent fold
" The default highlighting.

437
syntax/vifm.vim Normal file
View File

@@ -0,0 +1,437 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm syntax file
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: September 18, 2017
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
if exists('b:current_syntax')
finish
endif
let b:current_syntax = 'vifm'
let s:cpo_save = &cpo
set cpo-=C
" General commands
syntax keyword vifmCommand contained alink apropos bmark bmarks bmgo change
\ chmod chown clone compare cope[n] co[py] cq[uit] d[elete] delbmarks
\ delm[arks] di[splay] dirs e[dit] el[se] empty en[dif] exi[t] file fin[d]
\ fini[sh] gr[ep] h[elp] histnext his[tory] histprev jobs locate ls lstrash
\ marks mes[sages] mkdir m[ove] noh[lsearch] on[ly] popd pushd pu[t] pw[d]
\ q[uit] redr[aw] reg[isters] rename restart restore rlink screen sh[ell]
\ siblnext siblprev sor[t] sp[lit] s[ubstitute] touch tr trashes tree sync
\ undol[ist] ve[rsion] vie[w] vifm vs[plit] winc[md] w[rite] wq x[it] y[ank]
\ nextgroup=vifmArgs
" commands that might be prepended to a command without changing everything else
syntax keyword vifmPrefixCommands contained windo winrun
" Map commands
syntax keyword vifmMap contained dm[ap] dn[oremap] du[nmap] map mm[ap]
\ mn[oremap] mu[nmap] nm[ap] nn[oremap] no[remap] nun[map] qm[ap] qn[oremap]
\ qun[map] unm[ap] vm[ap] vn[oremap] vu[nmap]
\ skipwhite nextgroup=vifmMapArgs
syntax keyword vifmCMapAbbr contained ca[bbrev] cm[ap] cnorea[bbrev] cno[remap]
\ cuna[bbrev] cu[nmap]
\ skipwhite nextgroup=vifmCMapArgs
" Other commands
syntax keyword vifmAutocmdCommand contained au[tocmd] nextgroup=vifmAutoEvent
syntax keyword vifmCdCommand contained cd
syntax keyword vifmCmdCommand contained com[mand] nextgroup=vifmCmdCommandName
syntax keyword vifmColoCommand contained colo[rscheme]
syntax keyword vifmHiCommand contained hi[ghlight]
syntax keyword vifmInvertCommand contained invert
syntax keyword vifmLetCommand contained let
syntax keyword vifmUnletCommand contained unl[et]
syntax keyword vifmSetCommand contained se[t] setl[ocal] setg[lobal]
syntax keyword vifmSoCommand contained so[urce]
syntax keyword vifmMarkCommand contained ma[rk]
syntax keyword vifmFtCommand contained filet[ype] filex[type] filev[iewer]
syntax keyword vifmExprCommand contained if ec[ho] elsei[f] exe[cute]
syntax keyword vifmNormalCommand contained norm[al]
\ nextgroup=vifmColonSubcommand
syntax match vifmPatternCommands contained /\<\(filter\(!\|\>\)\|select\(!\|\>\)\|unselect\>\)/ skipwhite
\ nextgroup=vifmPattern
" List of event names for autocommands (case insensitive)
syntax case ignore
syntax keyword vifmAutoEvent contained DirEnter nextgroup=vifmStatementC
syntax case match
" Builtin functions
syntax match vifmBuiltinFunction
\ '\(chooseopt\|expand\|executable\|filetype\|getpanetype\|has\|layoutis\|paneisat\|system\|term\)\ze('
" Operators
syntax match vifmOperator "\(==\|!=\|>=\?\|<=\?\|\.\|-\|+\|&&\|||\)" skipwhite
" Highlight groups
syntax keyword vifmHiArgs contained cterm ctermfg ctermbg
syntax case ignore
syntax keyword vifmHiGroups contained WildMenu Border Win CmdLine CurrLine
\ OtherLine Directory Link Socket Device Executable Selected BrokenLink
\ TopLine TopLineSel StatusLine JobLine SuggestBox Fifo ErrorMsg CmpMismatch
\ AuxWin
syntax keyword vifmHiStyles contained bold underline reverse inverse standout
\ none
syntax keyword vifmHiColors contained black red green yellow blue magenta cyan
\ white default lightblack lightred lightgreen lightyellow lightblue
\ lightmagenta lightcyan lightwhite Grey0 NavyBlue DarkBlue Blue3 Blue3_2
\ Blue1 DarkGreen DeepSkyBlue4 DeepSkyBlue4_2 DeepSkyBlue4_3 DodgerBlue3
\ DodgerBlue2 Green4 SpringGreen4 Turquoise4 DeepSkyBlue3 DeepSkyBlue3_2
\ DodgerBlue1 Green3 SpringGreen3 DarkCyan LightSeaGreen DeepSkyBlue2
\ DeepSkyBlue1 Green3_2 SpringGreen3_2 SpringGreen2 Cyan3 DarkTurquoise
\ Turquoise2 Green1 SpringGreen2_2 SpringGreen1 MediumSpringGreen Cyan2
\ Cyan1 DarkRed DeepPink4 Purple4 Purple4_2 Purple3 BlueViolet Orange4
\ Grey37 MediumPurple4 SlateBlue3 SlateBlue3_2 RoyalBlue1 Chartreuse4
\ DarkSeaGreen4 PaleTurquoise4 SteelBlue SteelBlue3 CornflowerBlue
\ Chartreuse3 DarkSeaGreen4_2 CadetBlue CadetBlue_2 SkyBlue3 SteelBlue1
\ Chartreuse3_2 PaleGreen3 SeaGreen3 Aquamarine3 MediumTurquoise
\ SteelBlue1_2 Chartreuse2 SeaGreen2 SeaGreen1 SeaGreen1_2 Aquamarine1
\ DarkSlateGray2 DarkRed_2 DeepPink4_2 DarkMagenta DarkMagenta_2 DarkViolet
\ Purple Orange4_2 LightPink4 Plum4 MediumPurple3 MediumPurple3_2 SlateBlue1
\ Yellow4 Wheat4 Grey53 LightSlateGrey MediumPurple LightSlateBlue Yellow4_2
\ DarkOliveGreen3 DarkSeaGreen LightSkyBlue3 LightSkyBlue3_2 SkyBlue2
\ Chartreuse2_2 DarkOliveGreen3_2 PaleGreen3_2 DarkSeaGreen3 DarkSlateGray3
\ SkyBlue1 Chartreuse1 LightGreen_2 LightGreen_3 PaleGreen1 Aquamarine1_2
\ DarkSlateGray1 Red3 DeepPink4_3 MediumVioletRed Magenta3 DarkViolet_2
\ Purple_2 DarkOrange3 IndianRed HotPink3 MediumOrchid3 MediumOrchid
\ MediumPurple2 DarkGoldenrod LightSalmon3 RosyBrown Grey63 MediumPurple2_2
\ MediumPurple1 Gold3 DarkKhaki NavajoWhite3 Grey69 LightSteelBlue3
\ LightSteelBlue Yellow3 DarkOliveGreen3_3 DarkSeaGreen3_2 DarkSeaGreen2
\ LightCyan3 LightSkyBlue1 GreenYellow DarkOliveGreen2 PaleGreen1_2
\ DarkSeaGreen2_2 DarkSeaGreen1 PaleTurquoise1 Red3_2 DeepPink3 DeepPink3_2
\ Magenta3_2 Magenta3_3 Magenta2 DarkOrange3_2 IndianRed_2 HotPink3_2
\ HotPink2 Orchid MediumOrchid1 Orange3 LightSalmon3_2 LightPink3 Pink3
\ Plum3 Violet Gold3_2 LightGoldenrod3 Tan MistyRose3 Thistle3 Plum2
\ Yellow3_2 Khaki3 LightGoldenrod2 LightYellow3 Grey84 LightSteelBlue1
\ Yellow2 DarkOliveGreen1 DarkOliveGreen1_2 DarkSeaGreen1_2 Honeydew2
\ LightCyan1 Red1 DeepPink2 DeepPink1 DeepPink1_2 Magenta2_2 Magenta1
\ OrangeRed1 IndianRed1 IndianRed1_2 HotPink HotPink_2 MediumOrchid1_2
\ DarkOrange Salmon1 LightCoral PaleVioletRed1 Orchid2 Orchid1 Orange1
\ SandyBrown LightSalmon1 LightPink1 Pink1 Plum1 Gold1 LightGoldenrod2_2
\ LightGoldenrod2_3 NavajoWhite1 MistyRose1 Thistle1 Yellow1 LightGoldenrod1
\ Khaki1 Wheat1 Cornsilk1 Grey100 Grey3 Grey7 Grey11 Grey15 Grey19 Grey23
\ Grey27 Grey30 Grey35 Grey39 Grey42 Grey46 Grey50 Grey54 Grey58 Grey62
\ Grey66 Grey70 Grey74 Grey78 Grey82 Grey85 Grey89 Grey93
syntax case match
" Options
syntax keyword vifmOption contained aproposprg autochpos caseoptions cdpath cd
\ chaselinks classify columns co confirm cf cpoptions cpo cvoptions
\ deleteprg dotdirs dotfiles dirsize fastrun fillchars fcs findprg
\ followlinks fusehome gdefault grepprg history hi hlsearch hls iec
\ ignorecase ic iooptions incsearch is laststatus lines locateprg ls
\ lsoptions lsview milleroptions millerview mintimeoutlen number nu
\ numberwidth nuw previewprg relativenumber rnu rulerformat ruf runexec
\ scrollbind scb scrolloff so sort sortgroups sortorder sortnumbers shell sh
\ shortmess shm sizefmt slowfs smartcase scs statusline stl suggestoptions
\ syscalls tabstop timefmt timeoutlen title tm trash trashdir ts tuioptions
\ to undolevels ul vicmd viewcolumns vifminfo vimhelp vixcmd wildmenu wmnu
\ wildstyle wordchars wrap wrapscan ws
" Disabled boolean options
syntax keyword vifmOption contained noautochpos nocf nochaselinks nodotfiles
\ nofastrun nofollowlinks nohlsearch nohls noiec noignorecase noic
\ noincsearch nois nolaststatus nols nolsview nomillerview nonumber nonu
\ norelativenumber nornu noscrollbind noscb norunexec nosmartcase noscs
\ nosortnumbers nosyscalls notitle notrash novimhelp nowildmenu nowmnu
\ nowrap nowrapscan nows
" Inverted boolean options
syntax keyword vifmOption contained invautochpos invcf invchaselinks invdotfiles
\ invfastrun invfollowlinks invhlsearch invhls inviec invignorecase invic
\ invincsearch invis invlaststatus invls invlsview invmillerview invnumber
\ invnu invrelativenumber invrnu invscrollbind invscb invrunexec invsmartcase
\ invscs invsortnumbers invsyscalls invtitle invtrash invvimhelp invwildmenu
\ invwmnu invwrap invwrapscan invws
" Expressions
syntax region vifmStatement start='^\(\s\|:\)*'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend
\ contains=vifmCommand,vifmCmdCommand,vifmCmdCommandSt,vifmMarkCommandSt
\,vifmFtCommandSt,vifmCMapAbbr,vifmMap,vifmMapSt,vifmCMapSt,vifmExecute
\,vifmComment,vifmInlineComment,vifmNotComment,vifmExprCommandSt,vifmNormalCommandSt
\,vifmCdCommandSt,vifmSet,vifmArgument,vifmSoCommandSt,vifmPrefixCommands
\,vifmAutocmdCommand,vifmAutoEvent,vifmPatternCommands
" Contained statement with highlighting of angle-brace notation.
syntax region vifmStatementCN start='\(\s\|:\)*'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend contained
\ contains=vifmCommand,vifmCmdCommand,vifmCmdCommandSt,vifmMarkCommandSt
\,vifmFtCommandStN,vifmCMapAbbr,vifmMap,vifmMapSt,vifmCMapSt,vifmExecute
\,vifmComment,vifmInlineComment,vifmNotComment,vifmExprCommandSt,vifmNormalCommandSt
\,vifmNotation,vifmCdCommandStN,vifmSetN,vifmArgument,vifmSoCommand
\,vifmSoCommandStN,vifmInvertCommand,vifmInvertCommandStN,vifmPrefixCommands
" Contained statement without highlighting of angle-brace notation.
syntax region vifmStatementC start='\(\s\|:\)*'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend contained
\ contains=vifmCommand,vifmCmdCommand,vifmCmdCommandSt,vifmMarkCommandSt
\,vifmFtCommandSt,vifmCMapAbbr,vifmMap,vifmMapSt,vifmCMapSt,vifmExecute
\,vifmComment,vifmInlineComment,vifmNotComment,vifmExprCommandSt,vifmNormalCommandSt
\,vifmCdCommandSt,vifmSet,vifmArgument,vifmSoCommand,vifmSoCommandSt
\,vifmInvertCommand,vifmInvertCommandSt,vifmPrefixCommands
\,vifmAutocmdCommand,vifmAutoEvent,vifmPatternCommands
syntax region vifmCmdCommandSt start='^\(\s\|:\)*com\%[mand]\>'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend
\ contains=vifmCmdCommand,vifmComment,vifmInlineComment,vifmNotComment
syntax region vifmCmdCommandName contained start='!\?\s\+[a-zA-Z]\+' end='\ze\s'
\ skip='\(\s*\\\)\|\(\s*".*$\)'
\ nextgroup=vifmCmdArgs
syntax region vifmCmdArgs start='\(\s*\n\s*\\\)\?\s*\S\+'
\ end='\s' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ contained
\ contains=vifmColonSubcommand,vifmComment
syntax region vifmColoCommandSt start='^\(\s\|:\)*colo\%[rscheme]\>' end='$'
\ keepend oneline contains=vifmColoCommand
syntax region vifmInvertCommandSt start='\(\s\|:\)*invert\>' end='$\||'
\ keepend oneline contains=vifmInvertCommand
syntax region vifmInvertCommandStN start='\(\s\|:\)*invert\>' end='$\||'
\ contained keepend oneline contains=vifmInvertCommand,vifmNotation
syntax region vifmSoCommandSt start='\(\s\|:\)*so\%[urce]\>' end='$\||'
\ keepend oneline contains=vifmSoCommand,vifmEnvVar,vifmStringInExpr
syntax region vifmSoCommandStN start='\(\s\|:\)*so\%[urce]\>' end='$\||'
\ contained keepend oneline
\ contains=vifmSoCommand,vifmEnvVar,vifmNotation,vifmStringInExpr
syntax region vifmMarkCommandSt start='^\(\s\|:\)*ma\%[rk]\>' end='$' keepend
\ oneline contains=vifmMarkCommand
syntax region vifmCdCommandSt start='\(\s\|:\)*cd\>' end='$\||' keepend oneline
\ contains=vifmCdCommand,vifmEnvVar,vifmStringInExpr
" Highlight for :cd command with highlighting of angle-brace notation.
syntax region vifmCdCommandStN start='\(\s\|:\)*cd\>' end='$\||' keepend oneline
\ contained
\ contains=vifmCdCommand,vifmEnvVar,vifmNotation,vifmStringInExpr
syntax region vifmFtCommandSt start='\(\s\|:\)*file[tvx]'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend
\ contains=vifmFtCommand,vifmComment,vifmFtBeginning
syntax region vifmFtCommandStN start='\(\s\|:\)*file[tvx]'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$\|\(<[cC][rR]>\)' keepend
\ contains=vifmComment,vifmNotation,vifmFtBeginning
syntax region vifmMapSt start='^\(\s\|:\)*\(map\|mm\%[ap]\|mn\%[oremap]\|mu\%[nmap]\|nm\%[ap]\|nn\%[oremap]\|no\%[remap]\|nun\%[map]\|qm\%[ap]\|qn\%[oremap]\|qun\%[map]\|unm\%[ap]\|vm\%[ap]\|vn\%[oremap]\|vu\%[nmap]\)'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend
\ contains=vifmMap
syntax region vifmCMapSt
\ start='^\(\s\|:\)*\(cm\%[ap]\|cno\%[remap]\|cu\%[nmap]\)'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$' keepend
\ contains=vifmCMapAbbr
syntax region vifmExprCommandSt
\ start='\<\(if\|ec\%[ho]\|elsei\%[f]\|exe\%[cute]\)\>'
\ end='$\||'
\ contains=vifmExprCommand,vifmString,vifmStringInExpr,vifmBuiltinFunction
\,vifmOperator,vifmEnvVar,vifmNumber
syntax region vifmNormalCommandSt start='\(\s\|:\)*norm\%[al]\>' end='$' keepend
\ oneline
\ contains=vifmNormalCommand,vifmComment
syntax region vifmExecute start='!' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmNotation,vifmComment
syntax region vifmMapArgs start='\ze\S\+'
\ end='\ze.' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ contained
\ nextgroup=vifmMapLhs
syntax region vifmCMapArgs start='\S\+'
\ end='\n\s*\\' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ contained
\ contains=vifmMapLhs,vifmMapCRhs
syntax region vifmMapLhs start='\S\+'
\ end='\ze\s' skip='\(\s*\\\)\|\(\s*".*$\)'
\ contained
\ contains=vifmNotation,vifmComment
\ nextgroup=vifmMapRhs
syntax region vifmMapRhs start='.'
\ end='\ze<[cC][rR]>' skip='\(\s*\\\)\|\(\s*".*$\)'
\ contained keepend
\ contains=vifmNotation,vifmComment,vifmColonSubcommandN
\ nextgroup=vifmMapRhs
syntax region vifmMapCRhs start='\s'
\ end='<[cC][rR]>' skip='\(\s*\\\)\|\(\s*".*$\)'
\ contained keepend
\ contains=vifmNotation,vifmComment,vifmSubcommandN
syntax region vifmColonSubcommand start='\s*\(\s*\n\s*\\\)\?:\s*\S\+'
\ end='$' skip='\s*\n\(\s*\\\)\|\(\s*".*$\)'
\ contained
\ contains=vifmStatementC
" Contained sub command with highlighting of angle-brace notation.
syntax region vifmColonSubcommandN start='\s*\(\s*\n\s*\\\)\?:\s*\S\+'
\ end='\ze<[cC][rR]>\|$' skip='\s*\n\(\s*\\\)\|\(\s*".*$\)' keepend
\ contained
\ contains=vifmStatementCN
syntax region vifmSubcommandN start='\s*\(\s*\n\s*\\\)\?:\?\s*\S\+'
\ end='\ze<[cC][rR]>\|$' skip='\s*\n\(\s*\\\)\|\(\s*".*$\)' keepend
\ contained
\ contains=vifmStatementCN
" Non-empty pattern or form [!][{]{*.ext,*.e}[}], [!][/]/regex/[/][iI] or
" <mime-type-globs>, possibly multi-line.
" [!]/regexp/[iI]+
syntax region vifmPattern contained
\ start='!\?/\ze\(\n\s*\\\|\n\s*".*$\|[^/]\|\\/\)\+/'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='/[iI]*\ze\s\|/\ze\S\+\s' keepend
\ contains=vifmComment,vifmInlineComment,vifmNotComment,vifmNotPattern
" [!]//regexp//[iI]+
syntax region vifmPattern contained
\ start='!\?//\ze\(/[^/]\|\n\s*\\\|\n\s*".*$\|[^/]\|\\/\)\+//'
\ skip='/[^/]\|\(\n\s*\\\)\|\(\n\s*".*$\)' end='//[iI]*' keepend
\ contains=vifmComment,vifmInlineComment,vifmNotComment,vifmNotPattern
" [!]{regexp}
syntax region vifmPattern contained
\ start='!\?{[^}]' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='}' keepend
\ contains=vifmComment,vifmInlineComment,vifmNotComment,vifmNotPattern
" [!]{{regexp}}
syntax region vifmPattern contained
\ start='!\?{{\ze.\{-}}}' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='}}' keepend
\ contains=vifmComment,vifmInlineComment,vifmNotComment,vifmNotPattern
" [!]<regexp>
syntax region vifmPattern contained
\ start='!\?<[^>]' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='>' keepend
\ contains=vifmComment,vifmInlineComment,vifmNotComment,vifmNotPattern
syntax match vifmNotPattern contained '!\?\({{}}\|\<//\>\|////\)'
syntax region vifmHi
\ start='^\(\s\|:\)*\<hi\%[ghlight]\>' skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ end='$' keepend
\ contains=vifmHiCommand,vifmHiArgs,vifmHiGroups,vifmHiStyles,vifmHiColors
\,vifmNumber,vifmComment,vifmInlineComment,vifmNotComment,vifmHiClear
\,vifmPattern
syntax region vifmFtBeginning contained
\ start='\<\(filet\%[ype]\|filext\%[ype]\|filev\%[iewer]\)\>\s\+\S'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)'
\ end='\s' keepend
\ contains=vifmFtCommand,vifmPattern
" common highlight for :command arguments
syntax region vifmArgs start='!\?\zs\(\s*\S\+\|[^a-zA-Z]\)'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='|\|$'
\ contained
\ contains=vifmStringInExpr
syntax region vifmSet
\ start='\(\s\|:\)*\<\(se\%[t]\|setg\%[lobal]\|setl\%[ocal]\)\>'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmSetCommand,vifmOption,vifmSetAssignSQS,vifmSetAssignDQS
\,vifmSetAssignNS,vifmComment,vifmInlineComment,vifmNotComment
syntax region vifmSetN
\ start='\(\s\|:\)*\<\(se\%[t]\|setg\%[lobal]\|setl\%[ocal]\)\>'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmSetCommand,vifmOption,vifmSetAssignSQS,vifmSetAssignDQS
\,vifmSetAssignNSN,vifmComment,vifmInlineComment,vifmNotComment,vifmNotation
syntax region vifmSet2 contained
\ start='^\(\s\|:\)*\<\(se\%[t]\|setg\%[lobal]\|setl\%[ocal]\)\>'
\ skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmSetCommand,vifmOption,vifmSetAssignSQS,vifmSetAssignDQS
\,vifmSetAssignNSN,vifmComment,vifmInlineComment,vifmNotComment,vifmNotation
" Highlight for =value part of :set arguments of form option=value
" For single quoted string (check that it starts with =')
syntax region vifmSetAssignSQS contained
\ start="='" skip=+\\\\\|\\'+ end=+'+ keepend
\ contains=vifmString
" For double quoted string (check that it starts with =")
syntax region vifmSetAssignDQS contained
\ start='="' skip=+\\\\\|\\"+ end=+"+ keepend
\ contains=vifmString
" For not strings (check that it doesn't start with either =' or =")
syntax region vifmSetAssignNS contained
\ start='=[^"'' ]' skip='\(\n\s*\\\)\|\(\n\s*".*$\)\|^.*\S.*\\\s' end='^\s*\\\s\|[^\\]\s\|$'
\ extend
\ contains=vifmNumber,vifmComment,vifmInlineComment
" For not strings (check that it doesn't start with either =' or =")
syntax region vifmSetAssignNSN contained
\ start='=[^"'' ]' skip='\(\n\s*\\\)\|\(\n\s*".*$\)\|^.*\S.*\\\s' end='^\s*\\\s\|[^\\]\s\|$'
\ extend
\ contains=vifmNumber,vifmComment,vifmInlineComment,vifmNotation
syntax region vifmLet
\ start='^\(\s\|:\)*\<let\>' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmLetCommand,vifmEnvVar,vifmString,vifmStringInExpr,vifmComment
\,vifmInlineComment,vifmNotComment
syntax region vifmUnlet
\ start='^\(\s\|:\)*\<unl\%[et]\>' skip='\(\n\s*\\\)\|\(\n\s*".*$\)' end='$'
\ keepend
\ contains=vifmUnletCommand,vifmEnvVar,vifmComment,vifmInlineComment,vifmNotComment
syntax region vifmString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+
syntax region vifmString contained start=+='+hs=s+1 skip=+\\\\\|\\'+ end=+'+
syntax region vifmStringInExpr contained start=+=\@<="+hs=s+1 skip=+\\\\\|\\"+
\ end=+"+
syntax region vifmStringInExpr contained start=+=\@<='+hs=s+1
\ skip=+\\\\\|\\'\|''+ end=+'+
syntax region vifmStringInExpr contained start=+[.( ]"+hs=s+1 skip=+\\\\\|\\"+
\ end=+"+
syntax region vifmStringInExpr contained start=+[.( ]'+hs=s+1
\ skip=+\\\\\|\\'\|''+ end=+'+
syntax region vifmArgument contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syntax region vifmArgument contained start=+'+ skip=+\\\\\|\\'\|''+ end=+'+
syntax match vifmEnvVar contained /\$[0-9a-zA-Z_]\+/
syntax match vifmNumber contained /\d\+/
" Ange-bracket notation
syntax case ignore
syntax match vifmNotation '<\(esc\|cr\|space\|del\|nop\|\(s-\)\?tab\|home\|end\|left\|right\|up\|down\|bs\|delete\|pageup\|pagedown\|\([acms]-\)\?f\d\{1,2\}\|c-s-[a-z[\]^_]\|s-c-[a-z[\]^_]\|c-[a-z[\]^_]\|[am]-c-[a-z]\|c-[am]-[a-z]\|[am]-[a-z]\)>'
syntax case match
" Whole line comment
syntax region vifmComment contained contains=@Spell start='^\(\s\|:\)*"' end='$'
" Comment at the end of a line
syntax match vifmInlineComment contained contains=@Spell '\s"[^"]*$'
" This prevents highlighting non-first line of multi-line command
syntax match vifmNotComment contained '\s"[^"]*\(\(\n\s*\(\\\|"\)\)\@!\|$\)'
" Empty line
syntax match vifmEmpty /^\s*$/
" :highlight clear
syntax match vifmHiClear contained /\s*\<clear\>\s*/
" Check spelling only in syntax elements marked with @Spell
syntax spell notoplevel
" Highlight
highlight link vifmAutocmdCommand Statement
highlight link vifmPatternCommands Statement
highlight link vifmComment Comment
highlight link vifmInlineComment Comment
highlight link vifmCommand Statement
highlight link vifmPrefixCommands Statement
highlight link vifmCdCommand Statement
highlight link vifmCmdCommand Statement
highlight link vifmColoCommand Statement
highlight link vifmHiCommand Statement
highlight link vifmHiClear Statement
highlight link vifmInvertCommand Statement
highlight link vifmMarkCommand Statement
highlight link vifmFtCommand Statement
highlight link vifmExprCommand Statement
highlight link vifmNormalCommand Statement
highlight link vifmLetCommand Statement
highlight link vifmUnletCommand Statement
highlight link vifmSetCommand Statement
highlight link vifmSoCommand Statement
highlight link vifmBuiltinFunction Function
highlight link vifmOperator Operator
highlight link vifmMap Statement
highlight link vifmCMapAbbr Statement
highlight link vifmHiArgs Type
highlight link vifmAutoEvent Type
highlight link vifmHiGroups Identifier
highlight link vifmPattern String
highlight link vifmHiStyles PreProc
highlight link vifmHiColors Special
highlight link vifmOption PreProc
highlight link vifmNotation Special
highlight link vifmString String
highlight link vifmStringInExpr String
highlight link vifmEnvVar PreProc
highlight link vifmNumber Number
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
endif

View File

@@ -42,16 +42,18 @@ function! s:register_language(language, tag, ...)
endif
endfunction
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
call s:register_language('slm', 'template')
call s:register_language('handlebars', 'template')
call s:register_language('haml', 'template')
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
call s:register_language('coffee', 'script')
call s:register_language('stylus', 'style')
call s:register_language('sass', 'style')
call s:register_language('scss', 'style')
call s:register_language('less', 'style')
if !exists("g:vue_disable_pre_processors") || !g:vue_disable_pre_processors
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
call s:register_language('slm', 'template')
call s:register_language('handlebars', 'template')
call s:register_language('haml', 'template')
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
call s:register_language('coffee', 'script')
call s:register_language('stylus', 'style')
call s:register_language('sass', 'style')
call s:register_language('scss', 'style')
call s:register_language('less', 'style')
endif
syn region vueSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
syn keyword htmlSpecialTagName contained template