Compare commits

...

31 Commits

Author SHA1 Message Date
Adam Stankiewicz
74652b465d Update twig source 2016-09-11 13:50:56 +02:00
Adam Stankiewicz
7575da2064 Update 2016-09-11 13:42:21 +02:00
Adam Stankiewicz
9b23910103 Add raml syntax highlighting, closes #155 2016-09-11 13:38:46 +02:00
Adam Stankiewicz
98e021e969 Wrap ftdetect file in augroup, fixes #153 2016-09-11 13:34:02 +02:00
Adam Stankiewicz
b8d9939329 Add python compiler, closes #147 2016-09-11 13:25:03 +02:00
Adam Stankiewicz
0244e228fa Update 2016-09-11 13:24:17 +02:00
Adam Stankiewicz
ab61d2ac8e Update 2016-07-30 13:19:35 +02:00
Adam Stankiewicz
f42e1f477c Add note about non-completeness of plugins, #146 2016-07-27 19:48:12 +02:00
Adam Stankiewicz
3019afa721 Add applescript, closes #133 2016-07-26 14:08:59 +02:00
Adam Stankiewicz
cb574b283f Add livescript, closes #135 2016-07-26 14:06:32 +02:00
Adam Stankiewicz
b9ce3df4cd Add extras directory of vim-javascript, fixes #144 2016-07-26 14:04:56 +02:00
Adam Stankiewicz
f028cfae59 Add lua 2016-07-26 13:58:55 +02:00
Adam Stankiewicz
041ab2d237 Update 2016-07-26 13:52:55 +02:00
Adam Stankiewicz
acd25ccf95 Switch to elzr for json syntax, and disable conceal by default 2016-07-26 13:52:30 +02:00
Adam Stankiewicz
7dd62806a0 Enable jsx by default 2016-07-26 13:52:30 +02:00
Adam Stankiewicz
6a823fb3af Update 2016-07-26 13:52:30 +02:00
Adam Stankiewicz
11f34624aa Update 2016-07-19 10:09:54 +02:00
Yulij Andreevich Lesov
1422f7a75c Update vim-ember-script repo link (#138) 2016-07-05 10:28:08 +02:00
Adam Stankiewicz
b17b5d4d9f Readability fixes build 2016-07-05 10:00:59 +02:00
Yulij Andreevich Lesov
bd824d9407 readability: add newline and comment to generated ftdetect file (#142) 2016-07-05 09:59:45 +02:00
Yulij Andreevich Lesov
c3233deb70 Update vim-emblem repo link 2016-07-05 09:55:06 +02:00
Adam Stankiewicz
bf188c4a51 Update 2016-07-05 09:53:49 +02:00
Adam Stankiewicz
a5857b81c2 Create troubleshooting section in the README 2016-06-28 16:05:24 +02:00
Adam Stankiewicz
7a32eec6d1 Change markdown provider to plasticboy 2016-06-26 18:13:30 +02:00
Adam Stankiewicz
c69562f864 Update 2016-06-26 18:03:28 +02:00
Adam Stankiewicz
40c54bc12b Update 2016-06-17 20:47:16 +02:00
Adam Stankiewicz
44b3d860cb Update 2016-05-31 01:53:12 +02:00
Adam Stankiewicz
5a65ffe66d Change nginx source to othree/nginx-contrib-vim, closes #127 2016-05-13 16:10:17 +02:00
Adam Stankiewicz
b9dae8fbab Add mako support, closes #126 2016-05-13 16:10:17 +02:00
Adam Stankiewicz
84593f2d7f Update 2016-05-13 16:10:17 +02:00
Adam Stankiewicz
22f6f3b6d3 Add maintained badge 2016-05-03 13:19:31 +02:00
112 changed files with 5197 additions and 4022 deletions

View File

@@ -1,4 +1,4 @@
# vim-polyglot [![Build Status][travis-img-url]][travis-url]
# vim-polyglot [![Build Status][travis-img-url]][travis-url] [![Maintenance](https://img.shields.io/maintenance/yes/2016.svg?maxAge=2592000)]()
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
@@ -23,8 +23,13 @@ A collection of language packs for Vim.
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
NOTE: Not all features of listed language packs are available. We strip them from functionality slowing vim startup in general (for example we ignore `plugins` folder that is loaded regardless of file type, use `ftplugin` instead).
If you need full functionality of any plugin, please use it directly with your plugin manager.
## Language packs
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin, ftdetect)
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect)
@@ -42,8 +47,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect)
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect)
- [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin, ftdetect)
- [emberscript](https://github.com/heartsentwined/vim-ember-script) (syntax, indent, ftplugin, ftdetect)
- [emblem](https://github.com/heartsentwined/vim-emblem) (syntax, indent, ftplugin, ftdetect)
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin, ftdetect)
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin, ftdetect)
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent, ftdetect)
- [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
@@ -56,8 +61,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftplugin, ftdetect)
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftdetect, ftplugin, extras)
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin, ftdetect)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
- [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
@@ -65,8 +70,11 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
- [markdown](https://github.com/tpope/vim-markdown) (syntax, ftplugin, ftdetect)
- [nginx](https://github.com/nginx/nginx) (syntax, indent, ftdetect)
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin, ftdetect)
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, ftdetect)
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
@@ -76,32 +84,34 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)
- [pgsql](https://github.com/exu/pgsql.vim) (syntax, ftdetect)
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect)
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin, ftdetect)
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent, ftdetect)
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect)
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftdetect)
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftplugin, ftdetect)
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload, ftdetect)
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin, ftdetect)
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin, ftdetect)
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent, ftdetect)
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin, ftdetect)
- [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax, ftdetect)
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin, ftdetect)
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
- [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
@@ -111,9 +121,15 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
## Disabling a language pack
## Updating
Individual language packs can be disabled by setting `g:polyglot_disabled`.
You can either wait for new patch release with updates or run the `./build` script by yourself.
## Troubleshooting
Please make sure you have `syntax on` in your `.vimrc`, otherwise syntax files are not loaded at all.
Individual language packs can be disabled by setting `g:polyglot_disabled` as follows:
```viml
" ~/.vimrc
@@ -122,10 +138,6 @@ let g:polyglot_disabled = ['css']
Note that disabiling languages won't make in general your vim startup any faster / slower (only for specific file type). Vim-polyglot is selection of language plugins that are loaded only on demand.
## Updating
You can either wait for new patch release with updates or run the `./build` script by yourself.
## Contributing
Language packs are periodically updated using automated `build` script.

View File

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

View File

@@ -0,0 +1,16 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
" Vim filetype plugin file
" Language: JavaScript
" Maintainer: vim-javascript community
" URL: https://github.com/pangloss/vim-javascript
setlocal iskeyword+=$ suffixesadd+=.js
if exists('b:undo_ftplugin')
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
else
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
endif
endif

View File

@@ -5,7 +5,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
" Depends: pangloss/vim-javascript
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

View File

@@ -5,10 +5,12 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
" Depends: pangloss/vim-javascript
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Save the current JavaScript indentexpr.
let b:jsx_js_indentexpr = &indentexpr
" Prologue; load in XML indentation.
if exists('b:did_indent')
let s:did_indent=b:did_indent
@@ -51,19 +53,31 @@ fu! SynXMLish(syns)
return SynAttrXMLish(get(a:syns, -1))
endfu
" Check if a synstack has any XMLish attribute.
fu! SynXMLishAny(syns)
for synattr in a:syns
if SynAttrXMLish(synattr)
return 1
endif
endfor
return 0
endfu
" Check if a synstack denotes the end of a JSX block.
fu! SynJSXBlockEnd(syns)
return get(a:syns, -1) == 'jsBraces' && SynAttrXMLish(get(a:syns, -2))
return get(a:syns, -1) =~ '\%(js\|javascript\)Braces' &&
\ SynAttrXMLish(get(a:syns, -2))
endfu
" Determine how many jsxRegions deep a synstack is.
fu! SynJSXDepth(syns)
return len(filter(copy(a:syns), 'v:val ==# "jsxRegion"'))
endfu
" Check whether `cursyn' continues the same jsxRegion as `prevsyn'.
fu! SynJSXContinues(cursyn, prevsyn)
let curdepth = SynJSXDepth(a:cursyn)
let prevdepth = SynJSXDepth(a:prevsyn)
" In most places, we expect the nesting depths to be the same between any
" two consecutive positions within a jsxRegion (e.g., between a parent and
" child node, between two JSX attributes, etc.). The exception is between
" sibling nodes, where after a completed element (with depth N), we return
" to the parent's nesting (depth N - 1). This case is easily detected,
" since it is the only time when the top syntax element in the synstack is
" jsxRegion---specifically, the jsxRegion corresponding to the parent.
return prevdepth == curdepth ||
\ (prevdepth == curdepth + 1 && get(a:cursyn, -1) ==# 'jsxRegion')
endfu
" Cleverly mix JS and XML indentation.
@@ -71,9 +85,12 @@ fu! GetJsxIndent()
let cursyn = SynSOL(v:lnum)
let prevsyn = SynEOL(v:lnum - 1)
" Use XML indenting if the syntax at the end of the previous line was either
" JSX or was the closing brace of a jsBlock whose parent syntax was JSX.
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) && SynXMLishAny(cursyn)
" Use XML indenting iff:
" - the syntax at the end of the previous line was either JSX or was the
" closing brace of a jsBlock whose parent syntax was JSX; and
" - the current line continues the same jsxRegion as the previous line.
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) &&
\ SynJSXContinues(cursyn, prevsyn)
let ind = XmlIndentGet(v:lnum, 0)
" Align '/>' and '>' with '<' for multiline tags.
@@ -86,7 +103,13 @@ fu! GetJsxIndent()
let ind = ind + &sw
endif
else
let ind = GetJavascriptIndent()
if len(b:jsx_js_indentexpr)
" Invoke the base JS package's custom indenter. (For vim-javascript,
" e.g., this will be GetJavascriptIndent().)
let ind = eval(b:jsx_js_indentexpr)
else
let ind = cindent(v:lnum)
endif
endif
return ind

View File

@@ -624,6 +624,7 @@ syntax keyword cppSTLtype const_mem_fun_ref_t
syntax keyword cppSTLtype const_mem_fun_t
syntax keyword cppSTLtype const_pointer
syntax keyword cppSTLtype const_reference
syntax keyword cppSTLtype container_type
syntax keyword cppSTLtype deque
syntax keyword cppSTLtype difference_type
syntax keyword cppSTLtype div_t

View File

@@ -5,6 +5,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL
if exists('b:current_syntax')
let s:current_syntax_save = b:current_syntax
endif
" Inherit coffee from html so coffeeComment isn't redefined and given higher
" priority than hamlInterpolation.
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
@@ -14,4 +19,9 @@ syn region hamlCoffeescriptFilter matchgroup=hamlFilter
\ contains=@hamlCoffeeScript,hamlInterpolation
\ keepend
if exists('s:current_syntax_save')
let b:current_syntax = s:current_syntax_save
unlet s:current_syntax_save
endif
endif

View File

@@ -5,6 +5,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL
if exists('b:current_syntax')
let s:current_syntax_save = b:current_syntax
endif
" Syntax highlighting for text/coffeescript script tags
syn include @htmlCoffeeScript syntax/coffee.vim
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
@@ -12,6 +16,11 @@ syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
\ containedin=htmlHead
if exists('s:current_syntax_save')
let b:current_syntax = s:current_syntax_save
unlet s:current_syntax_save
endif
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1

View File

@@ -48,7 +48,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
" preceding it, to avoid conflicts with, respectively, the left shift operator
" and generic Flow type annotations (http://flowtype.org/).
syn region jsxRegion
\ contains=@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
\ skip=+<!--\_.\{-}-->+
\ end=+</\z1\_\s\{-}>+

View File

@@ -28,8 +28,11 @@ endif
hi link rustNiceOperator Operator
if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
if !(exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0)
hi! link Conceal Operator
" And keep it after a colorscheme change
au ColorScheme <buffer> hi! link Conceal Operator
endif
endif

File diff suppressed because one or more lines are too long

21
autoload/python/utils.vim Normal file
View File

@@ -0,0 +1,21 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
" Sometimes Python issues debugging messages
" which don't belong to a call stack context
" this function filters these messages
function! python#utils#fix_qflist() " {{{
let l:traceback = []
let l:qflist = getqflist()
for l:item in l:qflist
if !empty(l:item.type)
call add(l:traceback, l:item)
endif
endfor
if !empty(l:traceback)
call setqflist(l:traceback)
endif
endfunction " }}}
endif

View File

@@ -348,7 +348,7 @@ function! s:RmDir(path)
echoerr 'Attempted to delete protected path: ' . a:path
return 0
endif
silent exe "!rm -rf " . shellescape(a:path)
return system("rm -rf " . shellescape(a:path))
endfunction
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.

View File

@@ -29,9 +29,13 @@ function! rustfmt#Format()
let command = g:rustfmt_command . " --write-mode=overwrite "
if exists("*systemlist")
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
else
let out = split(system(command . g:rustfmt_options . " " . shellescape(l:tmpname)), '\r\?\n')
endif
if v:shell_error == 0
if v:shell_error == 0 || v:shell_error == 3
" remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry

32
build
View File

@@ -5,6 +5,9 @@ set -E
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
DIRS_JAVASCRIPT="${DIRS} extras"
DIRS_RM="$DIRS_JAVASCRIPT"
OUTPUT=""
@@ -74,7 +77,10 @@ copy_dir() {
}
concat_ftdetect() {
cat ftdetect/* | grep -E '^[^"]' > tmp/polyglot.vim
echo "augroup filetypedetect" > tmp/polyglot.vim
cat config.vim >> tmp/polyglot.vim
for f in ftdetect/*; do (echo '" '"$f"; cat "${f}"; echo) >> tmp/polyglot.vim; done
echo "augroup END" >> tmp/polyglot.vim
rm -f ftdetect/*
mv tmp/polyglot.vim ftdetect/
}
@@ -96,6 +102,7 @@ EOF
}
PACKS="
applescript:vim-scripts/applescript.vim
ansible:pearofducks/ansible-vim
arduino:sudar/vim-arduino-syntax
blade:jwalton512/vim-blade
@@ -113,8 +120,8 @@ PACKS="
dockerfile:honza/dockerfile.vim
elixir:elixir-lang/vim-elixir
elm:lambdatoast/elm.vim
emberscript:heartsentwined/vim-ember-script
emblem:heartsentwined/vim-emblem
emberscript:yalesov/vim-ember-script
emblem:yalesov/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
fish:dag/vim-fish
git:tpope/vim-git
@@ -127,8 +134,8 @@ PACKS="
haxe:yaymukund/vim-haxe
html5:othree/html5.vim
jasmine:glanotte/vim-jasmine
javascript:pangloss/vim-javascript
json:sheerun/vim-json
javascript:pangloss/vim-javascript:_JAVASCRIPT
json:elzr/vim-json
jst:briancollins/vim-jst
jsx:mxw/vim-jsx:_ALL
julia:dcjones/julia-minimalist-vim
@@ -136,8 +143,11 @@ PACKS="
latex:LaTeX-Box-Team/LaTeX-Box
less:groenewege/vim-less
liquid:tpope/vim-liquid
markdown:tpope/vim-markdown
nginx:nginx/nginx::/contrib/vim/
livescript:gkz/vim-ls
lua:tbastos/vim-lua
mako:sophacles/vim-bundle-mako
markdown:plasticboy/vim-markdown:_SYNTAX
nginx:othree/nginx-contrib-vim
nim:zah/nim.vim:_BASIC
nix:spwhitt/vim-nix
objc:b4winckler/vim-objc
@@ -154,8 +164,10 @@ PACKS="
puppet:voxpupuli/vim-puppet
purescript:raichoo/purescript-vim
python:mitsuhiko/vim-python-combined
python-compiler:aliev/vim-compiler-python
qml:peterhoeg/vim-qml
r-lang:vim-scripts/R.vim
raml:IN3D/vim-raml
ragel:jneen/ragel.vim
rspec:sheerun/rspec.vim
ruby:vim-ruby/vim-ruby
@@ -169,10 +181,10 @@ PACKS="
systemd:kurayama/systemd-vim-syntax
textile:timcharper/textile.vim
thrift:solarnz/thrift.vim
tmux:tejr/vim-tmux
tmux:keith/tmux.vim
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
twig:evidens/vim-twig
twig:lumiliet/vim-twig
typescript:leafgarland/typescript-vim
vala:tkztmk/vim-vala
vbnet:vim-scripts/vbnet.vim
@@ -184,7 +196,7 @@ PACKS="
"
rm -rf tmp
rm -rf $DIRS_ALL
rm -rf $DIRS_RM
mkdir tmp
printf "Downloading packs..."

View File

@@ -29,6 +29,8 @@ function! s:is_absolute(path)
return a:path[0] == '/' || a:path =~ '[A-Z]\+:'
endfunction
CompilerSet errorformat+=%-G%\\s%#Compiling%.%#
let s:local_manifest = findfile(s:cargo_manifest_name, '.;')
if s:local_manifest != ''
let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/'

View File

@@ -40,6 +40,6 @@ CompilerSet errorformat+=%-G%.%# " All lines not matching a
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:ts=4:sw=4:et
" vim: sw=2 ts=2 et
endif

78
compiler/ls.vim Normal file
View File

@@ -0,0 +1,78 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
" Language: LiveScript
" Maintainer: George Zahariev
" URL: http://github.com/gkz/vim-ls
" License: WTFPL
if exists('current_compiler')
finish
endif
let current_compiler = 'ls'
" Pattern to check if livescript is the compiler
let s:pat = '^' . current_compiler
" Path to LiveScript compiler
if !exists('livescript_compiler')
let livescript_compiler = 'lsc'
endif
if !exists('livescript_make_options')
let livescript_make_options = ''
endif
" Get a `makeprg` for the current filename. This is needed to support filenames
" with spaces and quotes, but also not break generic `make`.
function! s:GetMakePrg()
return g:livescript_compiler . ' -c ' . g:livescript_make_options . ' $* '
\ . fnameescape(expand('%'))
endfunction
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
function! s:SetMakePrg()
if &l:makeprg =~ s:pat
let &l:makeprg = s:GetMakePrg()
elseif &g:makeprg =~ s:pat
let &g:makeprg = s:GetMakePrg()
else
return 0
endif
return 1
endfunction
" Set a dummy compiler so we can check whether to set locally or globally.
CompilerSet makeprg=ls
call s:SetMakePrg()
CompilerSet errorformat=%EFailed\ at:\ %f,
\%ECan't\ find:\ %f,
\%CSyntaxError:\ %m\ on\ line\ %l,
\%CError:\ Parse\ error\ on\ line\ %l:\ %m,
\%C,%C\ %.%#
" Compile the current file.
command! -bang -bar -nargs=* LiveScriptMake make<bang> <args>
" Set `makeprg` on rename since we embed the filename in the setting.
augroup LiveScriptUpdateMakePrg
autocmd!
" Update `makeprg` if livescript is still the compiler, else stop running this
" function.
function! s:UpdateMakePrg()
if !s:SetMakePrg()
autocmd! LiveScriptUpdateMakePrg
endif
endfunction
" Set autocmd locally if compiler was set locally.
if &l:makeprg =~ s:pat
autocmd BufFilePost,BufWritePost <buffer> call s:UpdateMakePrg()
else
autocmd BufFilePost,BufWritePost call s:UpdateMakePrg()
endif
augroup END
endif

View File

@@ -13,7 +13,7 @@ endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=nim\ c\ $*
CompilerSet makeprg=nim\ c\ --verbosity:0\ $*\ %:p
CompilerSet errorformat=
\%-GHint:\ %m,

71
compiler/python.vim Normal file
View File

@@ -0,0 +1,71 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
" Vim compiler file
" Compiler: Unit testing tool for Python
" Maintainer: Ali Aliev <ali@aliev.me>
" Last Change: 2015 Nov 2
if exists("current_compiler")
finish
endif
let current_compiler = "python"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" Disable Python warnings
if !exists('$PYTHONWARNINGS')
let $PYTHONWARNINGS="ignore"
endif
" For Flake8 first
CompilerSet efm =%E%f:%l:\ could\ not\ compile,
CompilerSet efm +=%-Z%p^,
CompilerSet efm +=%A%f:%l:%c:\ %t%n\ %m,
CompilerSet efm +=%A%f:%l:\ %t%n\ %m,
" Python errors are multi-lined. They often start with 'Traceback', so
" we want to capture that (with +G) and show it in the quickfix window
" because it explains the order of error messages.
CompilerSet efm +=%+GTraceback%.%#,
" The error message itself starts with a line with 'File' in it. There
" are a couple of variations, and we need to process a line beginning
" with whitespace followed by File, the filename in "", a line number,
" and optional further text. %E here indicates the start of a multi-line
" error message. The %\C at the end means that a case-sensitive search is
" required.
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l\\,%m%\\C,
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l%\\C,
" The possible continutation lines are idenitifed to Vim by %C. We deal
" with these in order of most to least specific to ensure a proper
" match. A pointer (^) identifies the column in which the error occurs
" (but will not be entirely accurate due to indention of Python code).
CompilerSet efm +=%C%p^,
" Any text, indented by more than two spaces contain useful information.
" We want this to appear in the quickfix window, hence %+.
CompilerSet efm +=%+C\ \ \ \ %.%#,
CompilerSet efm +=%+C\ \ %.%#,
" The last line (%Z) does not begin with any whitespace. We use a zero
" width lookahead (\&) to check this. The line contains the error
" message itself (%m)
CompilerSet efm +=%Z%\\S%\\&%m,
" We can ignore any other lines (%-G)
CompilerSet efm +=%-G%.%#
if filereadable("Makefile")
CompilerSet makeprg=make
else
CompilerSet makeprg=python
endif
" vim:foldmethod=marker:foldlevel=0
endif

View File

@@ -13,6 +13,10 @@ if !exists("g:typescript_compiler_options")
let g:typescript_compiler_options = ""
endif
if exists(":CompilerSet") != 2
command! -nargs=* CompilerSet setlocal <args>
endif
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m

9
config.vim Normal file
View File

@@ -0,0 +1,9 @@
" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
endif
" Disable json concealing by default
if !exists('g:vim_json_syntax_conceal')
let g:vim_json_syntax_conceal = 0
endif

91
extras/flow.vim Normal file
View File

@@ -0,0 +1,91 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster
syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster
syntax match jsFlowNoise contained /[:;,<>]/
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object array bool class
syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType
syntax match jsFlowTypeCustom contained /\k*/ skipwhite skipempty nextgroup=jsFlowGroup
syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster
syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturnKeyword contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword
syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
syntax region jsFlowTypeStatement start=/type/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
syntax region jsFlowTypeValue contained start=/=/ end=/[;\n]/ contains=@jsExpression,jsFlowGroup,jsFlowMaybe
syntax match jsFlowTypeOperator contained /=/
syntax keyword jsFlowTypeKeyword contained type
syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock
syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue
syntax region jsFlowModule contained start=/module/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowDeclareBlock contains=jsString
syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator
if version >= 508 || !exists("did_javascript_syn_inits")
if version < 508
let did_javascript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink jsFlowDefinition PreProc
HiLink jsFlowClassDef jsFlowDefinition
HiLink jsFlowArgumentDef jsFlowDefinition
HiLink jsFlowType Type
HiLink jsFlowTypeCustom PreProc
HiLink jsFlowTypeof PreProc
HiLink jsFlowArray PreProc
HiLink jsFlowObject PreProc
HiLink jsFlowParens PreProc
HiLink jsFlowGroup PreProc
HiLink jsFlowReturn PreProc
HiLink jsFlowReturnObject jsFlowReturn
HiLink jsFlowReturnArray jsFlowArray
HiLink jsFlowReturnParens jsFlowParens
HiLink jsFlowReturnGroup jsFlowGroup
HiLink jsFlowFunctionGroup PreProc
HiLink jsFlowClassGroup PreProc
HiLink jsFlowArrowArguments PreProc
HiLink jsFlowArrow PreProc
HiLink jsFlowTypeStatement PreProc
HiLink jsFlowTypeKeyword PreProc
HiLink jsFlowTypeOperator PreProc
HiLink jsFlowMaybe PreProc
HiLink jsFlowReturnMaybe PreProc
HiLink jsFlowClassProperty jsClassProperty
HiLink jsFlowDeclare PreProc
HiLink jsFlowModule PreProc
HiLink jsFlowInterface PreProc
HiLink jsFlowNoise Noise
HiLink jsFlowObjectKey jsObjectKey
HiLink jsFlowOrOperator PreProc
HiLink jsFlowReturnOrOp jsFlowOrOperator
delcommand HiLink
endif
endif

43
extras/jsdoc.vim Normal file
View File

@@ -0,0 +1,43 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
"" syntax coloring for javadoc comments (HTML)
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
" tags containing a param
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
" tags containing type and param
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
" tags containing type but no param
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
" tags containing references
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
" other tags (no extra syntax)
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
if version >= 508 || !exists("did_javascript_syn_inits")
if version < 508
let did_javascript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink jsDocTags Special
HiLink jsDocSeeTag Function
HiLink jsDocType Type
HiLink jsDocTypeBrackets jsDocType
HiLink jsDocTypeRecord jsDocType
HiLink jsDocTypeNoParam Type
HiLink jsDocParam Label
delcommand HiLink
endif
endif

7
extras/ngdoc.vim Normal file
View File

@@ -0,0 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
endif

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,26 @@ endif
runtime! ftplugin/html.vim
let b:did_ftplugin = 1
setlocal iskeyword+=@-@
setlocal suffixesadd=.blade.php,.php
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
setlocal path+=resources/views;
setlocal include=\\w\\@<!@\\%(include\\\|extends\\)
setlocal define=\\w\\@<!@\\%(yield\\\|stack\\)
setlocal commentstring={{--%s--}}
setlocal comments+=s:{{--,m:\ \ \ \ ,e:--}}
if exists('loaded_matchit') && exists('b:match_words')
" Append to html matchit words
let b:match_words .= ',' .
\ '@\%(section\|if\|unless\|foreach\|forelse\|for\|while\|push\|can\|cannot\|hasSection\|php\|verbatim\)\>' .
\ ':' .
\ '@\%(else\|elseif\|empty\|break\|continue\|elsecan\|elsecannot\)\>' .
\ ':' .
\ '@\%(end\w\+\|stop\|show\|append\|overwrite\)' .
\ ',{:},\[:\],(:)'
let b:match_skip = 'synIDattr(synID(line("."), col("."), 0), "name") !=# "bladeKeyword"'
let b:match_ignorecase = 0
endif
endif

View File

@@ -15,7 +15,7 @@ call coffee#CoffeeSetUpVariables()
setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:# commentstring=#\ %s
setlocal omnifunc=javascriptcomplete#CompleteJS
setlocal suffixesadd+=coffee
setlocal suffixesadd+=.coffee
" Create custom augroups.
augroup CoffeeBufUpdate | augroup END

View File

@@ -40,6 +40,30 @@ setlocal errorformat=
\%C%p^,
\%-C%.%#
let g:crystal_compiler_command = get(g:, 'crystal_compiler_command', 'crystal')
let g:crystal_auto_format = get(g:, 'crystal_auto_format', 0)
command! -buffer -nargs=* CrystalImpl echo crystal_lang#impl(expand('%'), getpos('.'), <q-args>).output
command! -buffer -nargs=0 CrystalDef call crystal_lang#jump_to_definition(expand('%'), getpos('.'))
command! -buffer -nargs=* CrystalContext echo crystal_lang#context(expand('%'), getpos('.'), <q-args>).output
command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expand('%'), <q-args>)
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>)
nnoremap <Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR>
augroup plugin-ft-crystal
autocmd!
autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif
augroup END
if get(g:, 'crystal_define_mappings', 1)
nmap <buffer>gd <Plug>(crystal-jump-to-definition)
nmap <buffer>gc <Plug>(crystal-show-context)

View File

@@ -56,6 +56,6 @@ let &l:path =
setlocal includeexpr=GetElixirFilename(v:fname)
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
setlocal formatoptions-=t formatoptions+=croqlj
silent! setlocal formatoptions-=t formatoptions+=croqlj
endif

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
" Language: ember-script
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-ember-script
" Version: 1.0.1
" Last Change: 2013 Apr 17
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
" URL: http://github.com/yalesov/vim-ember-script
" Version: 1.0.4
" Last Change: 2016 Jul 6
" License: ISC
setlocal tabstop=2
setlocal softtabstop=2
@@ -14,7 +14,11 @@ setlocal smarttab
setlocal expandtab
setlocal smartindent
if v:version < 703
setlocal formatoptions-=t formatoptions+=croql
else
setlocal formatoptions-=t formatoptions+=croqlj
endif
setlocal comments=:#
setlocal commentstring=#\ %s

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
" Language: emblem
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-emblem
" Version: 1.2.0
" Last Change: 2013 Apr 22
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
" URL: http://github.com/yalesov/vim-emblem
" Version: 2.0.1
" Last Change: 2016 Jul 6
" License: ISC
setlocal tabstop=2
setlocal softtabstop=2

42
ftplugin/json.vim Normal file
View File

@@ -0,0 +1,42 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
" Vim syntax file
" Language: JSON
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
" Last Change: 2014-05-20 added warning toggle
"uncomment to enable folding of `{...}` and `[...]` blocks
"setlocal foldmethod=syntax
"conceal by default
if !exists("g:vim_json_syntax_conceal")
let g:vim_json_syntax_conceal = 1
end
"have warnings by default
if !exists("g:vim_json_warnings")
let g:vim_json_warnings = 1
end
"set concealcursor blank by default
"this should turn off the concealing in the current line (where the cursor is at),
"on all modes (normal, visual, insert)
if !exists("g:vim_json_syntax_concealcursor")
let g:vim_json_syntax_concealcursor = ""
end
if has('conceal')
if (g:vim_json_syntax_conceal == 1)
"level 2 means concealed text gets completely hidden unless a
"replacement is defined (none is defined by us)
setlocal conceallevel=2
let &l:concealcursor = g:vim_json_syntax_concealcursor
else
"level 0 means text is shown normally = no concealing
setlocal conceallevel=0
endif
"maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
"directly to vim's conceallevels? unsure if anyone cares
endif
endif

208
ftplugin/ls.vim Normal file
View File

@@ -0,0 +1,208 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
" Language: LiveScript
" Maintainer: George Zahariev
" URL: http://github.com/gkz/vim-ls
" License: WTFPL
"
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:#
setlocal commentstring=#\ %s
setlocal omnifunc=javascriptcomplete#CompleteJS
" Enable LiveScriptMake if it won't overwrite any settings.
if !len(&l:makeprg)
compiler ls
endif
" Check here too in case the compiler above isn't loaded.
if !exists('livescript_compiler')
let livescript_compiler = 'lsc'
endif
" Reset the LiveScriptCompile variables for the current buffer.
function! s:LiveScriptCompileResetVars()
" Compiled output buffer
let b:livescript_compile_buf = -1
let b:livescript_compile_pos = []
" If LiveScriptCompile is watching a buffer
let b:livescript_compile_watch = 0
endfunction
" Clean things up in the source buffer.
function! s:LiveScriptCompileClose()
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
call s:LiveScriptCompileResetVars()
endfunction
" Update the LiveScriptCompile buffer given some input lines.
function! s:LiveScriptCompileUpdate(startline, endline)
let input = join(getline(a:startline, a:endline), "\n")
" Move to the LiveScriptCompile buffer.
exec bufwinnr(b:livescript_compile_buf) 'wincmd w'
" LiveScript doesn't like empty input.
if !len(input)
return
endif
" Compile input.
let output = system(g:livescript_compiler . ' -scb 2>&1', input)
" Be sure we're in the LiveScriptCompile buffer before overwriting.
if exists('b:livescript_compile_buf')
echoerr 'LiveScriptCompile buffers are messed up'
return
endif
" Replace buffer contents with new output and delete the last empty line.
setlocal modifiable
exec '% delete _'
put! =output
exec '$ delete _'
setlocal nomodifiable
" Highlight as JavaScript if there is no compile error.
if v:shell_error
setlocal filetype=
else
setlocal filetype=javascript
endif
call setpos('.', b:livescript_compile_pos)
endfunction
" Update the LiveScriptCompile buffer with the whole source buffer.
function! s:LiveScriptCompileWatchUpdate()
call s:LiveScriptCompileUpdate(1, '$')
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
endfunction
" Peek at compiled LiveScript in a scratch buffer. We handle ranges like this
" to prevent the cursor from being moved (and its position saved) before the
" function is called.
function! s:LiveScriptCompile(startline, endline, args)
if !executable(g:livescript_compiler)
echoerr "Can't find LiveScript compiler `" . g:livescript_compiler . "`"
return
endif
" If in the LiveScriptCompile buffer, switch back to the source buffer and
" continue.
if !exists('b:livescript_compile_buf')
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
endif
" Parse arguments.
let watch = a:args =~ '\<watch\>'
let unwatch = a:args =~ '\<unwatch\>'
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
" Determine default split direction.
if exists('g:livescript_compile_vert')
let vert = 1
else
let vert = a:args =~ '\<vert\%[ical]\>'
endif
" Remove any watch listeners.
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
" If just unwatching, don't compile.
if unwatch
let b:livescript_compile_watch = 0
return
endif
if watch
let b:livescript_compile_watch = 1
endif
" Build the LiveScriptCompile buffer if it doesn't exist.
if bufwinnr(b:livescript_compile_buf) == -1
let src_buf = bufnr('%')
let src_win = bufwinnr(src_buf)
" Create the new window and resize it.
if vert
let width = size ? size : winwidth(src_win) / 2
belowright vertical new
exec 'vertical resize' width
else
" Try to guess the compiled output's height.
let height = size ? size : min([winheight(src_win) / 2,
\ a:endline - a:startline + 5])
belowright new
exec 'resize' height
endif
" We're now in the scratch buffer, so set it up.
setlocal bufhidden=wipe buftype=nofile
setlocal nobuflisted nomodifiable noswapfile nowrap
autocmd BufWipeout <buffer> call s:LiveScriptCompileClose()
" Save the cursor when leaving the LiveScriptCompile buffer.
autocmd BufLeave <buffer> let b:livescript_compile_pos = getpos('.')
nnoremap <buffer> <silent> q :hide<CR>
let b:livescript_compile_src_buf = src_buf
let buf = bufnr('%')
" Go back to the source buffer and set it up.
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
let b:livescript_compile_buf = buf
endif
if b:livescript_compile_watch
call s:LiveScriptCompileWatchUpdate()
augroup LiveScriptCompileAuWatch
autocmd InsertLeave <buffer> call s:LiveScriptCompileWatchUpdate()
autocmd BufWritePost <buffer> call s:LiveScriptCompileWatchUpdate()
augroup END
else
call s:LiveScriptCompileUpdate(a:startline, a:endline)
endif
endfunction
" Complete arguments for the LiveScriptCompile command.
function! s:LiveScriptCompileComplete(arg, cmdline, cursor)
let args = ['unwatch', 'vertical', 'watch']
if !len(a:arg)
return args
endif
let match = '^' . a:arg
for arg in args
if arg =~ match
return [arg]
endif
endfor
endfunction
" Don't overwrite the CoffeeCompile variables.
if !exists("s:livescript_compile_buf")
call s:LiveScriptCompileResetVars()
endif
" Peek at compiled LiveScript.
command! -range=% -bar -nargs=* -complete=customlist,s:LiveScriptCompileComplete
\ LiveScriptCompile call s:LiveScriptCompile(<line1>, <line2>, <q-args>)
" Run some LiveScript.
command! -range=% -bar LiveScriptRun <line1>,<line2>:w !lsc -sp
endif

15
ftplugin/mako.vim Normal file
View File

@@ -0,0 +1,15 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
" Vim filetype plugin file
" Language: Mako
" Maintainer: Randy Stauner <randy@magnificent-tears.com>
" Last Change: 2014-02-07
" Version: 0.1
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
setlocal comments=:##
setlocal commentstring=##%s
endif

View File

@@ -1,54 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
" Vim filetype plugin
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2013 May 30
if exists("b:did_ftplugin")
finish
endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
if exists('b:undo_ftplugin')
let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
else
let b:undo_ftplugin = "setl cms< com< fo< flp<"
endif
function! MarkdownFold()
let line = getline(v:lnum)
" Regular headers
let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
if depth > 0
return ">" . depth
endif
" Setext style headings
let nextline = getline(v:lnum + 1)
if (line =~ '^.\+$') && (nextline =~ '^=\+$')
return ">1"
endif
if (line =~ '^.\+$') && (nextline =~ '^-\+$')
return ">2"
endif
return "="
endfunction
if has("folding") && exists("g:markdown_folding")
setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr
let b:undo_ftplugin .= " foldexpr< foldmethod<"
endif
" vim:set sw=2:
endif

View File

@@ -1,92 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
" Vim filetype plugin file
" Language: Perl 6
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: {{LAST_CHANGE}}
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
setlocal formatoptions-=t
setlocal formatoptions+=crqol
setlocal keywordprg=p6doc
setlocal comments=:#\|,:#=,:#
setlocal commentstring=#%s
" Change the browse dialog on Win32 to show mainly Perl-related files
if has("gui_win32")
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
\ "Perl Modules (*.pm)\t*.pm\n" .
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
setlocal include=\\<\\(use\\\|require\\)\\>
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
setlocal define=[^A-Za-z_]
" The following line changes a global variable but is necessary to make
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
" the problem. If this causes a " problem for you, add an
" after/ftplugin/perl6.vim file that contains
" set isfname-=:
set isfname+=:
setlocal iskeyword=@,48-57,_,192-255,-
" Set this once, globally.
if !exists("perlpath")
if executable("perl6")
try
if &shellxquote != '"'
let perlpath = system('perl6 -e "@*INC.join(q/,/).say"')
else
let perlpath = system("perl6 -e '@*INC.join(q/,/).say'")
endif
let perlpath = substitute(perlpath,',.$',',,','')
catch /E145:/
let perlpath = ".,,"
endtry
else
" If we can't call perl to get its path, just default to using the
" current directory and the directory of the current file.
let perlpath = ".,,"
endif
endif
" Append perlpath to the existing path value, if it is set. Since we don't
" use += to do it because of the commas in perlpath, we have to handle the
" global / local settings, too.
if &l:path == ""
if &g:path == ""
let &l:path=perlpath
else
let &l:path=&g:path.",".perlpath
endif
else
let &l:path=&l:path.",".perlpath
endif
"---------------------------------------------
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" .
\ " | unlet! b:browsefilter"
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo
endif

View File

@@ -6,17 +6,33 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
" Last Change: 19-Jun-2012
" Version: 0.1
if exists("g:loaded_plantuml_plugin")
if exists("b:loaded_plantuml_plugin")
finish
endif
let g:loaded_plantuml_plugin = 1
let b:loaded_plantuml_plugin = 1
if !exists("g:plantuml_executable_script")
let g:plantuml_executable_script="plantuml"
endif
autocmd Filetype plantuml let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_words =
\ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' .
\ ',\<if\>:\<elseif\>:\<else\>:\<endif\>' .
\ ',\<rnote\>:\<endrnote\>' .
\ ',\<hnote\>:\<endhnote\>' .
\ ',\<title\>:\<endtitle\>' .
\ ',\<\while\>:\<endwhile\>'
endif
let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
let b:endwise_addition = '\=index(["note","legend"], submatch(0))!=-1 ? "end " . submatch(0) : "end"'
let b:endwise_words = 'loop,group,alt,note,legend'
let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$'
let b:endwise_syngroups = 'plantumlKeyword'
endif

5
ftplugin/purescript.vim Normal file
View File

@@ -0,0 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
endif

View File

@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
setlocal suffixesadd+=.js
set ts=2 sts=2 sw=2 et
endif

View File

@@ -77,20 +77,20 @@ function! s:query_path(root) abort
let prefix = ''
endif
if &shellxquote == "'"
let path_check = prefix.'ruby -e "' . code . '"'
let path_check = prefix.'ruby --disable-gems -e "' . code . '"'
else
let path_check = prefix."ruby -e '" . code . "'"
let path_check = prefix."ruby --disable-gems -e '" . code . "'"
endif
let cd = haslocaldir() ? 'lcd' : 'cd'
let cwd = getcwd()
let cwd = fnameescape(getcwd())
try
exe cd fnameescape(a:root)
let path = split(system(path_check),',')
exe cd fnameescape(cwd)
exe cd cwd
return path
finally
exe cd fnameescape(cwd)
exe cd cwd
endtry
endfunction
@@ -186,7 +186,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
if maparg('im','n') == ''
if maparg('im','x') == '' && maparg('im','o') == '' && maparg('am','x') == '' && maparg('am','o') == ''
onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
@@ -196,7 +196,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
\."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
endif
if maparg('iM','n') == ''
if maparg('iM','x') == '' && maparg('iM','o') == '' && maparg('aM','x') == '' && maparg('aM','o') == ''
onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Description: Vim syntax file for Rust
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Maintainer: Kevin Ballard <kevin@sb.org>
" Last Change: January 29, 2015
" Last Change: June 08, 2016
if exists("b:did_ftplugin")
finish
@@ -14,6 +14,9 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
augroup rust.vim
autocmd!
" Variables {{{1
" The rust source code at present seems to typically omit a leader on /*!
@@ -45,7 +48,6 @@ endif
" This includeexpr isn't perfect, but it's a good start
setlocal includeexpr=substitute(v:fname,'::','/','g')
" NOT adding .rc as it's being phased out (0.7)
setlocal suffixesadd=.rs
if exists("g:ftplugin_rust_source_path")
@@ -56,7 +58,33 @@ if exists("g:loaded_delimitMate")
if exists("b:delimitMate_excluded_regions")
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
endif
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
" For this buffer, when delimitMate issues the `User delimitMate_map`
" event in the autocommand system, add the above-defined extra excluded
" regions to delimitMate's state, if they have not already been added.
autocmd User <buffer>
\ if expand('<afile>') ==# 'delimitMate_map' && match(
\ delimitMate#Get("excluded_regions"),
\ s:delimitMate_extra_excluded_regions) == -1
\| let b:delimitMate_excluded_regions =
\ delimitMate#Get("excluded_regions")
\ . s:delimitMate_extra_excluded_regions
\|endif
" For this buffer, when delimitMate issues the `User delimitMate_unmap`
" event in the autocommand system, delete the above-defined extra excluded
" regions from delimitMate's state (the deletion being idempotent and
" having no effect if the extra excluded regions are not present in the
" targeted part of delimitMate's state).
autocmd User <buffer>
\ if expand('<afile>') ==# 'delimitMate_unmap'
\| let b:delimitMate_excluded_regions = substitute(
\ delimitMate#Get("excluded_regions"),
\ '\C\V' . s:delimitMate_extra_excluded_regions,
\ '', 'g')
\|endif
endif
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
@@ -161,10 +189,18 @@ let b:undo_ftplugin = "
\|ounmap <buffer> ]]
\|set matchpairs-=<:>
\|unlet b:match_skip
\|augroup! rust.vim
\"
" }}}1
" Code formatting on save
if get(g:, "rustfmt_autosave", 0)
autocmd BufWritePre *.rs call rustfmt#Format()
endif
augroup END
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -18,7 +18,11 @@ silent! setlocal formatoptions+=j
" Just like c.vim, but additionally doesn't wrap text onto /** line when
" formatting. Doesn't bungle bulleted lists when formatting.
if get(g:, 'scala_scaladoc_indent', 0)
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
else
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
endif
setlocal commentstring=//\ %s
setlocal shiftwidth=2 softtabstop=2 expandtab

13
ftplugin/slim.vim Normal file
View File

@@ -0,0 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl isk<"
setlocal iskeyword+=-
setlocal commentstring=/%s
endif

5
ftplugin/tmux.vim Normal file
View File

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

View File

@@ -16,7 +16,7 @@ setlocal formatoptions=cl
let s:comment = '\v^\s*#' " # comment
let s:array_entry = '\v^\s*-\s' " - foo
let s:named_module_entry = '\v^\s*-\s*(name|hosts):\s*\S' " - name: 'do stuff'
let s:named_module_entry = '\v^\s*-\s*(name|hosts|role):\s*\S' " - name: 'do stuff'
let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items:
let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package
let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: >

View File

@@ -7,13 +7,29 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
if exists("b:did_indent")
finish
endif
runtime! indent/html.vim
let s:htmlindent = &indentexpr
unlet! b:did_indent
runtime! indent/php.vim
let s:phpindent = &indentexpr
unlet! b:did_indent
let b:did_indent = 1
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim'
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
if exists('g:blade_custom_directives_pairs')
let s:directives_start .= '\|' . join(keys(g:blade_custom_directives_pairs), '\|')
let s:directives_end .= '\|' . join(values(g:blade_custom_directives_pairs), '\|')
endif
setlocal autoindent
setlocal indentexpr=GetBladeIndent()
setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty,=@show
exe "setlocal indentkeys=o,O,<>>,!^F,0=}},0=!!},=@" . substitute(s:directives_end, '\\|', ',=@', 'g')
" Only define the function once.
if exists("*GetBladeIndent")
@@ -29,27 +45,35 @@ function! GetBladeIndent()
let line = substitute(substitute(getline(lnum), '\s\+$', '', ''), '^\s\+', '', '')
let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')
let indent = indent(lnum)
let cindent = indent(v:lnum)
if cline =~# '@\%(else\|elseif\|empty\|end\|show\)'
if cline =~# '@\%(' . s:directives_end . '\)' ||
\ cline =~# '\%(<?.*\)\@<!?>\|\%({{.*\)\@<!}}\|\%({!!.*\)\@<!!!}'
let indent = indent - &sw
elseif line =~# '<?\%(.*?>\)\@!\|@php\%(\s*(\)\@!'
let indent = indent + &sw
else
if exists("*GetBladeIndentCustom")
let hindent = GetBladeIndentCustom()
" Don't use PHP indentation if line is a comment
elseif line !~# '^\s*\%(#\|//\)\|\*/\s*$' && (
\ searchpair('@include\%(If\)\?\s*(', '', ')', 'bWr') ||
\ searchpair('{!!', '', '!!}', 'bWr') ||
\ searchpair('{{', '', '}}', 'bWr') ||
\ searchpair('<?', '', '?>', 'bWr') ||
\ searchpair('@php\%(\s*(\)\@!', '', '@endphp', 'bWr') )
execute 'let hindent = ' . s:phpindent
else
let hindent = HtmlIndent()
execute 'let hindent = ' . s:htmlindent
endif
if hindent > -1
let indent = hindent
endif
endif
let increase = indent + &sw
if indent = indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
if line =~# '@\%(section\)\%(.*\s*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
if line =~# '@\%(section\)\%(.*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
return indent
elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\)\%(.*\s*@end\)\@!'
elseif line =~# '@\%(' . s:directives_start . '\)\%(.*@end\|.*@stop\)\@!' ||
\ line =~# '{{\%(.*}}\)\@!' || line =~# '{!!\%(.*!!}\)\@!'
return increase
else
return indent

View File

@@ -189,6 +189,16 @@ if exists("*searchpairpos")
return val
endfunction
" Check if form is a reader conditional, that is, it is prefixed by #?
" or @#?
function! s:is_reader_conditional_special_case(position)
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
return 1
endif
return 0
endfunction
" Returns 1 for opening brackets, -1 for _anything else_.
function! s:bracket_type(char)
return stridx('([{', a:char) > -1 ? 1 : -1
@@ -256,6 +266,10 @@ if exists("*searchpairpos")
return [paren[0], paren[1] + &shiftwidth - 1]
endif
if s:is_reader_conditional_special_case(paren)
return paren
endif
" In case we are at the last character, we use the paren position.
if col("$") - 1 == paren[1]
return paren

View File

@@ -8,6 +8,9 @@ runtime! indent/elixir.vim
unlet! b:did_indent
setlocal indentexpr=
let s:cpo_save = &cpo
set cpo&vim
if exists("b:eelixir_subtype")
exe "runtime! indent/".b:eelixir_subtype.".vim"
else
@@ -53,19 +56,21 @@ function! GetEelixirIndent(...)
let line = getline(lnum)
let cline = getline(v:lnum)
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
let ind = ind - &sw
let ind -= &sw
elseif line =~# '\S\s*<%\s*end\s*%>'
let ind = ind - &sw
let ind -= &sw
endif
if line =~# '<%[=%]\=\s*.*\<do\s*%>'
let ind = ind + &sw
elseif line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
let ind = ind + &sw
if line =~# '<%[=%]\=\s*.*\(\<do\|->\)\s*%>' ||
\ line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
let ind += &sw
endif
if cline =~# '^\s*%>\s*$'
let ind = ind - &sw
let ind -= &sw
endif
return ind
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -2,17 +2,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
if exists("b:did_indent")
finish
endif
end
let b:did_indent = 1
setlocal nosmartindent
setlocal indentexpr=GetElixirIndent()
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue,0=\|>
if exists("*GetElixirIndent")
finish
endif
end
let s:cpo_save = &cpo
set cpo&vim
@@ -34,91 +34,107 @@ let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:bloc
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after
let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
let s:pair_middle = '^\s*\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
let s:inside_block = 0
function! GetElixirIndent()
let lnum = prevnonblank(v:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0
return 0
endif
let opened_symbol = 0
let current_line = getline(v:lnum)
let last_line = getline(lnum)
let ind = indent(lnum)
function! s:is_indentable_syntax()
" TODO: Remove these 2 lines
" 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
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
call synID(s:current_line_ref, 1, 1)
" This forces vim to sync the syntax.
call synID(v:lnum, 1, 1)
syntax sync fromstart
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
if last_line !~ s:arrow
let split_line = split(last_line, '\zs')
let opened_symbol += count(split_line, '(') - count(split_line, ')')
let opened_symbol += count(split_line, '[') - count(split_line, ']')
let opened_symbol += count(split_line, '{') - count(split_line, '}')
end
return synIDattr(synID(s:current_line_ref, 1, 1), "name")
\ !~ s:skip_syntax
endfunction
function! s:indent_opened_symbol(ind)
if s:opened_symbol > 0
if s:pending_parenthesis > 0
\ && s:last_line !~ '^\s*def'
\ && s:last_line !~ s:arrow
let b:old_ind = a:ind
return matchend(s:last_line, '(')
" 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))
" Avoid negative indentation index
elseif s:last_line =~ '\('.s:symbols_start.'\).'
let regex = '\('.s:symbols_start.'\)\s*'
let opened_prefix = matchlist(s:last_line, regex)[0]
return a:ind + (s:opened_symbol * strlen(opened_prefix))
else
let ind += (opened_symbol * &sw)
endif
if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords
let ind += &sw
endif
if current_line =~ '^\s*\('.s:symbols_end.'\)'
let ind -= &sw
endif
if last_line =~ s:ending_with_assignment && opened_symbol == 0
let b:old_ind = indent(lnum)
let ind += &sw
return a:ind + (s:opened_symbol * &sw)
end
elseif s:opened_symbol < 0
let ind = get(b:, 'old_ind', a:ind + (s:opened_symbol * &sw))
let ind = float2nr(ceil(floor(ind)/&sw)*&sw)
return ind <= 0 ? 0 : ind
else
return a:ind
end
endfunction
" if line starts with pipeline
" and last line ends with a pipeline,
" align them
if last_line =~ '|>.*$' &&
\ current_line =~ s:starts_with_pipeline
let ind = float2nr(match(last_line, '|>') / &sw) * &sw
function! s:indent_last_line_end_symbol_or_indent_keyword(ind)
if s:last_line =~ '^\s*\('.s:symbols_end.'\)'
\ || s:last_line =~ s:indent_keywords
return a:ind + &sw
else
return a:ind
end
endfunction
function! s:indent_symbols_ending(ind)
if s:current_line =~ '^\s*\('.s:symbols_end.'\)'
return a:ind - &sw
else
return a:ind
end
endfunction
function! s:indent_assignment(ind)
if s:last_line =~ s:ending_with_assignment
let b:old_ind = indent(s:last_line_ref) " FIXME: side effect
return a:ind + &sw
else
return a:ind
end
endfunction
function! s:indent_pipeline(ind)
if s:last_line =~ s:starts_with_pipeline
\ && s:current_line =~ s:starts_with_pipeline
indent(s:last_line_ref)
elseif s:current_line =~ s:starts_with_pipeline
\ && s:last_line =~ '^[^=]\+=.\+$'
let b:old_ind = indent(s:last_line_ref)
" if line starts with pipeline
" and last line is an attribution
" indents pipeline in same level as attribution
elseif current_line =~ s:starts_with_pipeline &&
\ last_line =~ '^[^=]\+=.\+$'
if !exists('b:old_ind') || b:old_ind == 0
let b:old_ind = indent(lnum)
return match(s:last_line, '=\s*\zs[^ ]')
else
return a:ind
end
let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw
endif
endfunction
" if last line starts with pipeline
" and current line doesn't start with pipeline
" returns the indentation before the pipeline
if last_line =~ s:starts_with_pipeline &&
\ current_line !~ s:starts_with_pipeline
let ind = b:old_ind
endif
function! s:indent_after_pipeline(ind)
if s:last_line =~ s:starts_with_pipeline
if empty(substitute(s:current_line, ' ', '', 'g'))
\ || s:current_line =~ s:starts_with_pipeline
return indent(s:last_line_ref)
elseif s:last_line !~ s:indent_keywords
return b:old_ind
else
return a:ind
end
else
return a:ind
end
endfunction
if current_line =~ s:deindent_keywords
function! s:deindent_keyword(ind)
if s:current_line =~ s:deindent_keywords
let bslnum = searchpair(
\ s:pair_start,
\ s:pair_middle,
@@ -127,16 +143,57 @@ function! GetElixirIndent()
\ s:block_skip
\ )
let ind = indent(bslnum)
endif
return indent(bslnum)
else
return a:ind
end
endfunction
function! s:indent_arrow(ind)
if s:current_line =~ s:arrow
" indent case statements '->'
if current_line =~ s:arrow
let ind += &sw
endif
endif
return a:ind + &sw
else
return a:ind
end
endfunction
function! GetElixirIndent()
let s:current_line_ref = v:lnum
let s:last_line_ref = prevnonblank(s:current_line_ref - 1)
let s:current_line = getline(s:current_line_ref)
let s:last_line = getline(s:last_line_ref)
let s:pending_parenthesis = 0
let s:opened_symbol = 0
if s:last_line !~ s:arrow
let splitted_line = split(s:last_line, '\zs')
let s:pending_parenthesis =
\ + count(splitted_line, '(') - count(splitted_line, ')')
let s:opened_symbol =
\ + s:pending_parenthesis
\ + count(splitted_line, '[') - count(splitted_line, ']')
\ + count(splitted_line, '{') - count(splitted_line, '}')
end
if s:last_line_ref == 0
" At the start of the file use zero indent.
return 0
elseif !s:is_indentable_syntax()
" Current syntax is not indentable, keep last line indentation
return indent(s:last_line_ref)
else
let ind = indent(s:last_line_ref)
let ind = s:indent_opened_symbol(ind)
let ind = s:indent_symbols_ending(ind)
let ind = s:indent_pipeline(ind)
let ind = s:indent_after_pipeline(ind)
let ind = s:indent_assignment(ind)
let ind = s:indent_last_line_end_symbol_or_indent_keyword(ind)
let ind = s:deindent_keyword(ind)
let ind = s:indent_arrow(ind)
return ind
end
endfunction
let &cpo = s:cpo_save

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
" Language: ember-script
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-ember-script
" Version: 1.0.1
" Last Change: 2013 Apr 17
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
" URL: http://github.com/yalesov/vim-ember-script
" Version: 1.0.4
" Last Change: 2016 Jul 6
" License: ISC
if exists('b:did_indent')
finish

View File

@@ -1,10 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
" Language: emblem
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-emblem
" Version: 1.2.0
" Last Change: 2013 Apr 22
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
" URL: http://github.com/yalesov/vim-emblem
" Version: 2.0.1
" Last Change: 2016 Jul 6
" License: ISC
endif

View File

@@ -43,6 +43,10 @@ if exists("*GetErubyIndent")
finish
endif
" this file uses line continuations
let s:cpo_sav = &cpo
set cpo&vim
function! GetErubyIndent(...)
" The value of a single shift-width
if exists('*shiftwidth')
@@ -101,6 +105,9 @@ function! GetErubyIndent(...)
return ind
endfunction
let &cpo = s:cpo_sav
unlet! s:cpo_sav
" vim:set sw=2 sts=2 ts=8 noet:
endif

View File

@@ -77,6 +77,6 @@ function! GoIndent(lnum)
return ind
endfunction
" vim:ts=4:sw=4:et
" vim: sw=2 ts=2 et
endif

View File

@@ -45,4 +45,6 @@ function! GetGoHTMLTmplIndent(lnum)
return ind
endfunction
" vim: sw=2 ts=2 et
endif

View File

@@ -60,18 +60,35 @@ if !exists('g:haskell_indent_guard')
endif
setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,0\,,<space>
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
function! s:isInBlock(hlstack)
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
endfunction
function! s:stripTrailingComment(line)
if a:line =~ '^\s*--\(-\+\|\s\+\)' || a:line =~ '^\s*{-'
return a:line
else
let l:stripped = split(a:line, '-- ')
if len(l:stripped) > 1
return substitute(l:stripped[0], '\s*$', '', '')
else
return a:line
endif
endif
endfunction
function! s:isSYN(grp, line, col)
return index(s:getHLStack(a:line, a:col), a:grp) != -1
endfunction
function! s:getNesting(hlstack)
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens"')
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens" || v:val == "haskellBlockComment" || v:val == "haskellPragma" ')
endfunction
function! s:getHLStack()
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
function! s:getHLStack(line, col)
return map(synstack(a:line, a:col), 'synIDattr(v:val, "name")')
endfunction
" indent matching character
@@ -110,37 +127,68 @@ function! s:indentGuard(pos, prevline)
endfunction
function! GetHaskellIndent()
let l:hlstack = s:getHLStack()
let l:hlstack = s:getHLStack(line('.'), col('.'))
" do not indent in strings and quasiquotes
if index(l:hlstack, 'haskellString') > -1 || index(l:hlstack, 'haskellQuasiQuote') > -1
if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -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:prevline = s:stripTrailingComment(getline(v:lnum - 1))
let l:line = getline(v:lnum)
" indent multiline strings
if index(l:hlstack, 'haskellString') > -1
if l:line =~ '^\s*\\'
return match(l:prevline, '["\\]')
else
return - 1
endif
endif
" reset
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
return 0
endif
" comment indentation
if l:line =~ '^\s*--'
return match(l:prevline, '-- ')
endif
if l:prevline =~ '^\s*--'
return match(l:prevline, '\S')
endif
" { foo :: Int
" >>,
"
" |
" ...
" >>,
if l:line =~ '^\s*,'
if s:isInBlock(l:hlstack)
normal! 0
call search(',', 'cW')
let l:n = s:getNesting(s:getHLStack(line('.'), col('.')))
call search('[([{]', 'bW')
let l:cl = line('.')
let l:cc = col('.')
while l:n != s:getNesting(s:getHLStack(l:cl, l:cc)) || s:isSYN('haskellString', l:cl, l:cc) || s:isSYN('haskellChar', l:cl, l:cc)
call search('[([{]', 'bW')
let l:cl = line('.')
let l:cc = col('.')
endwhile
return l:cc - 1
else
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
if l:s > -1
return l:s
end
endif
endif
" operator at end of previous line
if l:prevline =~ '[!#$%&*+./<>?@\\^|~-]\s*$'
return match(l:prevline, '\S') + &shiftwidth
@@ -168,11 +216,20 @@ function! GetHaskellIndent()
" >>>>y = 2
if l:prevline =~ '\C\<let\>\s\+.\+$'
if l:line =~ '\C^\s*\<let\>'
return match(l:prevline, '\C\<let\>')
let l:s = match(l:prevline, '\C\<let\>')
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s
endif
elseif l:line =~ '\C^\s*\<in\>'
return match(l:prevline, '\C\<let\>') + g:haskell_indent_in
let l:s = match(l:prevline, '\C\<let\>')
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_in
endif
else
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let
let l:s = match(l:prevline, '\C\<let\>')
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_let
endif
endif
endif
@@ -201,20 +258,13 @@ function! GetHaskellIndent()
return match(l:prevline, '\S') + &shiftwidth
endif
"" where foo
"" >>>>>>bar
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
return match(l:prevline, ':: ')
else
return match(l:prevline, '\C\<where\>') + g:haskell_indent_where
endif
endif
" do foo
" >>>bar
if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
return match(l:prevline, '\C\<do\>') + g:haskell_indent_do
let l:s = match(l:prevline, '\C\<do\>')
if s:isSYN('haskellKeyword', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_do
endif
endif
" case foo of
@@ -223,6 +273,19 @@ function! GetHaskellIndent()
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
endif
"" where foo
"" >>>>>>bar
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
return match(l:prevline, ':: ')
else
let l:s = match(l:prevline, '\C\<where\>')
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)
return l:s + g:haskell_indent_where
endif
endif
endif
" newtype Foo = Foo
" >>deriving
if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
@@ -319,7 +382,10 @@ function! GetHaskellIndent()
" foo
" >>{
if l:line =~ '^\s*{' && l:prevline !~ '^{'
return match(l:prevline, '\S') + &shiftwidth
let l:s = match(l:prevline, '\S')
if l:s >= 0
return l:s + &shiftwidth
endif
endif
" in foo
@@ -361,32 +427,6 @@ function! GetHaskellIndent()
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
" |
" ...
" >>|

View File

@@ -2,26 +2,26 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
" Vim indent file
" Language: Javascript
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
" 0. Initialization {{{1
" =================
" Maintainer: vim-javascript community
" URL: https://github.com/pangloss/vim-javascript
" Last Change: August 20, 2016
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent()
setlocal formatexpr=Fixedgq(v:lnum,v:count)
setlocal indentkeys=0{,0},0),0],0\,:,!^F,o,O,e
setlocal nolisp noautoindent nosmartindent
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
setlocal cinoptions+=j1,J1
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< cinoptions<'
" Only define the function once.
if exists("*GetJavascriptIndent")
if exists('*GetJavascriptIndent')
finish
endif
@@ -30,586 +30,169 @@ set cpo&vim
" Get shiftwidth value
if exists('*shiftwidth')
func s:sw()
function s:sw()
return shiftwidth()
endfunc
endfunction
else
func s:sw()
function s:sw()
return &sw
endfunc
endfunction
endif
" 1. Variables {{{1
" ============
let s:js_keywords = '^\s*\(break\|catch\|const\|continue\|debugger\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|let\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)'
let s:expr_case = '^\s*\(case\s\+[^\:]*\|default\)\s*:\s*'
let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>'
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'
" Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\%(\%(template\)\@<!string\|regex\|comment\)\c'
" Regex of syntax group names that are or delimit template strings
let s:syng_template = 'template\c'
" Regex of syntax group names that are strings.
let s:syng_string = 'regex\c'
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
" Regex of syntax group names that are strings or documentation.
let s:syng_multiline = 'comment\c'
" Regex of syntax group names that are line comment.
let s:syng_linecom = 'linecomment\c'
let s:syng_comment = '\%(comment\|doc\)'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
" Regex that defines continuation lines, not including (, {, or [.
let s:continuation_regex = '\%([\\*/.:]\|+\@<!+\|-\@<!-\|\%(<%\)\@<!=\|\W[|&?]\|||\|&&\|[^=]=[^=>].*,\)' . s:line_term
" Regex that defines continuation lines.
" TODO: this needs to deal with if ...: and so on
let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*([^()]*)[^()]*\))[^()]*\))[^()]*\))\)\|=>\)' . s:line_term
" Regex that defines blocks.
let s:block_regex = '\%([{([]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
let s:operator_first = '^\s*\%([*/.:?]\|\([-+]\)\1\@!\|||\|&&\)'
let s:var_stmt = '^\s*\%(const\|let\|var\)'
let s:comma_first = '^\s*,'
let s:comma_last = ',\s*$'
let s:case_indent = s:sw()
let s:case_indent_after = s:sw()
let s:m = matchlist(&cinoptions, ':\(.\)')
if (len(s:m) > 2)
let s:case_indent = s:m[1]
if has('reltime')
function s:GetPair(start,end,flags,time)
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time)
endfunction
else
function s:GetPair(start,end,flags,n)
return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0]))
endfunction
endif
let s:m = matchlist(&cinoptions, '=\(.\)')
if (len(s:m) > 2)
let s:case_indent_after = s:m[1]
let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$'
" configurable regexes that define continuation lines, not including (, {, or [.
if !exists('g:javascript_opfirst')
let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\([-/.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
endif
if !exists('g:javascript_continuation')
let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
endif
" 2. Auxiliary Functions {{{1
" ======================
" Check if the character at lnum:col is inside a string, comment, or is ascii.
function s:IsInStringOrComment(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
let g:javascript_continuation .= s:line_term
function s:OneScope(lnum,text,add)
return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' :
\ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) ||
\ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) &&
\ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
\ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) &&
\ expand('cword') !=# 'each' || search('\C\<for\_s\+\%#','nbW'))) ? expand('<cword>') : ''
endfunction
" Check if the character at lnum:col is inside a string.
function s:IsInString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
function s:IsBlock()
return getline(line('.'))[col('.')-1] == '{' && !search(
\ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') &&
\ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))
endfunction
" Check if the character at lnum:col is inside a template string.
function s:IsInTempl(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_template
endfunction
" Check if the character at lnum:col is inside a multi-line comment.
function s:IsInMultilineComment(lnum, col)
return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
endfunction
" Check if the character at lnum:col is a line comment.
function s:IsLineComment(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom
endfunction
" Auxiliary Functions {{{2
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevNonBlankNonString(lnum)
let in_block = 0
let lnum = prevnonblank(a:lnum)
while lnum > 0
" Go in and out of blocks comments as necessary.
" If the line isn't empty (with opt. comment) or in a string, end search.
let line = getline(lnum)
if s:IsInMultilineComment(lnum, matchend(line, '/\*') - 1)
if in_block
let in_block = 0
else
break
function s:PrevCodeLine(lnum)
let l:lnum = prevnonblank(a:lnum)
while l:lnum
if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom
return l:lnum
endif
elseif !in_block && s:IsInMultilineComment(lnum, matchend(line, '\*/') - 1)
let in_block = 1
elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
break
endif
let lnum = prevnonblank(lnum - 1)
let l:lnum = prevnonblank(l:lnum - 1)
endwhile
return lnum
endfunction
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
function s:GetMSL(lnum, in_one_line_scope)
" Start on the line we're at and use its indent.
let msl = a:lnum
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
let col = match(line, s:msl_regex) + 1
let line2 = getline(msl)
let col2 = matchend(line2, ')')
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
let msl = lnum
" if there are more closing brackets, continue from the line which has the matching opening bracket
elseif col2 > 0 && !s:IsInStringOrComment(msl, col2) && s:LineHasOpeningBrackets(msl)[0] == '2' && !a:in_one_line_scope
call cursor(msl, 1)
if searchpair('(', '', ')', 'bW', s:skip_expr) > 0
let lnum = line('.')
let msl = lnum
endif
else
" Don't use lines that are part of a one line scope as msl unless the
" flag in_one_line_scope is set to 1
"
if a:in_one_line_scope
break
end
let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
if msl_one_line == 0
break
endif
end
let lnum = s:PrevNonBlankNonString(lnum - 1)
endwhile
return msl
endfunction
function s:RemoveTrailingComments(content)
let single = '\/\/\(.*\)\s*$'
let multi = '\/\*\(.*\)\*\/\s*$'
return substitute(substitute(a:content, single, '', ''), multi, '', '')
endfunction
" Find if the string is inside var statement (but not the first string)
function s:InMultiVarStatement(lnum)
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
" loop through previous expressions to find a var statement
while lnum > 0
let line = getline(lnum)
" if the line is a js keyword
if (line =~ s:js_keywords)
" check if the line is a var stmt
" if the line has a comma first or comma last then we can assume that we
" are in a multiple var statement
if (line =~ s:var_stmt)
return lnum
endif
" other js keywords, not a var
return 0
endif
let lnum = s:PrevNonBlankNonString(lnum - 1)
endwhile
" beginning of program, not a var
return 0
endfunction
" Find line above with beginning of the var statement or returns 0 if it's not
" this statement
function s:GetVarIndent(lnum)
let lvar = s:InMultiVarStatement(a:lnum)
let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
if lvar
let line = s:RemoveTrailingComments(getline(prev_lnum))
" if the previous line doesn't end in a comma, return to regular indent
if (line !~ s:comma_last)
return indent(prev_lnum) - s:sw()
else
return indent(lvar) + s:sw()
endif
endif
return -1
endfunction
" Check if line 'lnum' has more opening brackets than closing ones.
function s:LineHasOpeningBrackets(lnum)
let open_0 = 0
let open_2 = 0
let open_4 = 0
let line = getline(a:lnum)
let pos = match(line, '[][(){}]', 0)
" Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum)
let [open_0,open_2,open_4] = [0,0,0]
let l:line = getline(a:lnum)
let pos = match(l:line, '[][(){}]', 0)
while pos != -1
if !s:IsInStringOrComment(a:lnum, pos + 1)
let idx = stridx('(){}[]', line[pos])
if synIDattr(synID(a:lnum,pos + 1,0),'name') !~? s:syng_strcom
let idx = stridx('(){}[]', l:line[pos])
if idx % 2 == 0
let open_{idx} = open_{idx} + 1
else
let open_{idx - 1} = open_{idx - 1} - 1
endif
endif
let pos = match(line, '[][(){}]', pos + 1)
let pos = match(l:line, '[][(){}]', pos + 1)
endwhile
return (open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0) . (open_4 > 0)
return (!open_4 + !open_2 + !open_0) - 2
endfunction
function s:Match(lnum, regex)
let col = match(getline(a:lnum), a:regex) + 1
return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
endfunction
function s:IndentWithContinuation(lnum, ind, width)
" Set up variables to use and search for MSL to the previous line.
let p_lnum = a:lnum
let lnum = s:GetMSL(a:lnum, 1)
let line = getline(lnum)
" If the previous line wasn't a MSL and is continuation return its indent.
" TODO: the || s:IsInString() thing worries me a bit.
if p_lnum != lnum
if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
return a:ind
endif
endif
" Set up more variables now that we know we aren't continuation bound.
let msl_ind = indent(lnum)
" If the previous line ended with [*+/.-=], start a continuation that
" indents an extra level.
if s:Match(lnum, s:continuation_regex)
if lnum == p_lnum
return msl_ind + a:width
else
return msl_ind
endif
endif
return a:ind
endfunction
function s:InOneLineScope(lnum)
let msl = s:GetMSL(a:lnum, 1)
if msl > 0 && s:Match(msl, s:one_line_scope_regex)
return msl
endif
return 0
endfunction
function s:ExitingOneLineScope(lnum)
let msl = s:GetMSL(a:lnum, 1)
if msl > 0
" if the current line is in a one line scope ..
if s:Match(msl, s:one_line_scope_regex)
return 0
else
let prev_msl = s:GetMSL(msl - 1, 1)
if s:Match(prev_msl, s:one_line_scope_regex)
return prev_msl
endif
endif
endif
return 0
endfunction
" 3. GetJavascriptIndent Function {{{1
" =========================
" }}}
function GetJavascriptIndent()
" 3.1. Setup {{{2
" ----------
" Set up variables for restoring position in file. Could use v:lnum here.
let vcol = col('.')
" 3.2. Work on the current line {{{2
" -----------------------------
let ind = -1
if !exists('b:js_cache')
let b:js_cache = [0,0,0]
endif
" Get the current line.
let line = getline(v:lnum)
" previous nonblank line number
let prevline = prevnonblank(v:lnum - 1)
let l:line = getline(v:lnum)
let syns = synIDattr(synID(v:lnum, 1, 0), 'name')
if (line =~ s:expr_case)
if (getline(prevline) =~ s:expr_case)
return indent(prevline)
else
if (getline(prevline) =~ s:block_regex)
return indent(prevline) + s:case_indent
else
return indent(prevline) - s:case_indent_after
" start with strings,comments,etc.{{{2
if (l:line !~ '^[''"`]' && syns =~? '\%(string\|template\)') ||
\ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment)
return -1
endif
endif
endif
" If we got a closing bracket on an empty line, find its match and indent
" according to it. For parentheses we indent to its column - 1, for the
" others we indent to the containing line's MSL's level. Return -1 if fail.
let col = matchend(line, '^\s*[],})]')
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
call cursor(v:lnum, col)
let lvar = s:InMultiVarStatement(v:lnum)
if lvar
let prevline_contents = s:RemoveTrailingComments(getline(prevline))
" check for comma first
if (line[col - 1] =~ ',')
" if the previous line ends in comma or semicolon don't indent
if (prevline_contents =~ '[;,]\s*$')
return indent(s:GetMSL(line('.'), 0))
" get previous line indent, if it's comma first return prevline indent
elseif (prevline_contents =~ s:comma_first)
return indent(prevline)
" otherwise we indent 1 level
else
return indent(lvar) + s:sw()
endif
endif
endif
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
if line[col-1]==')' && col('.') != col('$') - 1
let ind = virtcol('.')-1
else
let ind = indent(s:GetMSL(line('.'), 0))
endif
endif
return ind
endif
" If the line is comma first, dedent 1 level
if (getline(prevline) =~ s:comma_first)
return indent(prevline) - s:sw()
endif
if (getline(prevline) =~ s:expr_case)
return indent(prevline) + s:case_indent_after
endif
" If line starts with an operator...
if (s:Match(v:lnum, s:operator_first))
if (s:Match(prevline, s:operator_first))
" and so does previous line, don't indent
return indent(prevline)
end
let counts = s:LineHasOpeningBrackets(prevline)
if counts[0] == '2'
call cursor(prevline, 1)
" Search for the opening tag
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
if mnum > 0 && s:Match(mnum, s:operator_first)
return indent(mnum)
end
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
" otherwise, indent 1 level
return indent(prevline) + s:sw()
end
" If previous line starts with an operator...
elseif s:Match(prevline, s:operator_first) && !s:Match(prevline, s:comma_last) && !s:Match(prevline, '};\=' . s:line_term)
let counts = s:LineHasOpeningBrackets(prevline)
if counts[0] == '2' && counts[1] == '1'
call cursor(prevline, 1)
" Search for the opening tag
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
if mnum > 0 && !s:Match(mnum, s:operator_first)
return indent(mnum) + s:sw()
end
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
return indent(prevline) - s:sw()
end
end
if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
if line !~ '^\s*`$'
return indent(prevline) + s:sw()
endif
elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
return indent(prevline) - s:sw()
endif
" If we are in a multi-line comment, cindent does the right thing.
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
if l:line !~ '^\%(\/\*\|\s*\/\/\)' && syns =~? s:syng_comment
return cindent(v:lnum)
endif
" Check for multiple var assignments
" let var_indent = s:GetVarIndent(v:lnum)
" if var_indent >= 0
" return var_indent
" endif
" 3.3. Work on the previous line. {{{2
" -------------------------------
" If the line is empty and the previous nonblank line was a multi-line
" comment, use that comment's indent. Deduct one char to account for the
" space in ' */'.
if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1)
return indent(prevline) - 1
endif
" Find a non-blank, non-multi-line string line above the current line.
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
" If the line is empty and inside a string, use the previous line.
if line =~ '^\s*$' && lnum != prevline
return indent(prevnonblank(v:lnum))
endif
" At the start of the file use zero indent.
if lnum == 0
let l:lnum = s:PrevCodeLine(v:lnum - 1)
if l:lnum == 0
return 0
endif
" If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex)
if (line =~ s:expr_case)
return indent(s:GetMSL(lnum, 0)) + s:sw()/2
else
return indent(s:GetMSL(lnum, 0)) + s:sw()
endif
endif
" Set up variables for current line.
let line = getline(lnum)
let ind = indent(lnum)
" If the previous line contained an opening bracket, and we are still in it,
" add indent depending on the bracket type.
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$') || line =~ s:one_line_scope_regex
return ind + s:sw()
else
return virtcol('.')
endif
elseif counts[1] == '1' || counts[2] == '1' && counts[0] != '2'
return ind + s:sw()
else
call cursor(v:lnum, vcol)
end
elseif line =~ '.\+};\=' . s:line_term
call cursor(lnum, 1)
" Search for the opening tag
let mnum = searchpair('{', '', '}', 'bW', s:skip_expr)
if mnum > 0
return indent(s:GetMSL(mnum, 0))
end
elseif line =~ '.\+);\=' || line =~ s:comma_last
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '2'
call cursor(lnum, 1)
" Search for the opening tag
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
if mnum > 0
return indent(s:GetMSL(mnum, 0))
end
elseif line !~ s:var_stmt
return indent(prevline)
end
end
" 3.4. Work on the MSL line. {{{2
" --------------------------
let ind_con = ind
let ind = s:IndentWithContinuation(lnum, ind_con, s:sw())
" }}}2
"
"
let ols = s:InOneLineScope(lnum)
if ols > 0
let ind = ind + s:sw()
else
let ols = s:ExitingOneLineScope(lnum)
while ols > 0 && ind > 0
let ind = ind - s:sw()
let ols = s:InOneLineScope(ols - 1)
endwhile
endif
if (l:line =~# s:expr_case)
let cpo_switch = &cpo
set cpo+=%
let ind = cindent(v:lnum)
let &cpo = cpo_switch
return ind
endif
"}}}
" the containing paren, bracket, curly. Memoize, last lineNr either has the
" same scope or starts a new one, unless if it closed a scope.
call cursor(v:lnum,1)
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && b:js_cache[0] &&
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0)
let num = b:js_cache[1]
elseif syns != '' && l:line[0] =~ '\s'
let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] :
\ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]']
let num = s:GetPair(pattern[0],pattern[1],'bW',2000)
else
let num = s:GetPair('[({[]','[])}]','bW',2000)
endif
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
if l:line =~ s:line_pre . '[])}]'
return indent(num)
endif
call cursor(b:js_cache[1],b:js_cache[2])
let swcase = getline(l:lnum) =~# s:expr_case
let pline = swcase ? getline(l:lnum) : substitute(getline(l:lnum), '\%(:\@<!\/\/.*\)$', '','')
let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock())
let switch_offset = num == 0 || s:OneScope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) !=# 'switch' ? 0 :
\ &cino !~ ':' || !has('float') ? s:sw() :
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1))
" most significant, find the indent amount
if inb && !swcase && ((l:line =~# g:javascript_opfirst || pline =~# g:javascript_continuation) ||
\ num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\<\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)\>' &&
\ l:line !~ s:line_pre . '{')
return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset
elseif num > 0
return indent(num) + s:sw() + switch_offset
endif
endfunction
" }}}1
let &cpo = s:cpo_save
unlet s:cpo_save
function! Fixedgq(lnum, count)
let l:tw = &tw ? &tw : 80;
let l:count = a:count
let l:first_char = indent(a:lnum) + 1
if mode() == 'i' " gq was not pressed, but tw was set
return 1
endif
" This gq is only meant to do code with strings, not comments
if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char)
return 1
endif
if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq
return 1
endif
" Put all the lines on one line and do normal spliting after that
if l:count > 1
while l:count > 1
let l:count -= 1
normal J
endwhile
endif
let l:winview = winsaveview()
call cursor(a:lnum, l:tw + 1)
let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum)
call cursor(a:lnum, l:tw + 1)
let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum)
" No need for special treatment, normal gq handles edgecases better
if breakpoint[1] == orig_breakpoint[1]
call winrestview(l:winview)
return 1
endif
" Try breaking after string
if breakpoint[1] <= indent(a:lnum)
call cursor(a:lnum, l:tw + 1)
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum)
endif
if breakpoint[1] != 0
call feedkeys("r\<CR>")
else
let l:count = l:count - 1
endif
" run gq on new lines
if l:count == 1
call feedkeys("gqq")
endif
return 0
endfunction
endif

View File

@@ -44,7 +44,7 @@ let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)
" Check if the character at lnum:col is inside a string.
function s:IsInString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') == jsonString
return synIDattr(synID(a:lnum, a:col, 1), 'name') == "jsonString"
endfunction
" Find line above 'lnum' that isn't empty, or in a string.
@@ -143,7 +143,11 @@ function GetJSONIndent()
" If the previous line ended with a block opening, add a level of indent.
" if s:Match(lnum, s:block_regex)
" if exists('*shiftwidth')
" return indent(lnum) + shiftwidth()
" else
" return indent(lnum) + &sw
" endif
" endif
" If the previous line contained an opening bracket, and we are still in it,
@@ -151,7 +155,11 @@ function GetJSONIndent()
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
if exists('*shiftwidth')
return ind + shiftwidth()
else
return ind + &sw
endif
else
call cursor(v:lnum, vcol)
end

268
indent/ls.vim Normal file
View File

@@ -0,0 +1,268 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
" Language: LiveScript
" Maintainer: George Zahariev
" URL: http://github.com/gkz/vim-ls
" License: WTFPL
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetLiveScriptIndent(v:lnum)
" Make sure GetLiveScriptIndent is run when these are typed so they can be
" indented or outdented.
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
" Only define the function once.
if exists("*GetLiveScriptIndent")
finish
endif
" Keywords to indent after
let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|'
\ . 'loop\|case\|default\|try\|catch\|finally\|'
\ . 'class\|do\|new\|let\|with\|function\)\>'
" Operators to indent after
let s:INDENT_AFTER_OPERATOR = '\%([([{:=]\|[-=]>\)$'
" Keywords and operators that continue a line
let s:CONTINUATION = '\<\%(is\|isnt\|and\|or\|do\)\>$'
\ . '\|'
\ . '\%(-\@<!-\|+\@<!+\|<\|[-~]\@<!>\|\*\|/\@<!/\|%\||\|'
\ . '&\|,\|\.\@<!\.\)$'
" Operators that block continuation indenting
let s:CONTINUATION_BLOCK = '[([{:=]$'
" A continuation dot access
let s:DOT_ACCESS = '^\.'
" Keywords to outdent after
let s:OUTDENT_AFTER = '^\%(return\|break\|continue\|throw\)\>'
" A compound assignment like `... = if ...`
let s:COMPOUND_ASSIGNMENT = '[:=]\s*\%(if\|unless\|for\|while\|until\|'
\ . 'try\|class\|do\|new\|let\|with\)\>'
" A postfix condition like `return ... if ...`.
let s:POSTFIX_CONDITION = '\S\s\+\zs\<\%(if\|unless\)\>'
" A single-line else statement like `else ...` but not `else if ...
let s:SINGLE_LINE_ELSE = '^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
" Max lines to look back for a match
let s:MAX_LOOKBACK = 50
" Get the linked syntax name of a character.
function! s:SyntaxName(linenum, col)
return synIDattr(synIDtrans(synID(a:linenum, a:col, 1)), 'name')
endfunction
" Check if a character is in a comment.
function! s:IsComment(linenum, col)
return s:SyntaxName(a:linenum, a:col) == 'Comment'
endfunction
" Check if a character is in a string.
function! s:IsString(linenum, col)
return s:SyntaxName(a:linenum, a:col) == 'Constant'
endfunction
" Check if a character is in a comment or string.
function! s:IsCommentOrString(linenum, col)
return s:SyntaxName(a:linenum, a:col) =~ 'Comment\|Constant'
endfunction
" Check if a whole line is a comment.
function! s:IsCommentLine(linenum)
" Check the first non-whitespace character.
return s:IsComment(a:linenum, indent(a:linenum) + 1)
endfunction
" Repeatedly search a line for a regex until one is found outside a string or
" comment.
function! s:SmartSearch(linenum, regex)
" Start at the first column.
let col = 0
" Search until there are no more matches, unless a good match is found.
while 1
call cursor(a:linenum, col + 1)
let [_, col] = searchpos(a:regex, 'cn', a:linenum)
" No more matches.
if !col
break
endif
if !s:IsCommentOrString(a:linenum, col)
return 1
endif
endwhile
" No good match found.
return 0
endfunction
" Skip a match if it's in a comment or string, is a single-line statement that
" isn't adjacent, or is a postfix condition.
function! s:ShouldSkip(startlinenum, linenum, col)
if s:IsCommentOrString(a:linenum, a:col)
return 1
endif
" Check for a single-line statement that isn't adjacent.
if s:SmartSearch(a:linenum, '\<then\>') && a:startlinenum - a:linenum > 1
return 1
endif
if s:SmartSearch(a:linenum, s:POSTFIX_CONDITION) &&
\ !s:SmartSearch(a:linenum, s:COMPOUND_ASSIGNMENT)
return 1
endif
return 0
endfunction
" Find the farthest line to look back to, capped to line 1 (zero and negative
" numbers cause bad things).
function! s:MaxLookback(startlinenum)
return max([1, a:startlinenum - s:MAX_LOOKBACK])
endfunction
" Get the skip expression for searchpair().
function! s:SkipExpr(startlinenum)
return "s:ShouldSkip(" . a:startlinenum . ", line('.'), col('.'))"
endfunction
" Search for pairs of text.
function! s:SearchPair(start, end)
" The cursor must be in the first column for regexes to match.
call cursor(0, 1)
let startlinenum = line('.')
" Don't need the W flag since MaxLookback caps the search to line 1.
return searchpair(a:start, '', a:end, 'bcn',
\ s:SkipExpr(startlinenum),
\ s:MaxLookback(startlinenum))
endfunction
" Try to find a previous matching line.
function! s:GetMatch(curline)
let firstchar = a:curline[0]
if firstchar == '}'
return s:SearchPair('{', '}')
elseif firstchar == ')'
return s:SearchPair('(', ')')
elseif firstchar == ']'
return s:SearchPair('\[', '\]')
elseif a:curline =~ '^else\>'
return s:SearchPair('\<\%(if\|unless\|case\|when\)\>', '\<else\>')
elseif a:curline =~ '^catch\>'
return s:SearchPair('\<try\>', '\<catch\>')
elseif a:curline =~ '^finally\>'
return s:SearchPair('\<try\>', '\<finally\>')
endif
return 0
endfunction
" Get the nearest previous line that isn't a comment.
function! s:GetPrevNormalLine(startlinenum)
let curlinenum = a:startlinenum
while curlinenum > 0
let curlinenum = prevnonblank(curlinenum - 1)
if !s:IsCommentLine(curlinenum)
return curlinenum
endif
endwhile
return 0
endfunction
" Get the contents of a line without leading or trailing whitespace.
function! s:GetTrimmedLine(linenum)
return substitute(substitute(getline(a:linenum), '^\s\+', '', ''),
\ '\s\+$', '', '')
endfunction
function! s:GetLiveScriptIndent(curlinenum)
let prevlinenum = s:GetPrevNormalLine(a:curlinenum)
" Don't do anything if there's no previous line.
if !prevlinenum
return -1
endif
let curline = s:GetTrimmedLine(a:curlinenum)
" Try to find a previous matching statement. This handles outdenting.
let matchlinenum = s:GetMatch(curline)
if matchlinenum
return indent(matchlinenum)
endif
let prevline = s:GetTrimmedLine(prevlinenum)
let previndent = indent(prevlinenum)
" Always indent after these operators.
if prevline =~ s:INDENT_AFTER_OPERATOR
return previndent + &shiftwidth
endif
" Indent after a continuation if it's the first.
if prevline =~ s:CONTINUATION
let prevprevlinenum = s:GetPrevNormalLine(prevlinenum)
let prevprevline = s:GetTrimmedLine(prevprevlinenum)
if prevprevline !~ s:CONTINUATION && prevprevline !~ s:CONTINUATION_BLOCK
return previndent + &shiftwidth
endif
endif
" Indent after these keywords and compound assignments if they aren't a
" single-line statement.
if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT
if !s:SmartSearch(prevlinenum, '\<then\>') && prevline !~ s:SINGLE_LINE_ELSE
return previndent + &shiftwidth
endif
endif
" Indent a dot access if it's the first.
if curline =~ s:DOT_ACCESS && prevline !~ s:DOT_ACCESS
return previndent + &shiftwidth
endif
" Outdent after these keywords if they don't have a postfix condition and
" aren't a single-line statement.
if prevline =~ s:OUTDENT_AFTER
if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) ||
\ s:SmartSearch(prevlinenum, '\<then\>')
return previndent - &shiftwidth
endif
endif
" No indenting or outdenting is needed.
return -1
endfunction
" Wrap s:GetLiveScriptIndent to keep the cursor position.
function! GetLiveScriptIndent(curlinenum)
let oldcursor = getpos('.')
let indent = s:GetLiveScriptIndent(a:curlinenum)
call setpos('.', oldcursor)
return indent
endfunction
endif

126
indent/lua.vim Normal file
View File

@@ -0,0 +1,126 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lua') == -1
" Vim indent file
" Language: Lua
" URL: https://github.com/tbastos/vim-lua
" Initialization ------------------------------------------{{{1
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal nosmartindent
setlocal indentexpr=GetLuaIndent()
setlocal indentkeys+=0=end,0=until,0=elseif,0=else
" Only define the function once.
if exists("*GetLuaIndent")
finish
endif
" Variables -----------------------------------------------{{{1
let s:open_patt = '\%(\<\%(function\|if\|repeat\|do\)\>\|(\|{\)'
let s:middle_patt = '\<\%(else\|elseif\)\>'
let s:close_patt = '\%(\<\%(end\|until\)\>\|)\|}\)'
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ 'luaComment\\|luaString'"
" Auxiliary Functions -------------------------------------{{{1
function s:IsInCommentOrString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ 'luaCommentLong\|luaStringLong'
\ && !(getline(a:lnum) =~ '^\s*\%(--\)\?\[=*\[') " opening tag is not considered 'in'
endfunction
" Find line above 'lnum' that isn't blank, in a comment or string.
function s:PrevLineOfCode(lnum)
let lnum = prevnonblank(a:lnum)
while s:IsInCommentOrString(lnum, 1)
let lnum = prevnonblank(lnum - 1)
endwhile
return lnum
endfunction
" Gets line contents, excluding trailing comments.
function s:GetContents(lnum)
return substitute(getline(a:lnum), '\v\m--.*$', '', '')
endfunction
" GetLuaIndent Function -----------------------------------{{{1
function GetLuaIndent()
" if the line is in a long comment or string, don't change the indent
if s:IsInCommentOrString(v:lnum, 1)
return -1
endif
let prev_line = s:PrevLineOfCode(v:lnum - 1)
if prev_line == 0
" this is the first non-empty line
return 0
endif
let contents_cur = s:GetContents(v:lnum)
let contents_prev = s:GetContents(prev_line)
let original_cursor_pos = getpos(".")
let i = 0
" check if the previous line opens blocks
call cursor(v:lnum, 1)
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
\ 'mrb', s:skip_expr, prev_line)
if num_pairs > 0
let i += num_pairs
endif
" special case: call(with, {anon = function() -- should indent only once
if num_pairs > 1 && contents_prev =~ s:anon_func_start
let i = 1
endif
" check if current line closes blocks
call cursor(prev_line, col([prev_line,'$']))
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
\ 'mr', s:skip_expr, v:lnum)
if num_pairs > 0
let i -= num_pairs
endif
" special case: end}) -- end of call with anon func should unindent once
if num_pairs > 1 && contents_cur =~ s:anon_func_end
let i = -1
endif
" if the previous line closed a paren, unindent (except with anon funcs)
call cursor(prev_line - 1, col([prev_line - 1, '$']))
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
if num_pairs > 0 && contents_prev !~ s:anon_func_end
let i -= 1
endif
" if this line closed a paren, indent (except with anon funcs)
call cursor(prev_line, col([prev_line, '$']))
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
if num_pairs > 0 && contents_cur !~ s:anon_func_end
let i += 1
endif
" restore cursor
call setpos(".", original_cursor_pos)
return indent(prev_line) + (&sw * i)
endfunction
endif

358
indent/mako.vim Normal file
View File

@@ -0,0 +1,358 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
" Vim indent file
" Language: Mako
" Author: Scott Torborg <storborg@mit.edu>
" Version: 0.4
" License: Do What The Fuck You Want To Public License (WTFPL)
"
" ---------------------------------------------------------------------------
"
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
" Version 2, December 2004
"
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
"
" Everyone is permitted to copy and distribute verbatim or modified
" copies of this license document, and changing it is allowed as long
" as the name is changed.
"
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
"
" 0. You just DO WHAT THE FUCK YOU WANT TO.
"
" ---------------------------------------------------------------------------
"
" This script does more useful indenting for Mako HTML templates. It indents
" inside of control blocks, defs, etc. Note that this indenting style will
" sacrifice readability of the output text for the sake of readability of the
" template.
"
" We'll use HTML indenting globally, python inside <% %> blocks. Inspired by
" the excellent PHP + HTML indentation files such as php.vim by Pim Snel.
"
" Changelog:
" 0.4 - 5 March 2010
" - Added license information
" 0.3 - 15 September 2009
" - Added explicit indenting for ## comments, fixed unindenting count,
" thanks to Mike Lewis (@MikeRLewis) for this
" 0.2 - 15 June 2009
" - Fixed issue where opening and closing mako tags on the same line
" would cause incorrect indenting
" 0.1 - 06 June 2009
" - Initial public release of mako indent file
let sw=2 " default shiftwidth of 2 spaces
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nosmartindent
setlocal noautoindent
setlocal nocindent
setlocal nolisp
setlocal indentexpr=GetMakoIndent()
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
" Only define the function once.
if exists("*GetMakoIndent")
finish
endif
if exists('g:html_indent_tags')
unlet g:html_indent_tags
endif
function IsInsidePythonBlock(startline)
" Loop until we get a line that's either <% or %>
let lnum = a:startline
while getline(lnum) !~ '\(%>\|<%\)$' && lnum > 0
let lnum = lnum - 1
endwhile
" lnum points to the last control. If it's a <% then we're inside an
" embedded python block, otherwise we're not.
return getline(lnum) =~ '<%$'
endfunction
function GetMakoIndent()
" Find a non-empty line above the current line
let lnum = prevnonblank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let line = getline(lnum) " last line
let cline = getline(v:lnum) " current line
let pline = getline(lnum - 1) " previous to last line
let ind = indent(lnum)
if line =~ '^\s*##'
return indent(lnum)
end
let restore_ic=&ic
let &ic=1 " ignore case
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
let &ic=restore_ic
let ind = indent(lnum) + (&sw * ind)
" Indent after %anything: or <%anything NOT ending in />
if line =~ '^\s*%.*:\s*$'
let ind = ind + &sw
endif
" Unindent before %end* or </%anything
if cline =~ '^\s*%\s*end'
let ind = ind - &sw
endif
"
" Unindent before %else, %except, and %elif
if cline =~ '^\s*%\s*else' || cline =~ '^\s*%\s*except' || cline =~ '^\s*%\s*elif'
let ind = ind - &sw
endif
" Indent at the beginning of a python control block
if line =~ '<%$'
let ind = ind + &sw
endif
"
" Unindent at the end of the python block.
if cline =~ '^\s*%>$'
let scanlnum = lnum
" Scan backwards until we find the beginning of this python block.
while getline(scanlnum) !~ '<%$' && scanlnum > 0
let scanlnum = scanlnum - 1
endwhile
let ind = indent(scanlnum)
endif
" If we're inside a python block and the previous line ends in a colon,
" indent.
if IsInsidePythonBlock(lnum - 1)
" Indent after :
if line =~ '\:$'
let ind = ind + &sw
endif
endif
return ind
endfunction
" [-- helper function to assemble tag list --]
fun! <SID>HtmlIndentPush(tag)
if exists('g:html_indent_tags')
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
else
let g:html_indent_tags = a:tag
endif
endfun
fun! <SID>MakoIndentPush(tag)
if exists('g:mako_indent_tags')
let g:mako_indent_tags = g:mako_indent_tags.'\|'.a:tag
else
let g:mako_indent_tags = a:tag
endif
endfun
" [-- <ELEMENT ? - - ...> --]
call <SID>HtmlIndentPush('a')
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('address')
call <SID>HtmlIndentPush('b')
call <SID>HtmlIndentPush('bdo')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blockquote')
call <SID>HtmlIndentPush('button')
call <SID>HtmlIndentPush('caption')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('cite')
call <SID>HtmlIndentPush('code')
call <SID>HtmlIndentPush('colgroup')
call <SID>HtmlIndentPush('del')
call <SID>HtmlIndentPush('dfn')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('div')
call <SID>HtmlIndentPush('dl')
call <SID>HtmlIndentPush('em')
call <SID>HtmlIndentPush('fieldset')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('form')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('h1')
call <SID>HtmlIndentPush('h2')
call <SID>HtmlIndentPush('h3')
call <SID>HtmlIndentPush('h4')
call <SID>HtmlIndentPush('h5')
call <SID>HtmlIndentPush('h6')
call <SID>HtmlIndentPush('i')
call <SID>HtmlIndentPush('iframe')
call <SID>HtmlIndentPush('ins')
call <SID>HtmlIndentPush('kbd')
call <SID>HtmlIndentPush('label')
call <SID>HtmlIndentPush('legend')
call <SID>HtmlIndentPush('map')
call <SID>HtmlIndentPush('menu')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('noscript')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('ol')
call <SID>HtmlIndentPush('optgroup')
call <SID>HtmlIndentPush('pre')
call <SID>HtmlIndentPush('q')
call <SID>HtmlIndentPush('s')
call <SID>HtmlIndentPush('samp')
call <SID>HtmlIndentPush('script')
call <SID>HtmlIndentPush('select')
call <SID>HtmlIndentPush('small')
call <SID>HtmlIndentPush('span')
call <SID>HtmlIndentPush('strong')
call <SID>HtmlIndentPush('style')
call <SID>HtmlIndentPush('sub')
call <SID>HtmlIndentPush('sup')
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('textarea')
call <SID>HtmlIndentPush('title')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('u')
call <SID>HtmlIndentPush('ul')
call <SID>HtmlIndentPush('var')
" For some reason the default HTML indentation script doesn't consider these
" elements to be worthy of indentation.
call <SID>HtmlIndentPush('p')
call <SID>HtmlIndentPush('dt')
call <SID>HtmlIndentPush('dd')
" [-- <ELEMENT ? O O ...> --]
if !exists('g:html_indent_strict')
call <SID>HtmlIndentPush('body')
call <SID>HtmlIndentPush('head')
call <SID>HtmlIndentPush('html')
call <SID>HtmlIndentPush('tbody')
endif
" [-- <ELEMENT ? O - ...> --]
if !exists('g:html_indent_strict_table')
call <SID>HtmlIndentPush('th')
call <SID>HtmlIndentPush('td')
call <SID>HtmlIndentPush('tr')
call <SID>HtmlIndentPush('tfoot')
call <SID>HtmlIndentPush('thead')
endif
" [-- <Mako Elements> --]
call <SID>MakoIndentPush('%def')
call <SID>MakoIndentPush('%block')
call <SID>MakoIndentPush('%call')
call <SID>MakoIndentPush('%doc')
call <SID>MakoIndentPush('%text')
call <SID>MakoIndentPush('%.\+:.\+')
delfun <SID>HtmlIndentPush
delfun <SID>MakoIndentPush
set cpo-=C
" [-- get number of regex matches in a string --]
fun! <SID>MatchCount(expr, pat)
let mpos = 0
let mcount = 0
let expr = a:expr
while (mpos > -1)
let mend = matchend(expr, a:pat)
if mend > -1
let mcount = mcount + 1
endif
if mend == mpos
let mpos = mpos + 1
else
let mpos = mend
endif
let expr = strpart(expr, mpos)
endwhile
return mcount
endfun
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing tags of line a:lnum --]
fun! <SID>HtmlIndentClose(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-increasing mako tags of line a:lnum --]
fun! <SID>MakoIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:mako_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing mako tags of line a:lnum --]
fun! <SID>MakoIndentClose(lnum)
let mcount = <SID>MatchCount(getline(a:lnum), '</\('.g:mako_indent_tags.'\)>')
let mcount = mcount + <SID>MatchCount(getline(a:lnum), '<\('.g:mako_indent_tags.'\)[^>]*/>')
return mcount
endfun
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentOpenAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
endfun
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentCloseAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
endfun
" [-- return the sum of indents respecting the syntax of a:lnum --]
fun! <SID>HtmlIndentSum(lnum, style)
let open = <SID>HtmlIndentOpen(a:lnum) + <SID>MakoIndentOpen(a:lnum)
let close = <SID>HtmlIndentClose(a:lnum) + <SID>MakoIndentClose(a:lnum)
if a:style == match(getline(a:lnum), '^\s*</')
if a:style == match(getline(a:lnum), '^\s*</\('.g:html_indent_tags.'\|'.g:mako_indent_tags.'\)')
if 0 != open || 0 != close
return open - close
endif
endif
endif
if '' != &syntax &&
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
\ =~ '\(css\|java\).*'
if a:style == match(getline(a:lnum), '^\s*}')
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
endif
endif
return 0
endfun
" vim: set ts=4 sw=4:
endif

View File

@@ -121,7 +121,7 @@ function! GetNimIndent(lnum)
endif
if pline =~ '\(type\|import\|const\|var\)\s*$'
\ || pline =~ '=\s*\(object\|enum\|tuple\|generic\)'
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
return plindent + &sw
endif

View File

@@ -1,131 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
" Vim indent file
" Language: Perl 6
" Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: {{LAST_CHANGE}}
" Contributors: Andy Lester <andy@petdance.com>
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr>
" Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints)
" Artem Chuprina (play nice with folding)
" TODO:
" This file still relies on stuff from the Perl 5 syntax file, which Perl 6
" does not use.
"
" Things that are not or not properly indented (yet) :
" - Continued statements
" print "foo",
" "bar";
" print "foo"
" if bar();
" - Multiline regular expressions (m//x)
" (The following probably needs modifying the perl syntax file)
" - qw() lists
" - Heredocs with terminators that don't match \I\i*
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" Is syntax highlighting active ?
let b:indent_use_syntax = has("syntax")
setlocal indentexpr=GetPerl6Indent()
" we reset it first because the Perl 5 indent file might have been loaded due
" to a .pl/pm file extension, and indent files don't clean up afterwards
setlocal indentkeys&
setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and
if !b:indent_use_syntax
setlocal indentkeys+=0=EO
endif
let s:cpo_save = &cpo
set cpo-=C
function! GetPerl6Indent()
" Get the line to be indented
let cline = getline(v:lnum)
" Indent POD markers to column 0
if cline =~ '^\s*=\L\@!'
return 0
endif
" Get current syntax item at the line's first char
let csynid = ''
if b:indent_use_syntax
let csynid = synIDattr(synID(v:lnum,1,0),"name")
endif
" Don't reindent POD and heredocs
if csynid =~ "^p6Pod"
return indent(v:lnum)
endif
" Now get the indent of the previous perl line.
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let line = getline(lnum)
let ind = indent(lnum)
" Skip heredocs, POD, and comments on 1st column
if b:indent_use_syntax
let skippin = 2
while skippin
let synid = synIDattr(synID(lnum,1,0),"name")
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
let lnum = prevnonblank(lnum - 1)
if lnum == 0
return 0
endif
let line = getline(lnum)
let ind = indent(lnum)
let skippin = 1
else
let skippin = 0
endif
endwhile
endif
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
let ind = ind + &sw
endif
if cline =~ '^\s*[)}\]»>]'
let ind = ind - &sw
endif
" Indent lines that begin with 'or' or 'and'
if cline =~ '^\s*\(or\|and\)\>'
if line !~ '^\s*\(or\|and\)\>'
let ind = ind + &sw
endif
elseif line =~ '^\s*\(or\|and\)\>'
let ind = ind - &sw
endif
return ind
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
endif

58
indent/plantuml.vim Normal file
View File

@@ -0,0 +1,58 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetPlantUMLIndent()
setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,}
" only define the indent code once
if exists("*GetPlantUMLIndent")
finish
endif
let s:incIndent =
\ '^\s*\(loop\|alt\|opt\|group\|critical\|else\|legend\|box\)\>\|' .
\ '^\s*\([hr]\?note\|ref\)\>[^:]*$\|' .
\ '^\s*title\s*$\|' .
\ '^\s*skinparam\>.*{\s*$\|' .
\ '^\s*state\>.*{'
let s:decIndent = '^\s*\(end\|else\|}\)'
function! GetPlantUMLIndent(...) abort
"for current line, use arg if given or v:lnum otherwise
let clnum = a:0 ? a:1 : v:lnum
if !s:insidePlantUMLTags(clnum)
return indent(clnum)
endif
let pnum = prevnonblank(clnum-1)
let pindent = indent(pnum)
let pline = getline(pnum)
let cline = getline(clnum)
if cline =~ s:decIndent
if pline =~ s:incIndent
return pindent
else
return pindent - shiftwidth()
endif
elseif pline =~ s:incIndent
return pindent + shiftwidth()
endif
return pindent
endfunction
function! s:insidePlantUMLTags(lnum) abort
call cursor(a:lnum, 1)
return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
endfunction
endif

21
indent/proto.vim Normal file
View File

@@ -0,0 +1,21 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1
" Vim indent file
" Language: Protobuf
" Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: Fri, 15 Mar 2002 07:53:54 CET
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" Protobuf is like indenting C
setlocal cindent
setlocal expandtab
setlocal shiftwidth=2
let b:undo_indent = "setl cin<"
endif

View File

@@ -20,6 +20,11 @@ if !exists('g:ruby_indent_access_modifier_style')
let g:ruby_indent_access_modifier_style = 'normal'
endif
if !exists('g:ruby_indent_block_style')
" Possible values: "expression", "do"
let g:ruby_indent_block_style = 'expression'
endif
setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
@@ -89,11 +94,12 @@ let s:end_skip_expr = s:skip_expr .
\ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
" Regex that defines continuation lines, not including (, {, or [.
let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
let s:non_bracket_continuation_regex =
\ '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'
" Regex that defines continuation lines.
let s:continuation_regex =
\ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
\ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'
" Regex that defines continuable keywords
let s:continuable_regex =
@@ -103,6 +109,12 @@ let s:continuable_regex =
" Regex that defines bracket continuations
let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
" Regex that defines dot continuations
let s:dot_continuation_regex = '%\@<!\.\s*\%(#.*\)\=$'
" Regex that defines backslash continuations
let s:backslash_continuation_regex = '%\@<!\\\s*$'
" Regex that defines end of bracket continuation followed by another continuation
let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex
@@ -191,7 +203,17 @@ function s:GetMSL(lnum)
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
if s:Match(msl, s:leading_operator_regex)
if !s:Match(msl, s:backslash_continuation_regex) &&
\ s:Match(lnum, s:backslash_continuation_regex)
" If the current line doesn't end in a backslash, but the previous one
" does, look for that line's msl
"
" Example:
" foo = "bar" \
" "baz"
"
let msl = lnum
elseif s:Match(msl, s:leading_operator_regex)
" If the current line starts with a leading operator, keep its indent
" and keep looking for an MSL.
let msl = lnum
@@ -216,6 +238,18 @@ function s:GetMSL(lnum)
" three
"
let msl = lnum
elseif s:Match(lnum, s:dot_continuation_regex) &&
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
" If the current line is a bracket continuation or a block-starter, but
" the previous is a dot, keep going to see if the previous line is the
" start of another continuation.
"
" Example:
" parent.
" method_call {
" three
"
let msl = lnum
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
" If the current line is a bracket continuation or a block-starter, but
@@ -419,7 +453,9 @@ function GetRubyIndent(...)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
if line[col-1]==')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1
else
elseif g:ruby_indent_block_style == 'do'
let ind = indent(line('.'))
else " g:ruby_indent_block_style == 'expression'
let ind = indent(s:GetMSL(line('.')))
endif
endif
@@ -444,12 +480,15 @@ function GetRubyIndent(...)
\ strpart(line, col('.') - 1, 2) !~ 'do'
" assignment to case/begin/etc, on the same line, hanging indent
let ind = virtcol('.') - 1
elseif g:ruby_indent_block_style == 'do'
" align to line of the "do", not to the MSL
let ind = indent(line('.'))
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
" in the case of assignment to the msl, align to the starting line,
" not to the msl
" in the case of assignment to the MSL, align to the starting line,
" not to the MSL
let ind = indent(line('.'))
else
" align to the msl
" align to the MSL
let ind = indent(msl)
endif
endif
@@ -516,7 +555,10 @@ function GetRubyIndent(...)
if s:Match(lnum, s:block_regex)
let msl = s:GetMSL(lnum)
if getline(msl) =~ '=\s*\(#.*\)\=$'
if g:ruby_indent_block_style == 'do'
" don't align to the msl, align to the "do"
let ind = indent(lnum) + sw
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
" in the case of assignment to the msl, align to the starting line,
" not to the msl
let ind = indent(lnum) + sw
@@ -564,7 +606,7 @@ function GetRubyIndent(...)
if s:Match(line('.'), s:ruby_indent_keywords)
return indent('.') + sw
else
return indent('.')
return indent(s:GetMSL(line('.')))
endif
else
call cursor(clnum, vcol)

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
" Vim indent file
" Language: Rust
" Author: Chris Morgan <me@chrismorgan.info>
" Last Change: 2014 Sep 13
" Last Change: 2016 Jul 15
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -134,6 +134,7 @@ function GetRustIndent(lnum)
\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
\ && prevline !~ '^\s*fn\s'
\ && prevline !~ '([^()]\+,$'
\ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>'
" Oh ho! The previous line ended in a comma! I bet cindent will try to
" take this too far... For now, let's normally use the previous line's
" indent.
@@ -158,6 +159,8 @@ function GetRustIndent(lnum)
" if baz && (foo ||
" bar) {
"
" Another case is when the current line is a new match arm.
"
" There are probably other cases where we don't want to do this as
" well. Add them as needed.
return indent(prevlinenum)

View File

@@ -378,12 +378,17 @@ function! GetScalaIndent()
let prevline = scala#GetLine(prevlnum)
let curlnum = v:lnum
let curline = scala#GetLine(curlnum)
if get(g:, 'scala_scaladoc_indent', 0)
let star_indent = 2
else
let star_indent = 1
end
if prevline =~ '^\s*/\*\*'
if prevline =~ '\*/\s*$'
return ind
else
return ind + 1
return ind + star_indent
endif
endif
@@ -538,7 +543,7 @@ function! GetScalaIndent()
if prevline =~ '^\s*\*/'
\ || prevline =~ '*/\s*$'
call scala#ConditionalConfirm("18")
let ind = ind - 1
let ind = ind - star_indent
endif
if scala#LineEndsInIncomplete(prevline)

80
indent/twig.vim Normal file
View File

@@ -0,0 +1,80 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
if exists("b:ran_once")
finish
endif
let b:ran_once = 1
let s:baseIndentExpr=&indentexpr
setlocal indentexpr=GetTwigIndent(v:lnum)
fun! GetTwigIndent(currentLineNumber)
let currentLine = getline(a:currentLineNumber)
let previousLineNumber = prevnonblank(a:currentLineNumber - 1)
let previousLine = getline(previousLineNumber)
if (previousLine =~ s:startStructures || previousLine =~ s:middleStructures) && (currentLine !~ s:endStructures && currentLine !~ s:middleStructures)
return indent(previousLineNumber) + &shiftwidth
elseif currentLine =~ s:endStructures || currentLine =~ s:middleStructures
let previousOpenStructureNumber = s:FindPreviousOpenStructure(a:currentLineNumber)
let previousOpenStructureLine = getline(previousOpenStructureNumber)
return indent(previousOpenStructureNumber)
endif
return s:CallBaseIndent()
endf
function! s:CallBaseIndent()
exe 'redir => s:outputOfBaseIndent'
exe 'silent echo ' . s:baseIndentExpr
exe 'redir END'
return split(s:outputOfBaseIndent)[0]
endf
function! s:FindPreviousOpenStructure(lineNumber)
let countOpen = 0
let countClosed = 0
let lineNumber = a:lineNumber
while lineNumber != 1 && countOpen <= countClosed
let lineNumber -= 1
let currentLine = getline(lineNumber)
if currentLine =~ s:startStructures
let countOpen += 1
elseif currentLine =~ s:endStructures
let countClosed += 1
endif
endwhile
return lineNumber
endfunction
function! s:StartStructure(name)
return '^\s*{%\s*' . a:name . '.*%}'
endfunction
function! s:EndStructure(name)
return '^\s*{%\s*end' . a:name . '.*%}'
endfunction
function! s:Map(Fun, list)
if len(a:list) == 0
return []
else
return [a:Fun(a:list[0])] + s:Map(a:Fun, a:list[1:])
endif
endfunction
fun! s:BuildStructures()
let structures = ['if','for','block']
let mStructures = ['elseif','else']
let s:startStructures = join(s:Map(function('s:StartStructure'), structures), '\|')
let s:endStructures = join(s:Map(function('s:EndStructure'), structures), '\|')
let s:middleStructures = join(s:Map(function('s:StartStructure'), mStructures), '\|')
endfun
call s:BuildStructures()
endif

View File

@@ -442,7 +442,7 @@ let &cpo = s:cpo_save
unlet s:cpo_save
function! Fixedgq(lnum, count)
let l:tw = &tw ? &tw : 80;
let l:tw = &tw ? &tw : 80
let l:count = a:count
let l:first_char = indent(a:lnum) + 1

249
syntax/applescript.vim Normal file
View File

@@ -0,0 +1,249 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'applescript') == -1
" Vim syntax file
" Language: AppleScript
" Maintainer: Jim Eberle <jim.eberle@fastnlight.com>
" Last Change: Mar 18, 2010
" URL: http://www.fastnlight.com/syntax/applescript.vim
" Use :syn w/in a buffer to see language element breakdown
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" --- Statement ---
syn keyword scptStmt get set count copy run global local prop property
syn keyword scptStmt close put delete duplicate exists
syn keyword scptStmt launch open print quit make move reopen save
syn keyword scptStmt saving into
hi def link scptStmt Statement
" --- Type ---
syn keyword scptType text string number integer real color date
hi def link scptType Type
" --- Operator ---
syn keyword scptOp div mod not and or as
syn match scptOp "[-+*/^&]"
" MacRoman single char :- (divide)
exec 'syn match scptOp "'.nr2char(214).'"'
syn match scptOp "\<\(a \)\?\(ref\( to\)\?\|reference to\)\>"
hi def link scptOp Operator
" Containment
syn match scptIN "\<starts\? with\>"
syn match scptIN "\<begins\? with\>"
syn match scptIN "\<ends\? with\>"
syn match scptIN "\<contains\>"
syn match scptIN "\<does not contain\>"
syn match scptIN "\<doesn't contain\>"
syn match scptIN "\<is in\>"
syn match scptIN "\<is contained by\>"
syn match scptIN "\<is not in\>"
syn match scptIN "\<is not contained by\>"
syn match scptIN "\<isn't contained by\>"
hi def link scptIN scptOp
" Equals
syn match scptEQ "="
syn match scptEQ "\<equal\>"
syn match scptEQ "\<equals\>"
syn match scptEQ "\<equal to\>"
syn match scptEQ "\<is\>"
syn match scptEQ "\<is equal to\>"
hi def link scptEQ scptOp
" Not Equals
syn match scptNE "\<does not equal\>"
syn match scptNE "\<doesn't equal\>"
syn match scptNE "\<is not\>"
syn match scptNE "\<is not equal\( to\)\?\>"
syn match scptNE "\<isn't\>"
syn match scptNE "\<isn't equal\( to\)\?\>"
hi def link scptNE scptOp
" MacRoman single char /=
exec 'syn match scptNE "'.nr2char(173).'"'
" Less Than
syn match scptLT "<"
syn match scptLT "\<comes before\>"
syn match scptLT "\(is \)\?less than"
syn match scptLT "\<is not greater than or equal\( to\)\?\>"
syn match scptLT "\<isn't greater than or equal\( to\)\?\>"
hi def link scptLT scptOp
" Greater Than
syn match scptGT ">"
syn match scptGT "\<comes after\>"
syn match scptGT "\(is \)\?greater than"
syn match scptGT "\<is not less than or equal\( to\)\?\>"
syn match scptGT "\<isn't less than or equal\( to\)\?\>"
hi def link scptGT scptOp
" Less Than or Equals
syn match scptLE "<="
syn match scptLE "\<does not come after\>"
syn match scptLE "\<doesn't come after\>"
syn match scptLE "\(is \)\?less than or equal\( to\)\?"
syn match scptLE "\<is not greater than\>"
syn match scptLE "\<isn't greater than\>"
hi def link scptLE scptOp
" MacRoman single char <=
exec 'syn match scptLE "'.nr2char(178).'"'
" Greater Than or Equals
syn match scptGE ">="
syn match scptGE "\<does not come before\>"
syn match scptGE "\<doesn't come before\>"
syn match scptGE "\(is \)\?greater than or equal\( to\)\?"
syn match scptGE "\<is not less than\>"
syn match scptGE "\<isn't less than\>"
hi def link scptGE scptOp
" MacRoman single char >=
exec 'syn match scptGE "'.nr2char(179).'"'
" --- Constant String ---
syn region scptString start=+"+ skip=+\\\\\|\\"+ end=+"+
hi def link scptString String
" --- Constant Number ---
syn match scptNumber "\<-\?\d\+\>"
hi def link scptNumber Number
" --- Constant Float ---
syn match scptFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\="
syn match scptFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=\>"
syn match scptFloat display contained "\d\+e[-+]\>"
hi def link scptFloat Float
" --- Constant Boolean ---
syn keyword scptBoolean true false yes no ask
hi def link scptBoolean Boolean
" --- Other Constants ---
syn keyword scptConst it me version pi result space tab anything
syn match scptConst "\<missing value\>"
" Considering and Ignoring
syn match scptConst "\<application responses\>"
syn match scptConst "\<current application\>"
syn match scptConst "\<white space\>"
syn keyword scptConst case diacriticals expansion hyphens punctuation
hi def link scptConst Constant
" Style
syn match scptStyle "\<all caps\>"
syn match scptStyle "\<all lowercase\>"
syn match scptStyle "\<small caps\>"
syn keyword scptStyle bold condensed expanded hidden italic outline plain
syn keyword scptStyle shadow strikethrough subscript superscript underline
hi def link scptStyle scptConst
" Day
syn keyword scptDay Mon Tue Wed Thu Fri Sat Sun
syn keyword scptDay Monday Tuesday Wednesday Thursday Friday Saturday Sunday
syn keyword scptDay weekday
hi def link scptDay scptConst
" Month
syn keyword scptMonth Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
syn keyword scptMonth January February March
syn keyword scptMonth April May June
syn keyword scptMonth July August September
syn keyword scptMonth October November December
syn keyword scptMonth month
hi def link scptMonth scptConst
" Time
syn keyword scptTime minutes hours days weeks
hi def link scptTime scptConstant
" --- Conditional ---
syn keyword scptCond if then else
syn match scptCond "\<end if\>"
hi def link scptCond Conditional
" --- Repeat ---
syn keyword scptRepeat repeat with from to by continue
syn match scptRepeat "\<repeat while\>"
syn match scptRepeat "\<repeat until\>"
syn match scptRepeat "\<repeat with\>"
syn match scptRepeat "\<end repeat\>"
hi def link scptRepeat Repeat
" --- Exception ---
syn keyword scptException try error
syn match scptException "\<on error\>"
syn match scptException "\<end try\>"
syn match scptException "\<end error\>"
hi def link scptException Exception
" --- Keyword ---
syn keyword scptKeyword end tell times exit
syn keyword scptKeyword application file alias activate
syn keyword scptKeyword script on return without given
syn keyword scptKeyword considering ignoring items delimiters
syn keyword scptKeyword some each every whose where id index item its
syn keyword scptKeyword first second third fourth fifth sixth seventh
syn keyword scptKeyword eighth ninth tenth container
syn match scptKeyword "\d\+\(st\|nd\|rd\|th\)"
syn keyword scptKeyword last front back middle named thru through
syn keyword scptKeyword before after in of the
syn match scptKeyword "\<text \>"
syn match scptKeyword "\<partial result\>"
syn match scptKeyword "\<but ignoring\>"
syn match scptKeyword "\<but considering\>"
syn match scptKeyword "\<with timeout\>"
syn match scptKeyword "\<with transaction\>"
syn match scptKeyword "\<do script\>"
syn match scptKeyword "\<POSIX path\>"
syn match scptKeyword "\<quoted form\>"
syn match scptKeyword "'s"
hi def link scptKeyword Keyword
" US Units
syn keyword scptUnitUS quarts gallons ounces pounds inches feet yards miles
syn match scptUnitUS "\<square feet\>"
syn match scptUnitUS "\<square yards\>"
syn match scptUnitUS "\<square miles\>"
syn match scptUnitUS "\<cubic inches\>"
syn match scptUnitUS "\<cubic feet\>"
syn match scptUnitUS "\<cubic yards\>"
syn match scptUnitUS "\<degrees Fahrenheit\>"
hi def link scptUnitUS scptKey
" British Units
syn keyword scptUnitBT litres centimetres metres kilometres
syn match scptUnitBT "\<square metres\>"
syn match scptUnitBT "\<square kilometres\>"
syn match scptUnitBT "\<cubic centimetres\>"
syn match scptUnitBT "\<cubic metres\>"
hi def link scptUnitBT scptKey
" Metric Units
syn keyword scptUnitMT liters centimeters meters kilometers grams kilograms
syn match scptUnitMT "\<square meters\>"
syn match scptUnitMT "\<square kilometers\>"
syn match scptUnitMT "\<cubic centimeters\>"
syn match scptUnitMT "\<cubic meters\>"
syn match scptUnitMT "\<degrees Celsius\>"
syn match scptUnitMT "\<degrees Kelvin\>"
hi def link scptUnitMT scptKey
" --- Comment ---
syn match scptComment "--.*"
syn match scptComment "#.*"
syn region scptComment start="(\*" end="\*)"
hi def link scptComment Comment
" --- Todo ---
syn keyword scptTodo contained TODO FIXME XXX
hi def link scptTodo Todo
let b:current_syntax = "applescript"
endif

View File

@@ -21,21 +21,39 @@ unlet! b:current_syntax
syn case match
syn clear htmlError
if has('patch-7.4.1142')
syn iskeyword @,48-57,_,192-255,@-@,:
else
setlocal iskeyword+=@-@
endif
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 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 @endpush @show containedin=ALLBUT,@bladeExempt
syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @cannot @elsecan @elsecannot @include @includeIf @each @inject @extends @section @stack @push @unless @yield @parent @hasSection @break @continue @unset @lang @choice nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan @endcannot @stop @append @endsection @endpush @show @overwrite @verbatim @endverbatim containedin=ALLBUT,@bladeExempt
if exists('g:blade_custom_directives')
exe "syn keyword bladeKeyword @" . join(g:blade_custom_directives, ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt"
endif
if exists('g:blade_custom_directives_pairs')
exe "syn keyword bladeKeyword @" . join(keys(g:blade_custom_directives_pairs), ' @') . " nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt"
exe "syn keyword bladeKeyword @" . join(values(g:blade_custom_directives_pairs), ' @') . " containedin=ALLBUT,@bladeExempt"
endif
syn region bladePhpRegion matchgroup=bladeKeyword start="\<@php\>\%(\s*(\)\@!" end="\<@endphp\>" contains=@bladePhp containedin=ALLBUT,@bladeExempt keepend
syn match bladeKeyword "@php\ze\s*(" nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
syn region bladePhpParenBlock matchgroup=bladeDelimiter start="\s*(" end=")" contains=@bladePhp,bladePhpParenBlock skipwhite contained
syn cluster bladePhp contains=@phpClTop
syn cluster bladeExempt contains=bladeComment,@htmlTop
syn cluster bladeExempt contains=bladeComment,bladePhpRegion,bladePhpParenBlock,@htmlTop
syn cluster htmlPreproc add=bladeEcho,bladeComment
syn cluster htmlPreproc add=bladeEcho,bladeComment,bladePhpRegion
syn keyword bladeTodo todo fixme xxx contained
syn case ignore
syn keyword bladeTodo todo fixme xxx note contained
hi def link bladeDelimiter PreProc
hi def link bladeComment Comment

View File

@@ -184,6 +184,11 @@ syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumbe
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
"hex number
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
if s:ft ==# 'cpp' && !exists("cpp_no_cpp14")
syn match cNumber display contained "\d\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cNumber display contained "0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
syn match cNumber display contained "0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
endif
" Flag the first zero of an octal number as something special
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
syn match cOctalZero display contained "\<0"
@@ -297,7 +302,7 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
if !exists("c_no_c99")
syn keyword cConstant __func__
syn keyword cConstant __func__ __VA_ARGS__
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX

File diff suppressed because one or more lines are too long

View File

@@ -34,7 +34,7 @@ hi def link coffeeConditional Conditional
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
hi def link coffeeException Exception
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\)\>/
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\)\>/
\ display
" The `own` keyword is only a keyword after `for`.
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat

View File

@@ -39,7 +39,7 @@ syn keyword cppConstant __cplusplus
" C++ 11 extensions
if !exists("cpp_no_cpp11")
syn keyword cppModifier override final
syn keyword cppModifier override final auto
syn keyword cppType nullptr_t
syn keyword cppExceptions noexcept
syn keyword cppStorageClass constexpr decltype thread_local

View File

@@ -42,7 +42,7 @@ syn region cryString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=crySpecial
syn region cryString start=+``+ skip=+\\\\\|\\"+ end=+``+ contains=hsSpecialChar
syn match cryCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=crySpecialChar,crySpecialCharError
syn match cryCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=crySpecialChar,crySpecialCharError
syn match cryNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
syn match cryNumber "\<[0-9]\+\>\|\<0[b][01]\+\>\|\<0[x][0-9a-fA-F]\+\>\|\<0[o][0-7]\+\>"
" Keyword definitions.
@@ -61,10 +61,12 @@ syn keyword cryPrimitive error parity lg2 pmod pdiv pmult format
syn keyword cryPrimitive join split groupBy take drop min max negate reverse
syn keyword cryPrimitive project tail width
syn keyword cryPrimitive ASSERT
syn keyword cryPrimitive module import private
" Comments
syn match cryLineComment "//.*"
syn region cryBlockComment start="/\*" end="\*/" contains=cryBlockComment
syn keyword cryTodo contained TODO FIXME XXX
syn match cryLineComment "//.*" contains=cryTodo
syn region cryBlockComment start="/\*" end="\*/" contains=cryBlockComment,cryTodo
if !exists("cry_minlines")
let cry_minlines = 50
@@ -103,6 +105,7 @@ if version >= 508 || !exists("did_cry_syntax_inits")
hi link cryBoolean Boolean
hi link cryType Type
hi link cryProp Keyword
hi link cryTodo Todo
delcommand HiLink
endif

View File

@@ -23,12 +23,12 @@ syntax keyword dartConditional if else switch
syntax keyword dartRepeat do while for
syntax keyword dartBoolean true false
syntax keyword dartConstant null
syntax keyword dartTypedef this super class typedef
syntax keyword dartOperator new is as in factory
syntax keyword dartTypedef this super class typedef enum
syntax keyword dartOperator new is as in
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
syntax keyword dartType void var bool int double num dynamic
syntax keyword dartStatement return
syntax keyword dartStorageClass static abstract final const
syntax keyword dartStorageClass static abstract final const factory
syntax keyword dartExceptions throw rethrow try on catch finally
syntax keyword dartAssert assert
syntax keyword dartClassDecl extends with implements
@@ -39,11 +39,17 @@ syntax match dartUserLabelRef "\k\+" contained
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
syntax keyword dartLabel default
syntax match dartLibrary "^\(import\|part of\|part\|export\|library\|show\|hide\)\s"
syntax match dartLibrary "^\(import\|export\)\>" nextgroup=dartUri skipwhite
syntax region dartUri contained start=+r\=\z(["']\)+ end=+\z1+ nextgroup=dartCombinators skipwhite
syntax region dartCombinators contained start="" end=";" contains=dartCombinator
syntax keyword dartCombinator contained show hide deferred as
syntax match dartLibrary "^\(library\|part of\|part\)\>"
syntax match dartMetadata "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>"
" Comments
syntax keyword dartTodo contained TODO FIXME XXX
syntax region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
@@ -96,9 +102,12 @@ highlight default link dartInterpolation PreProc
highlight default link dartDocLink SpecialComment
highlight default link dartSpecialChar SpecialChar
highlight default link dartLibrary Include
highlight default link dartUri String
highlight default link dartCombinator Keyword
highlight default link dartCoreClasses Type
highlight default link dartCoreTypedefs Typedef
highlight default link dartCoreExceptions Exception
highlight default link dartMetadata PreProc
let b:current_syntax = "dart"
let b:spell_options = "contained"

View File

@@ -4,6 +4,9 @@ if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
if !exists("main_syntax")
let main_syntax = 'eelixir'
endif
@@ -62,4 +65,7 @@ if main_syntax == 'eelixir'
unlet main_syntax
endif
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -4,16 +4,22 @@ if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" syncing starts 2000 lines before top line so docstrings don't screw things up
syn sync minlines=2000
syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration
syn match elixirComment '#.*' contains=elixirTodo,@Spell
syn match elixirComment '^\s*#.*' contains=elixirTodo,@Spell
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn keyword elixirKeyword case when with cond for if unless try receive send
syn keyword elixirKeyword exit raise throw after rescue catch else
syn keyword elixirKeyword do end exit raise throw after rescue catch else
syn keyword elixirKeyword quote unquote super spawn spawn_link spawn_monitor
" Functions used on guards
@@ -73,22 +79,19 @@ syn match elixirRegexCharClass "\[:\(alnum\|alpha\|ascii\|blank\|cntrl\|
syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'\|\\\\"
syn region elixirString matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ skip=+'\|\\\\+ contains=@elixirStringContained
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ skip=+"\|\\\\+ contains=@elixirStringContained
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop
syn region elixirDocStringStart matchgroup=elixirDocString start=+"""+ end=+$+ oneline contains=ALLBUT,@elixirNotTop
syn region elixirDocStringStart matchgroup=elixirDocString start=+'''+ end=+$+ oneline contains=ALLBUT,@elixirNotTop
syn region elixirDocString start=+\z("""\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold
syn region elixirDocString start=+\z('''\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold
syn match elixirDocString +\(@\w*doc\s*\)\@<=\%("""\_.\{-}\_^\s*"""\|".\{-\}"\)+ contains=elixirTodo,elixirInterpolation,@Spell fold
syn match elixirAtomInterpolated ':\("\)\@=' contains=elixirString
syn match elixirString "\(\w\)\@<!?\%(\\\(x\d{1,2}\|\h{1,2}\h\@!\>\|0[0-7]{0,2}[0-7]\@!\>\|[^x0MC]\)\|(\\[MC]-)+\w\|[^\s\\]\)"
syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
syn region elixirElseBlock matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
syn region elixirAnonymousFunction matchgroup=elixirBlockDefinition start="\<fn\>" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter
@@ -128,7 +131,7 @@ syn keyword elixirCallbackDefine defcallback nextgroup=elixirCallbackDec
syn keyword elixirStructDefine defstruct skipwhite skipnl
" Declarations
syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias nextgroup=elixirBlock skipwhite skipnl
syn match elixirModuleDeclaration "[^[:space:];#<]\+" contained nextgroup=elixirBlock skipwhite skipnl
syn match elixirFunctionDeclaration "[^[:space:];#<,()\[\]]\+" contained nextgroup=elixirArguments skipwhite skipnl
syn match elixirProtocolDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
syn match elixirImplDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
@@ -140,8 +143,6 @@ syn match elixirOverridableDeclaration "[^[:space:];#<]\+" contained con
syn match elixirExceptionDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration skipwhite skipnl
syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration
hi def link elixirBlockDefinition Keyword
hi def link elixirDefine Define
hi def link elixirPrivateDefine Define
@@ -157,6 +158,7 @@ hi def link elixirOverridableDefine Define
hi def link elixirExceptionDefine Define
hi def link elixirCallbackDefine Define
hi def link elixirStructDefine Define
hi def link elixirModuleDeclaration Type
hi def link elixirFunctionDeclaration Function
hi def link elixirMacroDeclaration Macro
hi def link elixirInclude Include
@@ -172,7 +174,7 @@ hi def link elixirVariable Identifier
hi def link elixirSelf Identifier
hi def link elixirUnusedVariable Comment
hi def link elixirNumber Number
hi def link elixirDocString String
hi def link elixirDocString Comment
hi def link elixirAtomInterpolated elixirAtom
hi def link elixirRegex elixirString
hi def link elixirRegexEscape elixirSpecial
@@ -189,4 +191,7 @@ hi def link elixirSigilDelimiter Delimiter
let b:current_syntax = "elixir"
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
" Language: ember-script
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-ember-script
" Version: 1.0.1
" Last Change: 2013 Apr 17
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
" URL: http://github.com/yalesov/vim-ember-script
" Version: 1.0.4
" Last Change: 2016 Jul 6
" License: ISC
if exists('b:current_syntax') && b:current_syntax == 'ember-script'
finish

View File

@@ -1,11 +1,11 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
" Language: emblem
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
" URL: http://github.com/heartsentwined/vim-emblem
" Version: 1.2.0
" Last Change: 2013 Apr 22
" License: GPL-3.0
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
" URL: http://github.com/yalesov/vim-emblem
" Version: 2.0.1
" Last Change: 2016 Jul 6
" License: ISC
" Quit when a syntax file is already loaded.
if exists('b:current_syntax') && b:current_syntax == 'emblem'
@@ -31,7 +31,7 @@ syn match eblClass '\v(\w|-)+' nextgroup=@eblComponent contained display
hi def link eblIdOp eblId
hi def link eblClassOp eblClass
syn region eblHbsAttrRegion matchgroup=eblHbsAttrRegionOp start='{' end='}' contains=@eblHbsHelpers nextgroup=@eblComponent keepend contained display
syn region eblHbsAttrRegion matchgroup=eblHbsAttrRegionOp start='{\|(\|\[' end='}\|)\|\]' contains=@eblHbsHelpers nextgroup=@eblComponent keepend contained display
hi def link eblHbsAttrRegionOp eblOperator
syn match eblInlineText '\v\s+[^:]+.*$' contains=eblItpl contained display
@@ -40,7 +40,7 @@ hi def link eblInlineText eblRaw
syn cluster eblHbsComponent contains=eblHbsArg,eblHbsAttr,eblHbsTextOp,eblLineOp
syn match eblHbsOp '\v\s*\=+' nextgroup=@eblHbsHelpers skipwhite contained display
syn match eblHbsHelper '\v\w(\w|-|\.)*' nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsHelper '\v\w(\w|-|\.|\/)*' nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsTextOp '|' nextgroup=eblHbsText contained display
syn match eblHbsText '.*' contained display
hi def link eblHbsOp eblOperator
@@ -48,24 +48,38 @@ hi def link eblHbsHelper eblFunction
hi def link eblHbsTextOp eblOperator
hi def link eblHbsText eblRaw
syn cluster eblHbsHelpers contains=eblHbsHelper,eblHbsCtrlFlowHelper,eblHbsEachHelper
syn cluster eblHbsHelpers contains=eblHbsHelper,eblHbsCtrlFlowHelper,eblHbsEachHelper,eblHbsWithHelper
syn match eblHbsCtrlFlowHelper '\v<(if|unless|else|with)>' nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsCtrlFlowHelper '\v<(else if|if|unless|else)>' nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsEachHelper '\v<each>' nextgroup=eblHbsEachArg skipwhite contained display
syn match eblHbsEachArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblHbsIn,eblLineOp skipwhite contained display
syn match eblHbsIn '\v<in>' nextgroup=eblHbsInArg skipwhite contained display
syn match eblHbsInArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblLineOp skipwhite contained display
syn match eblHbsWithHelper '\v<with>' nextgroup=eblHbsWithArg skipwhite contained display
syn match eblHbsWithArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblHbsAs skipwhite contained display
syn match eblHbsAs '\v<as>' nextgroup=eblHbsAsBlockStartArg skipwhite contained display
syn match eblHbsAsBlockStartArg /\v\|/ nextgroup=eblHbsAsBlockFirstArg skipwhite contained display
syn match eblHbsAsBlockFirstArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblHbsAsBlockSecondArg,eblHbsAsBlockEndArg skipwhite contained display
syn match eblHbsAsBlockSecondArg /\v((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=eblHbsAsBlockEndArg skipwhite contained display
syn match eblHbsAsBlockEndArg /\v\|/ nextgroup=eblLineOp skipwhite contained display
hi def link eblHbsCtrlFlowHelper eblKeyword
hi def link eblHbsEachHelper eblKeyword
hi def link eblHbsEachArg eblLiteral
hi def link eblHbsIn eblKeyword
hi def link eblHbsInArg eblLiteral
hi def link eblHbsWithHelper eblKeyword
hi def link eblHbsWithArg eblLiteral
hi def link eblHbsAs eblKeyword
hi def link eblHbsAsBlockStartArg eblOperator
hi def link eblHbsAsBlockFirstArg eblLiteral
hi def link eblHbsAsBlockSecondArg eblLiteral
hi def link eblHbsAsBlockEndArg eblOperator
syn match eblHbsArg /\v\s*((["'])[^\2]{-}\2|(\w|\.|-|\>)+)/ nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsAttr '\v\s*(\w|-)+\=@=' contains=eblHbsAttrBind nextgroup=eblHbsAttrOp contained display
syn match eblHbsAttrBind /\v<(\w|-)+Bind>/ contained display
syn match eblHbsAttrOp '=' nextgroup=eblHbsAttrLit contained display
syn match eblHbsAttrLit /\v(["'])[^\1]{-}\1|[^: ]+/ contains=eblItpl nextgroup=@eblHbsComponent skipwhite contained display
syn match eblHbsAttrLit /\v(["'])[^\1]{-}\1|[^\.: ]+/ contains=eblItpl nextgroup=@eblHbsComponent skipwhite contained display
hi def link eblHbsArg eblLiteral
hi def link eblHbsAttr eblAttr
hi def link eblhbsAttrBind eblBind
@@ -106,6 +120,7 @@ hi def link eblKnownEvent eblEvent
syn region eblItpl matchgroup=eblItplOp start='#{' end='}' contains=@eblHbsHelpers,eblHbsPartialOp keepend contained display
syn region eblItpl matchgroup=eblItplOp start='{{' end='}}' contains=@eblHbsHelpers,eblHbsPartialOp keepend contained display
syn region eblItpl matchgroup=eblItplOp start='(' end=')' contains=@eblHbsHelpers,eblHbsPartialOp keepend contained display
hi def link eblItplOp eblOperator
syn match eblHbsPartialOp '\s*>' nextgroup=@eblHbsHelpers skipwhite contained display

View File

@@ -23,7 +23,7 @@ syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite
syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
syn match gitrebaseCommand ".*" contained
syn match gitrebaseComment "^#.*" contains=gitrebaseHash
syn match gitrebaseComment "^\s*#.*" contains=gitrebaseHash
syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
hi def link gitrebaseCommit gitrebaseHash

View File

@@ -69,12 +69,12 @@ if !exists("g:go_highlight_methods")
let g:go_highlight_methods = 0
endif
if !exists("g:go_highlight_structs")
let g:go_highlight_structs = 0
if !exists("g:go_highlight_fields")
let g:go_highlight_fields = 0
endif
if !exists("g:go_highlight_interfaces")
let g:go_highlight_interfaces = 0
if !exists("g:go_highlight_types")
let g:go_highlight_types = 0
endif
if !exists("g:go_highlight_build_constraints")
@@ -96,12 +96,10 @@ endif
syn case match
syn keyword goDirective package import
syn keyword goDeclaration var const type
syn keyword goDeclType struct interface
syn keyword goDeclaration var const
hi def link goDirective Statement
hi def link goDeclaration Keyword
hi def link goDeclType Keyword
" Keywords within functions
syn keyword goStatement defer go goto return break continue fallthrough
@@ -127,17 +125,15 @@ hi def link goUnsignedInts Type
hi def link goFloats Type
hi def link goComplexes Type
" Treat func specially: it's a declaration at the start of a line, but a type
" elsewhere. Order matters here.
syn match goDeclaration /\<func\>/
" Predefined functions and values
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
syn keyword goBoolean iota true false nil
syn keyword goPredefinedIdentifiers nil iota
syn keyword goBoolean true false
hi def link goBuiltins Keyword
hi def link goPredefinedIdentifiers Identifier
hi def link goBoolean Boolean
" Comments; their contents
@@ -183,7 +179,7 @@ else
endif
if g:go_highlight_format_strings != 0
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
syn match goFormatSpecifier /\([^%]\(%%\)*\)\@<=%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
hi def link goFormatSpecifier goSpecialString
endif
@@ -279,6 +275,7 @@ hi def link goSpaceError Error
syn keyword goTodo contained NOTE
hi def link goTodo Todo
syn match goVarArgs /\.\.\./
" Operators;
if g:go_highlight_operators != 0
@@ -293,38 +290,52 @@ if g:go_highlight_operators != 0
" match remaining two-char operators: := && || <- ++ --
syn match goOperator /:=\|||\|<-\|++\|--/
" match ...
syn match goOperator /\.\.\./
hi def link goPointerOperator goOperator
hi def link goVarArgs goOperator
endif
hi def link goOperator Operator
" Functions;
if g:go_highlight_functions != 0
syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/
syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction skipwhite skipnl
syn match goReceiver /(\(\w\|[ *]\)\+)/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
syn match goReceiverVar /\w\+/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
syn match goReceiverType /\w\+/ contained
syn match goFunction /\w\+/ contained
else
syn keyword goDeclaration func
endif
hi def link goFunction Function
" Methods;
if g:go_highlight_methods != 0
syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/
syn match goMethod /\.\w\+\ze(/hs=s+1
endif
hi def link goMethod Type
" Structs;
if g:go_highlight_structs != 0
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/
" Fields;
if g:go_highlight_fields != 0
syn match goField /\.\w\+\([.\ \n\r\:\)\[,]\)\@=/hs=s+1
endif
hi def link goStruct Function
hi def link goStructDef Function
hi def link goField Identifier
" Interfaces;
if g:go_highlight_interfaces != 0
syn match goInterface /\(.\)\@<=\w\+\({\)\@=/
syn match goInterfaceDef /\(type\s\+\)\@<=\w\+\(\s\+interface\s\+{\)\@=/
" Structs & Interfaces;
if g:go_highlight_types != 0
syn match goTypeConstructor /\<\w\+{/he=e-1
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
syn match goDeclType /\<interface\|struct\>/ contained skipwhite skipnl
hi def link goReceiverType Type
else
syn keyword goDeclType struct interface
syn keyword goDeclaration type
endif
hi def link goInterface Function
hi def link goInterfaceDef Function
hi def link goTypeConstructor Type
hi def link goTypeName Type
hi def link goTypeDecl Keyword
hi def link goDeclType Keyword
" Build Constraints
if g:go_highlight_build_constraints != 0
@@ -359,6 +370,27 @@ if g:go_highlight_build_constraints != 0
hi def link goPackageComment Comment
endif
" :GoCoverage commands
hi def link goCoverageNormalText Comment
function! s:hi()
" :GoSameIds
if &background == 'dark'
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black
else
hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan
endif
" :GoCoverage commands
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
hi def goCoverageUncover ctermfg=red guifg=#F92672
endfunction
augroup vim-go-hi
autocmd!
autocmd ColorScheme * call s:hi()
augroup end
call s:hi()
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
@@ -369,4 +401,6 @@ syn sync minlines=500
let b:current_syntax = "go"
" vim: sw=2 ts=2 et
endif

View File

@@ -19,4 +19,6 @@ hi def link godefStackCurrentPosition Special
hi def link godefStackFilename Directory
hi def link godefStackEntryLocationNumber LineNr
" vim: sw=2 ts=2 et
endif

View File

@@ -14,6 +14,6 @@ unlet b:current_syntax
let b:current_syntax = "gohtmltmpl"
" vim:ts=4:sw=4:et
" vim: sw=2 ts=2 et
endif

View File

@@ -84,6 +84,6 @@ hi def link goTplComment Comment
let b:current_syntax = "gotexttmpl"
" vim:ts=4:sw=4:et
" vim: sw=2 ts=2 et
endif

View File

@@ -13,6 +13,7 @@ elseif exists("b:current_syntax")
finish
endif
syn spell notoplevel
syn match haskellRecordField contained containedin=haskellBlock
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
\ contains=
@@ -30,7 +31,7 @@ syn match haskellTypeSig
\ haskellOperators,
\ haskellSeparator,
\ haskellParens
syn keyword haskelLWhere where
syn keyword haskellWhere where
syn keyword haskellLet let
syn keyword haskellDeclKeyword module class instance newtype deriving in
syn match haskellDecl "\<\(type\|data\)\>\s\+\(\<family\>\)\?"
@@ -60,9 +61,9 @@ syn keyword haskellConditional if then else
syn match haskellNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>\|\<0[bB][10]\+\>"
syn match haskellFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
syn match haskellSeparator "[,;]"
syn region haskellParens matchgroup=haskellDelimiter start="(" end=")" contains=TOP,haskellTypeSig
syn region haskellBrackets matchgroup=haskellDelimiter start="\[" end="]" contains=TOP,haskellTypeSig
syn region haskellBlock matchgroup=haskellDelimiter start="{" end="}" contains=TOP
syn region haskellParens matchgroup=haskellDelimiter start="(" end=")" contains=TOP,haskellTypeSig,@Spell
syn region haskellBrackets matchgroup=haskellDelimiter start="\[" end="]" contains=TOP,haskellTypeSig,@Spell
syn region haskellBlock matchgroup=haskellDelimiter start="{" end="}" contains=TOP,@Spell
syn keyword haskellInfix infix infixl infixr
syn keyword haskellBottom undefined error
syn match haskellOperators "[-!#$%&\*\+/<=>\?@\\^|~:.]\+\|\<_\>"
@@ -94,7 +95,7 @@ syn region haskellBlockComment start="{-" end="-}"
\ @Spell
syn region haskellPragma start="{-#" end="#-}"
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-z][a-zA-z0-9_']*|" end="|\]"
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
syn match haskellPreProc "^#.*$"
@@ -144,26 +145,21 @@ highlight def link haskellChar String
highlight def link haskellBacktick Operator
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 haskellQuotedType Type
highlight def link haskellType Type
highlight def link haskellImportKeywords Include
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
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

View File

@@ -12,27 +12,72 @@ syntax case match
" keywords
syntax keyword jasmineSuite describe it beforeEach afterEach
syntax keyword jasmine jasmine
" special
syntax match jasmineSpecial /\.Ajax/
syntax match jasmineSpecial /\.addMatcher/
syntax match jasmineSpecial /\.getEnv/
syntax match jasmineSpecial /\.loadConfigFile/
syntax match jasmineSpecial /\.onComplete/
syntax match jasmineSpecial /\.QueryString/
syntax match jasmineSpecial /\.HtmlSpecFilter/
syntax match jasmineSpecial /\.addCustomEqualityTester/
syntax match jasmineSpecial /\.configureDefaultReporter/
syntax match jasmineSpecial /\.execute/
" clock
syntax match jasmineClock /\.Timer/
syntax match jasmineClock /\.clock/
syntax match jasmineClock /\.tick/
syntax match jasmineClock /\.mockDate/
" disabled
syntax keyword jasmineDisabled xdescribe xit
" expectation
syntax keyword jasmineExpectation expect
" not
syntax region jasmineNot start=/not/ end=/\.to/me=s-1
" matchers
syntax match jasmineMatcher /\.to\h\+/
syntax match jasmineMatcher /\.objectContaining/
syntax match jasmineMatcher /\.arrayContaining/
syntax match jasmineMatcher /\.anything/
syntax match jasmineMatcher /\.any/
syntax keyword jasmineSpy spyOn
syntax match jasmineSpy /\.createSpy/
syntax match jasmineSpyMatcher /and\h\+/
" jasmine is a subset of the javascript language, thus we need to activate
" javascript syntax highlighting and add new jasmin group names to the
" JavaScriptAll cluster which is defined there
runtime! syntax/javascript.vim
syntax cluster JavaScriptAll add=jasmineSuite,jasmineDisabled,jasmineExpectation,jasmineNot,jasmineMatcher,jasmineSpy,jasmineSpyMatcher
syntax cluster JavaScriptAll add=
\ jasmine,
\ jasmineClock,
\ jasmineDisabled,
\ jasmineExpectation,
\ jasmineMatcher,
\ jasmineNot,
\ jasmineSpecial,
\ jasmineSpy,
\ jasmineSpyMatcher,
\ jasmineSuite
let b:current_syntax = "jasmine"
hi def link jasmineSuite Statement
hi def link jasmine Special
hi def link jasmineClock Special
hi def link jasmineDisabled Error
hi def link jasmineExpectation Statement
hi def link jasmineNot Special
hi def link jasmineMatcher Statement
hi def link jasmineNot Special
hi def link jasmineSpecial Special
hi def link jasmineSpy Special
hi def link jasmineSpyMatcher Statement
hi def link jasmineSuite Statement
endif

View File

@@ -14,210 +14,213 @@ if !exists("main_syntax")
let main_syntax = 'javascript'
endif
if !exists('g:javascript_conceal')
let g:javascript_conceal = 0
" Dollar sign is permitted anywhere in an identifier
if v:version > 704 || v:version == 704 && has('patch1142')
syntax iskeyword @,48-57,_,192-255,$
else
setlocal iskeyword+=$
endif
"" dollar sign is permittd anywhere in an identifier
setlocal iskeyword+=$
syntax sync fromstart
" TODO: Figure out what type of casing I need
" syntax case ignore
syntax case match
syntax match jsNoise /[:,\;\.]\{1}/
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsParensError /[)}\]]/
"" Program Keywords
syntax keyword jsStorageClass const var let
syntax keyword jsOperator delete instanceof typeof void new in
" Program Keywords
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
syntax match jsVariableDef contained /\k\+/ nextgroup=jsFlowDefinition
syntax keyword jsOperator delete instanceof typeof void new in of
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/
syntax keyword jsBooleanTrue true
syntax keyword jsBooleanFalse false
syntax keyword jsModules import export contained
syntax keyword jsModuleWords default from as contained
syntax keyword jsOf of contained
syntax keyword jsArgsObj arguments
syntax region jsImportContainer start="^\s\?import \?" end=";\|$" contains=jsModules,jsModuleWords,jsLineComment,jsComment,jsStringS,jsStringD,jsTemplateString,jsNoise,jsBlock
" Modules
syntax keyword jsModuleKeywords contained import
syntax keyword jsModuleKeywords contained export skipwhite skipempty nextgroup=jsExportBlock,jsModuleDefault
syntax keyword jsModuleOperators contained from
syntax keyword jsModuleOperators contained as
syntax region jsModuleGroup contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment
syntax match jsModuleAsterisk contained /*/
syntax keyword jsModuleDefault contained default skipwhite skipempty nextgroup=@jsExpression
syntax region jsImportContainer start=/\<import\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsComment,jsString,jsTemplateString,jsNoise,jsModuleGroup,jsModuleAsterisk
syntax region jsExportContainer start=/\<export\> / end="\%(;\|$\)" contains=jsModuleKeywords,jsModuleOperators,jsStorageClass,jsModuleDefault,@jsExpression
syntax region jsExportBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=jsModuleOperators,jsNoise,jsComment
syntax region jsExportContainer start="^\s\?export \?" end="$" contains=jsModules,jsModuleWords,jsComment,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsArgsObj,jsBlock,jsClassDefinition
"" JavaScript comments
syntax keyword jsCommentTodo TODO FIXME XXX TBD contained
syntax region jsLineComment start=+\/\/+ end=+$+ keepend contains=jsCommentTodo,@Spell extend
syntax region jsEnvComment start="\%^#!" end="$" display
syntax region jsLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=jsCommentTodo,@Spell fold
syntax region jsCvsTag start="\$\cid:" end="\$" oneline contained
syntax region jsComment start="/\*" end="\*/" contains=jsCommentTodo,jsCvsTag,@Spell fold extend
"" JSDoc / JSDoc Toolkit
if !exists("javascript_ignore_javaScriptdoc")
syntax case ignore
"" syntax coloring for javadoc comments (HTML)
"syntax include @javaHtml <sfile>:p:h/html.vim
"unlet b:current_syntax
syntax region jsBlockComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
" tags containing a param
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" nextgroup=jsDocParam skipwhite
" tags containing type and param
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" nextgroup=jsDocType skipwhite
" tags containing type but no param
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" nextgroup=jsDocTypeNoParam skipwhite
" tags containing references
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" nextgroup=jsDocSeeTag skipwhite
" other tags (no extra syntax)
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
syntax region jsDocType matchgroup=jsDocTypeBrackets start="{" end="}" oneline contained nextgroup=jsDocParam skipwhite contains=jsDocTypeRecord
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
syntax region jsDocTypeRecord start=/{/ end=/}/ contained extend contains=jsDocTypeRecord
syntax region jsDocTypeRecord start=/\[/ end=/\]/ contained extend contains=jsDocTypeRecord
syntax region jsDocTypeNoParam start="{" end="}" oneline contained
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
syntax case match
endif "" JSDoc end
syntax case match
"" Syntax in the JavaScript code
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained
syntax region jsTemplateVar matchgroup=jsTemplateBraces start=+${+ end=+}+ contained contains=@jsExpression
syntax region jsStringD start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@htmlPreproc,@Spell
syntax region jsStringS start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@htmlPreproc,@Spell
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial,@htmlPreproc
syntax region jsTaggedTemplate start=/\k\+\%([\n\s]\+\)\?`/ end=+`+ contains=jsTemplateString keepend
syntax region jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained
syntax match jsRegexpBoundary "\v%(\<@![\^$]|\\[bB])" contained
syntax match jsRegexpBackRef "\v\\[1-9][0-9]*" contained
syntax match jsRegexpQuantifier "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" contained
syntax match jsRegexpOr "\v\<@!\|" contained
syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
" Strings, Templates, Numbers
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial extend
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
syntax keyword jsNumber Infinity
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
syntax match jsObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey contained
syntax match jsFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/ contained
syntax match jsDecorator "@" display contains=jsDecoratorFunction nextgroup=jsDecoratorFunction skipwhite
syntax match jsDecoratorFunction "[a-zA-Z_][a-zA-Z0-9_.]*" display contained nextgroup=jsFunc skipwhite
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
" Regular Expressions
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
syntax region jsTemplateVar contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
syntax match jsRegexpOr contained "\v\<@!\|"
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
if v:version > 703 || v:version == 603 && has("patch1088")
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
else
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
endif
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
syntax match jsObjectSeparator contained /,/
syntax region jsObjectValue contained start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
syntax match jsObjectMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
exe 'syntax keyword jsReturn return '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '')
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '')
exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '')
exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '')
exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '')
exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '')
exe 'syntax keyword jsStatic static '.(exists('g:javascript_conceal_static') ? 'conceal cchar='.g:javascript_conceal_static : '')
exe 'syntax keyword jsSuper super '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
exe 'syntax keyword jsThis this contained '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '')
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
"" Statement Keywords
syntax keyword jsStatement break continue with
syntax keyword jsConditional if else switch
syntax keyword jsRepeat do while for
syntax keyword jsLabel case default
syntax keyword jsKeyword yield
syntax keyword jsException try catch throw finally
" Statement Keywords
syntax keyword jsStatement contained break continue with yield debugger
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
syntax keyword jsConditional else skipwhite skipempty nextgroup=jsCommentMisc,jsBlock
syntax keyword jsConditional switch skipwhite skipempty nextgroup=jsParenSwitch
syntax keyword jsRepeat while for skipwhite skipempty nextgroup=jsParenRepeat
syntax keyword jsDo do skipwhite skipempty nextgroup=jsBlock
syntax keyword jsLabel contained case default
syntax keyword jsTry try skipwhite skipempty nextgroup=jsTryCatchBlock
syntax keyword jsFinally contained finally skipwhite skipempty nextgroup=jsBlock
syntax keyword jsCatch contained catch skipwhite skipempty nextgroup=jsParenCatch
syntax keyword jsException throw
syntax keyword jsAsyncKeyword async await
syntax match jsSwitchColon contained /:/ skipwhite skipempty nextgroup=jsBlock
" Keywords
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat
syntax keyword jsGlobalNodeObjects module exports global process
syntax match jsGlobalNodeObjects /require/ contains=jsFuncCall
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval
" DISCUSS: How imporant is this, really? Perhaps it should be linked to an error because I assume the keywords are reserved?
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient implements protected volatile double public
syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient debugger implements protected volatile double public
"" DOM/HTML/CSS specified things
" DISCUSS: Should we really be matching stuff like this?
" DOM2 Objects
syntax keyword jsGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
syntax keyword jsExceptions DOMException
" DISCUSS: Should we really be matching stuff like this?
" DOM2 CONSTANT
syntax keyword jsDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
syntax keyword jsDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
" DISCUSS: Should we really be special matching on these props?
" HTML events and internal variables
syntax case ignore
syntax keyword jsHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
syntax case match
" Follow stuff should be highligh within a special context
" While it can't be handled with context depended with Regex based highlight
" So, turn it off by default
if exists("javascript_enable_domhtmlcss")
" DOM2 things
syntax match jsDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
syntax match jsDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementById\|getElementsByClassName\|getElementsByTagName\|querySelector\|querySelectorAll\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=jsParen skipwhite
" HTML things
syntax match jsHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
syntax match jsHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=jsParen skipwhite
" CSS Styles in JavaScript
syntax keyword jsCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
syntax keyword jsCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
syntax keyword jsCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
syntax keyword jsCssStyles contained bottom height left position right top width zIndex
syntax keyword jsCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
syntax keyword jsCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
syntax keyword jsCssStyles contained listStyle listStyleImage listStylePosition listStyleType
syntax keyword jsCssStyles contained background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
syntax keyword jsCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
syntax keyword jsCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
syntax keyword jsCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
" Highlight ways
syntax match jsDotNotation "\." nextgroup=jsPrototype,jsDomElemAttrs,jsDomElemFuncs,jsHtmlElemAttrs,jsHtmlElemFuncs
syntax match jsDotNotation "\.style\." nextgroup=jsCssStyles
endif "DOM/HTML/CSS
"" end DOM/HTML/CSS specified things
"" Code blocks
syntax cluster jsExpression contains=jsComment,jsLineComment,jsBlockComment,jsTaggedTemplate,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsStatic,jsSuper,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsBlock,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsCommonJS,jsImportContainer,jsExportContainer,jsArgsObj,jsDecorator,jsAsyncKeyword,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs
syntax cluster jsAll contains=@jsExpression,jsLabel,jsConditional,jsRepeat,jsReturn,jsStatement,jsTernaryIf,jsException
syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsAll,jsParensErrB,jsParensErrC,jsBracket,jsParen,jsBlock,@htmlPreproc fold
syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsOf,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold extend
syntax region jsClassBlock matchgroup=jsClassBraces start="{" end="}" contains=jsFuncName,jsClassMethodDefinitions,jsOperator,jsArrowFunction,jsArrowFuncArgs,jsComment,jsBlockComment,jsLineComment contained fold
syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc,jsClassDefinition fold extend
syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc,jsClassDefinition fold extend
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf
syntax region jsBracket matchgroup=jsBrackets start=/\[/ end=/\]/ contains=@jsExpression extend fold
syntax region jsParen matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll extend fold
syntax region jsParenIfElse contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
syntax region jsParenRepeat contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsCommentMisc,jsBlock extend fold
syntax region jsParenSwitch contained matchgroup=jsParens start=/(/ end=/)/ contains=@jsAll skipwhite skipempty nextgroup=jsSwitchBlock extend fold
syntax region jsParenCatch contained matchgroup=jsParens start=/(/ end=/)/ skipwhite skipempty nextgroup=jsTryCatchBlock extend fold
syntax region jsFuncArgs contained matchgroup=jsFuncParens start=/(/ end=/)/ contains=jsFuncArgCommas,jsComment,jsFuncArgExpression,jsDestructuringBlock,jsRestExpression,jsFlowArgumentDef skipwhite skipempty nextgroup=jsCommentFunction,jsFuncBlock,jsFlowReturn extend fold
syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsNoise extend fold
syntax region jsFuncBlock contained matchgroup=jsFuncBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll extend fold
syntax region jsTryCatchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll skipwhite skipempty nextgroup=jsCatch,jsFinally extend fold
syntax region jsSwitchBlock contained matchgroup=jsBraces start=/{/ end=/}/ contains=@jsAll,jsLabel,jsSwitchColon extend fold
syntax region jsDestructuringBlock contained matchgroup=jsDestructuringBraces start=/{/ end=/}/ contains=jsDestructuringProperty,jsDestructuringAssignment,jsDestructuringNoise,jsDestructuringPropertyComputed,jsSpreadExpression extend fold
syntax region jsDestructuringArray contained matchgroup=jsDestructuringBraces start=/\[/ end=/\]/ contains=jsDestructuringPropertyValue,jsNoise,jsDestructuringProperty,jsSpreadExpression extend fold
syntax region jsObject matchgroup=jsObjectBraces start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression extend fold
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression
"" catch errors caused by wrong parenthesis
syntax match jsParensError ")\|}\|\]"
syntax match jsParensErrA contained "\]"
syntax match jsParensErrB contained ")"
syntax match jsParensErrC contained "}"
syntax match jsFuncArgDestructuring contained /\({\|}\|=\|:\|\[\|\]\)/ extend
exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
exe 'syntax match jsArrowFunction /=>/ skipwhite nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
syntax match jsGenerator contained '\*' nextgroup=jsFuncName,jsFuncArgs skipwhite
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite
syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsComment,jsLineComment,jsStringS,jsStringD,jsNumber,jsFuncArgDestructuring,jsArrowFunction,jsParen,jsArrowFuncArgs nextgroup=jsFuncBlock keepend skipwhite skipempty
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
syntax match jsFuncArgCommas contained ','
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots
syntax match jsFuncArgRestDots contained /\.\.\./
syntax keyword jsArguments contained arguments
" Matches a single keyword argument with no parens
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs nextgroup=jsArrowFunction extend
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
" Matches a series of arguments surrounded in parens
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ skipempty skipwhite contains=jsFuncArgs nextgroup=jsArrowFunction extend
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
syntax keyword jsClassKeywords extends class contained
syntax match jsClassNoise /\./ contained
syntax keyword jsClassMethodDefinitions get set static contained nextgroup=jsFuncName skipwhite skipempty
syntax match jsClassDefinition /class [a-zA-Z_$][0-9a-zA-Z_$ \n.]*/ contains=jsClassKeywords,jsClassNoise nextgroup=jsClassBlock skipwhite skipempty
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
syntax keyword jsClassKeywords contained extends class
syntax match jsClassNoise contained /\./
syntax match jsClassMethodType contained /\%(get\|set\|static\|async\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsFuncName,jsClassProperty
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsDecorator contained "@" nextgroup=jsDecoratorFunction
syntax match jsDecoratorFunction contained "[a-zA-Z_][a-zA-Z0-9_.]*"
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsClassValue
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
" Destructuring
syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/
syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue
syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
syntax match jsDestructuringNoise contained /[,\[\]]/
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold
" Comments
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD
syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend
syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend
syntax region jsEnvComment start=/\%^#!/ end=/$/ display
" Specialized Comments - These are special comment regexes that are used in
" odd places that maintain the proper nextgroup functionality. It sucks we
" can't make jsComment a skippable type of group for nextgroup
syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
syntax region jsCommentFunction contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
syntax region jsCommentClass contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
syntax region jsCommentMisc contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock extend keepend
syntax region jsCommentMisc contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsBlock fold extend keepend
if exists("javascript_plugin_jsdoc")
runtime extras/jsdoc.vim
" NGDoc requires JSDoc
if exists("javascript_plugin_ngdoc")
runtime extras/ngdoc.vim
endif
endif
if exists("javascript_plugin_flow")
runtime extras/flow.vim
endif
syntax cluster jsExpression contains=jsBracket,jsParen,jsObject,jsBlock,jsTernaryIf,jsTaggedTemplate,jsTemplateString,jsString,jsRegexpString,jsNumber,jsFloat,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsFuncCall,jsUndefined,jsNan,jsPrototype,jsBuiltins,jsNoise,jsClassDefinition,jsArrowFunction,jsArrowFuncArgs,jsParensError,jsComment,jsArguments,jsThis,jsSuper,jsDo
syntax cluster jsAll contains=@jsExpression,jsExportContainer,jsImportContainer,jsStorageClass,jsConditional,jsRepeat,jsReturn,jsStatement,jsException,jsTry,jsAsyncKeyword
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
@@ -229,25 +232,16 @@ if version >= 508 || !exists("did_javascript_syn_inits")
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink jsFuncArgRest Special
HiLink jsComment Comment
HiLink jsLineComment Comment
HiLink jsEnvComment PreProc
HiLink jsBlockComment Comment
HiLink jsCommentTodo Todo
HiLink jsCvsTag Function
HiLink jsDocTags Special
HiLink jsDocSeeTag Function
HiLink jsDocType Type
HiLink jsDocTypeBrackets jsDocType
HiLink jsDocTypeRecord jsDocType
HiLink jsDocTypeNoParam Type
HiLink jsDocParam Label
HiLink jsStringS String
HiLink jsStringD String
HiLink jsString String
HiLink jsObjectKeyString String
HiLink jsTemplateString String
HiLink jsObjectStringKey String
HiLink jsClassStringKey String
HiLink jsTaggedTemplate StorageClass
HiLink jsTernaryIfOperator Conditional
HiLink jsTernaryIfOperator Operator
HiLink jsRegexpString String
HiLink jsRegexpBoundary SpecialChar
HiLink jsRegexpQuantifier SpecialChar
@@ -263,28 +257,29 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsLabel Label
HiLink jsReturn Statement
HiLink jsRepeat Repeat
HiLink jsDo Repeat
HiLink jsStatement Statement
HiLink jsException Exception
HiLink jsKeyword Keyword
HiLink jsTry Exception
HiLink jsFinally Exception
HiLink jsCatch Exception
HiLink jsAsyncKeyword Keyword
HiLink jsArrowFunction Type
HiLink jsFunction Type
HiLink jsGenerator jsFunction
HiLink jsArrowFuncArgs jsFuncArgs
HiLink jsFuncName Function
HiLink jsArgsObj Special
HiLink jsClassFuncName jsFuncName
HiLink jsObjectFuncName Function
HiLink jsArguments Special
HiLink jsError Error
HiLink jsParensError Error
HiLink jsParensErrA Error
HiLink jsParensErrB Error
HiLink jsParensErrC Error
HiLink jsOperator Operator
HiLink jsOf Operator
HiLink jsStorageClass StorageClass
HiLink jsClassKeywords Structure
HiLink jsThis Special
HiLink jsStatic Special
HiLink jsSuper Special
HiLink jsSuper Constant
HiLink jsNan Number
HiLink jsNull Type
HiLink jsUndefined Type
@@ -300,18 +295,39 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsFuncParens Noise
HiLink jsClassBraces Noise
HiLink jsClassNoise Noise
HiLink jsObjectBraces Noise
HiLink jsObjectSeparator Noise
HiLink jsSpecial Special
HiLink jsTemplateVar Special
HiLink jsTemplateBraces jsBraces
HiLink jsGlobalObjects Special
HiLink jsExceptions Special
HiLink jsFutureKeys Special
HiLink jsBuiltins Special
HiLink jsModules Include
HiLink jsModuleWords Include
HiLink jsGlobalObjects Constant
HiLink jsGlobalNodeObjects Constant
HiLink jsExceptions Constant
HiLink jsBuiltins Constant
HiLink jsModuleKeywords Include
HiLink jsModuleOperators Include
HiLink jsModuleDefault Include
HiLink jsDecorator Special
HiLink jsFuncArgRestDots Noise
HiLink jsFuncArgDestructuring Noise
HiLink jsDecoratorFunction Special
HiLink jsFuncArgOperator jsFuncArgs
HiLink jsModuleAsterisk Noise
HiLink jsClassProperty jsObjectKey
HiLink jsSpreadOperator Operator
HiLink jsRestOperator Operator
HiLink jsRestExpression jsFuncArgs
HiLink jsSwitchColon Noise
HiLink jsClassMethodType Type
HiLink jsObjectMethodType Type
HiLink jsClassDefinition jsFuncName
HiLink jsDestructuringBraces Noise
HiLink jsDestructuringProperty jsFuncArgs
HiLink jsDestructuringAssignment jsObjectKey
HiLink jsDestructuringNoise Noise
HiLink jsCommentFunction jsComment
HiLink jsCommentClass jsComment
HiLink jsCommentMisc jsComment
HiLink jsDomErrNo Constant
HiLink jsDomNodeConsts Constant
@@ -324,14 +340,12 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsCssStyles Label
HiLink jsClassMethodDefinitions Type
delcommand HiLink
endif
" Define the htmlJavaScript for HTML syntax html.vim
syntax cluster htmlJavaScript contains=@jsAll,jsBracket,jsParen,jsBlock
syntax cluster javaScriptExpression contains=@jsAll,jsBracket,jsParen,jsBlock,@htmlPreproc
syntax cluster htmlJavaScript contains=@jsAll
syntax cluster javaScriptExpression contains=@jsAll
" Vim's default html.vim highlights all javascript as 'Special'
hi! def link javaScript NONE

View File

@@ -5,6 +5,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
" Last Change: 2014-12-20 Load ftplugin/json.vim
" Reload the definition of g:vim_json_syntax_conceal
" see https://github.com/elzr/vim-json/issues/42
runtime! ftplugin/json.vim
if !exists("main_syntax")
if version < 600
syntax clear
@@ -16,10 +20,16 @@ endif
syntax match jsonNoise /\%(:\|,\)/
" NOTE that for the concealing to work your conceallevel should be set to 2
" Syntax: Strings
" Separated into a match and region because a region by itself is always greedy
syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
if has('conceal') && g:vim_json_syntax_conceal == 1
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
else
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
endif
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
@@ -27,7 +37,11 @@ syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
" Syntax: JSON Keywords
" Separated into a match and region because a region by itself is always greedy
syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
if has('conceal') && g:vim_json_syntax_conceal == 1
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contains=jsonEscape contained
else
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained
endif
" Syntax: Escape sequences
syn match jsonEscape "\\["\\/bfnrt]" contained
@@ -37,6 +51,7 @@ syn match jsonEscape "\\u\x\{4}" contained
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
" ERROR WARNINGS **********************************************
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
" Syntax: Strings should always be enclosed with quotes.
syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
syn match jsonTripleQuotesError /"""/
@@ -62,6 +77,7 @@ syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
endif
" ********************************************** END OF ERROR WARNINGS
" Allowances for JSONP: function call at the beginning of the file,
@@ -87,12 +103,13 @@ if version >= 508 || !exists("did_json_syn_inits")
hi def link jsonString String
hi def link jsonTest Label
hi def link jsonEscape Special
hi def link jsonNumber Number
hi def link jsonNumber Delimiter
hi def link jsonBraces Delimiter
hi def link jsonNull Function
hi def link jsonBoolean Boolean
hi def link jsonBoolean Delimiter
hi def link jsonKeyword Label
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
hi def link jsonNumError Error
hi def link jsonCommentError Error
hi def link jsonSemicolonError Error
@@ -101,6 +118,7 @@ if version >= 508 || !exists("did_json_syn_inits")
hi def link jsonStringSQError Error
hi def link jsonNoQuotesError Error
hi def link jsonTripleQuotesError Error
endif
hi def link jsonQuote Quote
hi def link jsonNoise Noise
endif

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim syntax file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 24 February 2016
" Latest Revision: 4 July 2016
if exists("b:current_syntax")
finish
@@ -22,14 +22,14 @@ syn keyword ktInclude import package
syn keyword ktType Any Boolean Byte Char Double Float Int Long Nothing Short Unit
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic
syn keyword ktStructure class object interface fun val var constructor init
syn keyword ktStructure class object interface typealias fun val var constructor init
syn keyword ktReservedKeyword async typealias typeof yield
syn keyword ktReservedKeyword typeof
syn keyword ktBoolean true false
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 coroutine suspend
syn keyword ktTodo TODO FIXME XXX contained
syn match ktShebang "\v^#!.*$"

140
syntax/ls.vim Normal file
View File

@@ -0,0 +1,140 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
" Language: LiveScript "
" Maintainer: George Zahariev
" URL: http://github.com/gkz/vim-ls
" License: WTFPL
if exists('b:current_syntax') && b:current_syntax == 'livescript'
finish
endif
let b:current_syntax = "ls"
" Highlight long strings.
syntax sync minlines=100
setlocal iskeyword=48-57,A-Z,$,a-z,_,-
syntax match lsIdentifier /[$A-Za-z_]\k*\(-[a-zA-Z]\+\)*/
highlight default link lsIdentifier Identifier
" These are 'matches' rather than 'keywords' because vim's highlighting priority
" for keywords (the highest) causes them to be wrongly highlighted when used as
" dot-properties.
syntax match lsStatement /\<\%(return\|break\|continue\|throw\)\>/
highlight default link lsStatement Statement
syntax match lsRepeat /\<\%(for\%( own\| ever\)\?\|while\|until\)\>/
highlight default link lsRepeat Repeat
syntax match lsConditional /\<\%(if\|else\|unless\|switch\|case\|when\|default\|match\)\>/
highlight default link lsConditional Conditional
syntax match lsException /\<\%(try\|catch\|finally\)\>/
highlight default link lsException Exception
syntax match lsKeyword /\<\%(new\|in\%(stanceof\)\?\|typeof\|delete\|and\|o[fr]\|not\|xor\|is\|isnt\|imp\%(ort\%( all\)\?\|lements\)\|extends\|loop\|from\|to\|til\|by\|do\|then\|function\|class\|let\|with\|export\|const\|var\|eval\|super\|fallthrough\|debugger\|where\|yield\)\>/
highlight default link lsKeyword Keyword
syntax match lsBoolean /\<\%(true\|false\|yes\|no\|on\|off\|null\|void\)\>/
highlight default link lsBoolean Boolean
" Matches context variables.
syntax match lsContext /\<\%(this\|arguments\|it\|that\|constructor\|prototype\|superclass\)\>/
highlight default link lsContext Type
" Keywords reserved by the language
syntax cluster lsReserved contains=lsStatement,lsRepeat,lsConditional,
\ lsException,lsOperator,lsKeyword,lsBoolean
" Matches ECMAScript 5 built-in globals.
syntax match lsGlobal /\<\%(Array\|Boolean\|Date\|Function\|JSON\|Math\|Number\|Object\|RegExp\|String\|\%(Syntax\|Type\|URI\)\?Error\|is\%(NaN\|Finite\)\|parse\%(Int\|Float\)\|\%(en\|de\)codeURI\%(Component\)\?\)\>/
highlight default link lsGlobal Structure
syntax region lsString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=@lsInterpString
syntax region lsString start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=@lsSimpleString
highlight default link lsString String
" Matches decimal/floating-point numbers like 10.42e-8.
syntax match lsFloat
\ /\%(\<-\?\|-\)\zs\d[0-9_]*\%(\.\d[0-9_]*\)\?\%(e[+-]\?\d[0-9_]*\)\?\%([a-zA-Z$][$a-zA-Z0-9_]*\)\?/
\ contains=lsNumberComment
highlight default link lsFloat Float
syntax match lsNumberComment /\d\+\zs\%(e[+-]\?\d\)\@![a-zA-Z$][$a-zA-Z0-9_]*/ contained
highlight default link lsNumberComment Comment
" Matches hex numbers like 0xfff, 0x000.
syntax match lsNumber /\%(\<-\?\|-\)\zs0x\x\+/
" Matches N radix numbers like 2@1010.
syntax match lsNumber
\ /\%(\<-\?\|-\)\zs\%(\d*\)\~[0-9A-Za-z][0-9A-Za-z_]*/
highlight default link lsNumber Number
" Displays an error for reserved words.
syntax match lsReservedError /\<\%(enum\|interface\|package\|private\|protected\|public\|static\)\>/
highlight default link lsReservedError Error
syntax keyword lsTodo TODO FIXME XXX contained
highlight default link lsTodo Todo
syntax match lsComment /#.*/ contains=@Spell,lsTodo
syntax region lsComment start=/\/\*/ end=/\*\// contains=@Spell,lsTodo
highlight default link lsComment Comment
syntax region lsInfixFunc start=/`/ end=/`/
highlight default link lsInfixFunc Identifier
syntax region lsInterpolation matchgroup=lsInterpDelim
\ start=/\#{/ end=/}/
\ contained contains=TOP
highlight default link lsInterpDelim Delimiter
" Matches escape sequences like \000, \x00, \u0000, \n.
syntax match lsEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained
highlight default link lsEscape SpecialChar
syntax match lsVarInterpolation /#[$A-Za-z_]\k*\(-[a-zA-Z]\+\)*/ contained
highlight default link lsVarInterpolation Identifier
" What is in a non-interpolated string
syntax cluster lsSimpleString contains=@Spell,lsEscape
" What is in an interpolated string
syntax cluster lsInterpString contains=@lsSimpleString,
\ lsInterpolation,lsVarInterpolation
syntax region lsRegex start=/\%(\%()\|\i\@<!\d\)\s*\|\i\)\@<!\/\*\@!/
\ skip=/\[[^]]\{-}\/[^]]\{-}\]/
\ end=/\/[gimy$]\{,4}/
\ oneline contains=@lsSimpleString
syntax region lsHeregex start=/\/\// end=/\/\/[gimy$?]\{,4}/ contains=@lsInterpString,lsComment,lsSpaceError fold
highlight default link lsHeregex lsRegex
highlight default link lsRegex String
syntax region lsHeredoc start=/"""/ end=/"""/ contains=@lsInterpString fold
syntax region lsHeredoc start=/'''/ end=/'''/ contains=@lsSimpleString fold
highlight default link lsHeredoc String
syntax match lsWord /\\\S[^ \t\r,;)}\]]*/
highlight default link lsWord String
syntax region lsWords start=/<\[/ end=/\]>/ contains=fold
highlight default link lsWords String
" Reserved words can be used as property names.
syntax match lsProp /[$A-Za-z_]\k*[ \t]*:[:=]\@!/
highlight default link lsProp Label
syntax match lsKey
\ /\%(\.\@<!\.\%(=\?\s*\|\.\)\|[]})@?]\|::\)\zs\k\+/
\ transparent
\ contains=ALLBUT,lsNumberComment,lsIdentifier,lsContext,lsGlobal,lsReservedError,@lsReserved
" Displays an error for trailing whitespace.
syntax match lsSpaceError /\s\+$/ display
highlight default link lsSpaceError Error
if !exists('b:current_syntax')
let b:current_syntax = 'livescript'
endif
endif

216
syntax/lua.vim Normal file
View File

@@ -0,0 +1,216 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lua') == -1
" Vim syntax file
" Language: Lua
" URL: https://github.com/tbastos/vim-lua
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'lua'
endif
syntax sync fromstart
" Clusters
syntax cluster luaBase contains=luaComment,luaCommentLong,luaConstant,luaNumber,luaString,luaStringLong,luaBuiltIn
syntax cluster luaExpr contains=@luaBase,luaTable,luaParen,luaBracket,luaSpecialTable,luaSpecialValue,luaOperator,luaEllipsis,luaComma,luaFunc,luaFuncCall,luaError
syntax cluster luaStat contains=@luaExpr,luaIfThen,luaBlock,luaLoop,luaGoto,luaLabel,luaLocal,luaStatement,luaSemiCol
syntax match luaNoise /\%(\.\|,\|:\|\;\)/
" Symbols
syntax region luaTable transparent matchgroup=luaBraces start="{" end="}" contains=@luaExpr fold
syntax region luaParen transparent matchgroup=luaParens start='(' end=')' contains=@luaExpr
syntax region luaBracket transparent matchgroup=luaBrackets start="\[" end="\]" contains=@luaExpr
syntax match luaComma ","
syntax match luaSemiCol ";"
syntax match luaOperator "[#<>=~^&|*/%+-]\|\.\."
syntax match luaEllipsis "\.\.\."
" Catch errors caused by unbalanced brackets and keywords
syntax match luaError ")"
syntax match luaError "}"
syntax match luaError "\]"
syntax match luaError "\<\%(end\|else\|elseif\|then\|until\)\>"
" Shebang at the start
syntax match luaComment "\%^#!.*"
" Comments
syntax keyword luaCommentTodo contained TODO FIXME XXX TBD
syntax match luaComment "--.*$" contains=luaCommentTodo,luaDocTag,@Spell
syntax region luaCommentLong matchgroup=luaCommentLongTag start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaCommentTodo,luaDocTag,@Spell fold
syntax match luaDocTag contained "\s@\k\+"
" Function calls
syntax match luaFuncCall /\k\+\%(\s*[{('"]\)\@=/
" Functions
syntax region luaFunc transparent matchgroup=luaFuncKeyword start="\<function\>" end="\<end\>" contains=@luaStat,luaFuncSig fold
syntax region luaFuncSig contained transparent start="\(\<function\>\)\@<=" end=")" contains=luaFuncId,luaFuncArgs keepend
syntax match luaFuncId contained "[^(]*(\@=" contains=luaFuncTable,luaFuncName
syntax match luaFuncTable contained /\k\+\%(\s*[.:]\)\@=/
syntax match luaFuncName contained "[^(.:]*(\@="
syntax region luaFuncArgs contained transparent matchgroup=luaFuncParens start=/(/ end=/)/ contains=@luaBase,luaFuncArgName,luaFuncArgComma,luaEllipsis
syntax match luaFuncArgName contained /\k\+/
syntax match luaFuncArgComma contained /,/
" if ... then
syntax region luaIfThen transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=@luaExpr nextgroup=luaThenEnd skipwhite skipempty
" then ... end
syntax region luaThenEnd contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=@luaStat,luaElseifThen,luaElse fold
" elseif ... then
syntax region luaElseifThen contained transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=@luaExpr
" else
syntax keyword luaElse contained else
" do ... end
syntax region luaBlock transparent matchgroup=luaRepeat start="\<do\>" end="\<end\>" contains=@luaStat fold
" repeat ... until
syntax region luaLoop transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=@luaStat nextgroup=@luaExpr fold
" while ... do
syntax region luaLoop transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=@luaExpr nextgroup=luaBlock skipwhite skipempty fold
" for ... do and for ... in ... do
syntax region luaLoop transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=@luaExpr,luaIn nextgroup=luaBlock skipwhite skipempty
syntax keyword luaIn contained in
" goto and labels
syntax keyword luaGoto goto nextgroup=luaGotoLabel skipwhite
syntax match luaGotoLabel "\k\+" contained
syntax match luaLabel "::\k\+::"
" Other Keywords
syntax keyword luaConstant nil true false
syntax keyword luaBuiltIn _ENV self
syntax keyword luaLocal local
syntax keyword luaOperator and or not
syntax keyword luaStatement break return
" Strings
syntax match luaStringSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}#
syntax region luaStringLong matchgroup=luaStringLongTag start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell
syntax region luaString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaStringSpecial,@Spell
syntax region luaString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaStringSpecial,@Spell
" Decimal constant
syntax match luaNumber "\<\d\+\>"
" Hex constant
syntax match luaNumber "\<0[xX][[:xdigit:].]\+\%([pP][-+]\=\d\+\)\=\>"
" Floating point constant, with dot, optional exponent
syntax match luaFloat "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=\>"
" Floating point constant, starting with a dot, optional exponent
syntax match luaFloat "\.\d\+\%([eE][-+]\=\d\+\)\=\>"
" Floating point constant, without dot, with exponent
syntax match luaFloat "\<\d\+[eE][-+]\=\d\+\>"
" Special names from the Standard Library
syntax keyword luaSpecialTable
\ bit32
\ coroutine
\ debug
\ io
\ math
\ os
\ package
\ string
\ table
\ utf8
syntax keyword luaSpecialValue
\ _G
\ _VERSION
\ assert
\ collectgarbage
\ dofile
\ error
\ getfenv
\ getmetatable
\ ipairs
\ load
\ loadfile
\ loadstring
\ module
\ next
\ pairs
\ pcall
\ print
\ rawequal
\ rawget
\ rawlen
\ rawset
\ require
\ select
\ setfenv
\ setmetatable
\ tonumber
\ tostring
\ type
\ unpack
\ xpcall
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_lua_syn_inits")
if version < 508
let did_lua_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink luaParens Noise
HiLink luaBraces Structure
HiLink luaBrackets Noise
HiLink luaBuiltIn Special
HiLink luaComment Comment
HiLink luaCommentLong luaComment
HiLink luaCommentTodo Todo
HiLink luaCond Conditional
HiLink luaConstant Boolean
HiLink luaDocTag Underlined
HiLink luaEllipsis StorageClass
HiLink luaElse Conditional
HiLink luaError Error
HiLink luaFloat Float
HiLink luaFuncTable Function
HiLink luaFuncArgName Noise
HiLink luaFuncCall PreProc
HiLink luaFuncId Function
HiLink luaFuncKeyword Type
HiLink luaFuncName Function
HiLink luaFuncParens Noise
HiLink luaGoto luaStatement
HiLink luaGotoLabel Noise
HiLink luaIn Repeat
HiLink luaLabel Label
HiLink luaLocal Type
HiLink luaNumber Number
HiLink luaOperator Operator
HiLink luaRepeat Repeat
HiLink luaSemiCol Delimiter
HiLink luaSpecialTable Special
HiLink luaSpecialValue PreProc
HiLink luaStatement Statement
HiLink luaString String
HiLink luaStringLong luaString
HiLink luaStringSpecial SpecialChar
delcommand HiLink
end
let b:current_syntax = "lua"
if main_syntax == 'lua'
unlet main_syntax
endif
endif

96
syntax/mako.vim Normal file
View File

@@ -0,0 +1,96 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
" Vim syntax file
" Language: Mako
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
" URL: http://lucumr.pocoo.org/
" Last Change: 2013-05-01
" Version: 0.6.1+
"
" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
" delimiter handling.
"
" Known Limitations
" the <%text> block does not have correct attributes
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = "html"
endif
"Source the html syntax file
ru! syntax/html.vim
unlet b:current_syntax
" tell html.vim what syntax groups should take precedence (see :help html.vim)
syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
"Put the python syntax file in @pythonTop
syn include @pythonTop syntax/python.vim
" End keywords
syn keyword makoEnd contained endfor endwhile endif endtry enddef
" Block rules
syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
" Variables
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
" Comments
syn region makoComment start="^\s*##" end="$"
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
" Literal Blocks
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
" Attribute Sublexing
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
" Tags
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)\>" end="/\?>"
syn match makoDelim "</%\(def\|call\|namespace\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)>"
syn region makoJavaScript matchgroup=makoDelim start=+<%block .*js.*>+ keepend end=+</%block>+ contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc,makoLine,makoBlock,makoVariable
syn region makoCssStyle matchgroup=makoDelim start=+<%block .*css.*>+ keepend end=+</%block>+ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc,makoLine,makoBlock,makoVariable
" Newline Escapes
syn match makoEscape /\\$/
" Default highlighting links
if version >= 508 || !exists("did_mako_syn_inits")
if version < 508
let did_mako_syn_inits = 1
com -nargs=+ HiLink hi link <args>
else
com -nargs=+ HiLink hi def link <args>
endif
HiLink makoDocComment makoComment
HiLink makoDefEnd makoDelim
HiLink makoAttributeKey Type
HiLink makoAttributeValue String
HiLink makoText Normal
HiLink makoDelim Preproc
HiLink makoEnd Keyword
HiLink makoComment Comment
HiLink makoEscape Special
delc HiLink
endif
let b:current_syntax = "html"
endif

View File

@@ -2,160 +2,175 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -
" Vim syntax file
" Language: Markdown
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.markdown
" Last Change: 2013 May 30
" Maintainer: Ben Williams <benw@plasticboy.com>
" URL: http://plasticboy.com/markdown-vim-mode/
" Remark: Uses HTML syntax file
" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
if exists("b:current_syntax")
" Read the HTML syntax to start with
if version < 600
so <sfile>:p:h/html.vim
else
runtime! syntax/html.vim
if exists('b:current_syntax')
unlet b:current_syntax
endif
endif
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if !exists('main_syntax')
let main_syntax = 'markdown'
" don't use standard HiLink, it will not work with included syntax files
if version < 508
command! -nargs=+ HtmlHiLink hi link <args>
else
command! -nargs=+ HtmlHiLink hi def link <args>
endif
runtime! syntax/html.vim
unlet! b:current_syntax
if !exists('g:markdown_fenced_languages')
let g:markdown_fenced_languages = []
endif
let s:done_include = {}
for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")')
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
continue
endif
if s:type =~ '\.'
let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*')
endif
exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim'
unlet! b:current_syntax
let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
unlet! s:done_include
syn sync minlines=10
syn spell toplevel
syn case ignore
syn sync linebreaks=1
syn match markdownValid '[<>]\c[a-z/$!]\@!'
syn match markdownValid '&\%(#\=\w*;\)\@!'
syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock,htmlSpecialChar
syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule
syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError
syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink
syn match markdownHeadingRule "^[=-]\+$" contained
syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline,markdownAutomaticLink contained
syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
syn region markdownCodeBlock start=" \|\t" end="$" contained
" TODO: real nesting
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained
syn match markdownRule "\* *\* *\*[ *]*$" contained
syn match markdownRule "- *- *-[ -]*$" contained
syn match markdownLineBreak " \{2,\}$"
syn region markdownIdDeclaration matchgroup=markdownLinkDelimiter start="^ \{0,3\}!\=\[" end="\]:" oneline keepend nextgroup=markdownUrl skipwhite
syn match markdownUrl "\S\+" nextgroup=markdownUrlTitle skipwhite contained
syn region markdownUrl matchgroup=markdownUrlDelimiter start="<" end=">" oneline keepend nextgroup=markdownUrlTitle skipwhite contained
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+"+ keepend contained
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
let s:concealends = has('conceal') ? ' concealends' : ''
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend
syn match markdownFootnote "\[^[^\]]\+\]"
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
if main_syntax ==# 'markdown'
let s:done_include = {}
for s:type in g:markdown_fenced_languages
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
continue
endif
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
let s:done_include[matchstr(s:type,'[^.]*')] = 1
endfor
unlet! s:type
unlet! s:done_include
let s:conceal = ''
let s:concealends = ''
if has('conceal') && get(g:, 'vim_markdown_conceal', 1)
let s:conceal = ' conceal'
let s:concealends = ' concealends'
endif
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
syn match markdownError "\w\@<=_\w\@="
" additions to HTML groups
if get(g:, 'vim_markdown_emphasis_multiline', 1)
let s:oneline = ''
else
let s:oneline = ' oneline'
endif
execute 'syn region htmlItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline
execute 'syn region htmlItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend' . s:oneline
execute 'syn region htmlBold start="\%(^\|\s\)\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline
execute 'syn region htmlBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend' . s:oneline
execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline
execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend' . s:oneline
hi def link markdownH1 htmlH1
hi def link markdownH2 htmlH2
hi def link markdownH3 htmlH3
hi def link markdownH4 htmlH4
hi def link markdownH5 htmlH5
hi def link markdownH6 htmlH6
hi def link markdownHeadingRule markdownRule
hi def link markdownHeadingDelimiter Delimiter
hi def link markdownOrderedListMarker markdownListMarker
hi def link markdownListMarker htmlTagName
hi def link markdownBlockquote Comment
hi def link markdownRule PreProc
" [link](URL) | [link][id] | [link][] | ![image](URL)
syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]"
execute 'syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained oneline' . s:conceal
execute 'syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained oneline' . s:conceal
execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[" end="\n\{-,1}[^]]\{-}\zs\]\ze[[(]" contains=@mkdNonListItem,@Spell nextgroup=mkdURL,mkdID skipwhite oneline' . s:concealends
hi def link markdownFootnote Typedef
hi def link markdownFootnoteDefinition Typedef
" Autolink without angle brackets.
" mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
" ------------ _____________________ ----------------------------- _________________________ ----------------- __
syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
hi def link markdownLinkText htmlLink
hi def link markdownIdDeclaration Typedef
hi def link markdownId Type
hi def link markdownAutomaticLink markdownUrl
hi def link markdownUrl Float
hi def link markdownUrlTitle String
hi def link markdownIdDelimiter markdownLinkDelimiter
hi def link markdownUrlDelimiter htmlTag
hi def link markdownUrlTitleDelimiter Delimiter
" Autolink with parenthesis.
syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*)\)\@=" end=")"
hi def link markdownItalic htmlItalic
hi def link markdownItalicDelimiter markdownItalic
hi def link markdownBold htmlBold
hi def link markdownBoldDelimiter markdownBold
hi def link markdownBoldItalic htmlBoldItalic
hi def link markdownBoldItalicDelimiter markdownBoldItalic
hi def link markdownCodeDelimiter Delimiter
" Autolink with angle brackets.
syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@<!<\ze[a-z][a-z0-9,.-]\{1,22}:\/\/[^> ]*>" end=">"
hi def link markdownEscape Special
hi def link markdownError Error
" Link definitions: [id]: URL (Optional Title)
syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
let b:current_syntax = "markdown"
if main_syntax ==# 'markdown'
unlet main_syntax
"HTML headings
syn region htmlH1 start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn region htmlH2 start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn region htmlH3 start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn region htmlH4 start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn region htmlH5 start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn region htmlH6 start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell
syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell
syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
"define Markdown groups
syn match mkdLineBreak / \+$/
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
syn region mkdCode start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/\(\([^\\]\|^\)\\\)\@<!`/
syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
syn region mkdCode start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/
syn region mkdCode start=/\s*\~\~[^\~]*/ end=/[^\~]*\~\~\s*/
syn region mkdCode start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/
syn region mkdCode start="<pre[^>]*\\\@<!>" end="</pre>"
syn region mkdCode start="<code[^>]*\\\@<!>" end="</code>"
syn region mkdFootnote start="\[^" end="\]"
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained
syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\s\+/ contained
syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
syn match mkdRule /^\s*-\{3,}$/
syn match mkdRule /^\s*\*\{3,5}$/
" YAML frontmatter
if get(g:, 'vim_markdown_frontmatter', 0)
syn include @yamlTop syntax/yaml.vim
syn region Comment matchgroup=mkdDelimiter start="\%^---$" end="^---$" contains=@yamlTop keepend
unlet! b:current_syntax
endif
" vim:set sw=2:
if get(g:, 'vim_markdown_toml_frontmatter', 0)
try
syn include @tomlTop syntax/toml.vim
syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$" transparent contains=@tomlTop keepend
unlet! b:current_syntax
catch /E484/
syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$"
endtry
endif
if get(g:, 'vim_markdown_json_frontmatter', 0)
try
syn include @jsonTop syntax/json.vim
syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$" contains=@jsonTop keepend
unlet! b:current_syntax
catch /E484/
syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$"
endtry
endif
if get(g:, 'vim_markdown_math', 0)
syn include @tex syntax/tex.vim
syn region mkdMath start="\\\@<!\$" end="\$" contains=@tex keepend
syn region mkdMath start="\\\@<!\$\$" end="\$\$" contains=@tex keepend
endif
syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath
"highlighting for Markdown groups
HtmlHiLink mkdString String
HtmlHiLink mkdCode String
HtmlHiLink mkdCodeStart String
HtmlHiLink mkdCodeEnd String
HtmlHiLink mkdFootnote Comment
HtmlHiLink mkdBlockquote Comment
HtmlHiLink mkdListItem Identifier
HtmlHiLink mkdRule Identifier
HtmlHiLink mkdLineBreak Visual
HtmlHiLink mkdFootnotes htmlLink
HtmlHiLink mkdLink htmlLink
HtmlHiLink mkdURL htmlString
HtmlHiLink mkdInlineURL htmlLink
HtmlHiLink mkdID Identifier
HtmlHiLink mkdLinkDef mkdID
HtmlHiLink mkdLinkDefTarget mkdURL
HtmlHiLink mkdLinkTitle htmlString
HtmlHiLink mkdDelimiter Delimiter
let b:current_syntax = "mkd"
delcommand HtmlHiLink
" vim: ts=8
endif

View File

@@ -12,28 +12,32 @@ setlocal iskeyword+=/
setlocal iskeyword+=:
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
syn match ngxComment ' *#.*$'
syn match ngxRewriteURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxURI skipwhite
syn match ngxURI /\S\+/ contained contains=ngxVariableString skipwhite
syn match ngxLocationPath /[^ {]\+/ contained
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
syn keyword ngxBoolean on
syn keyword ngxBoolean off
syn keyword ngxDirectiveBlock http contained
syn keyword ngxDirectiveBlock mail contained
syn keyword ngxDirectiveBlock events contained
syn keyword ngxDirectiveBlock server contained
syn keyword ngxDirectiveBlock types contained
syn keyword ngxDirectiveBlock location contained
syn keyword ngxDirectiveBlock upstream contained
syn keyword ngxDirectiveBlock charset_map contained
syn keyword ngxDirectiveBlock limit_except contained
syn keyword ngxDirectiveBlock if contained
syn keyword ngxDirectiveBlock geo contained
syn keyword ngxDirectiveBlock map contained
syn keyword ngxDirectiveBlock split_clients contained
syn keyword ngxDirectiveBlock http
syn keyword ngxDirectiveBlock mail
syn keyword ngxDirectiveBlock events
syn keyword ngxDirectiveBlock server
syn keyword ngxDirectiveBlock types
syn match ngxLocationOperator /\(=\|\~\*\|\^\~\|\~\)/ contained nextgroup=ngxLocationPath,ngxString skipwhite
syn match ngxLocationNamedLoc /@\w\+/
syn keyword ngxDirectiveBlock location nextgroup=ngxLocationNamedLoc,ngxLocationOperator,ngxLocationPath,ngxString skipwhite
syn keyword ngxDirectiveBlock upstream
syn keyword ngxDirectiveBlock charset_map
syn keyword ngxDirectiveBlock limit_except
syn keyword ngxDirectiveBlock if
syn keyword ngxDirectiveBlock geo
syn keyword ngxDirectiveBlock map
syn keyword ngxDirectiveBlock split_clients
syn keyword ngxDirectiveImportant include
syn keyword ngxDirectiveImportant root
@@ -50,16 +54,17 @@ syn keyword ngxDirectiveImportant try_files
syn keyword ngxDirectiveControl break
syn keyword ngxDirectiveControl return
syn keyword ngxDirectiveControl rewrite
syn keyword ngxDirectiveControl rewrite nextgroup=ngxRewriteURI skipwhite
syn keyword ngxDirectiveControl set
syn keyword ngxRewriteFlag last break redirect permanent
syn keyword ngxDirectiveError error_page
syn keyword ngxDirectiveError post_action
syn keyword ngxDirectiveDeprecated connections
syn keyword ngxDirectiveDeprecated imap
syn keyword ngxDirectiveDeprecated limit_zone
syn keyword ngxDirectiveDeprecated mysql_test
syn keyword ngxDirectiveDeprecated open_file_cache_retest
syn keyword ngxDirectiveDeprecated optimize_server_names
syn keyword ngxDirectiveDeprecated satisfy_any
@@ -131,10 +136,12 @@ syn keyword ngxDirective fastcgi_cache
syn keyword ngxDirective fastcgi_cache_bypass
syn keyword ngxDirective fastcgi_cache_key
syn keyword ngxDirective fastcgi_cache_lock
syn keyword ngxDirective fastcgi_cache_lock_age
syn keyword ngxDirective fastcgi_cache_lock_timeout
syn keyword ngxDirective fastcgi_cache_methods
syn keyword ngxDirective fastcgi_cache_min_uses
syn keyword ngxDirective fastcgi_cache_path
syn keyword ngxDirective fastcgi_cache_purge
syn keyword ngxDirective fastcgi_cache_revalidate
syn keyword ngxDirective fastcgi_cache_use_stale
syn keyword ngxDirective fastcgi_cache_valid
@@ -147,6 +154,7 @@ syn keyword ngxDirective fastcgi_ignore_headers
syn keyword ngxDirective fastcgi_index
syn keyword ngxDirective fastcgi_intercept_errors
syn keyword ngxDirective fastcgi_keep_conn
syn keyword ngxDirective fastcgi_limit_rate
syn keyword ngxDirective fastcgi_max_temp_file_size
syn keyword ngxDirective fastcgi_next_upstream
syn keyword ngxDirective fastcgi_next_upstream_timeout
@@ -157,6 +165,7 @@ syn keyword ngxDirective fastcgi_pass_header
syn keyword ngxDirective fastcgi_pass_request_body
syn keyword ngxDirective fastcgi_pass_request_headers
syn keyword ngxDirective fastcgi_read_timeout
syn keyword ngxDirective fastcgi_request_buffering
syn keyword ngxDirective fastcgi_send_lowat
syn keyword ngxDirective fastcgi_send_timeout
syn keyword ngxDirective fastcgi_split_path_info
@@ -187,6 +196,7 @@ syn keyword ngxDirective gzip_types
syn keyword ngxDirective gzip_vary
syn keyword ngxDirective gzip_window
syn keyword ngxDirective hash
syn keyword ngxDirective http2 " Not a real directive
syn keyword ngxDirective if_modified_since
syn keyword ngxDirective ignore_invalid_headers
syn keyword ngxDirective image_filter
@@ -201,6 +211,8 @@ syn keyword ngxDirective imap_client_buffer
syn keyword ngxDirective index
syn keyword ngxDirective iocp_threads
syn keyword ngxDirective ip_hash
syn keyword ngxDirective js_run
syn keyword ngxDirective js_set
syn keyword ngxDirective keepalive
syn keyword ngxDirective keepalive_disable
syn keyword ngxDirective keepalive_requests
@@ -246,9 +258,12 @@ syn keyword ngxDirective modern_browser_value
syn keyword ngxDirective mp4
syn keyword ngxDirective mp4_buffer_size
syn keyword ngxDirective mp4_max_buffer_size
syn keyword ngxDirective mp4_limit_rate
syn keyword ngxDirective mp4_limit_rate_after
syn keyword ngxDirective msie_padding
syn keyword ngxDirective msie_refresh
syn keyword ngxDirective multi_accept
syn keyword ngxDirective mysql_test
syn keyword ngxDirective open_file_cache
syn keyword ngxDirective open_file_cache_errors
syn keyword ngxDirective open_file_cache_events
@@ -269,7 +284,8 @@ syn keyword ngxDirective port_in_redirect
syn keyword ngxDirective post_acceptex
syn keyword ngxDirective postpone_gzipping
syn keyword ngxDirective postpone_output
syn keyword ngxDirective protocol
syn keyword ngxDirective protocol nextgroup=ngxMailProtocol skipwhite
syn keyword ngxMailProtocol imap pop3 smtp
syn keyword ngxDirective proxy
syn keyword ngxDirective proxy_bind
syn keyword ngxDirective proxy_buffer
@@ -473,6 +489,7 @@ syn keyword ngxDirective uwsgi_cache
syn keyword ngxDirective uwsgi_cache_bypass
syn keyword ngxDirective uwsgi_cache_key
syn keyword ngxDirective uwsgi_cache_lock
syn keyword ngxDirective uwsgi_cache_lock_age
syn keyword ngxDirective uwsgi_cache_lock_timeout
syn keyword ngxDirective uwsgi_cache_methods
syn keyword ngxDirective uwsgi_cache_min_uses
@@ -494,14 +511,19 @@ syn keyword ngxDirective uwsgi_next_upstream_timeout
syn keyword ngxDirective uwsgi_next_upstream_tries
syn keyword ngxDirective uwsgi_no_cache
syn keyword ngxDirective uwsgi_param
syn keyword ngxDirective uwsgi_pass
syn keyword ngxDirective uwsgi_pass_header
syn keyword ngxDirective uwsgi_pass_request_body
syn keyword ngxDirective uwsgi_pass_request_headers
syn keyword ngxDirective uwsgi_read_timeout
syn keyword ngxDirective uwsgi_request_buffering
syn keyword ngxDirective uwsgi_send_timeout
syn keyword ngxDirective uwsgi_ssl_certificate
syn keyword ngxDirective uwsgi_ssl_certificate_key
syn keyword ngxDirective uwsgi_ssl_ciphers
syn keyword ngxDirective uwsgi_ssl_crl
syn keyword ngxDirective uwsgi_ssl_name
syn keyword ngxDirective uwsgi_ssl_password_file
syn keyword ngxDirective uwsgi_ssl_protocols
syn keyword ngxDirective uwsgi_ssl_server_name
syn keyword ngxDirective uwsgi_ssl_session_reuse
@@ -553,6 +575,16 @@ syn keyword ngxDirectiveThirdParty accesskey_signature
syn keyword ngxDirectiveThirdParty auth_pam
syn keyword ngxDirectiveThirdParty auth_pam_service_name
" Brotli Module <https://github.com/google/ngx_brotli>
" Nginx module for Brotli compression
syn keyword ngxDirectiveThirdParty brotli_static
syn keyword ngxDirectiveThirdParty brotli
syn keyword ngxDirectiveThirdParty brotli_types
syn keyword ngxDirectiveThirdParty brotli_buffers
syn keyword ngxDirectiveThirdParty brotli_comp_level
syn keyword ngxDirectiveThirdParty brotli_window
syn keyword ngxDirectiveThirdParty brotli_min_length
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
" Module adding ability to purge content from FastCGI and proxy caches.
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
@@ -606,7 +638,7 @@ syn keyword ngxDirectiveThirdParty echo_subrequest
syn keyword ngxDirectiveThirdParty echo_subrequest_async
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
" Provides options for start/stop events.
" Privides options for start/stop events.
syn keyword ngxDirectiveThirdParty on_start
syn keyword ngxDirectiveThirdParty on_stop
@@ -671,6 +703,70 @@ syn keyword ngxDirectiveThirdParty js_utf8
syn keyword ngxDirectiveThirdParty log_request_speed_filter
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
" Lua Module <https://github.com/openresty/lua-nginx-module>
" Embed the Power of Lua into NGINX HTTP servers
syn keyword ngxDirectiveThirdParty lua_use_default_type
syn keyword ngxDirectiveThirdParty lua_code_cache
syn keyword ngxDirectiveThirdParty lua_regex_cache_max_entries
syn keyword ngxDirectiveThirdParty lua_regex_match_limit
syn keyword ngxDirectiveThirdParty lua_package_path
syn keyword ngxDirectiveThirdParty lua_package_cpath
syn keyword ngxDirectiveThirdParty init_by_lua
syn keyword ngxDirectiveThirdParty init_by_lua_block
syn keyword ngxDirectiveThirdParty init_by_lua_file
syn keyword ngxDirectiveThirdParty init_worker_by_lua
syn keyword ngxDirectiveThirdParty init_worker_by_lua_block
syn keyword ngxDirectiveThirdParty init_worker_by_lua_file
syn keyword ngxDirectiveThirdParty set_by_lua
syn keyword ngxDirectiveThirdParty set_by_lua_block
syn keyword ngxDirectiveThirdParty set_by_lua_file
syn keyword ngxDirectiveThirdParty content_by_lua
syn keyword ngxDirectiveThirdParty content_by_lua_block
syn keyword ngxDirectiveThirdParty content_by_lua_file
syn keyword ngxDirectiveThirdParty rewrite_by_lua
syn keyword ngxDirectiveThirdParty rewrite_by_lua_block
syn keyword ngxDirectiveThirdParty rewrite_by_lua_file
syn keyword ngxDirectiveThirdParty access_by_lua
syn keyword ngxDirectiveThirdParty access_by_lua_block
syn keyword ngxDirectiveThirdParty access_by_lua_file
syn keyword ngxDirectiveThirdParty header_filter_by_lua
syn keyword ngxDirectiveThirdParty header_filter_by_lua_block
syn keyword ngxDirectiveThirdParty header_filter_by_lua_file
syn keyword ngxDirectiveThirdParty body_filter_by_lua
syn keyword ngxDirectiveThirdParty body_filter_by_lua_block
syn keyword ngxDirectiveThirdParty body_filter_by_lua_file
syn keyword ngxDirectiveThirdParty log_by_lua
syn keyword ngxDirectiveThirdParty log_by_lua_block
syn keyword ngxDirectiveThirdParty log_by_lua_file
syn keyword ngxDirectiveThirdParty balancer_by_lua_block
syn keyword ngxDirectiveThirdParty balancer_by_lua_file
syn keyword ngxDirectiveThirdParty lua_need_request_body
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_block
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_file
syn keyword ngxDirectiveThirdParty lua_shared_dict
syn keyword ngxDirectiveThirdParty lua_socket_connect_timeout
syn keyword ngxDirectiveThirdParty lua_socket_send_timeout
syn keyword ngxDirectiveThirdParty lua_socket_send_lowat
syn keyword ngxDirectiveThirdParty lua_socket_read_timeout
syn keyword ngxDirectiveThirdParty lua_socket_buffer_size
syn keyword ngxDirectiveThirdParty lua_socket_pool_size
syn keyword ngxDirectiveThirdParty lua_socket_keepalive_timeout
syn keyword ngxDirectiveThirdParty lua_socket_log_errors
syn keyword ngxDirectiveThirdParty lua_ssl_ciphers
syn keyword ngxDirectiveThirdParty lua_ssl_crl
syn keyword ngxDirectiveThirdParty lua_ssl_protocols
syn keyword ngxDirectiveThirdParty lua_ssl_trusted_certificate
syn keyword ngxDirectiveThirdParty lua_ssl_verify_depth
syn keyword ngxDirectiveThirdParty lua_http10_buffering
syn keyword ngxDirectiveThirdParty rewrite_by_lua_no_postpone
syn keyword ngxDirectiveThirdParty access_by_lua_no_postpone
syn keyword ngxDirectiveThirdParty lua_transform_underscores_in_response_headers
syn keyword ngxDirectiveThirdParty lua_check_client_abort
syn keyword ngxDirectiveThirdParty lua_max_pending_timers
syn keyword ngxDirectiveThirdParty lua_max_running_timers
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
syn keyword ngxDirectiveThirdParty memc_buffer_size
@@ -821,12 +917,13 @@ syn keyword ngxDirectiveThirdParty xss_output_type
hi link ngxComment Comment
hi link ngxVariable Identifier
hi link ngxVariableBlock Identifier
hi link ngxVariableString PreProc
hi link ngxBlock Normal
hi link ngxString String
hi link ngxLocationPath String
hi link ngxLocationNamedLoc Identifier
hi link ngxBoolean Boolean
hi link ngxRewriteFlag Boolean
hi link ngxDirectiveBlock Statement
hi link ngxDirectiveImportant Type
hi link ngxDirectiveControl Keyword

View File

@@ -21,25 +21,29 @@ endif
if !exists("nim_highlight_space_errors")
let nim_highlight_space_errors = 1
endif
if !exists("nim_highlight_special_vars")
let nim_highlight_special_vars = 1
endif
if exists("nim_highlight_all")
let nim_highlight_numbers = 1
let nim_highlight_builtins = 1
let nim_highlight_exceptions = 1
let nim_highlight_space_errors = 1
let nim_highlight_special_vars = 1
endif
syn region nimBrackets contained extend keepend matchgroup=Bold start=+\(\\\)\@<!\[+ end=+]\|$+ skip=+\\\s*$\|\(\\\)\@<!\\]+ contains=@tclCommandCluster
syn keyword nimKeyword addr and as asm atomic
syn keyword nimKeyword bind block break
syn keyword nimKeyword case cast const continue converter
syn keyword nimKeyword discard distinct div do
syn keyword nimKeyword case cast concept const continue converter
syn keyword nimKeyword defer discard distinct div do
syn keyword nimKeyword elif else end enum except export
syn keyword nimKeyword finally for from
syn keyword nimKeyword finally for from func
syn keyword nimKeyword generic
syn keyword nimKeyword if import in include interface is isnot iterator
syn keyword nimKeyword lambda let
syn keyword nimKeyword let
syn keyword nimKeyword mixin using mod
syn keyword nimKeyword nil not notin
syn keyword nimKeyword object of or out
@@ -59,6 +63,7 @@ syn keyword nimRepeat for while
syn keyword nimConditional if elif else case of
syn keyword nimOperator and in is not or xor shl shr div
syn match nimComment "#.*$" contains=nimTodo,@Spell
syn region nimComment start="#\[" end="\]#" contains=nimTodo,@Spell
syn keyword nimTodo TODO FIXME XXX contained
syn keyword nimBoolean true false
@@ -89,11 +94,9 @@ if nim_highlight_builtins == 1
" builtin functions, types and objects, not really part of the syntax
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool
syn keyword nimBuiltin char string cstring pointer range array openarray seq
syn keyword nimBuiltin set Byte Natural Positive TObject PObject Conversion TResult TAddress
syn keyword nimBuiltin set Byte Natural Positive Conversion
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
syn keyword nimBuiltin cstringArray TEndian PFloat32 PFloat64 PInt64 PInt32
syn keyword nimBuiltin TGC_Strategy TFile TFileMode TFileHandle isMainModule
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
@@ -107,7 +110,7 @@ if nim_highlight_builtins == 1
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAnd Sweep
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
@@ -115,6 +118,7 @@ if nim_highlight_builtins == 1
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
syn keyword nimBuiltin fileHandle countdown countup items lines
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
endif
if nim_highlight_exceptions == 1
@@ -139,6 +143,10 @@ if nim_highlight_space_errors == 1
syn match nimSpaceError display "\t"
endif
if nim_highlight_special_vars
syn keyword nimSpecialVar result
endif
syn sync match nimSync grouphere NONE "):$"
syn sync maxlines=200
syn sync minlines=2000
@@ -166,6 +174,7 @@ if version >= 508 || !exists("did_nim_syn_inits")
HiLink nimComment Comment
HiLink nimTodo Todo
HiLink nimDecorator Define
HiLink nimSpecialVar Identifier
if nim_highlight_numbers == 1
HiLink nimNumber Number

File diff suppressed because it is too large Load Diff

View File

@@ -127,6 +127,7 @@ syn match pgsqlKeyword "\<for\_s\+\(search\|order\_s\+by\)\>"
syn match pgsqlKeyword "\<\(no\_s\+\)\?inherit\>"
syn match pgsqlKeyword "\<\(not\_s\+\)\?of\>"
syn match pgsqlKeyword "\<primary\_s\+key\>"
syn match pgsqlKeyword "\<foreign\_s\+key\>"
syn match pgsqlKeyword "\<replica\_s\+identity\>"
syn match pgsqlKeyword "\<using\(\_s\+index\(\_s\+tablespace\)\?\)\?\>"
syn match pgsqlKeyword "\<with\(out\)\?\_s\+function\>"

Some files were not shown because too many files have changed in this diff Show More