This commit is contained in:
Adam Stankiewicz 2016-05-02 10:42:37 +02:00
parent bc098370c1
commit 5dd1a7e839
No known key found for this signature in database
GPG Key ID: A62480DCEAC884DF
52 changed files with 3198 additions and 2343 deletions

View File

@ -1,7 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
setlocal comments=s1fl:{-,mb:-,ex:-},:-- setlocal comments=s1fl:{-,mb:-,ex:-},:--
setlocal formatoptions-=cro formatoptions+=j
setlocal iskeyword+=-,.,* setlocal iskeyword+=-,.,*
setlocal commentstring=--\ %s setlocal commentstring=--\ %s

View File

@ -1,7 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
setlocal comments=s1fl:{-,mb:-,ex:-},:-- setlocal comments=s1fl:{-,mb:-,ex:-},:--
setlocal formatoptions-=cro formatoptions+=j
setlocal iskeyword+=' setlocal iskeyword+='
endif endif

View File

@ -36,22 +36,56 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" Functions " Functions
syn match cCustomParen "(" contains=cParen contains=cCppParen syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen syn match cCustomFunc "\w\+\s*(\@="
hi def link cCustomFunc Function hi def link cCustomFunc Function
" Template functions
if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight
syn region cCustomAngleBrackets matchgroup=AngleBracketContents start="\v%(<operator\_s*)@<!%(%(\_i|template\_s*)@<=\<[<=]@!|\<@<!\<[[:space:]<=]@!)" end='>' contains=@cppSTLgroup,cppStructure,cType,cCustomClass,cCustomAngleBrackets,cNumbers
syn match cCustomBrack "<\|>" contains=cCustomAngleBrackets
syn match cCustomTemplateFunc "\w\+\s*<.*>(\@=" contains=cCustomBrack,cCustomAngleBrackets
hi def link cCustomTemplateFunc Function
endif
" Class and namespace scope " Class and namespace scope
if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight
syn match cCustomScope "::" syn match cCustomScope "::"
syn match cCustomClass "\w\+\s*::" contains=cCustomScope syn match cCustomClass "\w\+\s*::"
hi def link cCustomClass Function " disabled for now \contains=cCustomScope
" hi def link cCustomClass Function " disabled for now
syn match cCustomClass "\<\u\w*\s*\>"
endif
" Template functions
if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight
syn match cCustomAngleBracketStart "<\_[^;()]\{-}>" contained
\contains=cCustomAngleBracketStart, cCustomAngleBracketEnd
hi def link cCustomAngleBracketStart cCustomAngleBracketContent
syn match cCustomAngleBracketEnd ">\_[^<>;()]\{-}>" contained
\contains=cCustomAngleBracketEnd
hi def link cCustomAngleBracketEnd cCustomAngleBracketContent
syn match cCustomTemplateFunc "\<\l\w*\s*<\_[^;()]\{-}>(\@="hs=s,he=e-1
\contains=cCustomAngleBracketStart
hi def link cCustomTemplateFunc cCustomFunc
syn match cCustomTemplateClass "\<\w\+\s*<\_[^;()]\{-}>"
\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
" Remove 'operator' from cppStructure 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
syn match cCustomOperator "\<operator\>"
hi def link cCustomOperator cppStructure
syn match cTemplateOperatorDeclare "\<operator\_s*<\_[^;()]\{-}>[<>]=\?"
\contains=cppOperator,cCustomOperator,cCustomAngleBracketStart
endif endif
" Alternative syntax that is used in: " Alternative syntax that is used in:
@ -65,7 +99,7 @@ syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconst
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" Standard library types and functions. " Standard library types and functions.
" "
" Mainly based on the excellent STL Syntax vim script by " Mainly based on the excellent STL Syntax vim script by
" Mizuchi <ytj000@gmail.com> " Mizuchi <ytj000@gmail.com>
" http://www.vim.org/scripts/script.php?script_id=4293 " http://www.vim.org/scripts/script.php?script_id=4293
" which in turn is based on the scripts " which in turn is based on the scripts
@ -136,7 +170,6 @@ syntax keyword cppSTLfunctional binary_negate
syntax keyword cppSTLfunctional bit_and syntax keyword cppSTLfunctional bit_and
syntax keyword cppSTLfunctional bit_not syntax keyword cppSTLfunctional bit_not
syntax keyword cppSTLfunctional bit_or syntax keyword cppSTLfunctional bit_or
syntax keyword cppSTLfunctional bit_xor
syntax keyword cppSTLfunctional divides syntax keyword cppSTLfunctional divides
syntax keyword cppSTLfunctional equal_to syntax keyword cppSTLfunctional equal_to
syntax keyword cppSTLfunctional greater syntax keyword cppSTLfunctional greater
@ -1324,31 +1357,6 @@ if !exists("cpp_no_cpp14")
"dynarray "dynarray
syntax keyword cppSTLtype dynarray syntax keyword cppSTLtype dynarray
"helper type traits types
syntax keyword cppSTLtype remove_cv_t
syntax keyword cppSTLtype remove_const_t
syntax keyword cppSTLtype remove_volatile_t
syntax keyword cppSTLtype add_cv_t
syntax keyword cppSTLtype add_const_t
syntax keyword cppSTLtype add_volatile_t
syntax keyword cppSTLtype remove_reference_t
syntax keyword cppSTLtype add_lvalue_reference_t
syntax keyword cppSTLtype add_rvalue_reference_t
syntax keyword cppSTLtype remove_pointer_t
syntax keyword cppSTLtype add_pointer_t
syntax keyword cppSTLtype remove_extent_t
syntax keyword cppSTLtype remove_all_extents_t
syntax keyword cppSTLtype make_signed_t
syntax keyword cppSTLtype make_unsigned_t
syntax keyword cppSTLtype aligned_storage_t
syntax keyword cppSTLtype aligned_union_t
syntax keyword cppSTLtype decay_t
syntax keyword cppSTLtype enable_if_t
syntax keyword cppSTLtype conditional_t
syntax keyword cppSTLtype common_type_t
syntax keyword cppSTLtype underlying_type_t
syntax keyword cppSTLtype result_of_t
"thread "thread
syntax keyword cppSTLtype shared_mutex syntax keyword cppSTLtype shared_mutex
syntax keyword cppSTLtype shared_lock syntax keyword cppSTLtype shared_lock
@ -1387,7 +1395,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
HiLink cppSTLenum Typedef HiLink cppSTLenum Typedef
HiLink cppSTLios Function HiLink cppSTLios Function
HiLink cppSTLcast Statement " be consistent with official syntax HiLink cppSTLcast Statement " be consistent with official syntax
HiLink cppRawString String HiLink cppRawString String
HiLink cppRawDelimiter Delimiter HiLink cppRawDelimiter Delimiter
delcommand HiLink delcommand HiLink
endif endif

View File

@ -32,12 +32,23 @@ endif
" - othree/yajs.vim: javascriptNoReserved " - othree/yajs.vim: javascriptNoReserved
" JSX attributes should color as JS. Note the trivial end pattern; we let
" jsBlock take care of ending the region.
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
" JSX child blocks behave just like JSX attributes, except that (a) they are
" syntactically distinct, and (b) they need the syn-extend argument, or else
" nested XML end-tag patterns may end the outer jsxRegion.
syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
\ extend
" Highlight JSX regions as XML; recursively match. " Highlight JSX regions as XML; recursively match.
" "
" Note that we prohibit JSX tags from having a < or word character immediately " Note that we prohibit JSX tags from having a < or word character immediately
" preceding it, to avoid conflicts with, respectively, the left shift operator " preceding it, to avoid conflicts with, respectively, the left shift operator
" and generic Flow type annotations (http://flowtype.org/). " and generic Flow type annotations (http://flowtype.org/).
syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock syn region jsxRegion
\ contains=@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+ \ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ skip=+<!--\_.\{-}-->+ \ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+ \ end=+</\z1\_\s\{-}>+
@ -45,10 +56,6 @@ syn region jsxRegion contains=@XMLSyntax,jsxRegion,jsBlock,javascriptBlock
\ keepend \ keepend
\ extend \ extend
" JSX attributes should color as JS. Note the trivial end pattern; we let
" jsBlock take care of ending the region.
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
" Add jsxRegion to the lowest-level JS syntax cluster. " Add jsxRegion to the lowest-level JS syntax cluster.
syn cluster jsExpression add=jsxRegion syn cluster jsExpression add=jsxRegion

View File

@ -1,15 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
function! DetectAnsible() function! s:isAnsible()
let filepath = expand("%:p") let filepath = expand("%:p")
let filename = expand("%:t") let filename = expand("%:t")
if filepath =~ '\v/(tasks|roles)/.*\.ya?ml$' || filepath =~ '\v/(group|host)_vars/' || filename =~ '\v(playbook|site)\.ya?ml$' if filepath =~ '\v/(tasks|roles|handlers)/.*\.ya?ml$' | return 1 | en
set ft=ansible if filepath =~ '\v/(group|host)_vars/' | return 1 | en
endif if filename =~ '\v(playbook|site|main|local)\.ya?ml$' | return 1 | en
unlet filepath let shebang = getline(1)
unlet filename if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en
if shebang =~# '^#!.*/bin/ansible-playbook\>' | return 1 | en
return 0
endfunction endfunction
:au BufNewFile,BufRead *.yml,*yaml,*/{group,host}_vars/* call DetectAnsible() :au BufNewFile,BufRead * if s:isAnsible() | set ft=ansible | en
:au BufNewFile,BufRead *.j2 set ft=ansible_template :au BufNewFile,BufRead *.j2 set ft=ansible_template
:au BufNewFile,BufRead hosts set ft=ansible_hosts :au BufNewFile,BufRead hosts set ft=ansible_hosts
endif endif
@ -67,8 +69,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir') au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
au BufRead,BufNewFile *.eex call s:setf('eelixir') au BufRead,BufNewFile *.eex call s:setf('eelixir')
au BufRead,BufNewFile * call s:DetectElixir()
au FileType elixir,eelixir setl sw=2 sts=2 et iskeyword+=!,? au FileType elixir,eelixir setl sw=2 sts=2 et iskeyword+=!,?
au BufNewFile,BufRead * call s:DetectElixir()
function! s:setf(filetype) abort function! s:setf(filetype) abort
let &filetype = a:filetype let &filetype = a:filetype
endfunction endfunction
@ -157,10 +159,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haxe') == -1
autocmd BufNewFile,BufRead *.hx setf haxe autocmd BufNewFile,BufRead *.hx setf haxe
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1
autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
@ -334,6 +332,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'powershell') ==
au BufNewFile,BufRead *.ps1xml set ft=ps1xml au BufNewFile,BufRead *.ps1xml set ft=ps1xml
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
autocmd BufNewFile,BufReadPost *.pug set filetype=pug
autocmd BufNewFile,BufReadPost *.jade set filetype=pug
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
au! BufRead,BufNewFile *.pp setfiletype puppet au! BufRead,BufNewFile *.pp setfiletype puppet
@ -409,7 +412,7 @@ autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
endif endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
autocmd BufNewFile,BufRead *.swift setfiletype swift autocmd BufNewFile,BufRead *.swift set filetype=swift
autocmd BufRead * call s:Swift() autocmd BufRead * call s:Swift()
function! s:Swift() function! s:Swift()
if !empty(&filetype) if !empty(&filetype)

View File

@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
if exists("b:did_ftplugin")
finish
else
let b:did_ftplugin = 1
endif
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions-=c
let b:undo_ftplugin = "setl comments< commentstring< formatoptions<"
endif

View File

@ -6,64 +6,4 @@ endif
let g:loaded_haskellvim_cabal = 1 let g:loaded_haskellvim_cabal = 1
function! s:makeSection(content)
return "\n" . join(a:content, "\n")
endfunction
function! s:exeTmpl(name, src)
let l:exetmpl = [ 'executable ' . a:name,
\ '-- ghc-options:',
\ 'main-is: ' . a:src,
\ '-- other-modules:',
\ '-- other-extensions:',
\ 'build-depends: base',
\ '-- hs-source-dirs:',
\ 'default-language: Haskell2010'
\ ]
return s:makeSection(l:exetmpl)
endfunction
function! s:libTmpl()
let l:libtmpl = [ 'library',
\ '-- ghc-options:',
\ '-- other-modules:',
\ '-- other-extensions:',
\ 'build-depends: base',
\ '-- hs-source-dirs:',
\ 'default-language: Haskell2010'
\ ]
return s:makeSection(l:libtmpl)
endfunction
function! s:flagTmpl(name)
let l:flagtmpl = [ 'flag ' . a:name,
\ 'description:',
\ 'default: False',
\ 'manual: True',
\ ]
return s:makeSection(l:flagtmpl)
endfunction
function! cabal#addExecutable()
let l:name = input("Enter executable name: ")
let l:src = input("Enter source file: ")
exe "normal Go" . s:exeTmpl(l:name, l:src)
endfunction
function! cabal#addLibrary()
exe "normal Go" . s:libTmpl()
endfunction
function! cabal#addFlag()
let l:name = input("Enter flag name: ")
exe "normal Go" . s:flagTmpl(l:name)
endfunction
command! -buffer CabalAddExecutable call cabal#addExecutable()
command! -buffer CabalAddLibrary call cabal#addLibrary()
command! -buffer CabalAddFlag call cabal#addFlag()
endif endif

View File

@ -5,7 +5,6 @@ if (exists("b:did_ftplugin"))
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
" Matchit support " Matchit support
if exists("loaded_matchit") && !exists("b:match_words") if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0 let b:match_ignorecase = 0
@ -21,4 +20,42 @@ endif
setlocal comments=:# setlocal comments=:#
setlocal commentstring=#\ %s setlocal commentstring=#\ %s
function! GetElixirFilename(word)
let word = a:word
" get first thing that starts uppercase, until the first space or end of line
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
" remove any trailing characters that don't look like a nested module
let word = substitute(word,'\.\U.*$','','g')
" replace module dots with slash
let word = substitute(word,'\.','/','g')
" remove any special chars
let word = substitute(word,'[^A-z0-9-_/]','','g')
" convert to snake_case
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
let word = substitute(word,'-','_','g')
let word = tolower(word)
return word
endfunction
let &l:path =
\ join([
\ getcwd().'/lib',
\ getcwd().'/src',
\ getcwd().'/deps/**/lib',
\ getcwd().'/deps/**/src',
\ &g:path
\ ], ',')
setlocal includeexpr=GetElixirFilename(v:fname)
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
setlocal formatoptions-=t formatoptions+=croqlj
endif endif

View File

@ -14,6 +14,8 @@ let b:did_ftplugin = 1
if !exists('b:git_dir') if !exists('b:git_dir')
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
" Stay out of the way " Stay out of the way
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
elseif expand('%:p') =~# '\.git\>' elseif expand('%:p') =~# '\.git\>'
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
elseif $GIT_DIR != '' elseif $GIT_DIR != ''

View File

@ -13,8 +13,10 @@ endif
runtime! ftplugin/git.vim runtime! ftplugin/git.vim
let b:did_ftplugin = 1 let b:did_ftplugin = 1
setlocal nomodeline tabstop=8 formatoptions-=croq formatoptions+=tl textwidth=72 setlocal comments=:# commentstring=#\ %s
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw<' setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<'
if exists("g:no_gitcommit_commands") || v:version < 700 if exists("g:no_gitcommit_commands") || v:version < 700
finish finish
@ -26,6 +28,8 @@ endif
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached"
function! s:diffcomplete(A,L,P) function! s:diffcomplete(A,L,P)
let args = "" let args = ""
if a:P <= match(a:L." -- "," -- ")+3 if a:P <= match(a:L." -- "," -- ")+3

View File

@ -6,20 +6,15 @@ endif
let g:loaded_haskellvim_haskell = 1 let g:loaded_haskellvim_haskell = 1
function! haskell#makeModuleCommentBlock() function! haskell#sortImports(line1, line2)
let l:commenttmpl = [ '{-|', exe a:line1 . "," . a:line2 . "sort /import\\s\\+\\(qualified\\s\\+\\)\\?/"
\ 'Module : ',
\ 'Description : ',
\ 'Copyright : ',
\ 'License : ',
\ 'Maintainer : ',
\ 'Stability : ',
\ 'Portability : ',
\ '-}']
exe "normal ggO" . join(l:commenttmpl, "\n")
endfunction endfunction
command! -buffer -nargs=0 HaskellAddModuleComment call haskell#makeModuleCommentBlock() function! haskell#formatImport(line1, line2)
exec a:line1 . ",". a:line2 . "s/import\\s\\+\\([A-Z].*\\)/import \\1"
endfunction
command! -buffer -range HaskellSortImports call haskell#sortImports(<line1>, <line2>)
command! -buffer -range HaskellFormatImport call haskell#formatImport(<line1>, <line2>)
endif endif

View File

@ -11,7 +11,7 @@ endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]: setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:

View File

@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
" Vim filetype plugin " Vim filetype plugin
" Language: Jade " Language: Pug
" Maintainer: Joshua Borton " Maintainer: Joshua Borton
" Credits: Tim Pope " Credits: Tim Pope
@ -39,7 +39,7 @@ endif
" Change the browse dialog on Win32 to show mainly Haml-related files " Change the browse dialog on Win32 to show mainly Haml-related files
if has("gui_win32") if has("gui_win32")
let b:browsefilter="Jade Files (*.jade)\t*.jade\n" . s:browsefilter let b:browsefilter="Pug Files (*.pug)\t*.pug\n" . s:browsefilter
endif endif
" Load the combined list of match_words for matchit.vim " Load the combined list of match_words for matchit.vim
@ -49,7 +49,7 @@ endif
setlocal comments=://-,:// commentstring=//\ %s setlocal comments=://-,:// commentstring=//\ %s
setlocal suffixesadd+=.jade setlocal suffixesadd+=.pug
let b:undo_ftplugin = "setl cms< com< " let b:undo_ftplugin = "setl cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin

View File

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

View File

@ -13,7 +13,7 @@ let b:did_indent = 1
setlocal autoindent setlocal autoindent
setlocal indentexpr=GetBladeIndent() setlocal indentexpr=GetBladeIndent()
setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty,=@show
" Only define the function once. " Only define the function once.
if exists("*GetBladeIndent") if exists("*GetBladeIndent")
@ -30,17 +30,26 @@ function! GetBladeIndent()
let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '') let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')
let indent = indent(lnum) let indent = indent(lnum)
let cindent = indent(v:lnum) let cindent = indent(v:lnum)
if cline =~# '@\%(else\|elseif\|empty\|end\)' if cline =~# '@\%(else\|elseif\|empty\|end\|show\)'
let indent = cindent < indent ? cindent : indent - &sw let indent = indent - &sw
elseif HtmlIndent() > -1 else
let indent = HtmlIndent() if exists("*GetBladeIndentCustom")
let hindent = GetBladeIndentCustom()
else
let hindent = HtmlIndent()
endif
if hindent > -1
let indent = hindent
endif
endif endif
let increase = indent + &sw let increase = indent + &sw
if indent = indent(lnum) if indent = indent(lnum)
let indent = cindent <= indent ? -1 : increase let indent = cindent <= indent ? -1 : increase
endif endif
if line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\)\%(.*\s*@end\)\@!' if line =~# '@\%(section\)\%(.*\s*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
return indent
elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\)\%(.*\s*@end\)\@!'
return increase return increase
else else
return indent return indent

View File

@ -29,6 +29,7 @@ function! GetCucumberIndent()
let line = getline(prevnonblank(v:lnum-1)) let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum) let cline = getline(v:lnum)
let nline = getline(nextnonblank(v:lnum+1)) let nline = getline(nextnonblank(v:lnum+1))
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
let syn = s:syn(prevnonblank(v:lnum-1)) let syn = s:syn(prevnonblank(v:lnum-1))
let csyn = s:syn(v:lnum) let csyn = s:syn(v:lnum)
let nsyn = s:syn(nextnonblank(v:lnum+1)) let nsyn = s:syn(nextnonblank(v:lnum+1))
@ -37,38 +38,38 @@ function! GetCucumberIndent()
return 0 return 0
elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):' elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
" examples heading " examples heading
return 2 * &sw return 2 * sw
elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" background, scenario or outline heading " background, scenario or outline heading
return &sw return sw
elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:' elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
" line after feature heading " line after feature heading
return &sw return sw
elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):' elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
" line after examples heading " line after examples heading
return 3 * &sw return 3 * sw
elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" line after background, scenario or outline heading " line after background, scenario or outline heading
return 2 * &sw return 2 * sw
elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
" tag or comment before a feature heading " tag or comment before a feature heading
return 0 return 0
elseif cline =~# '^\s*@' elseif cline =~# '^\s*@'
" other tags " other tags
return &sw return sw
elseif cline =~# '^\s*[#|]' && line =~# '^\s*|' elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
" mid-table " mid-table
" preserve indent " preserve indent
return indent(prevnonblank(v:lnum-1)) return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|]' elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
" first line of a table, relative indent " first line of a table, relative indent
return indent(prevnonblank(v:lnum-1)) + &sw return indent(prevnonblank(v:lnum-1)) + sw
elseif cline =~# '^\s*[^|]' && line =~# '^\s*|' elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
" line after a table, relative unindent " line after a table, relative unindent
return indent(prevnonblank(v:lnum-1)) - &sw return indent(prevnonblank(v:lnum-1)) - sw
elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):') elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
" comments on scenarios " comments on scenarios
return &sw return sw
endif endif
return indent(prevnonblank(v:lnum-1)) return indent(prevnonblank(v:lnum-1))
endfunction endfunction

View File

@ -17,16 +17,18 @@ endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
let s:no_colon_before = ':\@<!' let s:no_colon_before = ':\@<!'
let s:no_colon_after = ':\@!' let s:no_colon_after = ':\@!'
let s:symbols_end = '\]\|}' let s:symbols_end = '\]\|}\|)'
let s:arrow = '^.*->$' let s:symbols_start = '\[\|{\|('
let s:pipeline = '^\s*|>.*$' let s:arrow = '^.*->$'
let s:skip_syntax = '\%(Comment\|String\)$' let s:skip_syntax = '\%(Comment\|String\)$'
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'" let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
let s:block_start = 'do\|fn' let s:block_start = '\<\%(do\|fn\)\>'
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue' let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
let s:block_end = 'end' let s:block_end = 'end'
let s:starts_with_pipeline = '^\s*|>.*$'
let s:ending_with_assignment = '=\s*$'
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
@ -35,15 +37,21 @@ let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_af
let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs' let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs' let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
let s:inside_block = 0
function! GetElixirIndent() function! GetElixirIndent()
let lnum = prevnonblank(v:lnum - 1) let lnum = prevnonblank(v:lnum - 1)
let ind = indent(lnum)
" At the start of the file use zero indent. " At the start of the file use zero indent.
if lnum == 0 if lnum == 0
return 0 return 0
endif endif
let opened_symbol = 0
let current_line = getline(v:lnum)
let last_line = getline(lnum)
let ind = indent(lnum)
" TODO: Remove these 2 lines " TODO: Remove these 2 lines
" I don't know why, but for the test on spec/indent/lists_spec.rb:24. " I don't know why, but for the test on spec/indent/lists_spec.rb:24.
" Vim is making some mess on parsing the syntax of 'end', it is being " Vim is making some mess on parsing the syntax of 'end', it is being
@ -53,15 +61,22 @@ function! GetElixirIndent()
syntax sync fromstart syntax sync fromstart
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
let current_line = getline(v:lnum)
let last_line = getline(lnum)
let splited_line = split(last_line, '\zs') if last_line !~ s:arrow
let opened_symbol = 0 let split_line = split(last_line, '\zs')
let opened_symbol += count(splited_line, '[') - count(splited_line, ']') let opened_symbol += count(split_line, '(') - count(split_line, ')')
let opened_symbol += count(splited_line, '{') - count(splited_line, '}') let opened_symbol += count(split_line, '[') - count(split_line, ']')
let opened_symbol += count(split_line, '{') - count(split_line, '}')
end
let ind += (opened_symbol * &sw) " if start symbol is followed by a character, indent based on the
" whitespace after the symbol, otherwise use the default shiftwidth
if last_line =~ '\('.s:symbols_start.'\).'
let opened_prefix = matchlist(last_line, '\('.s:symbols_start.'\)\s*')[0]
let ind += (opened_symbol * strlen(opened_prefix))
else
let ind += (opened_symbol * &sw)
endif
if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords
let ind += &sw let ind += &sw
@ -71,27 +86,35 @@ function! GetElixirIndent()
let ind -= &sw let ind -= &sw
endif endif
if last_line =~ s:ending_with_assignment && opened_symbol == 0
let b:old_ind = indent(lnum)
let ind += &sw
end
" if line starts with pipeline " if line starts with pipeline
" and last line contains pipeline(s) " and last line ends with a pipeline,
" align them " align them
if last_line =~ '|>.*$' && if last_line =~ '|>.*$' &&
\ current_line =~ s:pipeline \ current_line =~ s:starts_with_pipeline
let ind = float2nr(match(last_line, '|>') / &sw) * &sw let ind = float2nr(match(last_line, '|>') / &sw) * &sw
" if line starts with pipeline " if line starts with pipeline
" and last line is an attribution " and last line is an attribution
" indents pipeline in same level as attribution " indents pipeline in same level as attribution
elseif current_line =~ s:pipeline && elseif current_line =~ s:starts_with_pipeline &&
\ last_line =~ '^[^=]\+=.\+$' \ last_line =~ '^[^=]\+=.\+$'
let b:old_ind = ind
if !exists('b:old_ind') || b:old_ind == 0
let b:old_ind = indent(lnum)
end
let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw
endif endif
" if last line starts with pipeline " if last line starts with pipeline
" and current line doesn't start with pipeline " and current line doesn't start with pipeline
" returns the indentation before the pipeline " returns the indentation before the pipeline
if last_line =~ s:pipeline && if last_line =~ s:starts_with_pipeline &&
\ current_line !~ s:pipeline \ current_line !~ s:starts_with_pipeline
let ind = b:old_ind let ind = b:old_ind
endif endif

View File

@ -22,17 +22,18 @@ if exists("*GetGitconfigIndent")
endif endif
function! GetGitconfigIndent() function! GetGitconfigIndent()
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
let line = getline(prevnonblank(v:lnum-1)) let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum) let cline = getline(v:lnum)
if line =~ '\\\@<!\%(\\\\\)*\\$' if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation " odd number of slashes, in a line continuation
return 2 * &sw return 2 * sw
elseif cline =~ '^\s*\[' elseif cline =~ '^\s*\['
return 0 return 0
elseif cline =~ '^\s*\a' elseif cline =~ '^\s*\a'
return &sw return sw
elseif cline == '' && line =~ '^\[' elseif cline == '' && line =~ '^\['
return &sw return sw
else else
return -1 return -1
endif endif

View File

@ -6,4 +6,43 @@ endif
runtime! indent/html.vim runtime! indent/html.vim
" Indent Golang HTML templates
setlocal indentexpr=GetGoHTMLTmplIndent(v:lnum)
setlocal indentkeys+==else,=end
" Only define the function once.
if exists("*GetGoHTMLTmplIndent")
finish
endif
function! GetGoHTMLTmplIndent(lnum)
" Get HTML indent
if exists('*HtmlIndent')
let ind = HtmlIndent()
else
let ind = HtmlIndentGet(a:lnum)
endif
" The value of a single shift-width
if exists('*shiftwidth')
let sw = shiftwidth()
else
let sw = &sw
endif
" If need to indent based on last line
let last_line = getline(a:lnum-1)
if last_line =~ '^\s*{{\s*\%(if\|else\|range\|with\|define\|block\).*}}'
let ind += sw
endif
" End of FuncMap block
let current_line = getline(a:lnum)
if current_line =~ '^\s*{{\s*\%(else\|end\).*}}'
let ind -= sw
endif
return ind
endfunction
endif endif

View File

@ -39,10 +39,11 @@ function! GetHamlIndent()
let line = substitute(line,'^\s\+','','') let line = substitute(line,'^\s\+','','')
let indent = indent(lnum) let indent = indent(lnum)
let cindent = indent(v:lnum) let cindent = indent(v:lnum)
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
if cline =~# '\v^-\s*%(elsif|else|when)>' if cline =~# '\v^-\s*%(elsif|else|when)>'
let indent = cindent < indent ? cindent : indent - &sw let indent = cindent < indent ? cindent : indent - sw
endif endif
let increase = indent + &sw let increase = indent + sw
if indent == indent(lnum) if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase let indent = cindent <= indent ? -1 : increase
endif endif

View File

@ -2,8 +2,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
" indentation for haskell " indentation for haskell
" "
" Based on idris indentation
"
" author: raichoo (raichoo@googlemail.com) " author: raichoo (raichoo@googlemail.com)
" "
" Modify g:haskell_indent_if and g:haskell_indent_case to " Modify g:haskell_indent_if and g:haskell_indent_case to
@ -18,7 +16,7 @@ endif
let b:did_indent = 1 let b:did_indent = 1
if !exists('g:haskell_indent_if') if !exists('g:haskell_indent_if')
" if bool " if x
" >>>then ... " >>>then ...
" >>>else ... " >>>else ...
let g:haskell_indent_if = 3 let g:haskell_indent_if = 3
@ -55,96 +53,130 @@ if !exists('g:haskell_indent_in')
let g:haskell_indent_in = 1 let g:haskell_indent_in = 1
endif endif
if !exists('g:haskell_indent_guard')
" f x y
" >>|
let g:haskell_indent_guard = 2
endif
setlocal indentexpr=GetHaskellIndent() setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=!^F,o,O,0\|,0=where,0=in,0=let,0=deriving,0=->,0=\=>,<CR>,0} setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,0\,,<space>
function! s:isInBlock(hlstack)
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1
endfunction
function! s:getNesting(hlstack)
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens"')
endfunction
function! s:getHLStack()
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction
" indent matching character
function! s:indentMatching(char)
normal! 0
call search(a:char, 'cW')
normal! %
return col('.') - 1
endfunction
" backtrack to find guard clause
function! s:indentGuard(pos, prevline)
let l:l = a:prevline
let l:c = 1
while v:lnum != l:c
" empty line, stop looking
if l:l =~ '^$'
return a:pos
" guard found
elseif l:l =~ '^\s*|\s\+'
return match(l:l, '|')
" found less deeper indentation (not starting with `,` or `=`)
" stop looking
else
let l:m = match(l:l, '\S')
if l:l !~ '^\s*[=,]' && l:m <= a:pos
return l:m + g:haskell_indent_guard
endif
endif
let l:c += 1
let l:l = getline(v:lnum - l:c)
endwhile
return -1
endfunction
function! GetHaskellIndent() function! GetHaskellIndent()
let l:prevline = getline(v:lnum - 1) let l:hlstack = s:getHLStack()
" do not indent in strings and quasiquotes
if index(l:hlstack, 'haskellString') > -1 || index(l:hlstack, 'haskellQuasiQuote') > -1
return -1
endif
" blockcomment handling
if index(l:hlstack, 'haskellBlockComment') > -1
for l:c in range(v:lnum - 1, 0, -1)
let l:line = getline(l:c)
if l:line =~ '{-'
return 1 + match(l:line, '{-')
endif
endfor
return 1
endif
let l:prevline = getline(v:lnum - 1)
let l:line = getline(v:lnum)
" reset
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
return 0
endif
" comment indentation
if l:prevline =~ '^\s*--' if l:prevline =~ '^\s*--'
return match(l:prevline, '\S') return match(l:prevline, '\S')
endif endif
if synIDattr(synID(line("."), col("."), 1), "name") == 'haskellBlockComment' " operator at end of previous line
for l:c in range(v:lnum - 1, 0, -1) if l:prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
let l:bline = getline(l:c) return match(l:prevline, '\S') + &shiftwidth
if l:bline =~ '{-'
return 1 + match(l:bline, '{-')
endfor
return 1
endif
if l:prevline =~ '^\s*$'
return 0
endif
let l:line = getline(v:lnum)
if l:line =~ '\C^\s*\<where\>'
let l:s = match(l:prevline, '\S')
return l:s + &shiftwidth
endif
if l:line =~ '\C^\s*\<deriving\>'
let l:s = match(l:prevline, '\C\<\(newtype\|data\)\>')
if l:s >= 0
return l:s + &shiftwidth
endif
endif
if l:line =~ '\C^\s*\<let\>'
let l:s = match(l:prevline, '\C\<let\>')
if l:s != 0
return l:s
endif
endif
if l:line =~ '\C^\s*\<in\>'
let l:s = match(l:prevline, '\C\<let\>')
if l:s >= 0
return l:s + g:haskell_indent_in
elseif match(l:prevline, '=') > 0
let l:s = match(l:prevline, '\S')
return l:s - (4 - g:haskell_indent_in)
endif
endif
if l:line =~ '^\s*|'
if match(l:prevline, '^\s*data') < 0
if match(l:prevline, '^\s*|\s') >= 0
return match(l:prevline, '|')
else
return &shiftwidth
endif
endif
endif
if l:line =~ '^\s*[=-]>'
let l:s = match(l:prevline, ' :: ')
if l:s >= 0
return l:s + 1
endif
endif
if l:prevline =~ '\s\+[!#$%&*+./<>?@\\^|~-]\+\s*$'
let l:s = match(l:prevline, '\S')
if l:s > 0
return l:s + &shiftwidth
endif
endif
if l:prevline =~ '[{([][^})\]]\+$'
return match(l:prevline, '[{([]')
endif endif
" let foo =
" >>>>>>bar
if l:prevline =~ '\C\<let\>\s\+[^=]\+=\s*$' if l:prevline =~ '\C\<let\>\s\+[^=]\+=\s*$'
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + &shiftwidth return match(l:prevline, '\C\<let\>') + g:haskell_indent_let + &shiftwidth
endif endif
if l:prevline =~ '\C\<let\>\s\+.\+\(\<in\>\)\?\s*$' " let x = 1 in
" >>>>x
if l:prevline =~ '\C\<let\>\s\+.\+\<in\>\?$' && l:line !~ '\C^\s*\<in\>'
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let return match(l:prevline, '\C\<let\>') + g:haskell_indent_let
endif endif
" let x = 1
" let y = 2
"
" let x = 1
" >in x
"
" let x = 1
" >>>>y = 2
if l:prevline =~ '\C\<let\>\s\+.\+$'
if l:line =~ '\C^\s*\<let\>'
return match(l:prevline, '\C\<let\>')
elseif l:line =~ '\C^\s*\<in\>'
return match(l:prevline, '\C\<let\>') + g:haskell_indent_in
else
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let
endif
endif
" if handling
if l:prevline !~ '\C\<else\>' if l:prevline !~ '\C\<else\>'
let l:s = match(l:prevline, '\C\<if\>.*\&.*\zs\<then\>') let l:s = match(l:prevline, '\C\<if\>.*\&.*\zs\<then\>')
if l:s > 0 if l:s > 0
@ -157,30 +189,252 @@ function! GetHaskellIndent()
endif endif
endif endif
if l:prevline =~ '\C\(\<where\>\|\<do\>\|=\|[{([]\)\s*$' " where
" >>foo
"
" do
" >>foo
"
" foo =
" >>bar
if l:prevline =~ '\C\(\<where\>\|\<do\>\|=\)\s*$'
return match(l:prevline, '\S') + &shiftwidth return match(l:prevline, '\S') + &shiftwidth
endif endif
"" where foo
"" >>>>>>bar
if l:prevline =~ '\C\<where\>\s\+\S\+.*$' if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
return match(l:prevline, '\C\<where\>') + g:haskell_indent_where if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
return match(l:prevline, ':: ')
else
return match(l:prevline, '\C\<where\>') + g:haskell_indent_where
endif
endif endif
" do foo
" >>>bar
if l:prevline =~ '\C\<do\>\s\+\S\+.*$' if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
return match(l:prevline, '\C\<do\>') + g:haskell_indent_do return match(l:prevline, '\C\<do\>') + g:haskell_indent_do
endif endif
if l:prevline =~ '\C^\s*\<data\>\s\+[^=]\+\s\+=\s\+\S\+.*$' " case foo of
if l:line =~ '^\s*|' " >>bar -> quux
return match(l:prevline, '=') if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
endif
endif
if l:prevline =~ '\C\<case\>\s\+.\+\<of\>\s*$'
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
endif endif
if l:prevline =~ '\C^\s*\<\data\>\s\+\S\+\s*$' " newtype Foo = Foo
return match(l:prevline, '\C\<data\>') + &shiftwidth " >>deriving
if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
return match(l:prevline, '\S') + &shiftwidth
endif
" foo :: Int
" >>>>-> Int
"
" foo
" :: Int
" foo
if l:prevline =~ '\s::\s'
if l:line =~ '^\s*[-=]>'
return match(l:prevline, '::\s')
elseif match(l:prevline, '^\s\+::') > -1
return match(l:prevline, '::\s') - &shiftwidth
endif
endif
" foo :: Int
" -> Int
" foo x
"
" foo
" :: Int
" -> Int
" foo x
if l:prevline =~ '^\s*[-=]>' && l:line !~ '^\s*[-=]>'
if s:isInBlock(l:hlstack)
return match(l:prevline, '[^\s-=>]')
else
let l:m = matchstr(l:line, '^\s*\zs\<\S\+\>\ze')
let l:l = l:prevline
let l:c = 1
while v:lnum != l:c
" fun decl
let l:s = match(l:l, l:m)
if l:s >= 0
if match(l:l, '\C^\s*\<default\>') > -1
return l:s - 8
else
return l:s
endif
" empty line, stop looking
elseif l:l =~ '^$'
return 0
endif
let l:c += 1
let l:l = getline(v:lnum - l:c)
endwhile
return 0
endif
endif
" | otherwise = ...
" foo
"
" | foo
" >>, bar
"
" | foo
" >>= bar
"
" | Foo
" >>deriving
if l:prevline =~ '^\s\+|' && !s:isInBlock(l:hlstack)
if l:line =~ '\s*[,=]'
return match(l:prevline, '|')
elseif l:line =~ '\C^\s*\<deriving\>'
return match(l:prevline, '|')
elseif l:line !~ '^\s*|'
return match(l:prevline, '|') - g:haskell_indent_guard
endif
endif
" foo :: ( Monad m
" , Functor f
" )
">>>>>=> Int
if l:prevline =~ '^\s*)' && l:line =~ '^\s*=>'
let l:s = match(l:prevline, ')')
return l:s - (&shiftwidth + 1)
endif
" module Foo
" >>( bar
if l:prevline =~ '\C^\<module\>'
return &shiftwidth
endif
" foo
" >>{
if l:line =~ '^\s*{' && l:prevline !~ '^{'
return match(l:prevline, '\S') + &shiftwidth
endif
" in foo
" where bar
if l:line =~ '\C^\s*\<where\>'
if match(l:prevline, '\C^\s\+in\s\+') == 0
return match(l:prevline, 'in') - g:haskell_indent_in
endif
return match(l:prevline, '\S') + &shiftwidth
endif
" let x = 1
" y = 2
" >in x + 1
if l:line =~ '\C^\s*\<in\>'
return match(l:prevline, '\S') - (4 - g:haskell_indent_in)
endif
" data Foo
" >>= Bar
"
" |
" ...
" >>=
"
" foo
" >>=
if l:line =~ '^\s*='
if l:prevline =~ '\C^\<data\>\s\+[^=]\+\s*$'
return match(l:prevline, '\C\<data\>') + &shiftwidth
else
let l:s = s:indentGuard(match(l:line, '='), l:prevline)
if l:s > 0
return l:s
else
return &shiftwidth
endif
endif
endif
" { foo :: Int
" >>,
"
" |
" ...
" >>,
if l:line =~ '^\s*,'
if s:isInBlock(l:hlstack)
normal! 0
call search(',', 'cW')
let l:n = s:getNesting(s:getHLStack())
call search('[(\[{]', 'bW')
while l:n != s:getNesting(s:getHLStack())
call search('[(\[{]', 'bW')
endwhile
return col('.') - 1
else
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
if l:s > -1
return l:s
end
endif
endif
" |
" ...
" >>|
"
" data Foo = Bar
" >>>>>>>>>|
if l:line =~ '^\s*|\s'
if l:prevline =~ '\C^\s*\<data\>.\+=.\+$'
return match(l:prevline, '=')
else
let l:s = s:indentGuard(match(l:line, '|'), l:prevline)
if l:s > -1
return l:s
endif
endif
endif
" foo
" >>:: Int
if l:line =~ '^\s*::\s'
return match(l:prevline, '\S') + &shiftwidth
endif
" indent closing brace, paren or bracket
if l:line =~ '^\s*}'
return s:indentMatching('}')
endif
if l:line =~ '^\s*)'
return s:indentMatching(')')
endif
if l:line =~ '^\s*]'
return s:indentMatching(']')
endif
"
" indent import
if l:line =~ '\C^\s*import'
return 0
endif
" do not reindent indented lines
if match(l:prevline, '\S') < match(l:line, '\S')
return -1
endif
if l:line !~ '^\s*[=-]>\s' && l:line =~ '^\s*[!#$%&*+./<>?@\\^|~-]\+'
return -1
endif endif
return match(l:prevline, '\S') return match(l:prevline, '\S')

View File

@ -177,7 +177,24 @@ call add(s:tags, 'tr')
call add(s:tags, 'th') call add(s:tags, 'th')
call add(s:tags, 'td') call add(s:tags, 'td')
let s:no_tags = []
call add(s:no_tags, 'base')
call add(s:no_tags, 'link')
call add(s:no_tags, 'meta')
call add(s:no_tags, 'hr')
call add(s:no_tags, 'br')
call add(s:no_tags, 'wbr')
call add(s:no_tags, 'img')
call add(s:no_tags, 'embed')
call add(s:no_tags, 'param')
call add(s:no_tags, 'source')
call add(s:no_tags, 'track')
call add(s:no_tags, 'area')
call add(s:no_tags, 'col')
call add(s:no_tags, 'input')
call add(s:no_tags, 'keygen')
call add(s:no_tags, 'menuitem')
let s:omittable = [ let s:omittable = [
\ ['address', 'article', 'aside', 'blockquote', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'], \ ['address', 'article', 'aside', 'blockquote', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'],
@ -187,16 +204,21 @@ let s:omittable = [
\ ['th', 'td'], \ ['th', 'td'],
\] \]
let s:html_noindent_tags = join(s:no_tags, '\|')
if exists('g:html_exclude_tags') if exists('g:html_exclude_tags')
for tag in g:html_exclude_tags for tag in g:html_exclude_tags
call remove(s:tags, index(s:tags, tag)) call remove(s:tags, index(s:tags, tag))
endfor endfor
let s:html_noindent_tags = s:html_noindent_tags.'\|'.join(g:html_exclude_tags, '\|')
endif endif
let s:html_indent_tags = join(s:tags, '\|')
let s:html_indent_tags = s:html_indent_tags.'\|\w\+\(-\w\+\)\+' " let s:html_indent_tags = join(s:tags, '\|')
if exists('g:html_indent_tags') let s:html_indent_tags = '[a-z_][a-z0-9_.-]*'
let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags " if exists('g:html_indent_tags')
endif " let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags
" endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo-=C set cpo-=C
@ -231,8 +253,8 @@ endfun
fun! <SID>HtmlIndentSum(lnum, style) fun! <SID>HtmlIndentSum(lnum, style)
if a:style == match(getline(a:lnum), '^\s*</') if a:style == match(getline(a:lnum), '^\s*</')
if a:style == match(getline(a:lnum), '^\s*</\<\('.s:html_indent_tags.'\)\>') if a:style == match(getline(a:lnum), '^\s*</\<\('.s:html_indent_tags.'\)\>')
let open = <SID>HtmlIndentOpen(a:lnum, 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) let close = <SID>HtmlIndentClose(a:lnum, s:html_indent_tags) - <SID>HtmlIndentClose(a:lnum, s:html_noindent_tags)
if 0 != open || 0 != close if 0 != open || 0 != close
return open - close return open - close
endif endif

View File

@ -56,10 +56,11 @@ function! GetLiquidIndent(...)
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') let sw = exists('*shiftwidth') ? shiftwidth() : &sw
let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
let ind -= &sw * s:count(cline,'{%\s*end\w*$') let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
let ind -= sw * s:count(cline,'{%\s*end\w*$')
return ind return ind
endfunction endfunction

View File

@ -1,9 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
" Vim indent file " Vim indent file
" Language: Jade " Language: Pug
" Maintainer: Joshua Borton " Maintainer: Joshua Borton
" Credits: Tim Pope (vim-jade) " Credits: Tim Pope (vim-pug)
" Last Change: 2010 Sep 22 " Last Change: 2010 Sep 22
if exists("b:did_indent") if exists("b:did_indent")
@ -14,25 +14,25 @@ unlet! b:did_indent
let b:did_indent = 1 let b:did_indent = 1
setlocal autoindent setlocal autoindent
setlocal indentexpr=GetJadeIndent() setlocal indentexpr=GetPugIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F setlocal indentkeys=o,O,*<Return>,},],0),!^F
" Only define the function once. " Only define the function once.
if exists("*GetJadeIndent") if exists("*GetPugIndent")
finish finish
endif endif
let s:attributes = '\%((.\{-\})\)' let s:attributes = '\%((.\{-\})\)'
let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*' let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
if !exists('g:jade_self_closing_tags') if !exists('g:pug_self_closing_tags')
let g:jade_self_closing_tags = 'meta|link|img|hr|br|input' let g:pug_self_closing_tags = 'meta|link|img|hr|br|input'
endif endif
setlocal formatoptions+=r setlocal formatoptions+=r
setlocal comments+=n:\| setlocal comments+=n:\|
function! GetJadeIndent() function! GetPugIndent()
let lnum = prevnonblank(v:lnum-1) let lnum = prevnonblank(v:lnum-1)
if lnum == 0 if lnum == 0
return 0 return 0
@ -60,9 +60,9 @@ function! GetJadeIndent()
return increase return increase
elseif line == '-#' elseif line == '-#'
return increase return increase
elseif line =~? '^\v%('.g:jade_self_closing_tags.')>' elseif line =~? '^\v%('.g:pug_self_closing_tags.')>'
return indent return indent
elseif group =~? '\v^%(jadeAttributesDelimiter|jadeClass|jadeId|htmlTagName|htmlSpecialTagName|jadeFilter|jadeTagBlockChar)$' elseif group =~? '\v^%(pugAttributesDelimiter|pugClass|pugId|htmlTagName|htmlSpecialTagName|pugFilter|pugTagBlockChar)$'
return increase return increase
else else
return indent return indent

View File

@ -125,7 +125,7 @@ let s:indent_access_modifier_regex = '\C^\s*\%(protected\|private\)\s*\%(#.*\)\=
" The reason is that the pipe matches a hanging "|" operator. " The reason is that the pipe matches a hanging "|" operator.
" "
let s:block_regex = let s:block_regex =
\ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$' \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|[^|]*|\)\=\s*\%(#.*\)\=$'
let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex

View File

@ -31,9 +31,7 @@ function! GetSassIndent()
let indent = indent(lnum) let indent = indent(lnum)
let cindent = indent(v:lnum) let cindent = indent(v:lnum)
if line !~ s:property && line !~ s:extend && cline =~ s:property if line !~ s:property && line !~ s:extend && cline =~ s:property
return indent + &sw return indent + (exists('*shiftwidth') ? shiftwidth() : &sw)
"elseif line =~ s:property && cline !~ s:property
"return indent - &sw
else else
return -1 return -1
endif endif

View File

@ -80,11 +80,17 @@ endif
syn keyword ansible_debug_keywords debug containedin=yamlBlockMappingKey contained syn keyword ansible_debug_keywords debug containedin=yamlBlockMappingKey contained
highlight link ansible_debug_keywords Debug highlight link ansible_debug_keywords Debug
syn match ansible_with_keywords "\vwith_.+" containedin=yamlBlockMappingKey contained if exists("g:ansible_extra_keywords_highlight")
syn keyword ansible_extra_special_keywords register always_run changed_when failed_when no_log args vars delegate_to ignore_errors containedin=yamlBlockMappingKey contained
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 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_with_keywords Statement
highlight link ansible_special_keywords Statement highlight link ansible_special_keywords Statement
syn match ansible_with_keywords "\vwith_.+" containedin=yamlBlockMappingKey contained
highlight link ansible_with_keywords Statement
let b:current_syntax = "ansible" let b:current_syntax = "ansible"
endif endif

View File

@ -25,14 +25,16 @@ syn region bladeEcho matchgroup=bladeDelimiter start="@\@<!{{" end="}}"
syn region bladeEcho matchgroup=bladeDelimiter start="{!!" end="!!}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend syn region bladeEcho matchgroup=bladeDelimiter start="{!!" end="!!}" contains=@bladePhp,bladePhpParenBlock containedin=ALLBUT,@bladeExempt keepend
syn region bladeComment matchgroup=bladeDelimiter start="{{--" end="--}}" contains=bladeTodo containedin=ALLBUT,@bladeExempt keepend syn region bladeComment matchgroup=bladeDelimiter start="{{--" end="--}}" contains=bladeTodo containedin=ALLBUT,@bladeExempt keepend
syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @include @each @inject @extends @section @unless nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @include @each @inject @extends @section @stack @push @unless @yield @parent @hasSection nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan @stop @append @endsection containedin=ALLBUT,@bladeExempt syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan @stop @append @endsection @endpush @show containedin=ALLBUT,@bladeExempt
syn region bladePhpParenBlock matchgroup=bladeDelimiter start="\s*(" end=")" contains=@bladePhp,bladePhpParenBlock skipwhite contained syn region bladePhpParenBlock matchgroup=bladeDelimiter start="\s*(" end=")" contains=@bladePhp,bladePhpParenBlock skipwhite contained
syn cluster bladePhp contains=@phpClTop syn cluster bladePhp contains=@phpClTop
syn cluster bladeExempt contains=bladeComment,@htmlTop syn cluster bladeExempt contains=bladeComment,@htmlTop
syn cluster htmlPreproc add=bladeEcho,bladeComment
syn keyword bladeTodo todo fixme xxx contained syn keyword bladeTodo todo fixme xxx contained
hi def link bladeDelimiter PreProc hi def link bladeDelimiter PreProc

View File

@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
" Vim syntax file " Vim syntax file
" Language: C " Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2015 Mar 05 " Last Change: 2016 Apr 10
" Quit when a (custom) syntax file was already loaded " Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax") if exists("b:current_syntax")
@ -250,6 +250,10 @@ if !exists("c_no_c99") " ISO C99
syn keyword cType _Bool bool _Complex complex _Imaginary imaginary syn keyword cType _Bool bool _Complex complex _Imaginary imaginary
syn keyword cType int8_t int16_t int32_t int64_t syn keyword cType int8_t int16_t int32_t int64_t
syn keyword cType uint8_t uint16_t uint32_t uint64_t syn keyword cType uint8_t uint16_t uint32_t uint64_t
if !exists("c_no_bsd")
" These are BSD specific.
syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t
endif
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
@ -266,7 +270,7 @@ syn keyword cStorageClass static register auto volatile extern const
if exists("c_gnu") if exists("c_gnu")
syn keyword cStorageClass inline __attribute__ syn keyword cStorageClass inline __attribute__
endif endif
if !exists("c_no_c99") if !exists("c_no_c99") && s:ft !=# 'cpp'
syn keyword cStorageClass inline restrict syn keyword cStorageClass inline restrict
endif endif
if !exists("c_no_c11") if !exists("c_no_c11")

View File

@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
" Language: C++ " Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
" Last Change: 2015 Sep 23 " Last Change: 2015 Nov 10
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded " For version 6.x: Quit when a syntax file was already loaded

View File

@ -70,21 +70,16 @@ catch /^.*/
syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*" syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
endtry endtry
" digits " digits and units
syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=%\=" contains=cssUnitDecorators
syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators syn match cssValue contained transparent "[-+]\=\d\+\(\.\d*\)\=\([a-z]\+\)\=\>" contains=cssUnitDecorators,cssValueNumber
syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators
syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators
syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators
syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators
syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained
" @media " @media
syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock 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 cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl
syn keyword cssMediaKeyword only not and contained 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 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 syn match cssMediaComma "," skipwhite skipnl contained
" Reference: http://www.w3.org/TR/css3-mediaqueries/ " Reference: http://www.w3.org/TR/css3-mediaqueries/
@ -99,7 +94,7 @@ syn keyword cssMediaAttr contained portrait landscape progressive interlace
" http://www.w3.org/TR/css3-page/ " http://www.w3.org/TR/css3-page/
syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl
syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained 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 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 match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl
syn keyword cssPageProp contained content size syn keyword cssPageProp contained content size
" http://www.w3.org/TR/CSS2/page.html#break-inside " http://www.w3.org/TR/CSS2/page.html#break-inside
@ -109,7 +104,7 @@ syn keyword cssPageProp contained orphans widows
" http://www.w3.org/TR/css3-animations/#keyframes " http://www.w3.org/TR/css3-animations/#keyframes
syn match cssKeyFrame "@\(-[a-z]\+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent 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 region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector
syn match cssKeyFrameSelector /\(\d*%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition syn match cssKeyFrameSelector /\([-+]\=\d\+\(\.\d*\)\=%\|from\|to\)\=/ contained skipwhite skipnl nextgroup=cssDefinition
" @import " @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=/@import\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType
@ -119,7 +114,7 @@ syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssSt
" @font-face " @font-face
" http://www.w3.org/TR/css3-fonts/#at-font-face-rule " http://www.w3.org/TR/css3-fonts/#at-font-face-rule
syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl 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 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 match cssFontDescriptorProp contained "\<font-family\>"
syn keyword cssFontDescriptorProp contained src syn keyword cssFontDescriptorProp contained src
@ -188,10 +183,10 @@ syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators
syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" 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 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=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma 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,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction 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,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma 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,cssValueNumber,cssValueLength,cssValueAngle,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 keyword cssGradientAttr contained top bottom left right cover center middle ellipse at
syn match cssFunctionComma contained "," syn match cssFunctionComma contained ","
@ -277,7 +272,7 @@ syn keyword cssFlexibleBoxProp contained order
syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>" syn match cssFlexibleBoxAttr contained "\<\(row\|column\|wrap\)\(-reverse\)\=\>"
syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center syn keyword cssFlexibleBoxAttr contained nowrap stretch baseline center
syn match cssFlexibleBoxAttr contained "\<flex-\(start\|end\)\>" syn match cssFlexibleBoxAttr contained "\<flex\(-\(start\|end\)\)\=\>"
syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\)\)\=\>" syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\)\)\=\>"
" CSS Fonts Module Level 3 " CSS Fonts Module Level 3
@ -319,8 +314,8 @@ syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>"
syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>" syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>"
syn keyword cssMultiColumnProp contained columns syn keyword cssMultiColumnProp contained columns
syn keyword cssMultiColumnAttr contained balance medium syn keyword cssMultiColumnAttr contained balance medium
syn keyword cssMultiColumnAttr contained always avoid left right page column syn keyword cssMultiColumnAttr contained always left right page column
syn match cssMultiColumnAttr contained "\<avoid-\(page\|column\)\>" syn match cssMultiColumnAttr contained "\<avoid\(-\(page\|column\)\)\=\>"
" http://www.w3.org/TR/css3-break/#page-break " http://www.w3.org/TR/css3-break/#page-break
syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>" syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
@ -357,7 +352,7 @@ syn match cssPositioningAttr contained "\<list-item\>"
syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\)\)\=\>" syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\)\)\=\>"
syn keyword cssPositioningAttr contained static relative absolute fixed syn keyword cssPositioningAttr contained static relative absolute fixed
syn keyword cssPrintAttr contained landscape portrait crop cross always avoid syn keyword cssPrintAttr contained landscape portrait crop cross always
syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>" 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 cssTableAttr contained fixed collapse separate show hide once always
@ -430,6 +425,10 @@ syn keyword cssUIAttr contained both horizontal vertical
syn match cssUIProp contained "\<text-overflow\>" syn match cssUIProp contained "\<text-overflow\>"
syn keyword cssUIAttr contained clip ellipsis 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 " Already highlighted Props: font content
"------------------------------------------------ "------------------------------------------------
" Webkit/iOS specific attributes " Webkit/iOS specific attributes
@ -469,7 +468,7 @@ syn match cssMobileTextProp contained "\<text-size-adjust\>"
syn match cssBraces contained "[{}]" syn match cssBraces contained "[{}]"
syn match cssError 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 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 cssBraceError "}"
syn match cssAttrComma "," syn match cssAttrComma ","
@ -488,7 +487,7 @@ syn match cssPseudoClassId contained "\<focus\(-inner\)\=\>"
syn match cssPseudoClassId contained "\<\(input-\)\=placeholder\>" syn match cssPseudoClassId contained "\<\(input-\)\=placeholder\>"
" Misc highlight groups " 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 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 /\(:\|;\|\/\)/ syntax match cssNoise contained /\(:\|;\|\/\)/
" Comment " Comment
@ -513,11 +512,11 @@ syn match cssHacks contained /\(_\|*\)/
" Attr Enhance " Attr Enhance
" Some keywords are both Prop and Attr, so we have to handle them " 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 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 " Hack for transition
" 'transition' has Props after ':'. " '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 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" if main_syntax == "css"
@ -612,12 +611,7 @@ if version >= 508 || !exists("did_css_syn_inits")
HiLink cssPseudoClassId PreProc HiLink cssPseudoClassId PreProc
HiLink cssPseudoClassLang Constant HiLink cssPseudoClassLang Constant
HiLink cssValueLength Number
HiLink cssValueInteger Number
HiLink cssValueNumber Number HiLink cssValueNumber Number
HiLink cssValueAngle Number
HiLink cssValueTime Number
HiLink cssValueFrequency Number
HiLink cssFunction Constant HiLink cssFunction Constant
HiLink cssURL String HiLink cssURL String
HiLink cssFunctionName Function HiLink cssFunctionName Function

View File

@ -33,7 +33,7 @@ syn keyword elixirSelf self
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>'
" This unfortunately also matches function names in function calls " This unfortunately also matches function names in function calls
syn match elixirUnusedVariable '\<_\w*\>' syn match elixirUnusedVariable '\(([^)]*\)\@<=\<_\w*\>'
syn keyword elixirOperator and not or when xor in syn keyword elixirOperator and not or when xor in
syn match elixirOperator '!==\|!=\|!' syn match elixirOperator '!==\|!=\|!'
@ -52,7 +52,7 @@ syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)' syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!" syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
syn match elixirAlias '\<[A-Z]\w*\(\.[A-Z]\w*\)*\>' syn match elixirAlias '\<[!]\?[A-Z]\w*\(\.[A-Z]\w*\)*\>'
syn keyword elixirBoolean true false nil syn keyword elixirBoolean true false nil
@ -187,4 +187,6 @@ hi def link elixirRegexDelimiter Delimiter
hi def link elixirInterpolationDelimiter Delimiter hi def link elixirInterpolationDelimiter Delimiter
hi def link elixirSigilDelimiter Delimiter hi def link elixirSigilDelimiter Delimiter
let b:current_syntax = "elixir"
endif endif

View File

@ -79,8 +79,8 @@ syn match erlangAtom '\<\l[[:alnum:]_@]*' contains=erlangBoolean
syn keyword erlangBoolean true false contained syn keyword erlangBoolean true false contained
syn match erlangLocalFuncCall '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangBIF syn match erlangLocalFuncCall '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangBIF
syn match erlangLocalFuncRef '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' syn match erlangLocalFuncRef '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@='
syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment,erlangVariable
syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment,erlangVariable
" Variables, macros, records, maps " Variables, macros, records, maps
syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*' syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*'

View File

@ -14,7 +14,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
" let OPTION_NAME = 1 " let OPTION_NAME = 1
" to enable particular options. " to enable particular options.
" At present, all options default to on, except highlight of: " At present, all options default to on, except highlight of:
" functions, methods and structs. " functions, methods, structs, operators, build constraints and interfaces.
" "
" - go_highlight_array_whitespace_error " - go_highlight_array_whitespace_error
" Highlights white space after "[]". " Highlights white space after "[]".
@ -29,6 +29,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
" Highlights trailing white space. " Highlights trailing white space.
" - go_highlight_string_spellcheck " - go_highlight_string_spellcheck
" Specifies that strings should be spell checked " 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 " Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax") if exists("b:current_syntax")
@ -83,6 +85,14 @@ if !exists("g:go_highlight_string_spellcheck")
let g:go_highlight_string_spellcheck = 1 let g:go_highlight_string_spellcheck = 1
endif endif
if !exists("g:go_highlight_format_strings")
let g:go_highlight_format_strings = 1
endif
if !exists("g:go_highlight_generate_tags")
let g:go_highlight_generate_tags = 0
endif
syn case match syn case match
syn keyword goDirective package import syn keyword goDirective package import
@ -134,11 +144,18 @@ hi def link goBoolean Boolean
syn keyword goTodo contained TODO FIXME XXX BUG syn keyword goTodo contained TODO FIXME XXX BUG
syn cluster goCommentGroup contains=goTodo syn cluster goCommentGroup contains=goTodo
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell
syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell
hi def link goComment Comment hi def link goComment Comment
hi def link goTodo Todo hi def link goTodo Todo
if g:go_highlight_generate_tags != 0
syn match goGenerateVariables contained /\(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/
syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables
hi def link goGenerate PreProc
hi def link goGenerateVariables Special
endif
" Go escapes " Go escapes
syn match goEscapeOctal display contained "\\[0-7]\{3}" syn match goEscapeOctal display contained "\\[0-7]\{3}"
syn match goEscapeC display contained +\\[abfnrtv\\'"]+ syn match goEscapeC display contained +\\[abfnrtv\\'"]+
@ -164,11 +181,14 @@ else
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
syn region goRawString start=+`+ end=+`+ syn region goRawString start=+`+ end=+`+
endif endif
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
if g:go_highlight_format_strings != 0
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
hi def link goFormatSpecifier goSpecialString
endif
hi def link goString String hi def link goString String
hi def link goRawString String hi def link goRawString String
hi def link goFormatSpecifier goSpecialString
" Characters; their contents " Characters; their contents
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
@ -181,30 +201,31 @@ syn region goBlock start="{" end="}" transparent fold
syn region goParen start='(' end=')' transparent syn region goParen start='(' end=')' transparent
" Integers " Integers
syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>" syn match goDecimalInt "\<-\=\d\+\%([Ee][-+]\=\d\+\)\=\>"
syn match goHexadecimalInt "\<0x\x\+\>" syn match goHexadecimalInt "\<-\=0[xX]\x\+\>"
syn match goOctalInt "\<0\o\+\>" syn match goOctalInt "\<-\=0\o\+\>"
syn match goOctalError "\<0\o*[89]\d*\>" syn match goOctalError "\<-\=0\o*[89]\d*\>"
hi def link goDecimalInt Integer hi def link goDecimalInt Integer
hi def link goHexadecimalInt Integer hi def link goHexadecimalInt Integer
hi def link goOctalInt Integer hi def link goOctalInt Integer
hi def link goOctalError Error
hi def link Integer Number hi def link Integer Number
" Floating point " Floating point
syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" syn match goFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=\>"
syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>" syn match goFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=\>"
syn match goFloat "\<\d\+[Ee][-+]\d\+\>"
hi def link goFloat Float hi def link goFloat Float
" Imaginary literals " Imaginary literals
syn match goImaginary "\<\d\+i\>" syn match goImaginary "\<-\=\d\+i\>"
syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" syn match goImaginary "\<-\=\d\+[Ee][-+]\=\d\+i\>"
syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" syn match goImaginaryFloat "\<-\=\d\+\.\d*\%([Ee][-+]\=\d\+\)\=i\>"
syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>" syn match goImaginaryFloat "\<-\=\.\d\+\%([Ee][-+]\=\d\+\)\=i\>"
hi def link goImaginary Number hi def link goImaginary Number
hi def link goImaginaryFloat Float
" Spaces after "[]" " Spaces after "[]"
if g:go_highlight_array_whitespace_error != 0 if g:go_highlight_array_whitespace_error != 0

22
syntax/godefstack.vim Normal file
View File

@ -0,0 +1,22 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
if exists("b:current_syntax")
finish
endif
syn match godefStackComment '^".*'
syn match godefLinePrefix '^[>\s]\s' nextgroup=godefStackEntryNumber contains=godefStackCurrentPosition
syn match godefStackEntryNumber '\d\+' nextgroup=godefStackFilename skipwhite
syn match godefStackCurrentPosition '>' contained
syn match godefStackFilename '[^|]\+' contained nextgroup=godefStackEntryLocation
syn region godefStackEntryLocation oneline start='|' end='|' contained contains=godefStackEntryLocationNumber
syn match godefStackEntryLocationNumber '\d\+' contained display
let b:current_syntax = "godefstack"
hi def link godefStackComment Comment
hi def link godefStackCurrentPosition Special
hi def link godefStackFilename Directory
hi def link godefStackEntryLocationNumber LineNr
endif

View File

@ -1,51 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
if exists("b:current_syntax")
finish
endif
syn case match
syn match godocTitle "^\([A-Z][A-Z ]*\)$"
hi def link godocTitle Title
" Single Line Definitions
syn match godocMethodRec /\i\+\ze)/ contained
syn match godocMethodName /) \zs\i\+\ze(/ contained
syn match godocMethod /^func \((\i\+ [^)]*)\) \i\+(/ contains=godocMethodRec,godocMethodName
syn match godocFunction /^func \zs\i\+\ze(/
syn match godocType /^type \zs\i\+\ze.*/
syn match godocVar /^var \zs\i\+\ze.*/
syn match godocConst /^const \zs\i\+\ze.*/
hi def link godocMethodRec Type
hi def link godocType Type
hi def link godocMethodName Function
hi def link godocFunction Function
hi def link godocVar Identifier
hi def link godocConst Identifier
" Definition Blocks
syn region godocComment start="/\*" end="\*/" contained
syn region godocComment start="//" end="$" contained
syn match godocDefinition /^\s\+\i\+/ contained
syn region godocVarBlock start=/^var (/ end=/^)/ contains=godocComment,godocDefinition
syn region godocConstBlock start=/^const (/ end=/^)/ contains=godocComment,godocDefinition
syn region godocTypeBlock start=/^type \i\+ \(interface\|struct\) {/ end=/^}/ matchgroup=godocType contains=godocComment,godocType
hi def link godocComment Comment
hi def link godocDefinition Identifier
syn sync minlines=500
let b:current_syntax = "godoc"
" vim:ts=4 sts=2 sw=2:
endif

View File

@ -68,7 +68,7 @@ syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goIn
syn keyword gotplControl contained if else end range with template syn keyword gotplControl contained if else end range with template
syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge
syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/ syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/
syn match goTplIdentifier contained /\.[^\s}]*\>/ syn match goTplIdentifier contained /\.[^\s}]+\>/
hi def link gotplControl Keyword hi def link gotplControl Keyword
hi def link gotplFunctions Function hi def link gotplFunctions Function

View File

@ -19,16 +19,17 @@ syn match haskellRecordField contained containedin=haskellBlock
\ haskellIdentifier, \ haskellIdentifier,
\ haskellOperators, \ haskellOperators,
\ haskellSeparator, \ haskellSeparator,
\ haskellParens, \ haskellParens
syn match haskellTypeSig syn match haskellTypeSig
\ "^\s*\(where\s\+\|let\s\+\|default\s\+\)\?[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)" \ "^\s*\(where\s\+\|let\s\+\|default\s\+\)\?[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
\ contains= \ contains=
\ haskellWhere, \ haskellWhere,
\ haskellLet, \ haskellLet,
\ haskellDefault,
\ haskellIdentifier, \ haskellIdentifier,
\ haskellOperators, \ haskellOperators,
\ haskellSeparator, \ haskellSeparator,
\ haskellParens, \ haskellParens
syn keyword haskelLWhere where syn keyword haskelLWhere where
syn keyword haskellLet let syn keyword haskellLet let
syn keyword haskellDeclKeyword module class instance newtype deriving in syn keyword haskellDeclKeyword module class instance newtype deriving in
@ -50,8 +51,8 @@ syn match haskellImport "^\<import\>\s\+\(\<safe\>\s\+\)\?\(\<qualified\>\s\+\)\
\ haskellType, \ haskellType,
\ haskellLineComment, \ haskellLineComment,
\ haskellBlockComment, \ haskellBlockComment,
\ haskellPragma, \ haskellPragma
syn keyword haskellStatement do case of syn keyword haskellKeyword do case of
if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1 if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1
syn keyword haskellStatic static syn keyword haskellStatic static
endif endif
@ -122,22 +123,18 @@ endif
highlight def link haskellBottom Macro highlight def link haskellBottom Macro
highlight def link haskellTH Boolean highlight def link haskellTH Boolean
highlight def link haskellBlockKeywords Structure
highlight def link haskellIdentifier Identifier highlight def link haskellIdentifier Identifier
highlight def link haskellForeignKeywords Structure highlight def link haskellForeignKeywords Structure
highlight def link haskellDeriving Structure highlight def link haskellKeyword Keyword
highlight def link haskellStatement Statement highlight def link haskellDefault Keyword
highlight def link haskellDefault Statement
highlight def link haskellConditional Conditional highlight def link haskellConditional Conditional
highlight def link haskellNumber Number highlight def link haskellNumber Number
highlight def link haskellFloat Float highlight def link haskellFloat Float
highlight def link haskellSeparator Delimiter highlight def link haskellSeparator Delimiter
highlight def link haskellDelimiter Delimiter highlight def link haskellDelimiter Delimiter
highlight def link haskellInfix PreProc highlight def link haskellInfix Keyword
highlight def link haskellOperators Operator highlight def link haskellOperators Operator
highlight def link haskellQuote Operator highlight def link haskellQuote Operator
highlight def link haskellQuotedType Include
highlight def link haskellType Include
highlight def link haskellShebang Comment highlight def link haskellShebang Comment
highlight def link haskellLineComment Comment highlight def link haskellLineComment Comment
highlight def link haskellBlockComment Comment highlight def link haskellBlockComment Comment
@ -145,34 +142,56 @@ highlight def link haskellPragma SpecialComment
highlight def link haskellString String highlight def link haskellString String
highlight def link haskellChar String highlight def link haskellChar String
highlight def link haskellBacktick Operator highlight def link haskellBacktick Operator
highlight def link haskellPreProc Macro
highlight def link haskellTodo Todo
highlight def link haskellAssocType Structure
highlight def link haskellImportBlock Delimiter
highlight def link haskellImportKeywords Structure
highlight def link haskellDeclKeyword Structure
highlight def link haskellDecl Structure
highlight def link haskellWhere Structure
highlight def link haskellLet Structure
highlight def link haskellQuasiQuoted String highlight def link haskellQuasiQuoted String
highlight def link haskellTodo Todo
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
highlight def link haskellPreProc PreProc
highlight def link haskellAssocType Type
highlight def link haskellImportKeywords Include
highlight def link haskellDeclKeyword Keyword
highlight def link haskellDecl Keyword
highlight def link haskellWhere Keyword
highlight def link haskellLet Keyword
highlight def link haskellQuotedType Type
highlight def link haskellType Type
else
highlight def link haskellPreProc Macro
highlight def link haskellAssocType Structure
highlight def link haskellImportKeywords Structure
highlight def link haskellDeclKeyword Structure
highlight def link haskellDecl Structure
highlight def link haskellWhere Structure
highlight def link haskellLet Structure
highlight def link haskellQuotedType Include
highlight def link haskellType Include
endif
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1 if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
highlight def link haskellForall Operator highlight def link haskellForall Operator
endif endif
if exists('g:haskell_enable_recursivedo') && g:haskell_enable_recursivedo == 1 if exists('g:haskell_enable_recursivedo') && g:haskell_enable_recursivedo == 1
highlight def link haskellRecursiveDo Operator highlight def link haskellRecursiveDo Keyword
endif endif
if exists('g:haskell_enable_arrowsyntax') && g:haskell_enable_arrowsyntax == 1 if exists('g:haskell_enable_arrowsyntax') && g:haskell_enable_arrowsyntax == 1
highlight def link haskellArrowSyntax Operator highlight def link haskellArrowSyntax Keyword
endif
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
highlight def link haskellPatternKeyword Structure
endif
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
highlight def link haskellTypeRoles Structure
endif endif
if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1 if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1
highlight def link haskellStatic Statement highlight def link haskellStatic Keyword
endif
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
highlight def link haskellPatternKeyword Keyword
endif
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
highlight def link haskellTypeRoles Keyword
endif
else
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
highlight def link haskellPatternKeyword Structure
endif
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
highlight def link haskellTypeRoles Structure
endif
endif endif
let b:current_syntax = "haskell" let b:current_syntax = "haskell"

View File

@ -1,108 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
" Vim syntax file
" Language: Jade
" Maintainer: Joshua Borton
" Credits: Tim Pope
" Filenames: *.jade
if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'jade'
endif
silent! syntax include @htmlCoffeescript syntax/coffee.vim
unlet! b:current_syntax
silent! syntax include @htmlStylus syntax/stylus.vim
unlet! b:current_syntax
silent! syntax include @htmlCss syntax/css.vim
unlet! b:current_syntax
silent! syntax include @htmlMarkdown syntax/markdown.vim
unlet! b:current_syntax
syn case match
syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend
syn cluster htmlJavascript add=javascriptParenthesisBlock
syn region jadeJavascript matchgroup=jadeJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn region jadeJavascript matchgroup=jadeJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn cluster jadeTop contains=jadeBegin,jadeComment,jadeHtmlComment,jadeJavascript
syn match jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar,jadeJavascript,jadeScriptConditional,jadeScriptStatement,jadePipedText
syn match jadeTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent
syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript,jadeTagBlockChar,jadeTagInlineText
syn match jadeComment '\s*\/\/.*$'
syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
syn region jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent
syn match jadeClassChar "\." contained nextgroup=jadeClass
syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar
syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId
syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
syn region jadeDocType start="^\s*\(!!!\|doctype\)" end="$"
" Unless I'm mistaken, syntax/html.vim requires
" that the = sign be present for these matches.
" This adds the matches back for jade.
syn keyword jadeHtmlArg contained href title
syn match jadePlainChar "\\" contained
syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
syn match jadeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn match jadeTagInlineText "\s.*$" contained contains=jadeInterpolation,jadeTextInlineJade
syn region jadePipedText matchgroup=jadePipeChar start="|" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadePipedText skipnl
syn match jadeTagBlockChar "\.$" contained nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
syn region jadeTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
syn region jadeTagBlockEnd start="\s*\S" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeBegin skipnl
syn region jadeTextInlineJade matchgroup=jadeInlineDelimiter start="#\[" end="]" contains=jadeTag keepend
syn region jadeJavascriptFilter matchgroup=jadeFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
syn region jadeMarkdownFilter matchgroup=jadeFilter start=/^\z(\s*\):\%(markdown\|marked\)\s*$/ end=/^\%(\z1\s\|\s*$\)\@!/ contains=@htmlMarkdown
syn region jadeStylusFilter matchgroup=jadeFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
syn region jadePlainFilter matchgroup=jadeFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
syn match jadeScriptConditional "^\s*\<\%(if\|else\|else if\|elif\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
syn match jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
syn region jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords
syn keyword jadeScriptLoopKeywords for in contained
syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag
syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
syn match jadeError "\$" contained
hi def link jadePlainChar Special
hi def link jadeScriptConditional PreProc
hi def link jadeScriptLoopKeywords PreProc
hi def link jadeScriptStatement PreProc
hi def link jadeHtmlArg htmlArg
hi def link jadeAttributeString String
hi def link jadeAttributesDelimiter Identifier
hi def link jadeIdChar Special
hi def link jadeClassChar Special
hi def link jadeBlockExpansionChar Special
hi def link jadePipeChar Special
hi def link jadeTagBlockChar Special
hi def link jadeId Identifier
hi def link jadeClass Type
hi def link jadeInterpolationDelimiter Delimiter
hi def link jadeInlineDelimiter Delimiter
hi def link jadeFilter PreProc
hi def link jadeDocType PreProc
hi def link jadeComment Comment
hi def link jadeCommentBlock Comment
hi def link jadeHtmlConditionalComment jadeComment
let b:current_syntax = "jade"
if main_syntax == "jade"
unlet main_syntax
endif
endif

View File

@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim syntax file " Vim syntax file
" Language: Kotlin " Language: Kotlin
" Maintainer: Alexander Udalov " Maintainer: Alexander Udalov
" Latest Revision: 23 December 2015 " Latest Revision: 24 February 2016
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@ -32,7 +32,8 @@ syn keyword ktConstant null
syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix
syn keyword ktTodo TODO FIXME XXX contained syn keyword ktTodo TODO FIXME XXX contained
syn match ktLineComment "//.*$" contains=ktTodo,@Spell syn match ktShebang "\v^#!.*$"
syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell
syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell
syn match ktSpecialCharError "\v\\." contained syn match ktSpecialCharError "\v\\." contained
@ -81,6 +82,7 @@ hi link ktBoolean Boolean
hi link ktConstant Constant hi link ktConstant Constant
hi link ktTodo Todo hi link ktTodo Todo
hi link ktShebang Comment
hi link ktLineComment Comment hi link ktLineComment Comment
hi link ktComment Comment hi link ktComment Comment
hi link ktCommentMatchGroup Comment hi link ktCommentMatchGroup Comment

View File

@ -59,6 +59,7 @@ syn keyword ngxDirectiveError post_action
syn keyword ngxDirectiveDeprecated connections syn keyword ngxDirectiveDeprecated connections
syn keyword ngxDirectiveDeprecated imap syn keyword ngxDirectiveDeprecated imap
syn keyword ngxDirectiveDeprecated limit_zone syn keyword ngxDirectiveDeprecated limit_zone
syn keyword ngxDirectiveDeprecated mysql_test
syn keyword ngxDirectiveDeprecated open_file_cache_retest syn keyword ngxDirectiveDeprecated open_file_cache_retest
syn keyword ngxDirectiveDeprecated optimize_server_names syn keyword ngxDirectiveDeprecated optimize_server_names
syn keyword ngxDirectiveDeprecated satisfy_any syn keyword ngxDirectiveDeprecated satisfy_any
@ -248,7 +249,6 @@ syn keyword ngxDirective mp4_max_buffer_size
syn keyword ngxDirective msie_padding syn keyword ngxDirective msie_padding
syn keyword ngxDirective msie_refresh syn keyword ngxDirective msie_refresh
syn keyword ngxDirective multi_accept syn keyword ngxDirective multi_accept
syn keyword ngxDirective mysql_test
syn keyword ngxDirective open_file_cache syn keyword ngxDirective open_file_cache
syn keyword ngxDirective open_file_cache_errors syn keyword ngxDirective open_file_cache_errors
syn keyword ngxDirective open_file_cache_events syn keyword ngxDirective open_file_cache_events
@ -606,7 +606,7 @@ syn keyword ngxDirectiveThirdParty echo_subrequest
syn keyword ngxDirectiveThirdParty echo_subrequest_async syn keyword ngxDirectiveThirdParty echo_subrequest_async
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html> " Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
" Privides options for start/stop events. " Provides options for start/stop events.
syn keyword ngxDirectiveThirdParty on_start syn keyword ngxDirectiveThirdParty on_start
syn keyword ngxDirectiveThirdParty on_stop syn keyword ngxDirectiveThirdParty on_stop

View File

@ -315,16 +315,16 @@ syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosx]*+ contains=@perlInterpMatch keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosxdual]*+ contains=@perlInterpMatch keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosx]*+ contains=@perlInterpSlash keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosxdual]*+ contains=@perlInterpSlash keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosx]*+ contains=@perlInterpMatch keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosxdual]*+ contains=@perlInterpMatch keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosx]*+ contains=@perlInterpSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosxdual]*+ contains=@perlInterpSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosx]*+ contains=@perlInterpMatch,perlParensDQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosxdual]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
" A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern " A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosx]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosxdual]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosx]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosxdual]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosx]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosxdual]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend
" Constructs such as print <<EOF [...] EOF, 'here' documents " Constructs such as print <<EOF [...] EOF, 'here' documents
" "

View File

@ -87,8 +87,8 @@ let s:keywords = {
\ "for loop repeat while until gather given", \ "for loop repeat while until gather given",
\ ], \ ],
\ "p6FlowControl": [ \ "p6FlowControl": [
\ "take do when next last redo return contend maybe defer start", \ "take do when next last redo return return-rw contend maybe defer",
\ "default exit make continue break goto leave async lift", \ "start default exit make continue break goto leave async lift",
\ ], \ ],
\ "p6ClosureTrait": [ \ "p6ClosureTrait": [
\ "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP", \ "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP",
@ -118,7 +118,7 @@ let s:types = [
\ "Object Any Junction Whatever Capture Match", \ "Object Any Junction Whatever Capture Match",
\ "Signature Proxy Matcher Package Module Class", \ "Signature Proxy Matcher Package Module Class",
\ "Grammar Scalar Array Hash KeyHash KeySet KeyBag", \ "Grammar Scalar Array Hash KeyHash KeySet KeyBag",
\ "Pair List Seq Range Set Bag Mapping Void Undef", \ "Pair List Seq Range Set Bag Map Mapping Void Undef",
\ "Failure Exception Code Block Routine Sub Macro", \ "Failure Exception Code Block Routine Sub Macro",
\ "Method Submethod Regex Str Blob Char Byte Parcel", \ "Method Submethod Regex Str Blob Char Byte Parcel",
\ "Codepoint Grapheme StrPos StrLen Version Num", \ "Codepoint Grapheme StrPos StrLen Version Num",

View File

@ -539,6 +539,8 @@ syn match phpMemberSelector "->\|::" contained display
syn match phpVarSelector "\$" contained display syn match phpVarSelector "\$" contained display
" highlight static and object variables inside strings " highlight static and object variables inside strings
syn match phpMethodsVar "\%(->\|::$\?\)\h\w*" contained contains=phpMethods,phpMemberSelector,phpIdentifier display containedin=phpStringDouble syn match phpMethodsVar "\%(->\|::$\?\)\h\w*" contained contains=phpMethods,phpMemberSelector,phpIdentifier display containedin=phpStringDouble
syn match phpMethodsVar "\%(->\|::\%($\)\@!\)\s*\h\w*\s*("me=e-1 skipwhite skipempty contained contains=phpMemberSelector,phpMethod display containedin=phpStringDouble
syn match phpMethod /\h\w*/
syn match phpSplatOperator "\.\.\." contained display syn match phpSplatOperator "\.\.\." contained display
" Identifier " Identifier
@ -597,7 +599,7 @@ syn match phpCommentStar contained "^\s*\*$"
if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc
syn case ignore syn case ignore
SynFoldDoc syn region phpDocComment start="/\*\*" end="\*/" keepend contains=phpCommentTitle,phpDocTags,phpTodo,@Spell SynFoldDoc syn region phpDocComment start="/\*\*" end="\*/" keepend contains=phpCommentTitle,phpDocTags,phpTodo,@Spell extend
syn region phpCommentTitle contained matchgroup=phpDocComment start="/\*\*" matchgroup=phpCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=phpCommentStar,phpTodo,phpDocTags,@Spell containedin=phpDocComment syn region phpCommentTitle contained matchgroup=phpDocComment start="/\*\*" matchgroup=phpCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=phpCommentStar,phpTodo,phpDocTags,@Spell containedin=phpDocComment
syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment
@ -849,7 +851,7 @@ let b:current_syntax = "php"
let &iskeyword = s:iskeyword_save let &iskeyword = s:iskeyword_save
unlet s:iskeyword_save unlet s:iskeyword_save
if main_syntax == 'php' if (exists("main_syntax") && main_syntax == 'php')
unlet main_syntax unlet main_syntax
endif endif

View File

@ -59,7 +59,7 @@ syn keyword pbSyntax syntax import option
syn keyword pbStructure package message group oneof syn keyword pbStructure package message group oneof
syn keyword pbRepeat optional required repeated syn keyword pbRepeat optional required repeated
syn keyword pbDefault default syn keyword pbDefault default
syn keyword pbExtend extend extensions to max syn keyword pbExtend extend extensions to max reserved
syn keyword pbRPC service rpc returns syn keyword pbRPC service rpc returns
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64 syn keyword pbType int32 int64 uint32 uint64 sint32 sint64

108
syntax/pug.vim Normal file
View File

@ -0,0 +1,108 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jade') == -1
" Vim syntax file
" Language: Pug
" Maintainer: Joshua Borton
" Credits: Tim Pope
" Filenames: *.pug
if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'pug'
endif
silent! syntax include @htmlCoffeescript syntax/coffee.vim
unlet! b:current_syntax
silent! syntax include @htmlStylus syntax/stylus.vim
unlet! b:current_syntax
silent! syntax include @htmlCss syntax/css.vim
unlet! b:current_syntax
silent! syntax include @htmlMarkdown syntax/markdown.vim
unlet! b:current_syntax
syn case match
syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend
syn cluster htmlJavascript add=javascriptParenthesisBlock
syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
syn match pugComment '\s*\/\/.*$'
syn region pugCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
syn match pugClassChar "\." contained nextgroup=pugClass
syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
syn match pugClass "\%(\w\|-\)\+" contained nextgroup=@pugComponent
syn match pugId "\%(\w\|-\)\+" contained nextgroup=@pugComponent
syn region pugDocType start="^\s*\(!!!\|doctype\)" end="$"
" Unless I'm mistaken, syntax/html.vim requires
" that the = sign be present for these matches.
" This adds the matches back for pug.
syn keyword pugHtmlArg contained href title
syn match pugPlainChar "\\" contained
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug
syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugPipedText skipnl
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend
syn region pugJavascriptFilter matchgroup=pugFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
syn region pugMarkdownFilter matchgroup=pugFilter start=/^\z(\s*\):\%(markdown\|marked\)\s*$/ end=/^\%(\z1\s\|\s*$\)\@!/ contains=@htmlMarkdown
syn region pugStylusFilter matchgroup=pugFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
syn region pugPlainFilter matchgroup=pugFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
syn match pugScriptConditional "^\s*\<\%(if\|else\|else if\|elif\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
syn match pugScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
syn region pugScriptLoopRegion start="^\s*\(for \)" end="$" contains=pugScriptLoopKeywords
syn keyword pugScriptLoopKeywords for in contained
syn region pugJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,pugJavascriptTag,pugCoffeescriptFilter keepend
syn region pugCoffeescriptFilter matchgroup=pugFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
syn region pugJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=pugBegin,pugTag
syn region pugCssBlock start="^\z(\s*\)style" nextgroup=@pugComponent,pugError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
syn match pugError "\$" contained
hi def link pugPlainChar Special
hi def link pugScriptConditional PreProc
hi def link pugScriptLoopKeywords PreProc
hi def link pugScriptStatement PreProc
hi def link pugHtmlArg htmlArg
hi def link pugAttributeString String
hi def link pugAttributesDelimiter Identifier
hi def link pugIdChar Special
hi def link pugClassChar Special
hi def link pugBlockExpansionChar Special
hi def link pugPipeChar Special
hi def link pugTagBlockChar Special
hi def link pugId Identifier
hi def link pugClass Type
hi def link pugInterpolationDelimiter Delimiter
hi def link pugInlineDelimiter Delimiter
hi def link pugFilter PreProc
hi def link pugDocType PreProc
hi def link pugComment Comment
hi def link pugCommentBlock Comment
hi def link pugHtmlConditionalComment pugComment
let b:current_syntax = "pug"
if main_syntax == "pug"
unlet main_syntax
endif
endif

View File

@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Maintainer: Patrick Walton <pcwalton@mozilla.com> " Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu> " Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info> " Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: January 29, 2015 " Last Change: Feb 24, 2016
if version < 600 if version < 600
syntax clear syntax clear
@ -16,6 +16,11 @@ endif
" Syntax definitions {{{1 " Syntax definitions {{{1
" Basic keywords {{{2 " Basic keywords {{{2
syn keyword rustConditional match if else syn keyword rustConditional match if else
syn keyword rustRepeat for loop while
syn keyword rustTypedef type nextgroup=rustIdentifier skipwhite skipempty
syn keyword rustStructure struct enum nextgroup=rustIdentifier skipwhite skipempty
syn keyword rustUnion union nextgroup=rustIdentifier skipwhite skipempty contained
syn match rustUnionContextual /\<union\_s\+\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*/ transparent contains=rustUnion
syn keyword rustOperator as syn keyword rustOperator as
syn match rustAssert "\<assert\(\w\)*!" contained syn match rustAssert "\<assert\(\w\)*!" contained
@ -25,17 +30,23 @@ syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty
syn keyword rustKeyword continue syn keyword rustKeyword continue
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
syn keyword rustKeyword for in if impl let syn keyword rustKeyword in impl let
syn keyword rustKeyword loop pub syn keyword rustKeyword pub nextgroup=rustPubScope skipwhite skipempty
syn keyword rustKeyword return super syn keyword rustKeyword return
syn keyword rustKeyword unsafe where while syn keyword rustSuper super
syn keyword rustKeyword unsafe where
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
" FIXME: Scoped impl's name is also fallen in this category " FIXME: Scoped impl's name is also fallen in this category
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipempty
syn keyword rustStorage move mut ref static const syn keyword rustStorage move mut ref static const
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
syn keyword rustInvalidBareKeyword crate syn keyword rustInvalidBareKeyword crate
syn keyword rustPubScopeCrate crate contained
syn match rustPubScopeDelim /[()]/ contained
syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty
" This is to get the `bar` part of `extern crate "foo" as bar;` highlighting. " This is to get the `bar` part of `extern crate "foo" as bar;` highlighting.
syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator
@ -133,7 +144,7 @@ syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustE
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError
syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait
" This list comes from src/libsyntax/ext/deriving/mod.rs " This list comes from src/libsyntax/ext/deriving/mod.rs
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). " Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
@ -157,25 +168,29 @@ 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\)" syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
" For the benefit of delimitMate " For the benefit of delimitMate
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ 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 rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting "rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
syn match rustLabel display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*:"
syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ 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). " 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 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 /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|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 match rustShebang /\%^#![^[].*/
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell syn region rustCommentLineDocError start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell contained
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent syn region rustCommentBlockDocError matchgroup=rustCommentBlockDocError start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent
" FIXME: this is a really ugly and not fully correct implementation. Most " FIXME: this is a really ugly and not fully correct implementation. Most
" importantly, a case like ``/* */*`` should have the final ``*`` not being in " importantly, a case like ``/* */*`` should have the final ``*`` not being in
" a comment, but in practice at present it leaves comments open two levels " a comment, but in practice at present it leaves comments open two levels
@ -226,7 +241,14 @@ hi def link rustFloat Float
hi def link rustArrowCharacter rustOperator hi def link rustArrowCharacter rustOperator
hi def link rustOperator Operator hi def link rustOperator Operator
hi def link rustKeyword Keyword hi def link rustKeyword Keyword
hi def link rustTypedef Keyword " More precise is Typedef, but it doesn't feel right for Rust
hi def link rustStructure Keyword " More precise is Structure
hi def link rustUnion rustStructure
hi def link rustPubScopeDelim Delimiter
hi def link rustPubScopeCrate rustKeyword
hi def link rustSuper rustKeyword
hi def link rustReservedKeyword Error hi def link rustReservedKeyword Error
hi def link rustRepeat Conditional
hi def link rustConditional Conditional hi def link rustConditional Conditional
hi def link rustIdentifier Identifier hi def link rustIdentifier Identifier
hi def link rustCapsIdent rustIdentifier hi def link rustCapsIdent rustIdentifier
@ -238,8 +260,10 @@ hi def link rustFuncCall Function
hi def link rustShebang Comment hi def link rustShebang Comment
hi def link rustCommentLine Comment hi def link rustCommentLine Comment
hi def link rustCommentLineDoc SpecialComment hi def link rustCommentLineDoc SpecialComment
hi def link rustCommentLineDocError Error
hi def link rustCommentBlock rustCommentLine hi def link rustCommentBlock rustCommentLine
hi def link rustCommentBlockDoc rustCommentLineDoc hi def link rustCommentBlockDoc rustCommentLineDoc
hi def link rustCommentBlockDocError Error
hi def link rustAssert PreCondit hi def link rustAssert PreCondit
hi def link rustPanic PreCondit hi def link rustPanic PreCondit
hi def link rustMacro Macro hi def link rustMacro Macro
@ -247,9 +271,11 @@ hi def link rustType Type
hi def link rustTodo Todo hi def link rustTodo Todo
hi def link rustAttribute PreProc hi def link rustAttribute PreProc
hi def link rustDerive PreProc hi def link rustDerive PreProc
hi def link rustDefault StorageClass
hi def link rustStorage StorageClass hi def link rustStorage StorageClass
hi def link rustObsoleteStorage Error hi def link rustObsoleteStorage Error
hi def link rustLifetime Special hi def link rustLifetime Special
hi def link rustLabel Label
hi def link rustInvalidBareKeyword Error hi def link rustInvalidBareKeyword Error
hi def link rustExternCrate rustKeyword hi def link rustExternCrate rustKeyword
hi def link rustObsoleteExternMod Error hi def link rustObsoleteExternMod Error

View File

@ -34,7 +34,6 @@ function! s:ContainedGroup()
endtry endtry
endfunction endfunction
syn include @scalaHtml syntax/html.vim " Doc comment HTML
unlet! b:current_syntax unlet! b:current_syntax
syn case match syn case match
@ -53,6 +52,13 @@ exe 'syn region scalaBlock start=/{/ end=/}/ contains=' . s:ContainedGroup() . '
syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome
hi link scalaAkkaSpecialWord PreProc hi link scalaAkkaSpecialWord PreProc
syn keyword scalatestSpecialWord shouldBe
syn match scalatestShouldDSLA /^\s\+\zsit should/
syn match scalatestShouldDSLB /\<should\>/
hi link scalatestSpecialWord PreProc
hi link scalatestShouldDSLA PreProc
hi link scalatestShouldDSLB PreProc
syn match scalaSymbol /'[_A-Za-z0-9$]\+/ syn match scalaSymbol /'[_A-Za-z0-9$]\+/
hi link scalaSymbol Number hi link scalaSymbol Number
@ -69,8 +75,9 @@ syn match scalaOperator "||"
syn match scalaOperator "&&" syn match scalaOperator "&&"
hi link scalaOperator Special hi link scalaOperator Special
syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList
syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition
syn match scalaVariableDeclarationList /\s*,\s*/ contained nextgroup=scalaNameDefinition
syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration
hi link scalaNameDefinition Function hi link scalaNameDefinition Function
@ -179,7 +186,7 @@ hi link scalaTypeOperator Keyword
hi link scalaTypeAnnotationParameter Function hi link scalaTypeAnnotationParameter Function
syn match scalaShebang "\%^#!.*" display syn match scalaShebang "\%^#!.*" display
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@scalaHtml,@Spell keepend fold syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold
syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained
syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained

View File

@ -12,7 +12,7 @@ endif
" basic " basic
syn keyword solKeyword break case const continue default delete do else for if in mapping 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 new private public return returns struct switch this var while constant
syn keyword solKeyword modifier suicide syn keyword solKeyword modifier suicide enum memory
syn keyword solConstant true false wei szabo finny ether syn keyword solConstant true false wei szabo finny ether
syn keyword solBuiltinType mapping real string text msg block tx ureal address bool bytes syn keyword solBuiltinType mapping real string text msg block tx ureal address bool bytes
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 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

View File

@ -56,8 +56,8 @@ delfunction s:CommentKeywordMatch
" Literals " Literals
" Strings " Strings
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline
syntax region swiftInterpolatedWrapper start="\v[^\\]\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString syntax region swiftInterpolatedWrapper start="\v[^\\]\zs\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper oneline
" Numbers " Numbers
syntax match swiftNumber "\v<\d+>" syntax match swiftNumber "\v<\d+>"
@ -91,8 +91,9 @@ syntax match swiftOperator "\v\<"
syntax match swiftOperator "\v\>" syntax match swiftOperator "\v\>"
syntax match swiftOperator "\v\?\?" syntax match swiftOperator "\v\?\?"
" Methods/Functions " Methods/Functions/Properties
syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@=" syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@="
syntax match swiftProperty "\(\.\)\@<=\<\w\+\>(\@!"
" Swift closure arguments " Swift closure arguments
syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?" syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?"
@ -103,7 +104,7 @@ syntax keyword swiftAvailabilityArg renamed unavailable introduced deprecated ob
" Keywords {{{ " Keywords {{{
syntax keyword swiftKeywords syntax keyword swiftKeywords
\ as \ associatedtype
\ atexit \ atexit
\ break \ break
\ case \ case
@ -128,12 +129,10 @@ syntax keyword swiftKeywords
\ if \ if
\ import \ import
\ in \ in
\ indirect
\ infix \ infix
\ init \ init
\ inout \ inout
\ internal \ internal
\ is
\ lazy \ lazy
\ let \ let
\ mutating \ mutating
@ -167,6 +166,8 @@ syntax keyword swiftKeywords
\ where \ where
\ while \ while
\ willSet \ willSet
syntax match swiftMultiwordKeywords "indirect case"
" }}} " }}}
" Names surrounded by backticks. This aren't limited to keywords because 1) " Names surrounded by backticks. This aren't limited to keywords because 1)
@ -201,14 +202,27 @@ syntax keyword swiftStructure
\ struct \ struct
\ enum \ enum
syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALL transparent syntax keyword swiftDebugIdentifier
\ #column
\ #file
\ #function
\ #line
\ __COLUMN__
\ __FILE__
\ __FUNCTION__
\ __LINE__
syntax keyword swiftLineDirective #setline
syntax region swiftTypeWrapper start="\v:\s*" 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 swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline
syntax match swiftType "\v<\u\w*" contained containedin=swiftGenericsWrapper,swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper syntax match swiftType "\v<\u\w*" contained containedin=swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper,swiftTypeCastWrapper
syntax keyword swiftImports import syntax keyword swiftImports import
syntax keyword swiftCastKeyword is as contained
" 'preprocesor' stuff " 'preprocesor' stuff
syntax keyword swiftPreprocessor syntax keyword swiftPreprocessor
@ -216,6 +230,7 @@ syntax keyword swiftPreprocessor
\ #elseif \ #elseif
\ #else \ #else
\ #endif \ #endif
\ #selector
" Comment patterns " Comment patterns
@ -238,7 +253,9 @@ highlight default link swiftNumber Number
highlight default link swiftBoolean Boolean highlight default link swiftBoolean Boolean
highlight default link swiftOperator Operator highlight default link swiftOperator Operator
highlight default link swiftCastKeyword Keyword
highlight default link swiftKeywords Keyword highlight default link swiftKeywords Keyword
highlight default link swiftMultiwordKeywords Keyword
highlight default link swiftEscapedReservedWord Normal highlight default link swiftEscapedReservedWord Normal
highlight default link swiftClosureArgument Operator highlight default link swiftClosureArgument Operator
highlight default link swiftAttributes PreProc highlight default link swiftAttributes PreProc
@ -248,11 +265,14 @@ highlight default link swiftType Type
highlight default link swiftImports Include highlight default link swiftImports Include
highlight default link swiftPreprocessor PreProc highlight default link swiftPreprocessor PreProc
highlight default link swiftMethod Function highlight default link swiftMethod Function
highlight default link swiftProperty Identifier
highlight default link swiftConditionStatement PreProc highlight default link swiftConditionStatement PreProc
highlight default link swiftAvailability Normal highlight default link swiftAvailability Normal
highlight default link swiftAvailabilityArg Normal highlight default link swiftAvailabilityArg Normal
highlight default link swiftPlatforms Keyword highlight default link swiftPlatforms Keyword
highlight default link swiftDebugIdentifier PreProc
highlight default link swiftLineDirective PreProc
" Force vim to sync at least x lines. This solves the multiline comment not " Force vim to sync at least x lines. This solves the multiline comment not
" being highlighted issue " being highlighted issue

View File

@ -54,7 +54,7 @@ syn keyword thriftStatement throws typedef
syn keyword thriftBasicTypes void bool byte string binary syn keyword thriftBasicTypes void bool byte string binary
syn keyword thriftBasicTypes i16 i32 i64 double syn keyword thriftBasicTypes i16 i32 i64 double
syn keyword thriftType map list set syn keyword thriftType map list set
syn keyword thriftClass struct exception enum syn keyword thriftClass union struct exception enum
syn region thriftString start=+"+ end=+"+ syn region thriftString start=+"+ end=+"+
" Special " Special

File diff suppressed because it is too large Load Diff