mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0823d2068 | ||
|
|
b4a6290b42 | ||
|
|
c324a086b2 | ||
|
|
2bde381723 | ||
|
|
61390f5885 | ||
|
|
f8a0fb37bf | ||
|
|
13fe6ad758 | ||
|
|
78427e4c22 | ||
|
|
829ab22723 | ||
|
|
a8d08c8a49 | ||
|
|
7679a92627 | ||
|
|
ad44c4f7a3 | ||
|
|
3c56c1c7cd | ||
|
|
d4e83d706f | ||
|
|
c47dc02849 | ||
|
|
841cb535df | ||
|
|
e5b26a7308 | ||
|
|
b4b054ebf5 | ||
|
|
08ea94e011 | ||
|
|
ba7a783c7f | ||
|
|
f58692a641 | ||
|
|
0dc7696c89 | ||
|
|
5658b62b7a | ||
|
|
938a2f1667 | ||
|
|
303b3f1b43 | ||
|
|
bf84973173 | ||
|
|
89728a486d | ||
|
|
ae3a0d72cc | ||
|
|
3475a2df67 | ||
|
|
ac42e00864 | ||
|
|
0293cf8346 | ||
|
|
8c139a4546 | ||
|
|
47a036761a | ||
|
|
d2c90dad0a | ||
|
|
7ac92eac0f | ||
|
|
7800dae776 | ||
|
|
a39c9013cc | ||
|
|
25d2786cae | ||
|
|
1f1e821192 | ||
|
|
ae882e85f8 | ||
|
|
aec5e42bdb | ||
|
|
a0c79360ed | ||
|
|
2d3b20bc68 | ||
|
|
a6b0efd530 | ||
|
|
0de043adbc | ||
|
|
67fcbd2a86 | ||
|
|
c925c92217 | ||
|
|
852d25b307 | ||
|
|
4d8ff4eabc |
@@ -1,7 +1,11 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.9.3
|
||||
before_install: sudo apt-get install vim-gtk
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- vim-gtk
|
||||
before_script:
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
|
||||
68
README.md
68
README.md
@@ -8,7 +8,7 @@ A collection of language packs for Vim.
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs 50+ times faster** than 50+ packages it consist of.
|
||||
- It **installs and updates 70+ times faster** than 70+ packages it consist of.
|
||||
- Solid syntax and indentation support. Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||
@@ -18,79 +18,93 @@ A collection of language packs for Vim.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install pathogen, Vundle or NeoBundle package manager.
|
||||
1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim.
|
||||
2. Use this repository as submodule or package.
|
||||
|
||||
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
||||
|
||||
## Language packs
|
||||
|
||||
- [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/xsbeats/vim-blade) (syntax, indent, ftdetect)
|
||||
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect)
|
||||
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
||||
- [c/c++](https://github.com/vim-jp/cpp-vim) (syntax)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin)
|
||||
- [cql](https://github.com/elubow/cql-vim) (syntax, ftdetect)
|
||||
- [css](https://github.com/JulesWang/css.vim) (syntax)
|
||||
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin, ftdetect)
|
||||
- [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)
|
||||
- [erlang](https://github.com/hcs42/vim-erlang-runtime) (syntax, indent)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent, ftdetect)
|
||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
|
||||
- [go](https://github.com/fatih/vim-go) (syntax, indent, ftdetect)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent, ftdetect)
|
||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent, ftdetect)
|
||||
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
||||
- [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, ftplugin, ftdetect)
|
||||
- [haskell](https://github.com/raichoo/haskell-vim) (syntax, indent, ftplugin, ftdetect)
|
||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin, ftdetect)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin, ftdetect)
|
||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
|
||||
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
||||
- [jade](https://github.com/digitaltoad/vim-jade) (syntax, indent, ftplugin, ftdetect)
|
||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftdetect)
|
||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
||||
- [javascript](https://github.com/sheerun/yajs.vim) (syntax, indent)
|
||||
- [jinja](https://github.com/Glench/Vim-Jinja2-Syntax) (syntax, indent, ftdetect)
|
||||
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
|
||||
- [jsx](https://github.com/mxw/vim-jsx) (after)
|
||||
- [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
|
||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftdetect)
|
||||
- [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/mutewinter/nginx.vim) (syntax, ftdetect)
|
||||
- [nginx](https://github.com/nginx/nginx) (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)
|
||||
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin, ftdetect)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)
|
||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, ftplugin, ftdetect)
|
||||
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)
|
||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
|
||||
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, ftplugin, ftdetect)
|
||||
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||
- [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/wting/rust.vim) (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)
|
||||
- [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)
|
||||
- [swift](https://github.com/toyamarinyon/vim-swift) (syntax, indent, ftdetect)
|
||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
||||
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
|
||||
- [tomdoc](https://github.com/duwanis/tomdoc.vim) (syntax)
|
||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
||||
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
|
||||
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
||||
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
|
||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
||||
- [twig](https://github.com/evidens/vim-twig) (syntax, 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)
|
||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax, ftdetect)
|
||||
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent, ftdetect)
|
||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
|
||||
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
||||
|
||||
## Disabling a language pack
|
||||
|
||||
@@ -103,6 +117,10 @@ 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.
|
||||
@@ -112,7 +130,3 @@ Feel free to add your language, and send pull-request.
|
||||
## License
|
||||
|
||||
See linked repositories for detailed license information.
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftdetect file
|
||||
"
|
||||
" Language: JSX (JavaScript)
|
||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
|
||||
|
||||
fu! <SID>EnableJSX()
|
||||
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
|
||||
if g:jsx_ext_required && !exists('b:jsx_ext_found') | return 0 | endif
|
||||
return 1
|
||||
endfu
|
||||
|
||||
autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1
|
||||
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx
|
||||
autocmd BufNewFile,BufRead *.js
|
||||
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
|
||||
|
||||
endif
|
||||
11
after/ftplugin/yaml.vim
Normal file
11
after/ftplugin/yaml.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Yaml
|
||||
" Author: Henrique Barcelos
|
||||
" Date: 2014-10-08
|
||||
" URL: https://github.com/hjpbarcelos
|
||||
setlocal autoindent sw=2 ts=2 expandtab
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
@@ -9,13 +9,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Do nothing if we don't find the @jsx pragma (and we care).
|
||||
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
|
||||
if g:jsx_pragma_required && !b:jsx_pragma_found | finish | endif
|
||||
|
||||
" Do nothing if we don't have the .jsx extension (and we care).
|
||||
if g:jsx_ext_required && !exists('b:jsx_ext_found') | finish | endif
|
||||
|
||||
" Prologue; load in XML indentation.
|
||||
if exists('b:did_indent')
|
||||
let s:did_indent=b:did_indent
|
||||
@@ -33,8 +26,8 @@ setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
|
||||
" XML indentkeys
|
||||
setlocal indentkeys+=*<Return>,<>>,<<>,/
|
||||
|
||||
" Self-closing tag regex.
|
||||
let s:sctag = '^\s*\/>\s*;\='
|
||||
" Multiline end tag regex (line beginning with '>' or '/>')
|
||||
let s:endtag = '^\s*\/\?>\s*;\='
|
||||
|
||||
" Get all syntax types at the beginning of a given line.
|
||||
fu! SynSOL(lnum)
|
||||
@@ -83,13 +76,13 @@ fu! GetJsxIndent()
|
||||
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) && SynXMLishAny(cursyn)
|
||||
let ind = XmlIndentGet(v:lnum, 0)
|
||||
|
||||
" Align '/>' with '<' for multiline self-closing tags.
|
||||
if getline(v:lnum) =~? s:sctag
|
||||
" Align '/>' and '>' with '<' for multiline tags.
|
||||
if getline(v:lnum) =~? s:endtag
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
" Then correct the indentation of any JSX following '/>'.
|
||||
if getline(v:lnum - 1) =~? s:sctag
|
||||
" Then correct the indentation of any JSX following '/>' or '>'.
|
||||
if getline(v:lnum - 1) =~? s:endtag
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
else
|
||||
|
||||
97
after/indent/objc.vim
Normal file
97
after/indent/objc.vim
Normal file
@@ -0,0 +1,97 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Objective-C
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: 2012 Jan 01
|
||||
|
||||
" Ensure 'cpo' is set to Vim default values and restore later
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
"if exists("b:did_indent")
|
||||
" finish
|
||||
"endif
|
||||
"let b:did_indent = 1
|
||||
"setlocal cindent
|
||||
|
||||
setl indentkeys=0{,0},:,0#,!^F,o,O,e,<:>
|
||||
|
||||
setlocal indentexpr=GetObjCIndentImproved()
|
||||
|
||||
" Top level statements which should not be indented, and which should not
|
||||
" cause next (non-blank) line to be indented either.
|
||||
let s:topLev = '^\s*@\%(class\|end\|implementation\|interface\|protocol\|\)\>'
|
||||
|
||||
function! GetObjCIndentImproved()
|
||||
" NOTE: Ignore leading white space to avoid having to deal with space vs.
|
||||
" tab issues. Rely on the indent() function instead.
|
||||
let thisLine = substitute(getline(v:lnum), '^\s*', '', '')
|
||||
|
||||
if thisLine =~# s:topLev || getline(prevnonblank(v:lnum - 1)) =~# s:topLev
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If current line looks like an argument to a message dispatch, then line
|
||||
" up colon with previous line. This will indent the second line so that
|
||||
" the colons line up in
|
||||
"
|
||||
" [obj firstParameter:value
|
||||
" paramB:value2];
|
||||
"
|
||||
" but it will not line up colons in
|
||||
"
|
||||
" if ([obj something:here])
|
||||
" [obj other:here];
|
||||
"
|
||||
let thisColon = match(thisLine, '^\s*\K\k*\zs:')
|
||||
if thisColon > 0
|
||||
let prevLine = substitute(getline(v:lnum - 1), '^\s*', '', '')
|
||||
let prevColon = match(prevLine, ':')
|
||||
if prevColon > 0
|
||||
" Try to align colons, always making sure line is indented at least
|
||||
" one shiftwidth more than the indentation at the beginning of the
|
||||
" message. Avoids situations like this:
|
||||
"
|
||||
" if ([obj a:x
|
||||
" aLongParameter:y])
|
||||
"
|
||||
let [lnum,lcol] = searchpairpos('\[', '', '\]', 'b', 0,
|
||||
\ max([1, v:lnum - 10]))
|
||||
let minInd = &sw + (lnum > 0 ? indent(lnum) : 0)
|
||||
let alignedInd = indent(v:lnum - 1) + prevColon - thisColon
|
||||
return alignedInd > minInd ? alignedInd : minInd
|
||||
endif
|
||||
endif
|
||||
|
||||
let prevLnum = v:lnum - 1
|
||||
let ind = indent(prevLnum)
|
||||
|
||||
" Indent one shiftwidth after opening block, e.g.:
|
||||
"
|
||||
" call_func_with_block(param, ^{
|
||||
" do_stuff();
|
||||
" });
|
||||
"
|
||||
let blockPat = '\^\s*\(([^)]*)\)\?\s*{$'
|
||||
if thisLine =~ '^}'
|
||||
norm '^%'
|
||||
if getline(".") =~ blockPat
|
||||
return indent(".")
|
||||
endif
|
||||
endif
|
||||
|
||||
if getline(prevLnum) =~ blockPat
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
return cindent(v:lnum)
|
||||
endfunction
|
||||
|
||||
|
||||
" Restore 'cpo' options
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
endif
|
||||
@@ -1,37 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vimscript file
|
||||
"
|
||||
" Set up a bunch of configuration variables.
|
||||
"
|
||||
" Also check (if desired) whether or not the @jsx pragma is correctly included
|
||||
" in '%'. Set the result in b:jsx_pragma_found.
|
||||
"
|
||||
" Language: JSX (JavaScript)
|
||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Only check once.
|
||||
if exists('b:jsx_pragma_found')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Whether the .jsx extension is required to enable JSX syntax/indent.
|
||||
if !exists('g:jsx_ext_required')
|
||||
let g:jsx_ext_required = 1
|
||||
endif
|
||||
|
||||
" Whether the @jsx pragma is required to enable JSX syntax/indent.
|
||||
if !exists('g:jsx_pragma_required')
|
||||
let g:jsx_pragma_required = 0
|
||||
endif
|
||||
if !g:jsx_pragma_required | finish | endif
|
||||
|
||||
" Look for the @jsx pragma. It must be included in a docblock comment before
|
||||
" anything else in the file (except whitespace).
|
||||
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
|
||||
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
|
||||
|
||||
endif
|
||||
@@ -65,7 +65,7 @@ syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconst
|
||||
" -----------------------------------------------------------------------------
|
||||
" Standard library types and functions.
|
||||
"
|
||||
" Mainly based on the excellent STL Syntax vim script by
|
||||
" Mainly based on the excellent STL Syntax vim script by
|
||||
" Mizuchi <ytj000@gmail.com>
|
||||
" http://www.vim.org/scripts/script.php?script_id=4293
|
||||
" which in turn is based on the scripts
|
||||
@@ -1324,6 +1324,31 @@ if !exists("cpp_no_cpp14")
|
||||
"dynarray
|
||||
syntax keyword cppSTLtype dynarray
|
||||
|
||||
"helper type traits types
|
||||
syntax keyword cppSTLtype remove_cv_t
|
||||
syntax keyword cppSTLtype remove_const_t
|
||||
syntax keyword cppSTLtype remove_volatile_t
|
||||
syntax keyword cppSTLtype add_cv_t
|
||||
syntax keyword cppSTLtype add_const_t
|
||||
syntax keyword cppSTLtype add_volatile_t
|
||||
syntax keyword cppSTLtype remove_reference_t
|
||||
syntax keyword cppSTLtype add_lvalue_reference_t
|
||||
syntax keyword cppSTLtype add_rvalue_reference_t
|
||||
syntax keyword cppSTLtype remove_pointer_t
|
||||
syntax keyword cppSTLtype add_pointer_t
|
||||
syntax keyword cppSTLtype remove_extent_t
|
||||
syntax keyword cppSTLtype remove_all_extents_t
|
||||
syntax keyword cppSTLtype make_signed_t
|
||||
syntax keyword cppSTLtype make_unsigned_t
|
||||
syntax keyword cppSTLtype aligned_storage_t
|
||||
syntax keyword cppSTLtype aligned_union_t
|
||||
syntax keyword cppSTLtype decay_t
|
||||
syntax keyword cppSTLtype enable_if_t
|
||||
syntax keyword cppSTLtype conditional_t
|
||||
syntax keyword cppSTLtype common_type_t
|
||||
syntax keyword cppSTLtype underlying_type_t
|
||||
syntax keyword cppSTLtype result_of_t
|
||||
|
||||
"thread
|
||||
syntax keyword cppSTLtype shared_mutex
|
||||
syntax keyword cppSTLtype shared_lock
|
||||
@@ -1362,7 +1387,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
||||
HiLink cppSTLenum Typedef
|
||||
HiLink cppSTLios Function
|
||||
HiLink cppSTLcast Statement " be consistent with official syntax
|
||||
HiLink cppRawString String
|
||||
HiLink cppRawString String
|
||||
HiLink cppRawDelimiter Delimiter
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
@@ -12,6 +12,19 @@ syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
||||
\ containedin=htmlHead
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||
|
||||
" Language: OpenGL Shading Language
|
||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
||||
|
||||
syn include @GLSL syntax/glsl.vim
|
||||
syn region ShaderScript
|
||||
\ start="<script [^>]*type=\('\|\"\)x-shader/x-\(vertex\|fragment\)\('\|\"\)[^>]*>"
|
||||
\ keepend
|
||||
\ end="</script>"me=s-1
|
||||
\ contains=@GLSL,htmlScriptTag,@htmlPreproc
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
|
||||
|
||||
@@ -11,13 +11,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Do nothing if we don't find the @jsx pragma (and we care).
|
||||
exec 'source '.fnameescape(expand('<sfile>:p:h:h').'/jsx-config.vim')
|
||||
if g:jsx_pragma_required && !b:jsx_pragma_found | finish | endif
|
||||
|
||||
" Do nothing if we don't have the .jsx extension (and we care).
|
||||
if g:jsx_ext_required && !exists('b:jsx_ext_found') | finish | endif
|
||||
|
||||
" Prologue; load in XML syntax.
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax=b:current_syntax
|
||||
@@ -28,9 +21,24 @@ if exists('s:current_syntax')
|
||||
let b:current_syntax=s:current_syntax
|
||||
endif
|
||||
|
||||
" Officially, vim-jsx depends on the pangloss/vim-javascript syntax package
|
||||
" (and is tested against it exclusively). However, in practice, we make some
|
||||
" effort towards compatibility with other packages.
|
||||
"
|
||||
" These are the plugin-to-syntax-element correspondences:
|
||||
"
|
||||
" - pangloss/vim-javascript: jsBlock, jsExpression
|
||||
" - jelera/vim-javascript-syntax: javascriptBlock
|
||||
" - othree/yajs.vim: javascriptNoReserved
|
||||
|
||||
|
||||
" Highlight JSX regions as XML; recursively match.
|
||||
"
|
||||
" Note that we prohibit JSX tags from having a < or word character immediately
|
||||
" 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,jsBlock,javascriptBlock
|
||||
\ start=+<\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
||||
\ skip=+<!--\_.\{-}-->+
|
||||
\ end=+</\z1\_\s\{-}>+
|
||||
\ end=+/>+
|
||||
@@ -44,4 +52,7 @@ syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
||||
" Add jsxRegion to the lowest-level JS syntax cluster.
|
||||
syn cluster jsExpression add=jsxRegion
|
||||
|
||||
" Allow jsxRegion to contain reserved words.
|
||||
syn cluster javascriptNoReserved add=jsxRegion
|
||||
|
||||
endif
|
||||
|
||||
23
after/syntax/objc.vim
Normal file
23
after/syntax/objc.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
|
||||
" ARC type modifiers
|
||||
syn keyword objcTypeModifier __bridge __bridge_retained __bridge_transfer __autoreleasing __strong __weak __unsafe_unretained
|
||||
|
||||
" Block modifiers
|
||||
syn keyword objcTypeModifier __block
|
||||
|
||||
" Remote messaging modifiers
|
||||
syn keyword objcTypeModifier byref
|
||||
|
||||
" Property keywords - these are only highlighted inside '@property (...)'
|
||||
syn keyword objcPropertyAttribute contained getter setter readwrite readonly strong weak copy assign retain nonatomic
|
||||
syn match objcProperty display "^\s*@property\>\s*([^)]*)" contains=objcPropertyAttribute
|
||||
|
||||
" The @property directive must be defined after objcProperty or it won't be
|
||||
" highlighted
|
||||
syn match objcDirective "@property\|@synthesize\|@dynamic\|@package"
|
||||
|
||||
" Highlight property attributes as if they were type modifiers
|
||||
hi def link objcPropertyAttribute objcTypeModifier
|
||||
|
||||
endif
|
||||
@@ -1,11 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
|
||||
if !exists('g:rust_conceal') || !has('conceal') || &enc != 'utf-8'
|
||||
if !exists('g:rust_conceal') || g:rust_conceal == 0 || !has('conceal') || &enc != 'utf-8'
|
||||
finish
|
||||
endif
|
||||
|
||||
" For those who don't want to see `::`...
|
||||
if exists('g:rust_conceal_mod_path')
|
||||
if exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
|
||||
syn match rustNiceOperator "::" conceal cchar=ㆍ
|
||||
endif
|
||||
|
||||
@@ -20,7 +20,7 @@ syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrow
|
||||
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=′
|
||||
|
||||
" For those who don't want to see `pub`...
|
||||
if exists('g:rust_conceal_pub')
|
||||
if exists('g:rust_conceal_pub') && g:rust_conceal_pub != 0
|
||||
syn match rustPublicSigil contained "pu" conceal cchar=*
|
||||
syn match rustPublicRest contained "b" conceal cchar=
|
||||
syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
|
||||
@@ -28,7 +28,7 @@ endif
|
||||
|
||||
hi link rustNiceOperator Operator
|
||||
|
||||
if !exists('g:rust_conceal_mod_path')
|
||||
if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
|
||||
hi! link Conceal Operator
|
||||
endif
|
||||
|
||||
|
||||
64
after/syntax/yaml.vim
Normal file
64
after/syntax/yaml.vim
Normal file
@@ -0,0 +1,64 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||
|
||||
" To make this file do stuff, add something like the following (without the
|
||||
" leading ") to your ~/.vimrc:
|
||||
" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim
|
||||
|
||||
" Vim syntax/macro file
|
||||
" Language: YAML
|
||||
" Author: Igor Vergeichik <iverg@mail.ru>
|
||||
" Sponsor: Tom Sawyer <transami@transami.net>
|
||||
" Stayven: Ryan King <jking@panoptic.com>
|
||||
" Copyright (c) 2002 Tom Saywer
|
||||
|
||||
" Add an item to a gangly list:
|
||||
"map , o<bs><bs><bs><bs>-<esc>o
|
||||
" Convert to Canonical form:
|
||||
"map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()'
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
endif
|
||||
syntax clear
|
||||
|
||||
syn match yamlDelimiter "[:,-]"
|
||||
syn match yamlBlock "[\[\]\{\}\|\>]"
|
||||
syn match yamlOperator "[?^+-]\|=>"
|
||||
|
||||
syn region yamlComment start="\#" end="$"
|
||||
syn match yamlIndicator "#YAML:\S\+"
|
||||
|
||||
syn region yamlString start="'" end="'" skip="\\'"
|
||||
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
||||
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
||||
syn match yamlEscape "\\\o\o\=\o\=" contained
|
||||
syn match yamlEscape "\\x\x\+" contained
|
||||
|
||||
syn match yamlType "!\S\+"
|
||||
|
||||
syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil
|
||||
syn keyword yamlConstant TRUE True true YES Yes yes ON On on
|
||||
syn keyword yamlConstant FALSE False false NO No no OFF Off off
|
||||
|
||||
syn match yamlKey "\w\+\ze\s*:"
|
||||
syn match yamlAnchor "&\S\+"
|
||||
syn match yamlAlias "*\S\+"
|
||||
|
||||
" Setupt the hilighting links
|
||||
|
||||
hi link yamlConstant Keyword
|
||||
hi link yamlIndicator PreCondit
|
||||
hi link yamlAnchor Function
|
||||
hi link yamlAlias Function
|
||||
hi link yamlKey Identifier
|
||||
hi link yamlType Type
|
||||
|
||||
hi link yamlComment Comment
|
||||
hi link yamlBlock Operator
|
||||
hi link yamlOperator Operator
|
||||
hi link yamlDelimiter Delimiter
|
||||
hi link yamlString String
|
||||
hi link yamlEscape Special
|
||||
|
||||
|
||||
endif
|
||||
70
autoload/dart.vim
Normal file
70
autoload/dart.vim
Normal file
@@ -0,0 +1,70 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
|
||||
|
||||
function! s:error(text) abort
|
||||
echohl Error
|
||||
echomsg printf('[dart-vim-plugin] %s', a:text)
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
function! s:cexpr(errorformat, joined_lines) abort
|
||||
let temp_errorfomat = &errorformat
|
||||
try
|
||||
let &errorformat = a:errorformat
|
||||
cexpr a:joined_lines
|
||||
copen
|
||||
finally
|
||||
let &errorformat = temp_errorfomat
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! dart#fmt(q_args) abort
|
||||
if executable('dartfmt')
|
||||
let path = expand('%:p:gs:\:/:')
|
||||
if filereadable(path)
|
||||
let joined_lines = system(printf('dartfmt %s %s', a:q_args, shellescape(path)))
|
||||
if 0 == v:shell_error
|
||||
silent % delete _
|
||||
silent put=joined_lines
|
||||
silent 1 delete _
|
||||
else
|
||||
call s:cexpr('line %l\, column %c of %f: %m', joined_lines)
|
||||
endif
|
||||
else
|
||||
call s:error(printf('cannot read a file: "%s"', path))
|
||||
endif
|
||||
else
|
||||
call s:error('cannot execute binary file: dartfmt')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! dart#analyzer(q_args) abort
|
||||
if executable('dartanalyzer')
|
||||
let path = expand('%:p:gs:\:/:')
|
||||
if filereadable(path)
|
||||
let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path)))
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
||||
else
|
||||
call s:error(printf('cannot read a file: "%s"', path))
|
||||
endif
|
||||
else
|
||||
call s:error('cannot execute binary file: dartanalyzer')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! dart#tojs(q_args) abort
|
||||
if executable('dart2js')
|
||||
let path = expand('%:p:gs:\:/:')
|
||||
if filereadable(path)
|
||||
let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path)))
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
||||
else
|
||||
call s:error(printf('cannot read a file: "%s"', path))
|
||||
endif
|
||||
else
|
||||
call s:error('cannot execute binary file: dartanalyzer')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
endif
|
||||
12
autoload/elm/io.vim
Normal file
12
autoload/elm/io.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||
|
||||
" System IO
|
||||
|
||||
" Craft a system command and run it, returning the output.
|
||||
function! elm#io#system(program, args)
|
||||
let cmd ="which " . a:program . " && " . a:program . " " . a:args
|
||||
return system(cmd)
|
||||
endfunction
|
||||
|
||||
|
||||
endif
|
||||
@@ -36,72 +36,74 @@ endfunction
|
||||
" Run {{{1
|
||||
|
||||
function! rust#Run(bang, args)
|
||||
let args = s:ShellTokenize(a:args)
|
||||
if a:bang
|
||||
let idx = index(a:args, '--')
|
||||
let idx = index(l:args, '--')
|
||||
if idx != -1
|
||||
let rustc_args = idx == 0 ? [] : a:args[:idx-1]
|
||||
let args = a:args[idx+1:]
|
||||
let rustc_args = idx == 0 ? [] : l:args[:idx-1]
|
||||
let args = l:args[idx+1:]
|
||||
else
|
||||
let rustc_args = a:args
|
||||
let rustc_args = l:args
|
||||
let args = []
|
||||
endif
|
||||
else
|
||||
let rustc_args = []
|
||||
let args = a:args
|
||||
endif
|
||||
|
||||
let b:rust_last_rustc_args = rustc_args
|
||||
let b:rust_last_args = args
|
||||
let b:rust_last_rustc_args = l:rustc_args
|
||||
let b:rust_last_args = l:args
|
||||
|
||||
call s:WithPath(function("s:Run"), rustc_args, args)
|
||||
endfunction
|
||||
|
||||
function! s:Run(path, rustc_args, args)
|
||||
try
|
||||
let exepath = tempname()
|
||||
if has('win32')
|
||||
let exepath .= '.exe'
|
||||
endif
|
||||
function! s:Run(dict, rustc_args, args)
|
||||
let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r')
|
||||
if has('win32')
|
||||
let exepath .= '.exe'
|
||||
endif
|
||||
|
||||
let rustc_args = [a:path, '-o', exepath] + a:rustc_args
|
||||
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
|
||||
let rustc_args = [relpath, '-o', exepath] + a:rustc_args
|
||||
|
||||
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
|
||||
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
|
||||
|
||||
let output = system(shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
|
||||
if output != ''
|
||||
echohl WarningMsg
|
||||
echo output
|
||||
echohl None
|
||||
endif
|
||||
if !v:shell_error
|
||||
exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)'))
|
||||
endif
|
||||
finally
|
||||
if exists("exepath")
|
||||
silent! call delete(exepath)
|
||||
endif
|
||||
endtry
|
||||
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
||||
let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
|
||||
if output != ''
|
||||
echohl WarningMsg
|
||||
echo output
|
||||
echohl None
|
||||
endif
|
||||
if !v:shell_error
|
||||
exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)'))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Expand {{{1
|
||||
|
||||
function! rust#Expand(bang, args)
|
||||
if a:bang && !empty(a:args)
|
||||
let pretty = a:args[0]
|
||||
let args = a:args[1:]
|
||||
let args = s:ShellTokenize(a:args)
|
||||
if a:bang && !empty(l:args)
|
||||
let pretty = remove(l:args, 0)
|
||||
else
|
||||
let pretty = "expanded"
|
||||
let args = a:args
|
||||
endif
|
||||
call s:WithPath(function("s:Expand"), pretty, args)
|
||||
endfunction
|
||||
|
||||
function! s:Expand(path, pretty, args)
|
||||
function! s:Expand(dict, pretty, args)
|
||||
try
|
||||
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
|
||||
|
||||
let args = [a:path, '--pretty', a:pretty] + a:args
|
||||
let output = system(shellescape(rustc) . " " . join(map(args, "shellescape(v:val)")))
|
||||
if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)'
|
||||
let flag = '--xpretty'
|
||||
else
|
||||
let flag = '--pretty'
|
||||
endif
|
||||
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
|
||||
let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args
|
||||
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
||||
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
|
||||
if v:shell_error
|
||||
echohl WarningMsg
|
||||
echo output
|
||||
@@ -115,6 +117,20 @@ function! s:Expand(path, pretty, args)
|
||||
setl buftype=nofile
|
||||
setl bufhidden=hide
|
||||
setl noswapfile
|
||||
" give the buffer a nice name
|
||||
let suffix = 1
|
||||
let basename = fnamemodify(a:dict.path, ':t:r')
|
||||
while 1
|
||||
let bufname = basename
|
||||
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
|
||||
let bufname .= '.pretty.rs'
|
||||
if bufexists(bufname)
|
||||
let suffix += 1
|
||||
continue
|
||||
endif
|
||||
exe 'silent noautocmd keepalt file' fnameescape(bufname)
|
||||
break
|
||||
endwhile
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
@@ -122,7 +138,7 @@ endfunction
|
||||
function! rust#CompleteExpand(lead, line, pos)
|
||||
if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$'
|
||||
" first argument and it has a !
|
||||
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph="]
|
||||
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"]
|
||||
if !empty(a:lead)
|
||||
call filter(list, "v:val[:len(a:lead)-1] == a:lead")
|
||||
endif
|
||||
@@ -135,72 +151,120 @@ endfunction
|
||||
" Emit {{{1
|
||||
|
||||
function! rust#Emit(type, args)
|
||||
call s:WithPath(function("s:Emit"), a:type, a:args)
|
||||
let args = s:ShellTokenize(a:args)
|
||||
call s:WithPath(function("s:Emit"), a:type, args)
|
||||
endfunction
|
||||
|
||||
function! s:Emit(path, type, args)
|
||||
function! s:Emit(dict, type, args)
|
||||
try
|
||||
let output_path = a:dict.tmpdir.'/output'
|
||||
|
||||
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
|
||||
|
||||
let args = [a:path, '--emit', a:type, '-o', '-'] + a:args
|
||||
let output = system(shellescape(rustc) . " " . join(map(args, "shellescape(v:val)")))
|
||||
if v:shell_error
|
||||
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
|
||||
let args = [relpath, '--emit', a:type, '-o', output_path] + a:args
|
||||
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
|
||||
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
|
||||
if output != ''
|
||||
echohl WarningMsg
|
||||
echo output
|
||||
echohl None
|
||||
else
|
||||
endif
|
||||
if !v:shell_error
|
||||
new
|
||||
silent put =output
|
||||
exe 'silent keepalt read' fnameescape(output_path)
|
||||
1
|
||||
d
|
||||
if a:type == "ir"
|
||||
if a:type == "llvm-ir"
|
||||
setl filetype=llvm
|
||||
let extension = 'll'
|
||||
elseif a:type == "asm"
|
||||
setl filetype=asm
|
||||
let extension = 's'
|
||||
endif
|
||||
setl buftype=nofile
|
||||
setl bufhidden=hide
|
||||
setl noswapfile
|
||||
if exists('l:extension')
|
||||
" give the buffer a nice name
|
||||
let suffix = 1
|
||||
let basename = fnamemodify(a:dict.path, ':t:r')
|
||||
while 1
|
||||
let bufname = basename
|
||||
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
|
||||
let bufname .= '.'.extension
|
||||
if bufexists(bufname)
|
||||
let suffix += 1
|
||||
continue
|
||||
endif
|
||||
exe 'silent noautocmd keepalt file' fnameescape(bufname)
|
||||
break
|
||||
endwhile
|
||||
endif
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Utility functions {{{1
|
||||
|
||||
" Invokes func(dict, ...)
|
||||
" Where {dict} is a dictionary with the following keys:
|
||||
" 'path' - The path to the file
|
||||
" 'tmpdir' - The path to a temporary directory that will be deleted when the
|
||||
" function returns.
|
||||
" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise.
|
||||
" If {istemp} is 1 then an additional key is provided:
|
||||
" 'tmpdir_relpath' - The {path} relative to the {tmpdir}.
|
||||
"
|
||||
" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the
|
||||
" existing path of the current buffer. If the path is inside of {dict.tmpdir}
|
||||
" then it is guaranteed to have a '.rs' extension.
|
||||
function! s:WithPath(func, ...)
|
||||
let buf = bufnr('')
|
||||
let saved = {}
|
||||
let dict = {}
|
||||
try
|
||||
let save_write = &write
|
||||
let saved.write = &write
|
||||
set write
|
||||
let path = expand('%')
|
||||
let pathisempty = empty(path)
|
||||
if pathisempty || !save_write
|
||||
" use a temporary file named 'unnamed.rs' inside a temporary
|
||||
" directory. This produces better error messages
|
||||
let tmpdir = tempname()
|
||||
call mkdir(tmpdir)
|
||||
let dict.path = expand('%')
|
||||
let pathisempty = empty(dict.path)
|
||||
|
||||
let save_cwd = getcwd()
|
||||
silent exe 'lcd' fnameescape(tmpdir)
|
||||
" Always create a tmpdir in case the wrapped command wants it
|
||||
let dict.tmpdir = tempname()
|
||||
call mkdir(dict.tmpdir)
|
||||
|
||||
let path = 'unnamed.rs'
|
||||
if pathisempty || !saved.write
|
||||
let dict.istemp = 1
|
||||
" if we're doing this because of nowrite, preserve the filename
|
||||
if !pathisempty
|
||||
let filename = expand('%:t:r').".rs"
|
||||
else
|
||||
let filename = 'unnamed.rs'
|
||||
endif
|
||||
let dict.tmpdir_relpath = filename
|
||||
let dict.path = dict.tmpdir.'/'.filename
|
||||
|
||||
let save_mod = &mod
|
||||
let saved.mod = &mod
|
||||
set nomod
|
||||
|
||||
silent exe 'keepalt write! ' . fnameescape(path)
|
||||
silent exe 'keepalt write! ' . fnameescape(dict.path)
|
||||
if pathisempty
|
||||
silent keepalt 0file
|
||||
endif
|
||||
else
|
||||
let dict.istemp = 0
|
||||
update
|
||||
endif
|
||||
|
||||
call call(a:func, [path] + a:000)
|
||||
call call(a:func, [dict] + a:000)
|
||||
finally
|
||||
if exists("save_mod") | let &mod = save_mod | endif
|
||||
if exists("save_write") | let &write = save_write | endif
|
||||
if exists("save_cwd") | silent exe 'lcd' fnameescape(save_cwd) | endif
|
||||
if exists("tmpdir") | silent call s:RmDir(tmpdir) | endif
|
||||
if bufexists(buf)
|
||||
for [opt, value] in items(saved)
|
||||
silent call setbufvar(buf, '&'.opt, value)
|
||||
unlet value " avoid variable type mismatches
|
||||
endfor
|
||||
endif
|
||||
if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
@@ -210,6 +274,71 @@ function! rust#AppendCmdLine(text)
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
" Tokenize the string according to sh parsing rules
|
||||
function! s:ShellTokenize(text)
|
||||
" states:
|
||||
" 0: start of word
|
||||
" 1: unquoted
|
||||
" 2: unquoted backslash
|
||||
" 3: double-quote
|
||||
" 4: double-quoted backslash
|
||||
" 5: single-quote
|
||||
let l:state = 0
|
||||
let l:current = ''
|
||||
let l:args = []
|
||||
for c in split(a:text, '\zs')
|
||||
if l:state == 0 || l:state == 1 " unquoted
|
||||
if l:c ==# ' '
|
||||
if l:state == 0 | continue | endif
|
||||
call add(l:args, l:current)
|
||||
let l:current = ''
|
||||
let l:state = 0
|
||||
elseif l:c ==# '\'
|
||||
let l:state = 2
|
||||
elseif l:c ==# '"'
|
||||
let l:state = 3
|
||||
elseif l:c ==# "'"
|
||||
let l:state = 5
|
||||
else
|
||||
let l:current .= l:c
|
||||
let l:state = 1
|
||||
endif
|
||||
elseif l:state == 2 " unquoted backslash
|
||||
if l:c !=# "\n" " can it even be \n?
|
||||
let l:current .= l:c
|
||||
endif
|
||||
let l:state = 1
|
||||
elseif l:state == 3 " double-quote
|
||||
if l:c ==# '\'
|
||||
let l:state = 4
|
||||
elseif l:c ==# '"'
|
||||
let l:state = 1
|
||||
else
|
||||
let l:current .= l:c
|
||||
endif
|
||||
elseif l:state == 4 " double-quoted backslash
|
||||
if stridx('$`"\', l:c) >= 0
|
||||
let l:current .= l:c
|
||||
elseif l:c ==# "\n" " is this even possible?
|
||||
" skip it
|
||||
else
|
||||
let l:current .= '\'.l:c
|
||||
endif
|
||||
let l:state = 3
|
||||
elseif l:state == 5 " single-quoted
|
||||
if l:c == "'"
|
||||
let l:state = 1
|
||||
else
|
||||
let l:current .= l:c
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if l:state != 0
|
||||
call add(l:args, l:current)
|
||||
endif
|
||||
return l:args
|
||||
endfunction
|
||||
|
||||
function! s:RmDir(path)
|
||||
" sanity check; make sure it's not empty, /, or $HOME
|
||||
if empty(a:path)
|
||||
@@ -222,6 +351,66 @@ function! s:RmDir(path)
|
||||
silent exe "!rm -rf " . shellescape(a:path)
|
||||
endfunction
|
||||
|
||||
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
|
||||
" If {pwd} is the empty string then it doesn't change the cwd.
|
||||
function! s:system(pwd, cmd)
|
||||
let cmd = a:cmd
|
||||
if !empty(a:pwd)
|
||||
let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd
|
||||
endif
|
||||
return system(cmd)
|
||||
endfunction
|
||||
|
||||
" Playpen Support {{{1
|
||||
" Parts of gist.vim by Yasuhiro Matsumoto <mattn.jp@gmail.com> reused
|
||||
" gist.vim available under the BSD license, available at
|
||||
" http://github.com/mattn/gist-vim
|
||||
function! s:has_webapi()
|
||||
if !exists("*webapi#http#post")
|
||||
try
|
||||
call webapi#http#post()
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
return exists("*webapi#http#post")
|
||||
endfunction
|
||||
|
||||
function! rust#Play(count, line1, line2, ...) abort
|
||||
redraw
|
||||
|
||||
let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/')
|
||||
let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/')
|
||||
|
||||
if !s:has_webapi()
|
||||
echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
let bufname = bufname('%')
|
||||
if a:count < 1
|
||||
let content = join(getline(a:line1, a:line2), "\n")
|
||||
else
|
||||
let save_regcont = @"
|
||||
let save_regtype = getregtype('"')
|
||||
silent! normal! gvy
|
||||
let content = @"
|
||||
call setreg('"', save_regcont, save_regtype)
|
||||
endif
|
||||
|
||||
let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content)
|
||||
|
||||
if strlen(body) > 5000
|
||||
echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
let payload = "format=simple&url=".webapi#http#encodeURI(body)
|
||||
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
|
||||
let url = res.content
|
||||
|
||||
redraw | echomsg 'Done: '.url
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
||||
" vim: set noet sw=4 ts=4:
|
||||
|
||||
83
autoload/rustfmt.vim
Normal file
83
autoload/rustfmt.vim
Normal file
@@ -0,0 +1,83 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
|
||||
" Author: Stephen Sugden <stephen@stephensugden.com>
|
||||
"
|
||||
" Adapted from https://github.com/fatih/vim-go
|
||||
|
||||
if !exists("g:rustfmt_autosave")
|
||||
let g:rustfmt_autosave = 0
|
||||
endif
|
||||
|
||||
if !exists("g:rustfmt_command")
|
||||
let g:rustfmt_command = "rustfmt"
|
||||
endif
|
||||
|
||||
if !exists("g:rustfmt_options")
|
||||
let g:rustfmt_options = ""
|
||||
endif
|
||||
|
||||
if !exists("g:rustfmt_fail_silently")
|
||||
let g:rustfmt_fail_silently = 0
|
||||
endif
|
||||
|
||||
let s:got_fmt_error = 0
|
||||
|
||||
function! rustfmt#Format()
|
||||
let l:curw = winsaveview()
|
||||
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
|
||||
call writefile(getline(1, '$'), l:tmpname)
|
||||
|
||||
let command = g:rustfmt_command . " --write-mode=overwrite "
|
||||
|
||||
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
|
||||
|
||||
if v:shell_error == 0
|
||||
" remove undo point caused via BufWritePre
|
||||
try | silent undojoin | catch | endtry
|
||||
|
||||
" Replace current file with temp file, then reload buffer
|
||||
call rename(l:tmpname, expand('%'))
|
||||
silent edit!
|
||||
let &syntax = &syntax
|
||||
|
||||
" only clear location list if it was previously filled to prevent
|
||||
" clobbering other additions
|
||||
if s:got_fmt_error
|
||||
let s:got_fmt_error = 0
|
||||
call setloclist(0, [])
|
||||
lwindow
|
||||
endif
|
||||
elseif g:rustfmt_fail_silently == 0
|
||||
" otherwise get the errors and put them in the location list
|
||||
let errors = []
|
||||
|
||||
for line in out
|
||||
" src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value`
|
||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)')
|
||||
if !empty(tokens)
|
||||
call add(errors, {"filename": @%,
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[5]})
|
||||
endif
|
||||
endfor
|
||||
|
||||
if empty(errors)
|
||||
% | " Couldn't detect rustfmt error format, output errors
|
||||
endif
|
||||
|
||||
if !empty(errors)
|
||||
call setloclist(0, errors, 'r')
|
||||
echohl Error | echomsg "rustfmt returned error" | echohl None
|
||||
endif
|
||||
|
||||
let s:got_fmt_error = 1
|
||||
lwindow
|
||||
" We didn't use the temp file, so clean up
|
||||
call delete(l:tmpname)
|
||||
endif
|
||||
|
||||
call winrestview(l:curw)
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" Vim completion for HTML5 data file
|
||||
" Language: HTML5
|
||||
" Maintainer: othree <othree@gmail.com>
|
||||
" Last Change: 2011 Apr 9
|
||||
" Language: HTML (version 5.1 Draft 2016 Jan 13)
|
||||
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||
" Last Change: 2016 Jan 20
|
||||
|
||||
|
||||
" Lang Tag: {{{
|
||||
@@ -598,9 +598,13 @@ let g:xmldata_html5 = {
|
||||
\ global_attributes
|
||||
\ ],
|
||||
\ 'menu': [
|
||||
\ flow_elements + ['li'],
|
||||
\ flow_elements + ['menuitem'],
|
||||
\ extend(copy(global_attributes), {'type': ['toolbar', 'context'], 'label': []})
|
||||
\ ],
|
||||
\ 'menuitem': [
|
||||
\ flow_elements + ['li'],
|
||||
\ extend(copy(global_attributes), {'type': ['toolbar', 'context'], 'label': [], 'icon': [], 'disabled': [], 'checked': [], 'radiogroup': [], 'default': [], 'command': []})
|
||||
\ ],
|
||||
\ 'meta': [
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'name': ['application-name', 'author', 'description', 'generator', 'referrer', 'creator', 'googlebot', 'publisher', 'robots', 'slurp', 'viewport', 'theme-color'], 'http-equiv': ['refresh', 'default-style', 'content-type'], 'content': [], 'charset': charset})
|
||||
|
||||
52
build
52
build
@@ -3,7 +3,7 @@
|
||||
set -E
|
||||
|
||||
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
|
||||
DIRS_BASIC="syntax indent ftdetect after/syntax after/indent after/ftdetect"
|
||||
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
||||
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
||||
|
||||
OUTPUT=""
|
||||
@@ -96,72 +96,86 @@ EOF
|
||||
}
|
||||
|
||||
PACKS="
|
||||
ansible:pearofducks/ansible-vim
|
||||
arduino:sudar/vim-arduino-syntax
|
||||
blade:xsbeats/vim-blade
|
||||
blade:jwalton512/vim-blade
|
||||
c++11:octol/vim-cpp-enhanced-highlight
|
||||
c/c++:vim-jp/cpp-vim
|
||||
c/c++:vim-jp/vim-cpp
|
||||
cjsx:mtscout6/vim-cjsx
|
||||
clojure:guns/vim-clojure-static
|
||||
coffee-script:kchmck/vim-coffee-script
|
||||
cjsx:mtscout6/vim-cjsx
|
||||
cql:elubow/cql-vim
|
||||
css:JulesWang/css.vim
|
||||
cucumber:tpope/vim-cucumber
|
||||
dart:dart-lang/dart-vim-plugin
|
||||
dockerfile:honza/dockerfile.vim
|
||||
elixir:elixir-lang/vim-elixir
|
||||
elm:lambdatoast/elm.vim
|
||||
emberscript:heartsentwined/vim-ember-script
|
||||
emblem:heartsentwined/vim-emblem
|
||||
erlang:hcs42/vim-erlang-runtime
|
||||
erlang:vim-erlang/vim-erlang-runtime
|
||||
git:tpope/vim-git
|
||||
glsl:tikhomirov/vim-glsl
|
||||
go:fatih/vim-go:_BASIC
|
||||
groovy:vim-scripts/groovy.vim
|
||||
haml:tpope/vim-haml
|
||||
handlebars:mustache/vim-mustache-handlebars
|
||||
haskell:raichoo/haskell-vim
|
||||
haskell:neovimhaskell/haskell-vim
|
||||
haxe:yaymukund/vim-haxe
|
||||
html5:othree/html5.vim
|
||||
jade:digitaltoad/vim-jade
|
||||
jasmine:glanotte/vim-jasmine
|
||||
javascript:pangloss/vim-javascript
|
||||
julia:dcjones/julia-minimalist-vim
|
||||
javascript:sheerun/yajs.vim
|
||||
jinja:Glench/Vim-Jinja2-Syntax
|
||||
json:sheerun/vim-json
|
||||
jst:briancollins/vim-jst
|
||||
jsx:mxw/vim-jsx:_ALL
|
||||
julia:dcjones/julia-minimalist-vim
|
||||
kotlin:udalov/kotlin-vim
|
||||
latex:LaTeX-Box-Team/LaTeX-Box
|
||||
less:groenewege/vim-less
|
||||
liquid:tpope/vim-liquid
|
||||
markdown:tpope/vim-markdown
|
||||
nginx:mutewinter/nginx.vim
|
||||
nginx:nginx/nginx::/contrib/vim/
|
||||
nim:zah/nim.vim:_BASIC
|
||||
nix:spwhitt/vim-nix
|
||||
objc:b4winckler/vim-objc
|
||||
ocaml:jrk/vim-ocaml
|
||||
octave:vim-scripts/octave.vim--
|
||||
opencl:petRUShka/vim-opencl
|
||||
perl:vim-perl/vim-perl
|
||||
php:StanAngeloff/php.vim
|
||||
puppet:rodjek/vim-puppet
|
||||
powershell:Persistent13/vim-ps1
|
||||
protobuf:uarun/vim-protobuf
|
||||
puppet:rodjek/vim-puppet
|
||||
python:mitsuhiko/vim-python-combined
|
||||
qml:peterhoeg/vim-qml
|
||||
r-lang:vim-scripts/R.vim
|
||||
ragel:jneen/ragel.vim
|
||||
rspec:sheerun/rspec.vim
|
||||
ruby:vim-ruby/vim-ruby
|
||||
rust:wting/rust.vim
|
||||
rust:rust-lang/rust.vim
|
||||
sbt:derekwyatt/vim-sbt
|
||||
scala:derekwyatt/vim-scala
|
||||
slim:slim-template/vim-slim
|
||||
solidity:ethereum/vim-solidity
|
||||
stylus:wavded/vim-stylus
|
||||
swift:keith/swift.vim
|
||||
systemd:kurayama/systemd-vim-syntax
|
||||
swift:toyamarinyon/vim-swift
|
||||
textile:timcharper/textile.vim
|
||||
tmux:tejr/vim-tmux
|
||||
tomdoc:duwanis/tomdoc.vim
|
||||
typescript:leafgarland/typescript-vim
|
||||
vbnet:vim-scripts/vbnet.vim
|
||||
thrift:solarnz/thrift.vim
|
||||
tmux:tejr/vim-tmux
|
||||
tomdoc:wellbredgrapefruit/tomdoc.vim
|
||||
toml:cespare/vim-toml
|
||||
twig:beyondwords/vim-twig
|
||||
xls:vim-scripts/XSLT-syntax
|
||||
yard:sheerun/vim-yardoc
|
||||
twig:evidens/vim-twig
|
||||
typescript:leafgarland/typescript-vim
|
||||
vala:tkztmk/vim-vala
|
||||
vbnet:vim-scripts/vbnet.vim
|
||||
vcl:smerrill/vcl-vim-plugin
|
||||
vm:lepture/vim-velocity
|
||||
xls:vim-scripts/XSLT-syntax
|
||||
yaml:stephpy/vim-yaml
|
||||
yard:sheerun/vim-yardoc
|
||||
"
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim compiler file
|
||||
" Language: ExUnit
|
||||
" Maintainer: Rein Henrichs <rein.henrichs@gmail.com>
|
||||
" URL: https://github.com/elixir-lang/vim-elixir
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
@@ -16,9 +11,15 @@ endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
CompilerSet makeprg=mix\ test
|
||||
CompilerSet errorformat=%A\ \ %.)\ %m(%.%#),%C\ \ \ \ \ **%m,%C\ \ \ \ \ \ \ %m,%Z\ \ \ \ \ at\ %f:%l,%-G%.%#
|
||||
CompilerSet errorformat=
|
||||
\%E\ \ %n)\ %m,
|
||||
\%+G\ \ \ \ \ **\ %m,
|
||||
\%+G\ \ \ \ \ stacktrace:,
|
||||
\%C\ \ \ \ \ %f:%l,
|
||||
\%+G\ \ \ \ \ \ \ (%\\w%\\+)\ %f:%l:\ %m,
|
||||
\%+G\ \ \ \ \ \ \ %f:%l:\ %.%#,
|
||||
\**\ (%\\w%\\+)\ %f:%l:\ %m
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
45
compiler/go.vim
Normal file
45
compiler/go.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
|
||||
" Copyright 2013 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" compiler/go.vim: Vim compiler file for Go.
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "go"
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo-=C
|
||||
if filereadable("makefile") || filereadable("Makefile")
|
||||
CompilerSet makeprg=make
|
||||
else
|
||||
CompilerSet makeprg=go\ build
|
||||
endif
|
||||
|
||||
" Define the patterns that will be recognized by QuickFix when parsing the
|
||||
" output of Go command that use this errorforamt (when called make, cexpr or
|
||||
" lmake, lexpr). This is the global errorformat, however some command might
|
||||
" use a different output, for those we define them directly and modify the
|
||||
" errorformat ourselves. More information at:
|
||||
" http://vimdoc.sourceforge.net/htmldoc/quickfix.html#errorformat
|
||||
CompilerSet errorformat =%-G#\ %.%# " Ignore lines beginning with '#' ('# command-line-arguments' line sometimes appears?)
|
||||
CompilerSet errorformat+=%-G%.%#panic:\ %m " Ignore lines containing 'panic: message'
|
||||
CompilerSet errorformat+=%Ecan\'t\ load\ package:\ %m " Start of multiline error string is 'can\'t load package'
|
||||
CompilerSet errorformat+=%A%f:%l:%c:\ %m " Start of multiline unspecified string is 'filename:linenumber:columnnumber:'
|
||||
CompilerSet errorformat+=%A%f:%l:\ %m " Start of multiline unspecified string is 'filename:linenumber:'
|
||||
CompilerSet errorformat+=%C%*\\s%m " Continuation of multiline error message is indented
|
||||
CompilerSet errorformat+=%-G%.%# " All lines not matching any of the above patterns are ignored
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
|
||||
endif
|
||||
27
compiler/nim.vim
Normal file
27
compiler/nim.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
|
||||
let current_compiler = "nim"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
CompilerSet makeprg=nim\ c\ $*
|
||||
|
||||
CompilerSet errorformat=
|
||||
\%-GHint:\ %m,
|
||||
\%E%f(%l\\,\ %c)\ Error:\ %m,
|
||||
\%W%f(%l\\,\ %c)\ Hint:\ %m
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
|
||||
endif
|
||||
@@ -24,9 +24,10 @@ CompilerSet errorformat=
|
||||
\%f:%l:\ %tarning:\ %m,
|
||||
\%E%.%#:in\ `load':\ %f:%l:%m,
|
||||
\%E%f:%l:in\ `%*[^']':\ %m,
|
||||
\%-Z\ \ \ \ \ \#\ %f:%l:%.%#,
|
||||
\%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#,
|
||||
\%E\ \ %\\d%\\+)%.%#,
|
||||
\%C\ \ \ \ \ %m,
|
||||
\%C%\\s%#,
|
||||
\%-G%.%#
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
|
||||
@@ -17,7 +17,7 @@ if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent == 1
|
||||
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0
|
||||
CompilerSet makeprg=rustc
|
||||
else
|
||||
CompilerSet makeprg=rustc\ \%
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
function! DetectAnsible()
|
||||
let filepath = expand("%:p")
|
||||
let filename = expand("%:t")
|
||||
if filepath =~ '\v/(tasks|roles)/.*\.ya?ml$' || filepath =~ '\v/(group|host)_vars/' || filename =~ '\v(playbook|site)\.ya?ml$'
|
||||
set ft=ansible
|
||||
endif
|
||||
unlet filepath
|
||||
unlet filename
|
||||
endfunction
|
||||
:au BufNewFile,BufRead *.yml,*yaml,*/{group,host}_vars/* call DetectAnsible()
|
||||
:au BufNewFile,BufRead *.j2 set ft=ansible_template
|
||||
:au BufNewFile,BufRead hosts set ft=ansible_hosts
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'arduino') == -1
|
||||
|
||||
au BufRead,BufNewFile *.ino,*.pde set filetype=arduino
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
||||
|
||||
au BufNewFile,BufRead *.blade.php set filetype=blade
|
||||
autocmd BufNewFile,BufRead *.blade.php set filetype=blade
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
||||
|
||||
@@ -30,29 +45,42 @@ function! s:DetectCoffee()
|
||||
endfunction
|
||||
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cql') == -1
|
||||
|
||||
if has("autocmd")
|
||||
au BufNewFile,BufRead *.cql set filetype=cql
|
||||
endif
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cucumber') == -1
|
||||
|
||||
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
|
||||
autocmd BufRead,BufNewFile *.dart set filetype=dart
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
|
||||
|
||||
au BufNewFile,BufRead Dockerfile set filetype=dockerfile
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
au BufRead,BufNewFile *.eex set filetype=eelixir
|
||||
au FileType eelixir setl sw=2 sts=2 et iskeyword+=!,?
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||
au FileType elixir setl sw=2 sts=2 et iskeyword+=!,?
|
||||
function! s:DetectElixir()
|
||||
if getline(1) =~ '^#!.*\<elixir\>'
|
||||
set filetype=elixir
|
||||
endif
|
||||
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||
au FileType elixir,eelixir setl sw=2 sts=2 et iskeyword+=!,?
|
||||
au BufNewFile,BufRead * call s:DetectElixir()
|
||||
function! s:setf(filetype) abort
|
||||
let &filetype = a:filetype
|
||||
endfunction
|
||||
autocmd BufNewFile,BufRead * call s:DetectElixir()
|
||||
function! s:DetectElixir()
|
||||
if getline(1) =~ '^#!.*\<elixir\>'
|
||||
call s:setf('elixir')
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||
|
||||
au BufNewFile,BufRead *.elm set filetype=elm
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
|
||||
|
||||
@@ -64,9 +92,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
|
||||
autocmd BufNewFile,BufRead *.emblem set filetype=emblem
|
||||
autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1
|
||||
|
||||
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl set ft=erlang
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
||||
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
||||
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
|
||||
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
||||
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
||||
@@ -85,23 +117,30 @@ autocmd BufNewFile,BufRead *
|
||||
\ set filetype=gitsendemail |
|
||||
\ endif
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||
|
||||
autocmd! BufNewFile,BufRead *.glsl,*.geom,*.vert,*.frag,*.gsh,*.vsh,*.fsh,*.vs,*.fs,*.gs,*.tcs,*.tes set filetype=glsl
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
|
||||
let s:current_fileformats = ''
|
||||
let s:current_fileencodings = ''
|
||||
function! s:gofiletype_pre()
|
||||
function! s:gofiletype_pre(type)
|
||||
let s:current_fileformats = &g:fileformats
|
||||
let s:current_fileencodings = &g:fileencodings
|
||||
set fileencodings=utf-8 fileformats=unix
|
||||
setlocal filetype=go
|
||||
let &l:filetype = a:type
|
||||
endfunction
|
||||
function! s:gofiletype_post()
|
||||
let &g:fileformats = s:current_fileformats
|
||||
let &g:fileencodings = s:current_fileencodings
|
||||
endfunction
|
||||
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.go call s:gofiletype_pre()
|
||||
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.go call s:gofiletype_pre("go")
|
||||
au BufReadPost *.go call s:gofiletype_post()
|
||||
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.s call s:gofiletype_pre("asm")
|
||||
au BufReadPost *.s call s:gofiletype_post()
|
||||
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
@@ -126,17 +165,45 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
|
||||
au BufNewFile,BufRead *.js setf javascript
|
||||
au BufNewFile,BufRead *.jsm setf javascript
|
||||
au BufNewFile,BufRead Jakefile setf javascript
|
||||
fun! s:SelectJavascript()
|
||||
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
|
||||
set ft=javascript
|
||||
endif
|
||||
if !exists('g:jsx_ext_required')
|
||||
let g:jsx_ext_required = 1
|
||||
endif
|
||||
if !exists('g:jsx_pragma_required')
|
||||
let g:jsx_pragma_required = 0
|
||||
endif
|
||||
if g:jsx_pragma_required
|
||||
" Look for the @jsx pragma. It must be included in a docblock comment before
|
||||
" anything else in the file (except whitespace).
|
||||
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
|
||||
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
|
||||
endif
|
||||
fu! <SID>EnableJSX()
|
||||
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
|
||||
if g:jsx_ext_required && !exists('b:jsx_ext_found') | return 0 | endif
|
||||
return 1
|
||||
endfu
|
||||
autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1
|
||||
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx
|
||||
autocmd BufNewFile,BufRead *.js
|
||||
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
fun! s:SelectHTML()
|
||||
let n = 1
|
||||
while n < 50 && n <= line("$")
|
||||
" check for jinja
|
||||
if getline(n) =~ '{{.*}}\|{%-\?\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
|
||||
set ft=jinja
|
||||
return
|
||||
endif
|
||||
let n = n + 1
|
||||
endwhile
|
||||
endfun
|
||||
au BufNewFile,BufRead * call s:SelectJavascript()
|
||||
autocmd BufNewFile,BufRead *.html,*.htm,*.nunjucks,*.nunjs call s:SelectHTML()
|
||||
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja set ft=jinja
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
||||
|
||||
@@ -156,6 +223,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
au BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
||||
au BufRead,BufNewFile *.jl set filetype=julia
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.kt setfiletype kotlin
|
||||
autocmd BufNewFile,BufRead *.kts setfiletype kotlin
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.less setf less
|
||||
@@ -200,11 +272,22 @@ endif
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
|
||||
|
||||
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.conf if &ft == '' | setfiletype nginx | endif
|
||||
au BufRead,BufNewFile *.nginx set ft=nginx
|
||||
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
|
||||
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
|
||||
au BufRead,BufNewFile nginx.conf set ft=nginx
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
|
||||
au BufNewFile,BufRead *.nim set filetype=nim
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.nix setfiletype nix
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'opencl') == -1
|
||||
|
||||
au BufRead,BufNewFile *.cl set filetype=opencl
|
||||
au! BufRead,BufNewFile *.cl set filetype=opencl
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
||||
|
||||
@@ -256,6 +339,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||
au! BufRead,BufNewFile *.pp setfiletype puppet
|
||||
au! BufRead,BufNewFile Puppetfile setfiletype ruby
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
|
||||
autocmd BufRead,BufNewFile *.qml setfiletype qml
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
||||
|
||||
function! s:setf(filetype) abort
|
||||
@@ -285,6 +372,8 @@ au BufNewFile,BufRead Puppetfile call s:setf('ruby')
|
||||
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
|
||||
au BufNewFile,BufRead Appraisals call s:setf('ruby')
|
||||
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
|
||||
au BufNewFile,BufRead [rR]outefile call s:setf('ruby')
|
||||
au BufNewFile,BufRead .simplecov set filetype=ruby
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
|
||||
@@ -320,7 +409,17 @@ autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.swift set filetype=swift
|
||||
autocmd BufNewFile,BufRead *.swift setfiletype swift
|
||||
autocmd BufRead * call s:Swift()
|
||||
function! s:Swift()
|
||||
if !empty(&filetype)
|
||||
return
|
||||
endif
|
||||
let line = getline(1)
|
||||
if line =~ "^#!.*swift"
|
||||
setfiletype swift
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'systemd') == -1
|
||||
|
||||
@@ -351,20 +450,19 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1
|
||||
autocmd BufNewFile,BufRead *.toml set filetype=toml
|
||||
autocmd BufNewFile,BufRead Cargo.lock set filetype=toml
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.twig set filetype=twig
|
||||
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
||||
autocmd BufNewFile,BufRead *.ts,*.tsx setlocal filetype=typescript
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vala') == -1
|
||||
|
||||
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
|
||||
au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vcl') == -1
|
||||
|
||||
au BufRead,BufNewFile *.vcl set filetype=vcl
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vm') == -1
|
||||
|
||||
au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity
|
||||
|
||||
8
ftplugin/ansible.vim
Normal file
8
ftplugin/ansible.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
" Slow yaml highlighting workaround
|
||||
if exists('+regexpengine') && ('®expengine' == 0)
|
||||
setlocal regexpengine=1
|
||||
endif
|
||||
|
||||
endif
|
||||
16
ftplugin/blade.vim
Normal file
16
ftplugin/blade.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: Blade (Laravel)
|
||||
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/html.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal iskeyword+=@-@
|
||||
|
||||
endif
|
||||
31
ftplugin/dart.vim
Normal file
31
ftplugin/dart.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Enable automatic indentation (2 spaces) if variable g:dart_style_guide is set
|
||||
if exists('g:dart_style_guide')
|
||||
setlocal expandtab
|
||||
setlocal shiftwidth=2
|
||||
setlocal softtabstop=2
|
||||
|
||||
setlocal formatoptions-=t
|
||||
endif
|
||||
|
||||
" Set 'comments' to format dashed lists in comments.
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
|
||||
|
||||
setlocal commentstring=//%s
|
||||
let s:win_sep = (has('win32') || has('win64')) ? '/' : ''
|
||||
let &l:errorformat =
|
||||
\ join([
|
||||
\ ' %#''file://' . s:win_sep . '%f'': %s: line %l pos %c:%m',
|
||||
\ '%m'
|
||||
\ ], ',')
|
||||
|
||||
|
||||
let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms<'
|
||||
|
||||
endif
|
||||
@@ -1,9 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: Embedded Elixir
|
||||
" URL: https://github.com/elixir-lang/vim-elixir
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: Elixir
|
||||
" Maintainer: Carlos Galdino <carloshsgaldino@gmail.com>
|
||||
" URL: https://github.com/elixir-lang/vim-elixir
|
||||
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
@@ -15,7 +10,7 @@ let b:did_ftplugin = 1
|
||||
if exists("loaded_matchit") && !exists("b:match_words")
|
||||
let b:match_ignorecase = 0
|
||||
|
||||
let b:match_words = '\<\%(do\|fn\)\:\@!\>' .
|
||||
let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
|
||||
\ ':' .
|
||||
\ '\<\%(else\|elsif\|catch\|after\|rescue\)\:\@!\>' .
|
||||
\ ':' .
|
||||
|
||||
86
ftplugin/elm.vim
Normal file
86
ftplugin/elm.vim
Normal file
@@ -0,0 +1,86 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||
|
||||
" elm.vim - Plugin for the Elm programming language
|
||||
" Maintainer: Alexander Noriega <http://lambdatoast.com/>
|
||||
" Version: 0.4.3
|
||||
|
||||
" Plugin setup stuff
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Compilation
|
||||
|
||||
function! ElmMake(file)
|
||||
let args = a:file
|
||||
return elm#io#system("elm-make", args)
|
||||
endfunction
|
||||
|
||||
function! ElmMakeCurrentFile()
|
||||
echo ElmMake(expand("%"))
|
||||
endfunction
|
||||
|
||||
function! ElmMakeMain()
|
||||
echo ElmMake("Main.elm")
|
||||
endfunction
|
||||
|
||||
function! ElmMakeFile(file)
|
||||
echo ElmMake(a:file)
|
||||
endfunction
|
||||
|
||||
" REPL
|
||||
|
||||
function! ElmRepl()
|
||||
!elm-repl
|
||||
endfunction
|
||||
|
||||
" Evaluation
|
||||
|
||||
function! ElmEvalLine()
|
||||
return ElmEval(getline("."))
|
||||
endfunction
|
||||
|
||||
function! ElmEvalSelection()
|
||||
let savedReg = @z
|
||||
normal! `<v`>"zy
|
||||
let res = ElmEval(substitute(getreg("z"), "\n", "\\\n", "g"))
|
||||
let @z = savedReg
|
||||
normal! gv
|
||||
endfunction
|
||||
|
||||
function! ElmEval(sourceCode)
|
||||
let currentLine = a:sourceCode
|
||||
let args = "echo '" . currentLine . "' | elm-repl"
|
||||
let result = elm#io#system("echo", args)
|
||||
let cleanResult = "-- " . join(s:Filtered(function("s:IsUsefulReplOutput"), split(result, "\n")), "")
|
||||
put =cleanResult
|
||||
endfunction
|
||||
|
||||
function! s:IsUsefulReplOutput(str)
|
||||
return a:str !~ "^Elm REPL" && a:str !~ "Type :help" && a:str !~ ">\\s*$"
|
||||
endfunction
|
||||
|
||||
" List processing
|
||||
|
||||
function! s:Filtered(fn, l)
|
||||
let new_list = deepcopy(a:l)
|
||||
call filter(new_list, string(a:fn) . '(v:val)')
|
||||
return new_list
|
||||
endfunction
|
||||
|
||||
command -buffer ElmEvalLine call ElmEvalLine()
|
||||
command -buffer ElmEvalSelection call ElmEvalSelection()
|
||||
command -buffer ElmMakeMain call ElmMakeMain()
|
||||
command -buffer -nargs=1 ElmMakeFile call ElmMakeFile <args>
|
||||
command -buffer ElmMakeCurrentFile call ElmMakeCurrentFile()
|
||||
command -buffer ElmRepl call ElmRepl()
|
||||
|
||||
" Define comment convention
|
||||
|
||||
setlocal comments=:--
|
||||
setlocal commentstring=--%s
|
||||
|
||||
endif
|
||||
@@ -3,6 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
" Vim filetype plugin
|
||||
" Language: generic git output
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
|
||||
@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
" Vim filetype plugin
|
||||
" Language: git commit file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2012 April 7
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
|
||||
@@ -14,10 +14,11 @@ runtime! ftplugin/git.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=:# commentstring=#\ %s formatoptions-=t
|
||||
setlocal nomodeline
|
||||
if !exists("b:undo_ftplugin")
|
||||
let b:undo_ftplugin = ""
|
||||
endif
|
||||
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<"
|
||||
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<"
|
||||
|
||||
function! s:choose(word)
|
||||
s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
|
||||
|
||||
@@ -8,4 +8,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" setlocal iskeyword+=-
|
||||
|
||||
setlocal commentstring=<!--%s-->
|
||||
|
||||
endif
|
||||
|
||||
@@ -21,7 +21,7 @@ setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
||||
setlocal omnifunc=csscomplete#CompleteCSS
|
||||
setlocal suffixesadd=.less
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,://
|
||||
setlocal fo=jcroql
|
||||
setlocal fo=croql
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
||||
|
||||
|
||||
17
ftplugin/nix.vim
Normal file
17
ftplugin/nix.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin=1
|
||||
|
||||
setlocal comments=
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Nixpkgs indent settings
|
||||
setlocal tabstop=2
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal expandtab
|
||||
|
||||
endif
|
||||
10
ftplugin/objc.vim
Normal file
10
ftplugin/objc.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
|
||||
" Use C++ style comment strings with commentary.vim
|
||||
setl commentstring=//%s
|
||||
|
||||
" Search for include files inside frameworks (used for gf etc.)
|
||||
setl includeexpr=substitute(v:fname,'\\([^/]\\+\\)/\\(.\\+\\)','/System/Library/Frameworks/\\1.framework/Headers/\\2','')
|
||||
|
||||
|
||||
endif
|
||||
@@ -45,7 +45,7 @@ setlocal define=[^A-Za-z_]
|
||||
" after/ftplugin/perl6.vim file that contains
|
||||
" set isfname-=:
|
||||
set isfname+=:
|
||||
setlocal iskeyword=@,48-57,_,192-255,:,-,'
|
||||
setlocal iskeyword=@,48-57,_,192-255,-
|
||||
|
||||
" Set this once, globally.
|
||||
if !exists("perlpath")
|
||||
|
||||
41
ftplugin/qml.vim
Normal file
41
ftplugin/qml.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: qml
|
||||
" Last change: 2014 Feb 8
|
||||
|
||||
if exists( 'b:did_ftplugin' )
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpoptions_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
" command for undo
|
||||
let b:undo_ftplugin =
|
||||
\ 'let b:browsefilter = "" | ' .
|
||||
\ 'setlocal ' .
|
||||
\ 'comments< '.
|
||||
\ 'commentstring< ' .
|
||||
\ 'formatoptions< ' .
|
||||
\ 'indentexpr<'
|
||||
|
||||
if has( 'gui_win32' )
|
||||
\ && !exists( 'b:browsefilter' )
|
||||
let b:browsefilter =
|
||||
\ 'qml files (*.qml)\t*.qml\n' .
|
||||
\ 'All files (*.*)\t*.*\n'
|
||||
endif
|
||||
|
||||
" Set 'comments' to format dashed lists in comments.
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//%s
|
||||
|
||||
setlocal formatoptions-=t
|
||||
setlocal formatoptions+=croql
|
||||
|
||||
let &cpoptions = s:cpoptions_save
|
||||
unlet s:cpoptions_save
|
||||
|
||||
endif
|
||||
@@ -46,7 +46,7 @@ endif
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
|
||||
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','')
|
||||
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','')
|
||||
setlocal suffixesadd=.rb
|
||||
|
||||
if exists("&ofu") && has("ruby")
|
||||
@@ -104,7 +104,7 @@ endfunction
|
||||
|
||||
if !exists('b:ruby_version') && !exists('g:ruby_path') && isdirectory(expand('%:p:h'))
|
||||
let s:version_file = findfile('.ruby-version', '.;')
|
||||
if !empty(s:version_file)
|
||||
if !empty(s:version_file) && filereadable(s:version_file)
|
||||
let b:ruby_version = get(readfile(s:version_file, '', 1), '')
|
||||
if !has_key(g:ruby_version_paths, b:ruby_version)
|
||||
let g:ruby_version_paths[b:ruby_version] = s:query_path(fnamemodify(s:version_file, ':p:h'))
|
||||
@@ -138,7 +138,7 @@ if exists('s:ruby_paths') && stridx(&l:tags, join(map(copy(s:ruby_paths),'v:val.
|
||||
let &l:tags = &tags . ',' . join(map(copy(s:ruby_paths),'v:val."/tags"'),',')
|
||||
endif
|
||||
|
||||
if has("gui_win32") && !exists("b:browsefilter")
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
@@ -209,16 +209,16 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
||||
call s:map('c', '', '<C-R><C-W> <Plug><cword>')
|
||||
call s:map('c', '', '<C-R><C-F> <Plug><cfile>')
|
||||
|
||||
nmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? 'zv' : ''
|
||||
call s:map('n', '<silent>', '<C-]> <SID>c:tag <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', 'g<C-]> <SID>:tjump <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', 'g] <SID>:tselect <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', '<C-W>] <SID>c:stag <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', '<C-W><C-]> <SID>c:stag <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:stjump <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', '<C-W>g] <SID>:stselect <Plug><cword><CR><SID>tagzv')
|
||||
call s:map('n', '<silent>', '<C-W>} <SID>c:ptag <Plug><cword><CR>')
|
||||
call s:map('n', '<silent>', '<C-W>g} <SID>:ptjump <Plug><cword><CR>')
|
||||
cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : ''
|
||||
call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><cword>"<SID>tagzv<CR>')
|
||||
call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><cword>"<CR>')
|
||||
call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><cword>"<CR>')
|
||||
|
||||
call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>')
|
||||
call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>')
|
||||
@@ -361,7 +361,7 @@ function! RubyCursorFile() abort
|
||||
endtry
|
||||
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
|
||||
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
|
||||
let ext = getline('.') =~# '^\s*\%(require\|autoload\)\>' ? '.rb' : ''
|
||||
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
|
||||
if s:synname() ==# 'rubyConstant'
|
||||
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
|
||||
let cfile = substitute(cfile,'::','/','g')
|
||||
@@ -369,7 +369,7 @@ function! RubyCursorFile() abort
|
||||
let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')
|
||||
return tolower(cfile) . '.rb'
|
||||
elseif getline('.') =~# '^\s*require_relative\s*\(["'']\).*\1\s*$'
|
||||
let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . '.rb'
|
||||
let cfile = expand('%:p:h') . '/' . matchstr(getline('.'),'\(["'']\)\zs.\{-\}\ze\1') . ext
|
||||
elseif getline('.') =~# '^\s*\%(require[( ]\|load[( ]\|autoload[( ]:\w\+,\)\s*\%(::\)\=File\.expand_path(\(["'']\)\.\./.*\1,\s*__FILE__)\s*$'
|
||||
let target = matchstr(getline('.'),'\(["'']\)\.\.\zs/.\{-\}\ze\1')
|
||||
let cfile = expand('%:p:h') . target . ext
|
||||
|
||||
@@ -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: Jul 07, 2014
|
||||
" Last Change: January 29, 2015
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
@@ -20,7 +20,7 @@ set cpo&vim
|
||||
" comments, so we'll use that as our default, but make it easy to switch.
|
||||
" This does not affect indentation at all (I tested it with and without
|
||||
" leader), merely whether a leader is inserted by default or not.
|
||||
if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader == 1
|
||||
if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0
|
||||
" Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why,
|
||||
" but without it, */ gets indented one space even if there were no
|
||||
" leaders. I'm fairly sure that's a Vim bug.
|
||||
@@ -37,7 +37,7 @@ silent! setlocal formatoptions+=j
|
||||
" otherwise it's better than nothing.
|
||||
setlocal smartindent nocindent
|
||||
|
||||
if !exists("g:rust_recommended_style") || g:rust_recommended_style == 1
|
||||
if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0
|
||||
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
|
||||
setlocal textwidth=99
|
||||
endif
|
||||
@@ -69,7 +69,7 @@ if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
|
||||
endif
|
||||
endif
|
||||
|
||||
if has('conceal') && exists('g:rust_conceal')
|
||||
if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0
|
||||
let b:rust_set_conceallevel=1
|
||||
setlocal conceallevel=2
|
||||
endif
|
||||
@@ -84,19 +84,35 @@ xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
|
||||
onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
|
||||
onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
|
||||
|
||||
" %-matching. <:> is handy for generics.
|
||||
set matchpairs+=<:>
|
||||
" There are two minor issues with it; (a) comparison operators in expressions,
|
||||
" where a less-than may match a greater-than later on—this is deemed a trivial
|
||||
" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the
|
||||
" highlighting perspective (built into Vim), but the actual % functionality
|
||||
" can be fixed by this use of matchit.vim.
|
||||
let b:match_skip = 's:comment\|string\|rustArrow'
|
||||
source $VIMRUNTIME/macros/matchit.vim
|
||||
|
||||
" Commands {{{1
|
||||
|
||||
" See |:RustRun| for docs
|
||||
command! -nargs=* -complete=file -bang -bar -buffer RustRun call rust#Run(<bang>0, [<f-args>])
|
||||
command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>)
|
||||
|
||||
" See |:RustExpand| for docs
|
||||
command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -bar -buffer RustExpand call rust#Expand(<bang>0, [<f-args>])
|
||||
command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>)
|
||||
|
||||
" See |:RustEmitIr| for docs
|
||||
command! -nargs=* -bar -buffer RustEmitIr call rust#Emit("ir", [<f-args>])
|
||||
command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>)
|
||||
|
||||
" See |:RustEmitAsm| for docs
|
||||
command! -nargs=* -bar -buffer RustEmitAsm call rust#Emit("asm", [<f-args>])
|
||||
command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>)
|
||||
|
||||
" See |:RustPlay| for docs
|
||||
command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
|
||||
|
||||
" See |:RustFmt| for docs
|
||||
command! -buffer RustFmt call rustfmt#Format()
|
||||
|
||||
" Mappings {{{1
|
||||
|
||||
@@ -134,6 +150,7 @@ let b:undo_ftplugin = "
|
||||
\|delcommand RustExpand
|
||||
\|delcommand RustEmitIr
|
||||
\|delcommand RustEmitAsm
|
||||
\|delcommand RustPlay
|
||||
\|nunmap <buffer> <D-r>
|
||||
\|nunmap <buffer> <D-R>
|
||||
\|nunmap <buffer> [[
|
||||
@@ -142,6 +159,8 @@ let b:undo_ftplugin = "
|
||||
\|xunmap <buffer> ]]
|
||||
\|ounmap <buffer> [[
|
||||
\|ounmap <buffer> ]]
|
||||
\|set matchpairs-=<:>
|
||||
\|unlet b:match_skip
|
||||
\"
|
||||
|
||||
" }}}1
|
||||
|
||||
8
ftplugin/swift.vim
Normal file
8
ftplugin/swift.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
|
||||
|
||||
setlocal commentstring=//\ %s
|
||||
" @-@ adds the literal @ to iskeyword for @IBAction and similar
|
||||
setlocal iskeyword+=@-@,#
|
||||
setlocal completefunc=syntaxcomplete#Complete
|
||||
|
||||
endif
|
||||
@@ -8,14 +8,15 @@ if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/html.vim ftplugin/html*.vim ftplugin/html/*.vim
|
||||
unlet! b:did_ftplugin
|
||||
|
||||
setlocal comments=s:{#,ex:#}
|
||||
setlocal formatoptions+=tcqln
|
||||
" setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+
|
||||
|
||||
let b:undo_ftplugin .= "|setl cms< com< fo<"
|
||||
if exists("b:did_ftplugin")
|
||||
let b:undo_ftplugin .= "|setlocal comments< formatoptions<"
|
||||
else
|
||||
let b:undo_ftplugin = "setlocal comments< formatoptions<"
|
||||
endif
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
|
||||
58
indent/ansible.vim
Normal file
58
indent/ansible.vim
Normal file
@@ -0,0 +1,58 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal indentexpr=GetAnsibleIndent(v:lnum)
|
||||
setlocal indentkeys=!^F,o,O,0#,0},0],<:>,-,*<Return>
|
||||
setlocal nosmartindent
|
||||
setlocal expandtab
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal commentstring=#%s
|
||||
setlocal formatoptions=cl
|
||||
" c -> wrap long comments, including #
|
||||
" l -> do not wrap long lines
|
||||
|
||||
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: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: >
|
||||
|
||||
if exists('*GetAnsibleIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
function GetAnsibleIndent(lnum)
|
||||
if a:lnum == 1 || !prevnonblank(a:lnum-1)
|
||||
return 0
|
||||
endif
|
||||
let prevlnum = prevnonblank(a:lnum - 1)
|
||||
let maintain = indent(prevlnum)
|
||||
let increase = maintain + &sw
|
||||
|
||||
let line = getline(prevlnum)
|
||||
if line =~ s:array_entry
|
||||
if line =~ s:named_module_entry
|
||||
return increase
|
||||
else
|
||||
return maintain
|
||||
endif
|
||||
elseif line =~ s:dictionary_entry
|
||||
return increase
|
||||
elseif line =~ s:key_value
|
||||
if line =~ s:scalar_value
|
||||
return increase
|
||||
else
|
||||
return maintain
|
||||
endif
|
||||
else
|
||||
return maintain
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
endif
|
||||
@@ -1,66 +1,50 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
||||
|
||||
" Language: Blade
|
||||
" Author: Barry Deeney <sitemaster16@gmail.com>
|
||||
" Version: 0.1
|
||||
" Description: BLADE indent file based on HTML indentation...
|
||||
" Vim indent file
|
||||
" Language: Blade (Laravel)
|
||||
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
||||
|
||||
" Check if this file has already been loaded
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
|
||||
" Include HTML
|
||||
runtime! indent/html.vim
|
||||
runtime! indent/php.vim
|
||||
silent! unlet b:did_indent
|
||||
|
||||
" What function do we need to use to detect indentation?
|
||||
setlocal indentexpr=BladeIndent()
|
||||
|
||||
" What keys would trigger indentation?
|
||||
setlocal indentkeys=o,O,<Return>,<>>,{,},!^F,0{,0},0),:,!^F,o,O,e,*<Return>,=?>,=<?,=*/
|
||||
|
||||
" THE MAIN INDENT FUNCTION. Return the amount of indent for v:lnum.
|
||||
func! BladeIndent()
|
||||
" What is the current line?
|
||||
let current_line = v:lnum
|
||||
|
||||
" What is the current text?
|
||||
let current_text = tolower(getline(current_line))
|
||||
|
||||
" What was the last non blank line?
|
||||
let previous_line = prevnonblank(current_line)
|
||||
|
||||
" What was the last non blank text?
|
||||
let previous_text = tolower(getline(previous_line))
|
||||
|
||||
" How large are indents??
|
||||
let indent_size = &sw
|
||||
|
||||
" Check if we have a PHPIndent value...
|
||||
let indent = GetPhpIndent()
|
||||
|
||||
" check if we have indent
|
||||
if indent == -1
|
||||
" Check if we have BLADE
|
||||
if current_text =~ '^\s*@' || previous_text =~ '^\s*@'
|
||||
" We need to add to the indent
|
||||
return indent_size * indent(previous_text)
|
||||
endif
|
||||
|
||||
" Check if we have HTML
|
||||
if current_text =~ '^\s*<' || previous_text =~ '^\s*<'
|
||||
" We now give the honors to HtmlIndent()
|
||||
let indent = HtmlIndent()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Give the indent back!
|
||||
return indent
|
||||
endfunc
|
||||
|
||||
" Make sure we store that flag!
|
||||
unlet! b:did_indent
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetBladeIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetBladeIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetBladeIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
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\)'
|
||||
let indent = cindent < indent ? cindent : indent - &sw
|
||||
elseif HtmlIndent() > -1
|
||||
let indent = HtmlIndent()
|
||||
endif
|
||||
let increase = indent + &sw
|
||||
if indent = indent(lnum)
|
||||
let indent = cindent <= indent ? -1 : increase
|
||||
endif
|
||||
|
||||
if line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\)\%(.*\s*@end\)\@!'
|
||||
return increase
|
||||
else
|
||||
return indent
|
||||
endif
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
13
indent/dart.vim
Normal file
13
indent/dart.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal cindent
|
||||
setlocal cinoptions+=j1,J1
|
||||
|
||||
let b:undo_indent = 'setl cin< cino<'
|
||||
|
||||
endif
|
||||
@@ -1,10 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Embedded Elixir
|
||||
" URL: https://github.com/elixir-lang/vim-elixir
|
||||
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Elixir
|
||||
" Maintainer: Carlos Galdino <carloshsgaldino@gmail.com>
|
||||
" Last Change: 2013 Apr 24
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
@@ -13,7 +8,7 @@ let b:did_indent = 1
|
||||
setlocal nosmartindent
|
||||
|
||||
setlocal indentexpr=GetElixirIndent()
|
||||
setlocal indentkeys+=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
|
||||
|
||||
if exists("*GetElixirIndent")
|
||||
finish
|
||||
@@ -22,17 +17,23 @@ endif
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . s:skip_syntax . "'"
|
||||
let s:block_start = 'do\|fn'
|
||||
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
||||
let s:block_end = 'end'
|
||||
let s:symbols_end = '\]\|}'
|
||||
let s:arrow = '^.*->$'
|
||||
let s:pipeline = '^\s*|>.*$'
|
||||
let s:no_colon_before = ':\@<!'
|
||||
let s:no_colon_after = ':\@!'
|
||||
let s:symbols_end = '\]\|}'
|
||||
let s:arrow = '^.*->$'
|
||||
let s:pipeline = '^\s*|>.*$'
|
||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
|
||||
let s:block_start = 'do\|fn'
|
||||
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
||||
let s:block_end = 'end'
|
||||
|
||||
let s:indent_keywords = '\<\%(' . s:block_start . '\|' . s:block_middle . '\)$' . '\|' . s:arrow
|
||||
let s:deindent_keywords = '^\s*\<\%(' . s:block_end . '\|' . s:block_middle . '\)\>' . '\|' . s:arrow
|
||||
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow
|
||||
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
|
||||
|
||||
let s: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_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
|
||||
|
||||
function! GetElixirIndent()
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
@@ -60,20 +61,16 @@ function! GetElixirIndent()
|
||||
let opened_symbol += count(splited_line, '[') - count(splited_line, ']')
|
||||
let opened_symbol += count(splited_line, '{') - count(splited_line, '}')
|
||||
|
||||
let ind += opened_symbol * &sw
|
||||
let ind += (opened_symbol * &sw)
|
||||
|
||||
if last_line =~ '^\s*\(' . s:symbols_end . '\)'
|
||||
if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
if current_line =~ '^\s*\(' . s:symbols_end . '\)'
|
||||
if current_line =~ '^\s*\('.s:symbols_end.'\)'
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
if last_line =~ s:indent_keywords
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
" if line starts with pipeline
|
||||
" and last line contains pipeline(s)
|
||||
" align them
|
||||
@@ -99,11 +96,13 @@ function! GetElixirIndent()
|
||||
endif
|
||||
|
||||
if current_line =~ s:deindent_keywords
|
||||
let bslnum = searchpair( '\<\%(' . s:block_start . '\):\@!\>',
|
||||
\ '\<\%(' . s:block_middle . '\):\@!\>\zs',
|
||||
\ '\<:\@<!' . s:block_end . '\>\zs',
|
||||
let bslnum = searchpair(
|
||||
\ s:pair_start,
|
||||
\ s:pair_middle,
|
||||
\ s:pair_end,
|
||||
\ 'nbW',
|
||||
\ s:block_skip )
|
||||
\ s:block_skip
|
||||
\ )
|
||||
|
||||
let ind = indent(bslnum)
|
||||
endif
|
||||
|
||||
129
indent/elm.vim
Normal file
129
indent/elm.vim
Normal file
@@ -0,0 +1,129 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Haskell
|
||||
" Maintainer: lilydjwg <lilydjwg@gmail.com>
|
||||
" Version: 1.0
|
||||
" References: http://en.wikibooks.org/wiki/Haskell/Indentation
|
||||
" http://book.realworldhaskell.org/read/
|
||||
" See Also: The Align plugin http://www.vim.org/scripts/script.php?script_id=294
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=HaskellIndent()
|
||||
for i in split('0{,:,0#,e', ',')
|
||||
exec "setlocal indentkeys-=" . i
|
||||
endfor
|
||||
setlocal indentkeys+=0=else,0=in,0=where,0),0<bar>
|
||||
setlocal tabstop=8
|
||||
setlocal expandtab
|
||||
|
||||
if !exists('g:Haskell_no_mapping')
|
||||
inoremap <silent> <BS> <C-R>=<SID>HaskellDedent(1)<CR>
|
||||
inoremap <silent> <C-D> <C-R>=<SID>HaskellDedent(0)<CR>
|
||||
endif
|
||||
|
||||
" Only define the functions once.
|
||||
if exists("*HaskellIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:align_map = {
|
||||
\ 'in': '\<let\>',
|
||||
\ '\<else\>': '\<then\>',
|
||||
\ ',': '\v%(\s|\w|^)@<=[[{]%(\s|\w|"|$)@='
|
||||
\ }
|
||||
let s:indent_self = ['=']
|
||||
let s:indent_next = ['let', 'in', 'where', 'do', 'if']
|
||||
let s:indent_if_final = ['=', 'do', '->', 'of', 'where']
|
||||
|
||||
function HaskellIndent()
|
||||
let lnum = v:lnum - 1
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let prevline = getline(lnum)
|
||||
let curline = getline(v:lnum)
|
||||
let curwords = split(curline)
|
||||
if len(curwords) > 0
|
||||
if has_key(s:align_map, curwords[0])
|
||||
let word = s:align_map[curwords[0]]
|
||||
let m = -1
|
||||
let line = v:lnum
|
||||
while m == -1
|
||||
let line -= 1
|
||||
if line <= 0
|
||||
return -1
|
||||
endif
|
||||
let m = match(getline(line), word)
|
||||
endwhile
|
||||
return m
|
||||
elseif index(s:indent_self, curwords[0]) != -1
|
||||
return ind + &sw
|
||||
elseif curwords[0] == '|'
|
||||
return match(prevline, '\v%(\s|\w|^)@<=[|=]%(\s|\w)@=')
|
||||
elseif index([')', '}'], curwords[0]) != -1
|
||||
return ind - &sw
|
||||
elseif curwords[0] == 'where'
|
||||
if prevline =~ '\v^\s+\|%(\s|\w)@='
|
||||
return ind - 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let prevwords = split(prevline)
|
||||
if len(prevwords) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
if prevwords[-1] == 'where' && prevwords[0] == 'module'
|
||||
return 0
|
||||
elseif index(s:indent_if_final, prevwords[-1]) != -1
|
||||
return ind + &sw
|
||||
elseif prevwords[-1] =~ '\v%(\s|\w|^)@<=[[{(]$'
|
||||
return ind + &sw
|
||||
else
|
||||
for word in reverse(prevwords)
|
||||
if index(s:indent_next, word) != -1
|
||||
return match(prevline, '\<'.word.'\>') + len(word) + 1
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if len(curwords) > 0 && curwords[0] == 'where'
|
||||
return ind + &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
function s:HaskellDedent(isbs)
|
||||
if a:isbs && strpart(getline('.'), 0, col('.')-1) !~ '^\s\+$'
|
||||
return "\<BS>"
|
||||
endif
|
||||
|
||||
let curind = indent('.')
|
||||
let line = line('.') - 1
|
||||
while curind > 0 && line > 0
|
||||
let ind = indent(line)
|
||||
if ind >= curind
|
||||
let line -= 1
|
||||
else
|
||||
echomsg curind ind
|
||||
call setline('.', repeat(' ', ind) .
|
||||
\ substitute(getline('.'), '^\s\+', '', ''))
|
||||
return ''
|
||||
endif
|
||||
endwhile
|
||||
return a:isbs ? "\<BS>" : ''
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -92,7 +92,7 @@ function! GetErubyIndent(...)
|
||||
if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
if line !~# '^\s*<%' && line =~# '%>\s*$'
|
||||
if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
if cline =~# '^\s*[-=]\=%>\s*$'
|
||||
|
||||
@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
" Vim indent file
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2012 April 7
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
|
||||
14
indent/glsl.vim
Normal file
14
indent/glsl.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||
|
||||
" Language: OpenGL Shading Language
|
||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal autoindent cindent
|
||||
|
||||
" vim:set sts=2 sw=2 :
|
||||
|
||||
endif
|
||||
104
indent/handlebars.vim
Normal file
104
indent/handlebars.vim
Normal file
@@ -0,0 +1,104 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
" Mustache & Handlebars syntax
|
||||
" Language: Mustache, Handlebars
|
||||
" Maintainer: Juvenn Woo <machese@gmail.com>
|
||||
" Screenshot: http://imgur.com/6F408
|
||||
" Version: 2
|
||||
" Last Change: Oct 10th 2015
|
||||
" Remarks: based on eruby indent plugin by tpope
|
||||
" References:
|
||||
" [Mustache](http://github.com/defunkt/mustache)
|
||||
" [Handlebars](https://github.com/wycats/handlebars.js)
|
||||
" [ctemplate](http://code.google.com/p/google-ctemplate/)
|
||||
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
|
||||
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
|
||||
|
||||
if exists("b:did_indent_hbs")
|
||||
finish
|
||||
endif
|
||||
|
||||
unlet! b:did_indent
|
||||
setlocal indentexpr=
|
||||
|
||||
runtime! indent/html.vim
|
||||
unlet! b:did_indent
|
||||
|
||||
" Force HTML indent to not keep state.
|
||||
let b:html_indent_usestate = 0
|
||||
|
||||
if &l:indentexpr == ''
|
||||
if &l:cindent
|
||||
let &l:indentexpr = 'cindent(v:lnum)'
|
||||
else
|
||||
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||
endif
|
||||
endif
|
||||
let b:handlebars_subtype_indentexpr = &l:indentexpr
|
||||
|
||||
let b:did_indent = 1
|
||||
let b:did_indent_hbs = 1
|
||||
|
||||
setlocal indentexpr=GetHandlebarsIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetHandlebarsIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetHandlebarsIndent(...)
|
||||
" The value of a single shift-width
|
||||
if exists('*shiftwidth')
|
||||
let sw = shiftwidth()
|
||||
else
|
||||
let sw = &sw
|
||||
endif
|
||||
|
||||
if a:0 && a:1 == '.'
|
||||
let v:lnum = line('.')
|
||||
elseif a:0 && a:1 =~ '^\d'
|
||||
let v:lnum = a:1
|
||||
endif
|
||||
let vcol = col('.')
|
||||
call cursor(v:lnum,1)
|
||||
call cursor(v:lnum,vcol)
|
||||
exe "let ind = ".b:handlebars_subtype_indentexpr
|
||||
|
||||
" Workaround for Andy Wokula's HTML indent. This should be removed after
|
||||
" some time, since the newest version is fixed in a different way.
|
||||
if b:handlebars_subtype_indentexpr =~# '^HtmlIndent('
|
||||
\ && exists('b:indent')
|
||||
\ && type(b:indent) == type({})
|
||||
\ && has_key(b:indent, 'lnum')
|
||||
" Force HTML indent to not keep state
|
||||
let b:indent.lnum = -1
|
||||
endif
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let line = getline(lnum)
|
||||
let cline = getline(v:lnum)
|
||||
|
||||
" all indent rules only apply if the block opening/closing
|
||||
" tag is on a separate line
|
||||
|
||||
" indent after block {{#block
|
||||
if line =~# '\v\s*\{\{\#.*\s*'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
" unindent after block close {{/block}}
|
||||
if cline =~# '\v^\s*\{\{\/\S*\}\}\s*'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" unindent {{else}}
|
||||
if cline =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" indent again after {{else}}
|
||||
if line =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -65,6 +65,15 @@ function! GetHaskellIndent()
|
||||
return match(l:prevline, '\S')
|
||||
endif
|
||||
|
||||
if synIDattr(synID(line("."), col("."), 1), "name") == 'haskellBlockComment'
|
||||
for l:c in range(v:lnum - 1, 0, -1)
|
||||
let l:bline = getline(l:c)
|
||||
if l:bline =~ '{-'
|
||||
return 1 + match(l:bline, '{-')
|
||||
endfor
|
||||
return 1
|
||||
endif
|
||||
|
||||
if l:prevline =~ '^\s*$'
|
||||
return 0
|
||||
endif
|
||||
|
||||
16
indent/jinja.vim
Normal file
16
indent/jinja.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Jinja HTML template
|
||||
" Maintainer: Evan Hammer <evan@evanhammer.com>
|
||||
" Last Change: 2013 Jan 26
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use HTML formatting rules.
|
||||
runtime! indent/html.vim
|
||||
|
||||
endif
|
||||
54
indent/kotlin.vim
Normal file
54
indent/kotlin.vim
Normal file
@@ -0,0 +1,54 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Kotlin
|
||||
" Maintainer: Alexander Udalov
|
||||
" Latest Revision: 27 June 2015
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetKotlinIndent()
|
||||
setlocal indentkeys=0},0),!^F,o,O,e,<CR>
|
||||
setlocal autoindent " TODO ?
|
||||
|
||||
" TODO teach it to count bracket balance, etc.
|
||||
function! GetKotlinIndent()
|
||||
if v:lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let prev_num = prevnonblank(v:lnum - 1)
|
||||
let prev = getline(prev_num)
|
||||
let prev_indent = indent(prev_num)
|
||||
let cur = getline(v:lnum)
|
||||
|
||||
let prev_open_paren = prev =~ '^.*(\s*$'
|
||||
let cur_close_paren = cur =~ '^\s*).*$'
|
||||
|
||||
if prev_open_paren && !cur_close_paren
|
||||
return prev_indent + 2 * &shiftwidth
|
||||
endif
|
||||
|
||||
if cur_close_paren && !prev_open_paren
|
||||
return prev_indent - 2 * &shiftwidth
|
||||
endif
|
||||
|
||||
|
||||
let prev_open_brace = prev =~ '^.*\({\|->\)\s*$'
|
||||
let cur_close_brace = cur =~ '^\s*}.*$'
|
||||
|
||||
if prev_open_brace && !cur_close_brace
|
||||
return prev_indent + &shiftwidth
|
||||
endif
|
||||
|
||||
if cur_close_brace && !prev_open_brace
|
||||
return prev_indent - &shiftwidth
|
||||
endif
|
||||
|
||||
return prev_indent
|
||||
endfunction
|
||||
|
||||
endif
|
||||
15
indent/nginx.vim
Normal file
15
indent/nginx.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=
|
||||
|
||||
" cindent actually works for nginx' simple file structure
|
||||
setlocal cindent
|
||||
" Just make sure that the comments are not reset as defs would be.
|
||||
setlocal cinkeys-=0#
|
||||
|
||||
endif
|
||||
146
indent/nim.vim
Normal file
146
indent/nim.vim
Normal file
@@ -0,0 +1,146 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" Some preliminary settings
|
||||
setlocal nolisp " Make sure lisp indenting doesn't supersede us
|
||||
setlocal autoindent " indentexpr isn't much help otherwise
|
||||
|
||||
setlocal indentexpr=GetNimIndent(v:lnum)
|
||||
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetNimIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:FindStartLine(fromln, pattern)
|
||||
let lnum = a:fromln
|
||||
let safechoice = indent(lnum)
|
||||
while getline(lnum) !~ a:pattern
|
||||
if indent(lnum) == 0 || lnum == 1
|
||||
return safechoice
|
||||
endif
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
return indent(lnum)
|
||||
endfunction
|
||||
|
||||
function! GetNimIndent(lnum)
|
||||
" Search backwards for the previous non-empty line.
|
||||
let plnum = prevnonblank(a:lnum - 1)
|
||||
|
||||
if plnum == 0
|
||||
" This is the first non-empty line, use zero indent.
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If the start of the line is in a string don't change the indent.
|
||||
if has('syntax_items') && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$"
|
||||
return -1
|
||||
endif
|
||||
|
||||
let pline = getline(plnum)
|
||||
let cline = getline(a:lnum)
|
||||
let pline_len = strlen(pline)
|
||||
let plindent = indent(plnum)
|
||||
let clindent = indent(a:lnum)
|
||||
|
||||
" Remove any trailing comment from previous line.
|
||||
" Use syntax highlighting attributes when possible.
|
||||
if has('syntax_items')
|
||||
" If the last character in the line is a comment, do a binary search for
|
||||
" the start of the comment. synID() is slow, a linear search would take
|
||||
" too long on a long line.
|
||||
if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$"
|
||||
let min = 1
|
||||
let max = pline_len
|
||||
while min < max
|
||||
let col = (min + max) / 2
|
||||
if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$"
|
||||
let max = col
|
||||
else
|
||||
let min = col + 1
|
||||
endif
|
||||
endwhile
|
||||
let pline = strpart(pline, 0, min - 1)
|
||||
endif
|
||||
else
|
||||
let col = 0
|
||||
while col < pline_len
|
||||
if pline[col] == '#'
|
||||
let pline = strpart(pline, 0, col)
|
||||
break
|
||||
endif
|
||||
let col = col + 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*\(if\|when\|for\|while\|case\|of\|try\)\>'
|
||||
" This is a benign line, do nothing
|
||||
return -1
|
||||
endif
|
||||
|
||||
" If the current line begins with a keyword that lines up with "try"
|
||||
if cline =~ '^\s*\(except\|finally\)\>'
|
||||
let lnum = a:lnum - 1
|
||||
while lnum >= 1
|
||||
if getline(lnum) =~ '^\s*\(try\|except\)\>'
|
||||
let ind = indent(lnum)
|
||||
if ind >= clindent
|
||||
return -1 " indent is already less than this
|
||||
endif
|
||||
return ind " line up with previous try or except
|
||||
endif
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
return -1 " no matching "try"!
|
||||
endif
|
||||
|
||||
" If the current line begins with a header keyword, dedent
|
||||
if cline =~ '^\s*\(elif\|else\)\>'
|
||||
return s:FindStartLine(a:lnum, '^\s*\(if\|when\|elif\|of\)')
|
||||
endif
|
||||
|
||||
if pline =~ ':\s*$'
|
||||
"return s:FindStartLine(plnum, '(^\s*\(if\|when\|else\|elif\|case\|of\|try\|except\|finally\)\>)\|\<do\>') + &sw
|
||||
return s:FindStartLine(plnum, '^\s*\(if\|when\|else\|elif\|for\|while\|case\|of\|try\|except\|finally\)\>') + &sw
|
||||
endif
|
||||
|
||||
if pline =~ '=\s*$'
|
||||
return s:FindStartLine(plnum, '^\s*\(proc\|template\|macro\|iterator\)\>') + &sw
|
||||
endif
|
||||
|
||||
" if we got here, this should be the begging of a multi-line if expression for example
|
||||
if pline =~ '^\s*\(if\|when\|proc\|iterator\|macro\|template\|for\|while\)[^:]*$'
|
||||
return plindent + &sw
|
||||
endif
|
||||
|
||||
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
||||
\ || pline =~ '=\s*\(object\|enum\|tuple\|generic\)'
|
||||
return plindent + &sw
|
||||
endif
|
||||
|
||||
" If the previous line was a stop-execution statement...
|
||||
if pline =~ '^\s*\(break\|continue\|raise\|return\)\>'
|
||||
" See if the user has already dedented
|
||||
if indent(a:lnum) > plindent - &sw
|
||||
" If not, recommend one dedent
|
||||
return plindent - &sw
|
||||
endif
|
||||
" Otherwise, trust the user
|
||||
return -1
|
||||
endif
|
||||
|
||||
return -1
|
||||
|
||||
endfunction
|
||||
|
||||
" vim:sw=2
|
||||
|
||||
|
||||
endif
|
||||
63
indent/qml.vim
Normal file
63
indent/qml.vim
Normal file
@@ -0,0 +1,63 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: QML
|
||||
" Author: Robert Kieffer
|
||||
" URL:
|
||||
" Last Change: 2010-03-27 (Happy Birthday, Dash!)
|
||||
"
|
||||
" Improved JavaScript indent script.
|
||||
|
||||
" Indent script in place for this already?
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetJsIndent()
|
||||
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=*/
|
||||
|
||||
" Only define functions once per session
|
||||
if exists("*GetJsIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Clean up a line of code by removing trailing '//' comments, and trimming
|
||||
" whitespace
|
||||
function! Trim(line)
|
||||
return substitute(substitute(a:line, '// .*', '', ''), '^\s*\|\s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! GetJsIndent()
|
||||
let num = v:lnum
|
||||
let line = Trim(getline(num))
|
||||
|
||||
let pnum = prevnonblank(num - 1)
|
||||
if pnum == 0
|
||||
return 0
|
||||
endif
|
||||
let pline = Trim(getline(pnum))
|
||||
|
||||
let ind = indent(pnum)
|
||||
|
||||
" bracket/brace/paren blocks
|
||||
if pline =~ '[{[(]$'
|
||||
let ind += &sw
|
||||
endif
|
||||
if line =~ '^[}\])]'
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
" '/*' comments
|
||||
if pline =~ '^/\*.*\*/'
|
||||
" no indent for single-line form
|
||||
elseif pline =~ '^/\*'
|
||||
let ind += 1
|
||||
elseif pline =~ '^\*/'
|
||||
let ind -= 1
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -123,6 +123,13 @@ function GetRustIndent(lnum)
|
||||
let prevlinenum = prevnonblank(prevlinenum - 1)
|
||||
let prevline = s:get_line_trimmed(prevlinenum)
|
||||
endwhile
|
||||
|
||||
" Handle where clauses nicely: subsequent values should line up nicely.
|
||||
if prevline[len(prevline) - 1] == ","
|
||||
\ && prevline =~# '^\s*where\s'
|
||||
return indent(prevlinenum) + 6
|
||||
endif
|
||||
|
||||
if prevline[len(prevline) - 1] == ","
|
||||
\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'
|
||||
\ && prevline !~ '^\s*fn\s'
|
||||
|
||||
@@ -119,7 +119,7 @@ function! GetStylusIndent()
|
||||
|
||||
" if group !~? 'css.*' && line =~? ')\s*$' " match user functions
|
||||
" return increase
|
||||
if group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudoClass|cssPseudoClassId|stylusId|stylusClass)$'
|
||||
if group =~? '\v^%(cssTagName|cssClassName|cssIdentifier|cssSelectorOp|cssSelectorOp2|cssBraces|cssAttributeSelector|cssPseudo|stylusId|stylusClass)$'
|
||||
return increase
|
||||
elseif (group == 'stylusUserFunction') && (indent(lnum) == '0') " mixin definition
|
||||
return increase
|
||||
|
||||
241
indent/swift.vim
241
indent/swift.vim
@@ -1,19 +1,242 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
|
||||
|
||||
" Language: Swift<https://developer.apple.com/swift/>
|
||||
" Maintainer: toyama satoshi <toyamarinyon@gmail.com>
|
||||
" URL: http://github.com/toyamarinyon/vim-swift
|
||||
" License: GPL
|
||||
" File: swift.vim
|
||||
" Author: Keith Smiley
|
||||
" Description: The indent file for Swift
|
||||
" Last Modified: December 05, 2014
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" C indenting is built-in, thus this is very simple
|
||||
setlocal cindent
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:undo_indent = "setl cin<"
|
||||
setlocal nosmartindent
|
||||
setlocal indentkeys-=e
|
||||
setlocal indentkeys+=0]
|
||||
setlocal indentexpr=SwiftIndent()
|
||||
|
||||
function! s:NumberOfMatches(char, string, index)
|
||||
let instances = 0
|
||||
let i = 0
|
||||
while i < strlen(a:string)
|
||||
if a:string[i] == a:char && !s:IsExcludedFromIndentAtPosition(a:index, i + 1)
|
||||
let instances += 1
|
||||
endif
|
||||
|
||||
let i += 1
|
||||
endwhile
|
||||
|
||||
return instances
|
||||
endfunction
|
||||
|
||||
function! s:SyntaxNameAtPosition(line, column)
|
||||
return synIDattr(synID(a:line, a:column, 0), "name")
|
||||
endfunction
|
||||
|
||||
function! s:SyntaxName()
|
||||
return s:SyntaxNameAtPosition(line("."), col("."))
|
||||
endfunction
|
||||
|
||||
function! s:IsExcludedFromIndentAtPosition(line, column)
|
||||
let name = s:SyntaxNameAtPosition(a:line, a:column)
|
||||
return name ==# "swiftComment" || name ==# "swiftString"
|
||||
endfunction
|
||||
|
||||
function! s:IsExcludedFromIndent()
|
||||
return s:SyntaxName() ==# "swiftComment" || s:SyntaxName() ==# "swiftString"
|
||||
endfunction
|
||||
|
||||
function! s:IsCommentLine(lnum)
|
||||
return synIDattr(synID(a:lnum,
|
||||
\ match(getline(a:lnum), "\S") + 1, 0), "name")
|
||||
\ ==# "swiftComment"
|
||||
endfunction
|
||||
|
||||
function! SwiftIndent(...)
|
||||
let clnum = a:0 ? a:1 : v:lnum
|
||||
|
||||
let line = getline(clnum)
|
||||
let previousNum = prevnonblank(clnum - 1)
|
||||
while s:IsCommentLine(previousNum) != 0
|
||||
let previousNum = prevnonblank(previousNum - 1)
|
||||
endwhile
|
||||
|
||||
let previous = getline(previousNum)
|
||||
let cindent = cindent(clnum)
|
||||
let previousIndent = indent(previousNum)
|
||||
|
||||
let numOpenParens = s:NumberOfMatches("(", previous, previousNum)
|
||||
let numCloseParens = s:NumberOfMatches(")", previous, previousNum)
|
||||
let numOpenBrackets = s:NumberOfMatches("{", previous, previousNum)
|
||||
let numCloseBrackets = s:NumberOfMatches("}", previous, previousNum)
|
||||
|
||||
let currentOpenBrackets = s:NumberOfMatches("{", line, clnum)
|
||||
let currentCloseBrackets = s:NumberOfMatches("}", line, clnum)
|
||||
|
||||
let numOpenSquare = s:NumberOfMatches("[", previous, previousNum)
|
||||
let numCloseSquare = s:NumberOfMatches("]", previous, previousNum)
|
||||
|
||||
let currentCloseSquare = s:NumberOfMatches("]", line, clnum)
|
||||
if numOpenSquare > numCloseSquare && currentCloseSquare < 1
|
||||
return previousIndent + shiftwidth()
|
||||
endif
|
||||
|
||||
if currentCloseSquare > 0 && line !~ '\v\[.*\]'
|
||||
let column = col(".")
|
||||
call cursor(line("."), 1)
|
||||
let openingSquare = searchpair("\\[", "", "\\]", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line("."), column)
|
||||
|
||||
if openingSquare == 0
|
||||
return -1
|
||||
endif
|
||||
|
||||
" - Line starts with closing square, indent as opening square
|
||||
if line =~ '\v^\s*]'
|
||||
return indent(openingSquare)
|
||||
endif
|
||||
|
||||
" - Line contains closing square and more, indent a level above opening
|
||||
return indent(openingSquare) + shiftwidth()
|
||||
endif
|
||||
|
||||
if line =~ ":$"
|
||||
let switch = search("switch", "bWn")
|
||||
return indent(switch)
|
||||
elseif previous =~ ":$"
|
||||
return previousIndent + shiftwidth()
|
||||
endif
|
||||
|
||||
if numOpenParens == numCloseParens
|
||||
if numOpenBrackets > numCloseBrackets
|
||||
if currentCloseBrackets > currentOpenBrackets || line =~ "\\v^\\s*}"
|
||||
let column = col(".")
|
||||
call cursor(line("."), 1)
|
||||
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line("."), column)
|
||||
if openingBracket == 0
|
||||
return -1
|
||||
else
|
||||
return indent(openingBracket)
|
||||
endif
|
||||
endif
|
||||
|
||||
return previousIndent + shiftwidth()
|
||||
elseif previous =~ "}.*{"
|
||||
if line =~ "\\v^\\s*}"
|
||||
return previousIndent
|
||||
endif
|
||||
|
||||
return previousIndent + shiftwidth()
|
||||
elseif line =~ "}.*{"
|
||||
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
|
||||
return indent(openingBracket)
|
||||
elseif currentCloseBrackets > currentOpenBrackets
|
||||
let column = col(".")
|
||||
call cursor(line("."), 1)
|
||||
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line("."), column)
|
||||
|
||||
let bracketLine = getline(openingBracket)
|
||||
|
||||
let numOpenParensBracketLine = s:NumberOfMatches("(", bracketLine, openingBracket)
|
||||
let numCloseParensBracketLine = s:NumberOfMatches(")", bracketLine, openingBracket)
|
||||
if numCloseParensBracketLine > numOpenParensBracketLine
|
||||
let line = line(".")
|
||||
let column = col(".")
|
||||
call cursor(openingParen, column)
|
||||
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line, column)
|
||||
return indent(openingParen)
|
||||
endif
|
||||
return indent(openingBracket)
|
||||
else
|
||||
" - Current line is blank, and the user presses 'o'
|
||||
return previousIndent
|
||||
endif
|
||||
endif
|
||||
|
||||
if numCloseParens > 0
|
||||
if currentOpenBrackets > 0 || currentCloseBrackets > 0
|
||||
if currentOpenBrackets > 0
|
||||
if numOpenBrackets > numCloseBrackets
|
||||
return previousIndent + shiftwidth()
|
||||
endif
|
||||
|
||||
if line =~ "}.*{"
|
||||
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
|
||||
return indent(openingBracket)
|
||||
endif
|
||||
|
||||
if numCloseParens > numOpenParens
|
||||
let line = line(".")
|
||||
let column = col(".")
|
||||
call cursor(line - 1, column)
|
||||
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line, column)
|
||||
return indent(openingParen)
|
||||
endif
|
||||
|
||||
return previousIndent
|
||||
endif
|
||||
|
||||
if currentCloseBrackets > 0
|
||||
let openingBracket = searchpair("{", "", "}", "bWn", "s:IsExcludedFromIndent()")
|
||||
return indent(openingBracket)
|
||||
endif
|
||||
|
||||
return cindent
|
||||
endif
|
||||
|
||||
if numCloseParens < numOpenParens
|
||||
if numOpenBrackets > numCloseBrackets
|
||||
return previousIndent + shiftwidth()
|
||||
endif
|
||||
|
||||
let previousParen = match(previous, "(")
|
||||
return indent(previousParen) + shiftwidth()
|
||||
endif
|
||||
|
||||
if numOpenBrackets > numCloseBrackets
|
||||
let line = line(".")
|
||||
let column = col(".")
|
||||
call cursor(previousNum, column)
|
||||
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line, column)
|
||||
return indent(openingParen) + shiftwidth()
|
||||
endif
|
||||
|
||||
" - Previous line has close then open braces, indent previous + 1 'sw'
|
||||
if previous =~ "}.*{"
|
||||
return previousIndent + shiftwidth()
|
||||
endif
|
||||
|
||||
let line = line(".")
|
||||
let column = col(".")
|
||||
call cursor(previousNum, column)
|
||||
let openingParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
|
||||
call cursor(line, column)
|
||||
|
||||
return indent(openingParen)
|
||||
endif
|
||||
|
||||
" - Line above has (unmatched) open paren, next line needs indent
|
||||
if numOpenParens > 0
|
||||
let savePosition = getcurpos()
|
||||
" Must be at EOL because open paren has to be above (left of) the cursor
|
||||
call cursor(previousNum, col("$"))
|
||||
let previousParen = searchpair("(", "", ")", "bWn", "s:IsExcludedFromIndent()")
|
||||
call setpos(".", savePosition)
|
||||
return indent(previousParen) + shiftwidth()
|
||||
endif
|
||||
|
||||
return cindent
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,93 +1,505 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1
|
||||
|
||||
" Vim indent file, taken from indent/java.vim
|
||||
" Language: Typescript
|
||||
" Maintainer: None! Wanna improve this?
|
||||
" Last Change: 2015 Mar 07
|
||||
" Vim indent file
|
||||
" Language: Typescript
|
||||
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
|
||||
|
||||
if get(g:, 'typescript_indent_disable')
|
||||
finish
|
||||
endif
|
||||
" 0. Initialization {{{1
|
||||
" =================
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" Use javascript cindent options
|
||||
setlocal cindent cinoptions& cinoptions+=j1,J1
|
||||
setlocal indentkeys&
|
||||
setlocal nosmartindent
|
||||
|
||||
" Load typescript indent function
|
||||
" Now, set up our indentation expression and keys that trigger it.
|
||||
setlocal indentexpr=GetTypescriptIndent()
|
||||
setlocal formatexpr=Fixedgq(v:lnum,v:count)
|
||||
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
|
||||
|
||||
let b:undo_indent = "setl cin< cino< indentkeys< indentexpr<"
|
||||
|
||||
" Only define the function once
|
||||
" Only define the function once.
|
||||
if exists("*GetTypescriptIndent")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
|
||||
" Make sure we have vim capabilities
|
||||
let s:keepcpo = &cpo
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! TypescriptPrevNonBlankOrComment(lnum)
|
||||
let pnum = prevnonblank(a:lnum)
|
||||
" skip any comments (either `//`, `/*` or `*`)
|
||||
while getline(pnum) =~ '^\s*\(\/\/\|\/\*\|\*\)'
|
||||
let pnum = prevnonblank(pnum-1)
|
||||
endwhile
|
||||
return pnum
|
||||
" 1. Variables {{{1
|
||||
" ============
|
||||
|
||||
let s:ts_keywords = '^\s*\(break\|case\|catch\|continue\|debugger\|default\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)'
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let s:syng_strcom = 'string\|regex\|comment\c'
|
||||
|
||||
" Regex of syntax group names that are strings.
|
||||
let s:syng_string = 'regex\c'
|
||||
|
||||
" 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'
|
||||
|
||||
" 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: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
|
||||
|
||||
let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term
|
||||
|
||||
" Regex that defines blocks.
|
||||
let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
|
||||
|
||||
let s:var_stmt = '^\s*var'
|
||||
|
||||
let s:comma_first = '^\s*,'
|
||||
let s:comma_last = ',\s*$'
|
||||
|
||||
let s:ternary = '^\s\+[?|:]'
|
||||
let s:ternary_q = '^\s\+?'
|
||||
|
||||
" 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
|
||||
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
|
||||
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
|
||||
|
||||
" 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 line =~ '/\*'
|
||||
if in_block
|
||||
let in_block = 0
|
||||
else
|
||||
break
|
||||
endif
|
||||
elseif !in_block && line =~ '\*/'
|
||||
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)
|
||||
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
|
||||
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
|
||||
let msl = lnum
|
||||
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
|
||||
endif
|
||||
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 ts keyword
|
||||
if (line =~ s:ts_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 ts 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) - &sw
|
||||
else
|
||||
return indent(lvar) + &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)
|
||||
while pos != -1
|
||||
if !s:IsInStringOrComment(a:lnum, pos + 1)
|
||||
let idx = stridx('(){}[]', 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)
|
||||
endwhile
|
||||
return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
|
||||
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. GetTypescriptIndent Function {{{1
|
||||
" =========================
|
||||
|
||||
function GetTypescriptIndent()
|
||||
" 3.1. Setup {{{2
|
||||
" ----------
|
||||
|
||||
" default value: trust cindent
|
||||
let ind = cindent(v:lnum)
|
||||
" Set up variables for restoring position in file. Could use v:lnum here.
|
||||
let vcol = col('.')
|
||||
|
||||
if getline(v:lnum) =~ '^\s*[{}\*]'
|
||||
return ind
|
||||
endif
|
||||
" 3.2. Work on the current line {{{2
|
||||
" -----------------------------
|
||||
|
||||
" The last non-empty line
|
||||
let prev = TypescriptPrevNonBlankOrComment(v:lnum-1)
|
||||
let ind = -1
|
||||
" Get the current line.
|
||||
let line = getline(v:lnum)
|
||||
" previous nonblank line number
|
||||
let prevline = prevnonblank(v:lnum - 1)
|
||||
|
||||
" Check if the previous line consists of a single `<variable> : <type>;`
|
||||
" declaration (e.g. in interface definitions)
|
||||
if getline(prev) =~ '^\s*\w\+\s*:[^{]\+;\s*$'
|
||||
return indent(prev)
|
||||
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)
|
||||
|
||||
" If a variable was declared and the semicolon omitted, do not indent
|
||||
" the next line
|
||||
if getline(prev) =~ '^\s*var\s\+\w\+'
|
||||
return indent(prev)
|
||||
endif
|
||||
let lvar = s:InMultiVarStatement(v:lnum)
|
||||
if lvar
|
||||
let prevline_contents = s:RemoveTrailingComments(getline(prevline))
|
||||
|
||||
" Try to find out whether the last `}` ended a `<variable> : {` block
|
||||
if getline(prev) =~ '};\s*$'
|
||||
" jump to matching `{` bracket
|
||||
call cursor(prev, 1)
|
||||
silent normal %
|
||||
|
||||
" See if current line is type annotation without closing ';' but open
|
||||
" `{` bracket
|
||||
let lnum = line('.')
|
||||
if getline(lnum) =~ '^\s*\w\+\s*:[^;]\+{'
|
||||
let ind = indent(lnum)
|
||||
" 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) + &sw
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind
|
||||
|
||||
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) - &sw
|
||||
endif
|
||||
|
||||
if (line =~ s:ternary)
|
||||
if (getline(prevline) =~ s:ternary_q)
|
||||
return indent(prevline)
|
||||
else
|
||||
return indent(prevline) + &sw
|
||||
endif
|
||||
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)
|
||||
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
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Set up variables for current line.
|
||||
let line = getline(lnum)
|
||||
let ind = indent(lnum)
|
||||
|
||||
" If the previous line ended with a block opening, add a level of indent.
|
||||
if s:Match(lnum, s:block_regex)
|
||||
return indent(s:GetMSL(lnum, 0)) + &sw
|
||||
endif
|
||||
|
||||
" 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('$')
|
||||
return ind + &sw
|
||||
else
|
||||
return virtcol('.')
|
||||
endif
|
||||
elseif counts[1] == '1' || counts[2] == '1'
|
||||
return ind + &sw
|
||||
else
|
||||
call cursor(v:lnum, vcol)
|
||||
end
|
||||
endif
|
||||
|
||||
" 3.4. Work on the MSL line. {{{2
|
||||
" --------------------------
|
||||
|
||||
let ind_con = ind
|
||||
let ind = s:IndentWithContinuation(lnum, ind_con, &sw)
|
||||
|
||||
" }}}2
|
||||
"
|
||||
"
|
||||
let ols = s:InOneLineScope(lnum)
|
||||
if ols > 0
|
||||
let ind = ind + &sw
|
||||
else
|
||||
let ols = s:ExitingOneLineScope(lnum)
|
||||
while ols > 0 && ind > 0
|
||||
let ind = ind - &sw
|
||||
let ols = s:InOneLineScope(ols - 1)
|
||||
endwhile
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
" Restore compatibility mode
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
" }}}1
|
||||
|
||||
" vim: et
|
||||
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
|
||||
|
||||
90
syntax/ansible.vim
Normal file
90
syntax/ansible.vim
Normal file
@@ -0,0 +1,90 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Ansible YAML/Jinja templates
|
||||
" Maintainer: Dave Honneffer <pearofducks@gmail.com>
|
||||
" Last Change: 2015.09.06
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'yaml'
|
||||
endif
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
runtime! syntax/yaml.vim
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
syntax include @Yaml syntax/yaml.vim
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
syntax include @Jinja syntax/jinja2.vim
|
||||
|
||||
" Jinja
|
||||
" ================================
|
||||
|
||||
syn cluster jinjaSLSBlocks add=jinjaTagBlock,jinjaVarBlock,jinjaComment
|
||||
" https://github.com/mitsuhiko/jinja2/blob/6b7c0c23/ext/Vim/jinja.vim
|
||||
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks
|
||||
syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment,@jinjaSLSBlocks
|
||||
syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,@jinjaSLSBlocks
|
||||
highlight link jinjaVariable Constant
|
||||
highlight link jinjaVarDelim Delimiter
|
||||
|
||||
" YAML
|
||||
" ================================
|
||||
|
||||
" Reset some YAML to plain styling
|
||||
" the number 80 in Ansible isn't any more important than the word root
|
||||
highlight link yamlInteger NONE
|
||||
highlight link yamlBool NONE
|
||||
highlight link yamlFlowString NONE
|
||||
" but it does make sense we visualize quotes easily
|
||||
highlight link yamlFlowStringDelimiter Delimiter
|
||||
|
||||
fun! s:attribute_highlight(attributes)
|
||||
if a:attributes =~ 'a'
|
||||
syn match ansible_attributes "\v\w+\=" containedin=yamlPlainScalar
|
||||
else
|
||||
syn match ansible_attributes "\v^\s*\w+\=" containedin=yamlPlainScalar
|
||||
endif
|
||||
if a:attributes =~ 'n'
|
||||
highlight link ansible_attributes NONE
|
||||
elseif a:attributes =~ 'd'
|
||||
highlight link ansible_attributes Comment
|
||||
else
|
||||
highlight link ansible_attributes Structure
|
||||
endif
|
||||
endfun
|
||||
|
||||
if exists("g:ansible_attribute_highlight")
|
||||
call s:attribute_highlight(g:ansible_attribute_highlight)
|
||||
else
|
||||
call s:attribute_highlight('ad')
|
||||
endif
|
||||
|
||||
if exists("g:ansible_name_highlight")
|
||||
syn keyword ansible_name name containedin=yamlBlockMappingKey contained
|
||||
if g:ansible_name_highlight =~ 'd'
|
||||
highlight link ansible_name Comment
|
||||
else
|
||||
highlight link ansible_name Underlined
|
||||
endif
|
||||
endif
|
||||
|
||||
syn keyword ansible_debug_keywords debug containedin=yamlBlockMappingKey contained
|
||||
highlight link ansible_debug_keywords Debug
|
||||
|
||||
syn match ansible_with_keywords "\vwith_.+" containedin=yamlBlockMappingKey contained
|
||||
syn keyword ansible_special_keywords include until retries delay when only_if become become_user block rescue always notify containedin=yamlBlockMappingKey contained
|
||||
highlight link ansible_with_keywords Statement
|
||||
highlight link ansible_special_keywords Statement
|
||||
|
||||
let b:current_syntax = "ansible"
|
||||
|
||||
endif
|
||||
35
syntax/ansible_hosts.vim
Normal file
35
syntax/ansible_hosts.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Ansible hosts files
|
||||
" Maintainer: Dave Honneffer <pearofducks@gmail.com>
|
||||
" Last Change: 2015.09.23
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
syn match hostsFirstWord "\v^\S+"
|
||||
syn match hostsAttributes "\v\S*\="
|
||||
syn region hostsHeader start="\v^\s*\[" end="\v\]"
|
||||
syn keyword hostsHeaderSpecials children vars containedin=hostsHeader contained
|
||||
syn match hostsComment "\v^[#;].*$"
|
||||
|
||||
highlight link hostsFirstWord Label
|
||||
highlight link hostsHeader Define
|
||||
highlight link hostsComment Comment
|
||||
highlight link hostsHeaderSpecials Identifier
|
||||
highlight link hostsAttributes Structure
|
||||
|
||||
if exists("g:ansible_attribute_highlight")
|
||||
if g:ansible_attribute_highlight =~ 'n'
|
||||
highlight link hostsAttributes NONE
|
||||
elseif g:ansible_attribute_highlight =~ 'd'
|
||||
highlight link hostsAttributes Comment
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:current_syntax = "ansible_hosts"
|
||||
|
||||
endif
|
||||
31
syntax/ansible_template.vim
Normal file
31
syntax/ansible_template.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Ansible YAML/Jinja templates
|
||||
" Maintainer: Dave Honneffer <pearofducks@gmail.com>
|
||||
" Last Change: 2015.09.06
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'jinja2'
|
||||
endif
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
runtime! syntax/jinja2.vim
|
||||
|
||||
if exists("g:ansible_extra_syntaxes")
|
||||
let s:extra_syntax = split(g:ansible_extra_syntaxes)
|
||||
for syntax_name in s:extra_syntax
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
execute 'runtime!' "syntax/" . syntax_name
|
||||
endfor
|
||||
endif
|
||||
|
||||
let b:current_syntax = "ansible_template"
|
||||
|
||||
endif
|
||||
@@ -1,45 +1,49 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
||||
|
||||
" Language: Blade
|
||||
" Vim syntax file
|
||||
" Language: Blade (Laravel)
|
||||
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
||||
" URL: https://github.com/xsbeats/vim-blade
|
||||
" License: DBAD
|
||||
" Filenames: *.blade.php
|
||||
|
||||
" Check if our syntax is already loaded
|
||||
if exists('b:current_syntax') && b:current_syntax == 'blade'
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Include PHP
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'blade'
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet! b:current_syntax
|
||||
runtime! syntax/php.vim
|
||||
silent! unlet b:current_syntax
|
||||
unlet! b:current_syntax
|
||||
|
||||
" Echos
|
||||
syn region bladeUnescapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{!!/ end=/!!}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
|
||||
syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{\@!/ end=/}}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
|
||||
syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{{\@!/ end=/}}}/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
|
||||
syn case match
|
||||
syn clear htmlError
|
||||
|
||||
" Structures
|
||||
syn match bladeStructure /\s*@\(else\|empty\|endfor\|endforeach\|endforelse\|endif\|endpush\|endsection\|endunless\|endwhile\|overwrite\|show\|stop\)\>/
|
||||
syn match bladeStructure /\s*@\(append\|choice\|each\|elseif\|extends\|for\|foreach\|forelse\|if\|include\|lang\|push\|section\|stack\|unless\|while\|yield\|\)\>\s*/ nextgroup=bladeParens
|
||||
syn region bladeParens matchgroup=bladeParen start=/(/ end=/)/ contained contains=@bladeAll,@phpClTop
|
||||
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
|
||||
|
||||
" Comments
|
||||
syn region bladeComments start=/\s*{{--/ end=/--}}/ contains=bladeComment keepend
|
||||
syn match bladeComment /.*/ contained containedin=bladeComments
|
||||
syn keyword bladeKeyword @if @elseif @foreach @forelse @for @while @can @include @each @inject @extends @section @unless nextgroup=bladePhpParenBlock skipwhite containedin=ALLBUT,@bladeExempt
|
||||
syn keyword bladeKeyword @else @endif @endunless @endfor @endforeach @empty @endforelse @endwhile @endcan @stop @append @endsection containedin=ALLBUT,@bladeExempt
|
||||
|
||||
" Clusters
|
||||
syn cluster bladeAll contains=bladeStructure,bladeParens
|
||||
syn region bladePhpParenBlock matchgroup=bladeDelimiter start="\s*(" end=")" contains=@bladePhp,bladePhpParenBlock skipwhite contained
|
||||
|
||||
" Highlighting
|
||||
syn cluster bladePhp contains=@phpClTop
|
||||
syn cluster bladeExempt contains=bladeComment,@htmlTop
|
||||
|
||||
syn keyword bladeTodo todo fixme xxx contained
|
||||
|
||||
hi def link bladeDelimiter PreProc
|
||||
hi def link bladeComment Comment
|
||||
hi def link bladeEchoDelim Delimiter
|
||||
hi def link bladeParen Delimiter
|
||||
hi def link bladeStructure Keyword
|
||||
hi def link bladeTodo Todo
|
||||
hi def link bladeKeyword Statement
|
||||
|
||||
let b:current_syntax = 'blade'
|
||||
|
||||
if !exists('b:current_syntax')
|
||||
let b:current_syntax = 'blade'
|
||||
if exists('main_syntax') && main_syntax == 'blade'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -73,7 +73,7 @@ syntax match clojureKeyword "\v<:{1,2}%([^ \n\r\t()\[\]{}";@^`~\\%/]+/)*[^ \n\r\
|
||||
|
||||
syntax match clojureStringEscape "\v\\%([\\btnfr"]|u\x{4}|[0-3]\o{2}|\o{1,2})" contained
|
||||
|
||||
syntax region clojureString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell
|
||||
syntax region clojureString matchgroup=clojureStringDelimiter start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell
|
||||
|
||||
syntax match clojureCharacter "\\."
|
||||
syntax match clojureCharacter "\\o\%([0-3]\o\{2\}\|\o\{1,2\}\)"
|
||||
@@ -156,9 +156,9 @@ syntax match clojureComment "#!.*$"
|
||||
" Generated from https://github.com/guns/vim-clojure-static/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj
|
||||
syntax cluster clojureTop contains=@Spell,clojureAnonArg,clojureBoolean,clojureCharacter,clojureComment,clojureCond,clojureConstant,clojureDefine,clojureDeref,clojureDispatch,clojureError,clojureException,clojureFunc,clojureKeyword,clojureMacro,clojureMap,clojureMeta,clojureNumber,clojureQuote,clojureRegexp,clojureRepeat,clojureSexp,clojureSpecial,clojureString,clojureSymbol,clojureUnquote,clojureVarArg,clojureVariable,clojureVector
|
||||
|
||||
syntax region clojureSexp matchgroup=clojureParen start="(" matchgroup=clojureParen end=")" contains=@clojureTop fold
|
||||
syntax region clojureVector matchgroup=clojureParen start="\[" matchgroup=clojureParen end="]" contains=@clojureTop fold
|
||||
syntax region clojureMap matchgroup=clojureParen start="{" matchgroup=clojureParen end="}" contains=@clojureTop fold
|
||||
syntax region clojureSexp matchgroup=clojureParen start="(" end=")" contains=@clojureTop fold
|
||||
syntax region clojureVector matchgroup=clojureParen start="\[" end="]" contains=@clojureTop fold
|
||||
syntax region clojureMap matchgroup=clojureParen start="{" end="}" contains=@clojureTop fold
|
||||
|
||||
" Highlight superfluous closing parens, brackets and braces.
|
||||
syntax match clojureError "]\|}\|)"
|
||||
@@ -171,6 +171,7 @@ highlight default link clojureCharacter Character
|
||||
highlight default link clojureKeyword Keyword
|
||||
highlight default link clojureNumber Number
|
||||
highlight default link clojureString String
|
||||
highlight default link clojureStringDelimiter String
|
||||
highlight default link clojureStringEscape Character
|
||||
|
||||
highlight default link clojureRegexp Constant
|
||||
|
||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c/c++') == -1
|
||||
" Language: C++
|
||||
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
|
||||
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
|
||||
" Last Change: 2015 Mar 1
|
||||
" Last Change: 2015 Sep 23
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
@@ -25,7 +25,8 @@ endif
|
||||
" C++ extensions
|
||||
syn keyword cppStatement new delete this friend using
|
||||
syn keyword cppAccess public protected private
|
||||
syn keyword cppType inline virtual explicit export bool wchar_t
|
||||
syn keyword cppModifier inline virtual explicit export
|
||||
syn keyword cppType bool wchar_t
|
||||
syn keyword cppExceptions throw try catch
|
||||
syn keyword cppOperator operator typeid
|
||||
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
|
||||
@@ -38,7 +39,8 @@ syn keyword cppConstant __cplusplus
|
||||
|
||||
" C++ 11 extensions
|
||||
if !exists("cpp_no_cpp11")
|
||||
syn keyword cppType override final
|
||||
syn keyword cppModifier override final
|
||||
syn keyword cppType nullptr_t
|
||||
syn keyword cppExceptions noexcept
|
||||
syn keyword cppStorageClass constexpr decltype thread_local
|
||||
syn keyword cppConstant nullptr
|
||||
@@ -51,6 +53,11 @@ if !exists("cpp_no_cpp11")
|
||||
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
|
||||
endif
|
||||
|
||||
" C++ 14 extensions
|
||||
if !exists("cpp_no_cpp14")
|
||||
syn match cppNumber display "\<0b[01]\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
endif
|
||||
|
||||
" The minimum and maximum operators in GNU C++
|
||||
syn match cppMinMax "[<>]?"
|
||||
|
||||
@@ -67,6 +74,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
||||
HiLink cppExceptions Exception
|
||||
HiLink cppOperator Operator
|
||||
HiLink cppStatement Statement
|
||||
HiLink cppModifier Type
|
||||
HiLink cppType Type
|
||||
HiLink cppStorageClass StorageClass
|
||||
HiLink cppStructure Structure
|
||||
@@ -74,6 +82,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
||||
HiLink cppConstant Constant
|
||||
HiLink cppRawStringDelimiter Delimiter
|
||||
HiLink cppRawString String
|
||||
HiLink cppNumber Number
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
||||
134
syntax/cql.vim
Normal file
134
syntax/cql.vim
Normal file
@@ -0,0 +1,134 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cql') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: cql
|
||||
" Maintainer: Eric Lubow <eric@lubow.org
|
||||
" Filenames: *.cql
|
||||
" URL: https://github.com/elubow/cql-vim
|
||||
" Note:
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Always ignore case
|
||||
syn case ignore
|
||||
|
||||
" General keywords which don't fall into other categories
|
||||
syn keyword cqlKeyword apply and batch
|
||||
syn keyword cqlKeyword column columnfamily create delete drop
|
||||
syn keyword cqlKeyword family first from
|
||||
syn keyword cqlKeyword in index insert into
|
||||
syn keyword cqlKeyword limit key keyspace
|
||||
syn keyword cqlKeyword on or primary reversed
|
||||
syn keyword cqlKeyword select set truncate
|
||||
syn keyword cqlKeyword where with update use using values
|
||||
|
||||
" CQL 3 additions
|
||||
syn keyword cqlKeyword table order by type if exists not frozen
|
||||
|
||||
|
||||
" Column family/table options
|
||||
syn keyword cqlKeyword comparator key_cache_size row_cache_size read_repair_chance
|
||||
syn keyword cqlKeyword gc_grace_seconds default_validation min_compaction_threshold
|
||||
syn keyword cqlKeyword max_compaction_threshold row_cache_save_period_in_seconds
|
||||
syn keyword cqlKeyword key_cache_save_period_in_seconds memtable_flush_after_mins
|
||||
syn keyword cqlKeyword memtable_throughput_in_mb memtable_operations_in_millions replication_on_write
|
||||
syn keyword cqlKeyword replication_on_write default_validation_class key_validation_class
|
||||
syn keyword cqlKeyword rows_cached row_cache_save_period row_cache_keys_to_save keys_cached
|
||||
syn keyword cqlKeyword column_type key_cache_save_period gc_grace replicate_on_write
|
||||
syn keyword cqlKeyword row_cache_provider compaction_strategy column_metadata
|
||||
syn keyword cqlKeyword column_name validation_class subcomparator replication
|
||||
syn keyword cqlKeyword index_name index_type caching dclocal_read_repair_chance
|
||||
syn keyword cqlKeyword bloom_filter_fp_chance populate_io_cache_on_flush compaction
|
||||
syn keyword cqlKeyword compression class sstable_compression
|
||||
|
||||
" CQL 3 additions
|
||||
syn keyword cqlKeyword clustering
|
||||
|
||||
" Keyspace options
|
||||
syn keyword cqlKeyword placement_strategy strategy_options durable_writes replication_factor
|
||||
syn keyword cqlKeyword strategy_class
|
||||
|
||||
" Hadoop keywords
|
||||
syn keyword cqlKeyword currentJobTracker
|
||||
|
||||
|
||||
" TODO Fix to use regions properly
|
||||
syn keyword cqlColType standard super
|
||||
syn region cqlColumnType start="column_type\W" end="\"'" contains=cqlColType
|
||||
|
||||
" TODO Fix to use regions properly
|
||||
syn keyword cqlPStrategy simplestrategy localstrategy networktopologystrategy
|
||||
syn region cqlPlacementStrategy start="placement_strategy\W" end="\"'" contains=cqlPlaceStrategy
|
||||
|
||||
" Comments highlight the word as a keyword and comment as blue
|
||||
syn region cqlKeyword start=/comment\s*=\s*'/ end=/'/ contains=cqlComment
|
||||
syn region cqlKeyword start=/comment\s*=\s*"/ end=/"/ contains=cqlComment
|
||||
syn region cqlComment start="/\*" end="\*/" contains=cqlComment
|
||||
syn match cqlComment /'\zs\%(\\.\|[^\\']\)*\ze'/ contained
|
||||
syn match cqlComment /"\zs\%(\\.\|[^\\"]\)*\ze"/ contained
|
||||
syn match cqlComment "--.*$" contains=cqlComment
|
||||
syn match cqlComment "//.*$" contains=cqlComment
|
||||
syn match cqlComment "/\*\*/"
|
||||
|
||||
" Special values
|
||||
syn keyword cqlSpecial false null true
|
||||
|
||||
" TODO Add ability to include entire Java class name for compaction strategies
|
||||
syn keyword cqlType SizeTieredCompactionStrategy LeveledCompactionStrategy
|
||||
|
||||
" Variable Types
|
||||
syn keyword cqlType bytea ascii text varchar uuid varint int bigint
|
||||
syn keyword cqlType bytestype utf8type timeuuidtype timeuuid timestamp
|
||||
syn keyword cqlType blob boolean counter decimal double float
|
||||
syn keyword cqlType serializingcacheprovider
|
||||
syn keyword cqlType set list map tuple
|
||||
|
||||
" Consistency Levels
|
||||
syn region cqlType start="consistency" end="zero"
|
||||
syn region cqlType start="consistency" end="one"
|
||||
syn region cqlType start="consistency" end="quorum"
|
||||
syn region cqlType start="consistency" end="all"
|
||||
syn region cqlType start="consistency" end="local_quorum"
|
||||
syn region cqlType start="consistency" end="each_quorum"
|
||||
|
||||
" Numbers and hexidecimal values
|
||||
syn match cqlNumber "-\=\<[0-9]*\>"
|
||||
syn match cqlNumber "-\=\<[0-9]*\.[0-9]*\>"
|
||||
syn match cqlNumber "-\=\<[0-9][0-9]*e[+-]\=[0-9]*\>"
|
||||
syn match cqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>"
|
||||
syn match cqlNumber "\<0x[abcdefABCDEF0-9]*\>"
|
||||
|
||||
" 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_cql_syn_inits")
|
||||
if version < 508
|
||||
let did_cql_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink cqlKeyword Statement
|
||||
HiLink cqlSpecial Special
|
||||
HiLink cqlString String
|
||||
HiLink cqlNumber Number
|
||||
HiLink cqlVariable Identifier
|
||||
HiLink cqlComment Comment
|
||||
HiLink cqlType Type
|
||||
HiLink cqlOperator Statement
|
||||
HiLink cqlConsistency Statement
|
||||
HiLink cqlColType Type
|
||||
HiLink cqlPStrategy Type
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "cql"
|
||||
|
||||
|
||||
endif
|
||||
@@ -8,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'css') == -1
|
||||
" Nikolai Weibull (Add CSS2 support)
|
||||
" Maintainer: Jules Wang <w.jq0722@gmail.com>
|
||||
" URL: https://github.com/JulesWang/css.vim
|
||||
" Last Change: 2015 Apr.17
|
||||
" Last Change: 2015 Aug.25
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
@@ -166,8 +166,8 @@ syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajow
|
||||
syn keyword cssColor contained oldlace olivedrab orange orangered orchid
|
||||
syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/
|
||||
syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue
|
||||
syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown
|
||||
syn keyword cssColor contained seagreen seashell sienna skyblue slateblue
|
||||
syn keyword cssColor contained rosybrown royalblue rebeccapurple saddlebrown salmon
|
||||
syn keyword cssColor contained sandybrown seagreen seashell sienna skyblue slateblue
|
||||
syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan
|
||||
syn keyword cssColor contained thistle tomato turquoise violet wheat
|
||||
syn keyword cssColor contained whitesmoke yellowgreen
|
||||
|
||||
110
syntax/dart.vim
Normal file
110
syntax/dart.vim
Normal file
@@ -0,0 +1,110 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
|
||||
" Vim syntax file " Language: Dart
|
||||
" Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
" for details. All rights reserved. Use of this source code is governed by a
|
||||
" BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
if !exists("g:main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let g:main_syntax = 'dart'
|
||||
syntax region dartFold start="{" end="}" transparent fold
|
||||
endif
|
||||
|
||||
" Ensure long multiline strings are highlighted.
|
||||
syntax sync fromstart
|
||||
|
||||
" keyword definitions
|
||||
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 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 dartExceptions throw rethrow try on catch finally
|
||||
syntax keyword dartAssert assert
|
||||
syntax keyword dartClassDecl extends with implements
|
||||
syntax keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite
|
||||
syntax keyword dartKeyword get set operator call external async await yield sync
|
||||
syntax 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"
|
||||
|
||||
" Comments
|
||||
syntax keyword dartTodo contained TODO FIXME XXX
|
||||
syntax region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell
|
||||
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
||||
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
||||
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
||||
|
||||
" Strings
|
||||
syntax region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
|
||||
syntax region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell
|
||||
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
|
||||
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell
|
||||
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)"
|
||||
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)"
|
||||
|
||||
" Numbers
|
||||
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
|
||||
|
||||
" TODO(antonm): consider conditional highlighting of corelib classes.
|
||||
syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime Duration Expando Function Invocation Iterable Iterator List Map Match Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String StringBuffer StringSink Symbol Type
|
||||
syntax keyword dartCoreTypedefs Comparator
|
||||
syntax keyword dartCoreExceptions AbstractClassInstantiationError ArgumentError AssertionError CastError ConcurrentModificationError Error Exception FallThroughError FormatException IntegerDivisionByZeroException NoSuchMethodError NullThrownError OutOfMemoryError RangeError RuntimeError StackOverflowError StateError TypeError UnimplementedError UnsupportedError
|
||||
|
||||
|
||||
" The default highlighting.
|
||||
highlight default link dartBranch Conditional
|
||||
highlight default link dartUserLabelRef dartUserLabel
|
||||
highlight default link dartLabel Label
|
||||
highlight default link dartUserLabel Label
|
||||
highlight default link dartConditional Conditional
|
||||
highlight default link dartRepeat Repeat
|
||||
highlight default link dartExceptions Exception
|
||||
highlight default link dartAssert Statement
|
||||
highlight default link dartStorageClass StorageClass
|
||||
highlight default link dartClassDecl dartStorageClass
|
||||
highlight default link dartBoolean Boolean
|
||||
highlight default link dartString String
|
||||
highlight default link dartRawString String
|
||||
highlight default link dartMultilineString String
|
||||
highlight default link dartRawMultilineString String
|
||||
highlight default link dartNumber Number
|
||||
highlight default link dartStatement Statement
|
||||
highlight default link dartOperator Operator
|
||||
highlight default link dartComment Comment
|
||||
highlight default link dartLineComment Comment
|
||||
highlight default link dartLineDocComment Comment
|
||||
highlight default link dartConstant Constant
|
||||
highlight default link dartTypedef Typedef
|
||||
highlight default link dartTodo Todo
|
||||
highlight default link dartKeyword Keyword
|
||||
highlight default link dartType Type
|
||||
highlight default link dartInterpolation PreProc
|
||||
highlight default link dartDocLink SpecialComment
|
||||
highlight default link dartSpecialChar SpecialChar
|
||||
highlight default link dartLibrary Include
|
||||
highlight default link dartCoreClasses Type
|
||||
highlight default link dartCoreTypedefs Typedef
|
||||
highlight default link dartCoreExceptions Exception
|
||||
|
||||
let b:current_syntax = "dart"
|
||||
let b:spell_options = "contained"
|
||||
|
||||
if g:main_syntax is# 'dart'
|
||||
unlet g:main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -1,9 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Embedded Elixir
|
||||
" URL: https://github.com/elixir-lang/vim-elixir
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
@@ -66,5 +62,4 @@ if main_syntax == 'eelixir'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Elixir
|
||||
" Maintainer: Carlos Galdino <carloshsgaldino@gmail.com>
|
||||
" Last Change: 2013 Apr 24
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
@@ -12,21 +7,21 @@ endif
|
||||
" 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
|
||||
syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition
|
||||
|
||||
syn match elixirComment '#.*' contains=elixirTodo
|
||||
syn match elixirComment '#.*' contains=elixirTodo,@Spell
|
||||
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||
|
||||
syn keyword elixirKeyword case when cond for if unless try receive send
|
||||
syn keyword elixirKeyword exit raise throw after rescue catch else do end
|
||||
syn keyword elixirKeyword quote unquote super
|
||||
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 quote unquote super spawn spawn_link spawn_monitor
|
||||
|
||||
" Functions used on guards
|
||||
syn keyword elixirKeyword contained is_atom is_binary is_bitstring is_boolean
|
||||
syn keyword elixirKeyword contained is_float is_function is_integer is_list
|
||||
syn keyword elixirKeyword contained is_map is_number is_pid is_port is_record
|
||||
syn keyword elixirKeyword contained is_reference is_tuple is_exception abs
|
||||
syn keyword elixirKeyword contained bit_size byte_size div elem hd length
|
||||
syn keyword elixirKeyword contained is_map is_nil is_number is_pid is_port
|
||||
syn keyword elixirKeyword contained is_record is_reference is_tuple is_exception
|
||||
syn keyword elixirKeyword contained abs bit_size byte_size div elem hd length
|
||||
syn keyword elixirKeyword contained map_size node rem round tl trunc tuple_size
|
||||
|
||||
syn match elixirGuard '.*when.*' contains=ALLBUT,@elixirNotTop
|
||||
@@ -87,14 +82,14 @@ syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{
|
||||
|
||||
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 fold keepend
|
||||
syn region elixirDocString start=+\z('''\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation fold keepend
|
||||
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 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=elixirKeyword start="\<do\>\(:\)\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
|
||||
syn region elixirAnonymousFunction matchgroup=elixirKeyword start="\<fn\>" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
|
||||
syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do\>:\@!" 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
|
||||
|
||||
@@ -106,11 +101,11 @@ syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\u<"
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\u\[" end="\]" skip="\\\\\|\\\]" contains=elixirDelimEscape fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\u(" end=")" skip="\\\\\|\\)" contains=elixirDelimEscape fold
|
||||
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\z(/\|\"\|'\||\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l{" end="}" skip="\\\\\|\\}" fold contains=@elixirStringContained,elixirRegexEscapePunctuation
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l<" end=">" skip="\\\\\|\\>" fold contains=@elixirStringContained,elixirRegexEscapePunctuation
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\[" end="\]" skip="\\\\\|\\\]" fold contains=@elixirStringContained,elixirRegexEscapePunctuation
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l(" end=")" skip="\\\\\|\\)" fold contains=@elixirStringContained,elixirRegexEscapePunctuation
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\z(/\|\"\|'\||\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l{" end="}" skip="\\\\\|\\}" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l<" end=">" skip="\\\\\|\\>" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l\[" end="\]" skip="\\\\\|\\\]" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start="\~\l(" end=")" skip="\\\\\|\\)" contains=@elixirStringContained,elixirRegexEscapePunctuation fold
|
||||
|
||||
" Sigils surrounded with docString
|
||||
syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z("""\)+ end=+^\s*\zs\z1+ skip=+\\"+ fold
|
||||
@@ -147,6 +142,7 @@ syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained con
|
||||
|
||||
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
|
||||
hi def link elixirModuleDefine Define
|
||||
|
||||
81
syntax/elm.vim
Normal file
81
syntax/elm.vim
Normal file
@@ -0,0 +1,81 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Elm (http://elm-lang.org/)
|
||||
" Maintainer: Alexander Noriega
|
||||
" Latest Revision: 19 April 2015
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Keywords
|
||||
syn keyword elmKeyword alias as case else exposing if import in let module of port then type where
|
||||
|
||||
" Builtin operators
|
||||
syn match elmBuiltinOp "\~"
|
||||
syn match elmBuiltinOp "||"
|
||||
syn match elmBuiltinOp "|>"
|
||||
syn match elmBuiltinOp "|"
|
||||
syn match elmBuiltinOp "`"
|
||||
syn match elmBuiltinOp "\^"
|
||||
syn match elmBuiltinOp "\\"
|
||||
syn match elmBuiltinOp ">>"
|
||||
syn match elmBuiltinOp ">="
|
||||
syn match elmBuiltinOp ">"
|
||||
syn match elmBuiltinOp "=="
|
||||
syn match elmBuiltinOp "="
|
||||
syn match elmBuiltinOp "<\~"
|
||||
syn match elmBuiltinOp "<|"
|
||||
syn match elmBuiltinOp "<="
|
||||
syn match elmBuiltinOp "<<"
|
||||
syn match elmBuiltinOp "<-"
|
||||
syn match elmBuiltinOp "<"
|
||||
syn match elmBuiltinOp "::"
|
||||
syn match elmBuiltinOp ":"
|
||||
syn match elmBuiltinOp "/="
|
||||
syn match elmBuiltinOp "//"
|
||||
syn match elmBuiltinOp "/"
|
||||
syn match elmBuiltinOp "\.\."
|
||||
syn match elmBuiltinOp "\."
|
||||
syn match elmBuiltinOp "->"
|
||||
syn match elmBuiltinOp "-"
|
||||
syn match elmBuiltinOp "++"
|
||||
syn match elmBuiltinOp "+"
|
||||
syn match elmBuiltinOp "*"
|
||||
syn match elmBuiltinOp "&&"
|
||||
syn match elmBuiltinOp "%"
|
||||
|
||||
" Special names
|
||||
syntax match specialName "^main "
|
||||
|
||||
" Comments
|
||||
syn match elmTodo "[tT][oO][dD][oO]\|FIXME\|XXX" contained
|
||||
syn match elmLineComment "--.*" contains=elmTodo,@spell
|
||||
syn region elmComment matchgroup=elmComment start="{-|\=" end="-}" contains=elmTodo,elmComment,@spell
|
||||
|
||||
" String literals
|
||||
syn region elmString start="\"" skip="\\\"" end="\"" contains=elmStringEscape
|
||||
syn match elmStringEscape "\\u[0-9a-fA-F]\{4}" contained
|
||||
syn match elmStringEscape "\\[nrfvbt\\\"]" contained
|
||||
|
||||
" Number literals
|
||||
syn match elmNumber "\(\<\d\+\>\)"
|
||||
syn match elmNumber "\(\<\d\+\.\d\+\>\)"
|
||||
|
||||
" Types
|
||||
syn match elmType "\<[A-Z][0-9A-Za-z_'-]*"
|
||||
|
||||
let b:current_syntax = "elm"
|
||||
|
||||
hi def link elmKeyword Keyword
|
||||
hi def link elmBuiltinOp Special
|
||||
hi def link elmType Type
|
||||
hi def link elmTodo Todo
|
||||
hi def link elmLineComment Comment
|
||||
hi def link elmComment Comment
|
||||
hi def link elmString String
|
||||
hi def link elmNumber Number
|
||||
hi def link specialName Special
|
||||
|
||||
endif
|
||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
" Language: git commit file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.git/COMMIT_EDITMSG
|
||||
" Last Change: 2012 April 7
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
|
||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
|
||||
" Language: git rebase --interactive
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: git-rebase-todo
|
||||
" Last Change: 2012 April 7
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -20,6 +20,7 @@ syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite
|
||||
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
|
||||
@@ -33,6 +34,7 @@ hi def link gitrebaseEdit PreProc
|
||||
hi def link gitrebaseSquash Type
|
||||
hi def link gitrebaseFixup Special
|
||||
hi def link gitrebaseExec Function
|
||||
hi def link gitrebaseDrop Comment
|
||||
hi def link gitrebaseSummary String
|
||||
hi def link gitrebaseComment Comment
|
||||
hi def link gitrebaseSquashError Error
|
||||
|
||||
660
syntax/glsl.vim
Normal file
660
syntax/glsl.vim
Normal file
@@ -0,0 +1,660 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||
|
||||
" Language: OpenGL Shading Language
|
||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
||||
|
||||
if exists("b:current_syntax") && b:current_syntax == "glsl"
|
||||
finish
|
||||
endif
|
||||
|
||||
" Statements
|
||||
syn keyword glslConditional if else
|
||||
syn keyword glslRepeat for while do
|
||||
syn keyword glslStatement discard return break continue
|
||||
|
||||
" Comments
|
||||
syn keyword glslTodo contained TODO FIXME XXX
|
||||
syn region glslCommentL start="//" skip="\\$" end="$" keepend contains=glslTodo,@Spell
|
||||
syn region glslComment matchgroup=glslCommentStart start="/\*" end="\*/" extend contains=glslTodo,@Spell
|
||||
|
||||
" Preprocessor
|
||||
syn region glslPreCondit start="^\s*#\s*\(if\|ifdef\|ifndef\|else\|elif\|endif\)" skip="\\$" end="$" keepend
|
||||
syn region glslDefine start="^\s*#\s*\(define\|undef\)" skip="\\$" end="$" keepend
|
||||
syn keyword glslTokenConcat ##
|
||||
syn keyword glslPredefinedMacro __LINE__ __FILE__ __VERSION__ GL_ES
|
||||
syn region glslPreProc start="^\s*#\s*\(error\|pragma\|extension\|version\|line\)" skip="\\$" end="$" keepend
|
||||
|
||||
" Boolean Constants
|
||||
syn keyword glslBoolean true false
|
||||
|
||||
" Integer Numbers
|
||||
syn match glslDecimalInt display "\(0\|[1-9]\d*\)"
|
||||
syn match glslOctalInt display "0\o\+"
|
||||
syn match glslHexInt display "0[xX]\x\+"
|
||||
|
||||
" Float Numbers
|
||||
syn match glslFloat display "\d\+\.\([eE][+-]\=\d\+\)\="
|
||||
syn match glslFloat display "\.\d\+\([eE][+-]\=\d\+\)\="
|
||||
syn match glslFloat display "\d\+[eE][+-]\=\d\+"
|
||||
syn match glslFloat display "\d\+\.\d\+\([eE][+-]\=\d\+\)\="
|
||||
|
||||
" Swizzles
|
||||
syn match glslSwizzle display /\.[xyzw]\{1,4\}\>/
|
||||
syn match glslSwizzle display /\.[rgba]\{1,4\}\>/
|
||||
syn match glslSwizzle display /\.[stpq]\{1,4\}\>/
|
||||
|
||||
" Structure
|
||||
syn keyword glslStructure struct
|
||||
|
||||
" This prevents numbers at ends of identifies from being highlighted as numbers
|
||||
syn match glslIdentifier display "\I\i*"
|
||||
|
||||
" Types
|
||||
syn keyword glslType atomic_uint
|
||||
syn keyword glslType bool
|
||||
syn keyword glslType bvec2
|
||||
syn keyword glslType bvec3
|
||||
syn keyword glslType bvec4
|
||||
syn keyword glslType dmat2
|
||||
syn keyword glslType dmat2x2
|
||||
syn keyword glslType dmat2x3
|
||||
syn keyword glslType dmat2x4
|
||||
syn keyword glslType dmat3
|
||||
syn keyword glslType dmat3x2
|
||||
syn keyword glslType dmat3x3
|
||||
syn keyword glslType dmat3x4
|
||||
syn keyword glslType dmat4
|
||||
syn keyword glslType dmat4x2
|
||||
syn keyword glslType dmat4x3
|
||||
syn keyword glslType dmat4x4
|
||||
syn keyword glslType double
|
||||
syn keyword glslType dvec2
|
||||
syn keyword glslType dvec3
|
||||
syn keyword glslType dvec4
|
||||
syn keyword glslType float
|
||||
syn keyword glslType iimage1D
|
||||
syn keyword glslType iimage1DArray
|
||||
syn keyword glslType iimage2D
|
||||
syn keyword glslType iimage2DArray
|
||||
syn keyword glslType iimage2DMS
|
||||
syn keyword glslType iimage2DMSArray
|
||||
syn keyword glslType iimage2DRect
|
||||
syn keyword glslType iimage3D
|
||||
syn keyword glslType iimageBuffer
|
||||
syn keyword glslType iimageCube
|
||||
syn keyword glslType iimageCubeArray
|
||||
syn keyword glslType image1D
|
||||
syn keyword glslType image1DArray
|
||||
syn keyword glslType image2D
|
||||
syn keyword glslType image2DArray
|
||||
syn keyword glslType image2DMS
|
||||
syn keyword glslType image2DMSArray
|
||||
syn keyword glslType image2DRect
|
||||
syn keyword glslType image3D
|
||||
syn keyword glslType imageBuffer
|
||||
syn keyword glslType imageCube
|
||||
syn keyword glslType imageCubeArray
|
||||
syn keyword glslType int
|
||||
syn keyword glslType isampler1D
|
||||
syn keyword glslType isampler1DArray
|
||||
syn keyword glslType isampler2D
|
||||
syn keyword glslType isampler2DArray
|
||||
syn keyword glslType isampler2DMS
|
||||
syn keyword glslType isampler2DMSArray
|
||||
syn keyword glslType isampler2DRect
|
||||
syn keyword glslType isampler3D
|
||||
syn keyword glslType isamplerBuffer
|
||||
syn keyword glslType isamplerCube
|
||||
syn keyword glslType isamplerCubeArray
|
||||
syn keyword glslType ivec2
|
||||
syn keyword glslType ivec3
|
||||
syn keyword glslType ivec4
|
||||
syn keyword glslType mat2
|
||||
syn keyword glslType mat2x2
|
||||
syn keyword glslType mat2x3
|
||||
syn keyword glslType mat2x4
|
||||
syn keyword glslType mat3
|
||||
syn keyword glslType mat3x2
|
||||
syn keyword glslType mat3x3
|
||||
syn keyword glslType mat3x4
|
||||
syn keyword glslType mat4
|
||||
syn keyword glslType mat4x2
|
||||
syn keyword glslType mat4x3
|
||||
syn keyword glslType mat4x4
|
||||
syn keyword glslType sampler1D
|
||||
syn keyword glslType sampler1DArray
|
||||
syn keyword glslType sampler1DArrayShadow
|
||||
syn keyword glslType sampler1DShadow
|
||||
syn keyword glslType sampler2D
|
||||
syn keyword glslType sampler2DArray
|
||||
syn keyword glslType sampler2DArrayShadow
|
||||
syn keyword glslType sampler2DMS
|
||||
syn keyword glslType sampler2DMSArray
|
||||
syn keyword glslType sampler2DRect
|
||||
syn keyword glslType sampler2DRectShadow
|
||||
syn keyword glslType sampler2DShadow
|
||||
syn keyword glslType sampler3D
|
||||
syn keyword glslType samplerBuffer
|
||||
syn keyword glslType samplerCube
|
||||
syn keyword glslType samplerCubeArray
|
||||
syn keyword glslType samplerCubeArrayShadow
|
||||
syn keyword glslType samplerCubeShadow
|
||||
syn keyword glslType uimage1D
|
||||
syn keyword glslType uimage1DArray
|
||||
syn keyword glslType uimage2D
|
||||
syn keyword glslType uimage2DArray
|
||||
syn keyword glslType uimage2DMS
|
||||
syn keyword glslType uimage2DMSArray
|
||||
syn keyword glslType uimage2DRect
|
||||
syn keyword glslType uimage3D
|
||||
syn keyword glslType uimageBuffer
|
||||
syn keyword glslType uimageCube
|
||||
syn keyword glslType uimageCubeArray
|
||||
syn keyword glslType uint
|
||||
syn keyword glslType usampler1D
|
||||
syn keyword glslType usampler1DArray
|
||||
syn keyword glslType usampler2D
|
||||
syn keyword glslType usampler2DArray
|
||||
syn keyword glslType usampler2DMS
|
||||
syn keyword glslType usampler2DMSArray
|
||||
syn keyword glslType usampler2DRect
|
||||
syn keyword glslType usampler3D
|
||||
syn keyword glslType usamplerBuffer
|
||||
syn keyword glslType usamplerCube
|
||||
syn keyword glslType usamplerCubeArray
|
||||
syn keyword glslType uvec2
|
||||
syn keyword glslType uvec3
|
||||
syn keyword glslType uvec4
|
||||
syn keyword glslType vec2
|
||||
syn keyword glslType vec3
|
||||
syn keyword glslType vec4
|
||||
syn keyword glslType void
|
||||
|
||||
" Qualifiers
|
||||
syn keyword glslQualifier attribute
|
||||
syn keyword glslQualifier binding
|
||||
syn keyword glslQualifier buffer
|
||||
syn keyword glslQualifier ccw
|
||||
syn keyword glslQualifier centroid
|
||||
syn keyword glslQualifier centroid varying
|
||||
syn keyword glslQualifier coherent
|
||||
syn keyword glslQualifier column_major
|
||||
syn keyword glslQualifier const
|
||||
syn keyword glslQualifier cw
|
||||
syn keyword glslQualifier depth_any
|
||||
syn keyword glslQualifier depth_greater
|
||||
syn keyword glslQualifier depth_less
|
||||
syn keyword glslQualifier depth_unchanged
|
||||
syn keyword glslQualifier early_fragment_tests
|
||||
syn keyword glslQualifier equal_spacing
|
||||
syn keyword glslQualifier flat
|
||||
syn keyword glslQualifier fractional_even_spacing
|
||||
syn keyword glslQualifier fractional_odd_spacing
|
||||
syn keyword glslQualifier highp
|
||||
syn keyword glslQualifier in
|
||||
syn keyword glslQualifier index
|
||||
syn keyword glslQualifier inout
|
||||
syn keyword glslQualifier invariant
|
||||
syn keyword glslQualifier invocations
|
||||
syn keyword glslQualifier isolines
|
||||
syn keyword glslQualifier layout
|
||||
syn keyword glslQualifier line_strip
|
||||
syn keyword glslQualifier lines
|
||||
syn keyword glslQualifier lines_adjacency
|
||||
syn keyword glslQualifier local_size_x
|
||||
syn keyword glslQualifier local_size_y
|
||||
syn keyword glslQualifier local_size_z
|
||||
syn keyword glslQualifier location
|
||||
syn keyword glslQualifier lowp
|
||||
syn keyword glslQualifier max_vertices
|
||||
syn keyword glslQualifier mediump
|
||||
syn keyword glslQualifier noperspective
|
||||
syn keyword glslQualifier offset
|
||||
syn keyword glslQualifier origin_upper_left
|
||||
syn keyword glslQualifier out
|
||||
syn keyword glslQualifier packed
|
||||
syn keyword glslQualifier patch
|
||||
syn keyword glslQualifier pixel_center_integer
|
||||
syn keyword glslQualifier point_mode
|
||||
syn keyword glslQualifier points
|
||||
syn keyword glslQualifier precise
|
||||
syn keyword glslQualifier precision
|
||||
syn keyword glslQualifier quads
|
||||
syn keyword glslQualifier r11f_g11f_b10f
|
||||
syn keyword glslQualifier r16
|
||||
syn keyword glslQualifier r16_snorm
|
||||
syn keyword glslQualifier r16f
|
||||
syn keyword glslQualifier r16i
|
||||
syn keyword glslQualifier r16ui
|
||||
syn keyword glslQualifier r32f
|
||||
syn keyword glslQualifier r32i
|
||||
syn keyword glslQualifier r32ui
|
||||
syn keyword glslQualifier r8
|
||||
syn keyword glslQualifier r8_snorm
|
||||
syn keyword glslQualifier r8i
|
||||
syn keyword glslQualifier r8ui
|
||||
syn keyword glslQualifier readonly
|
||||
syn keyword glslQualifier restrict
|
||||
syn keyword glslQualifier rg16
|
||||
syn keyword glslQualifier rg16_snorm
|
||||
syn keyword glslQualifier rg16f
|
||||
syn keyword glslQualifier rg16i
|
||||
syn keyword glslQualifier rg16ui
|
||||
syn keyword glslQualifier rg32f
|
||||
syn keyword glslQualifier rg32i
|
||||
syn keyword glslQualifier rg32ui
|
||||
syn keyword glslQualifier rg8
|
||||
syn keyword glslQualifier rg8_snorm
|
||||
syn keyword glslQualifier rg8i
|
||||
syn keyword glslQualifier rg8ui
|
||||
syn keyword glslQualifier rgb10_a2
|
||||
syn keyword glslQualifier rgb10_a2ui
|
||||
syn keyword glslQualifier rgba16
|
||||
syn keyword glslQualifier rgba16_snorm
|
||||
syn keyword glslQualifier rgba16f
|
||||
syn keyword glslQualifier rgba16i
|
||||
syn keyword glslQualifier rgba16ui
|
||||
syn keyword glslQualifier rgba32f
|
||||
syn keyword glslQualifier rgba32i
|
||||
syn keyword glslQualifier rgba32ui
|
||||
syn keyword glslQualifier rgba8
|
||||
syn keyword glslQualifier rgba8_snorm
|
||||
syn keyword glslQualifier rgba8i
|
||||
syn keyword glslQualifier rgba8ui
|
||||
syn keyword glslQualifier row_major
|
||||
syn keyword glslQualifier sample
|
||||
syn keyword glslQualifier shared
|
||||
syn keyword glslQualifier smooth
|
||||
syn keyword glslQualifier std140
|
||||
syn keyword glslQualifier std430
|
||||
syn keyword glslQualifier stream
|
||||
syn keyword glslQualifier triangle_strip
|
||||
syn keyword glslQualifier triangles
|
||||
syn keyword glslQualifier triangles_adjacency
|
||||
syn keyword glslQualifier uniform
|
||||
syn keyword glslQualifier varying
|
||||
syn keyword glslQualifier vertices
|
||||
syn keyword glslQualifier volatile
|
||||
syn keyword glslQualifier writeonly
|
||||
|
||||
" Built-in Constants
|
||||
syn keyword glslBuiltinConstant gl_MaxAtomicCounterBindings
|
||||
syn keyword glslBuiltinConstant gl_MaxAtomicCounterBufferSize
|
||||
syn keyword glslBuiltinConstant gl_MaxClipDistances
|
||||
syn keyword glslBuiltinConstant gl_MaxClipPlanes
|
||||
syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxCombinedImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxCombinedImageUnitsAndFragmentOutputs
|
||||
syn keyword glslBuiltinConstant gl_MaxCombinedTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupCount
|
||||
syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupSize
|
||||
syn keyword glslBuiltinConstant gl_MaxDrawBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentInputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentInputVectors
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxFragmentUniformVectors
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryInputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryOutputVertices
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryTotalOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxGeometryVaryingComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxImageSamples
|
||||
syn keyword glslBuiltinConstant gl_MaxImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxLights
|
||||
syn keyword glslBuiltinConstant gl_MaxPatchVertices
|
||||
syn keyword glslBuiltinConstant gl_MaxProgramTexelOffset
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlInputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlTotalOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessControlUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationInputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxTessEvaluationUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTessGenLevel
|
||||
syn keyword glslBuiltinConstant gl_MaxTessPatchComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxTextureCoords
|
||||
syn keyword glslBuiltinConstant gl_MaxTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxTextureUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxVaryingComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxVaryingFloats
|
||||
syn keyword glslBuiltinConstant gl_MaxVaryingVectors
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexAtomicCounterBuffers
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexAtomicCounters
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexAttribs
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexImageUniforms
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexOutputComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexOutputVectors
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexTextureImageUnits
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexUniformComponents
|
||||
syn keyword glslBuiltinConstant gl_MaxVertexUniformVectors
|
||||
syn keyword glslBuiltinConstant gl_MaxViewports
|
||||
syn keyword glslBuiltinConstant gl_MinProgramTexelOffset
|
||||
|
||||
" Built-in Variables
|
||||
syn keyword glslBuiltinVariable gl_BackColor
|
||||
syn keyword glslBuiltinVariable gl_BackLightModelProduct
|
||||
syn keyword glslBuiltinVariable gl_BackLightProduct
|
||||
syn keyword glslBuiltinVariable gl_BackLightProduct
|
||||
syn keyword glslBuiltinVariable gl_BackMaterial
|
||||
syn keyword glslBuiltinVariable gl_BackSecondaryColor
|
||||
syn keyword glslBuiltinVariable gl_ClipDistance
|
||||
syn keyword glslBuiltinVariable gl_ClipPlane
|
||||
syn keyword glslBuiltinVariable gl_ClipVertex
|
||||
syn keyword glslBuiltinVariable gl_Color
|
||||
syn keyword glslBuiltinVariable gl_DepthRange
|
||||
syn keyword glslBuiltinVariable gl_EyePlaneQ
|
||||
syn keyword glslBuiltinVariable gl_EyePlaneR
|
||||
syn keyword glslBuiltinVariable gl_EyePlaneS
|
||||
syn keyword glslBuiltinVariable gl_EyePlaneT
|
||||
syn keyword glslBuiltinVariable gl_Fog
|
||||
syn keyword glslBuiltinVariable gl_FogCoord
|
||||
syn keyword glslBuiltinVariable gl_FogFragCoord
|
||||
syn keyword glslBuiltinVariable gl_FragColor
|
||||
syn keyword glslBuiltinVariable gl_FragCoord
|
||||
syn keyword glslBuiltinVariable gl_FragData
|
||||
syn keyword glslBuiltinVariable gl_FragDepth
|
||||
syn keyword glslBuiltinVariable gl_FrontColor
|
||||
syn keyword glslBuiltinVariable gl_FrontFacing
|
||||
syn keyword glslBuiltinVariable gl_FrontLightModelProduct
|
||||
syn keyword glslBuiltinVariable gl_FrontLightProduct
|
||||
syn keyword glslBuiltinVariable gl_FrontMaterial
|
||||
syn keyword glslBuiltinVariable gl_FrontSecondaryColor
|
||||
syn keyword glslBuiltinVariable gl_GlobalInvocationID
|
||||
syn keyword glslBuiltinVariable gl_InstanceID
|
||||
syn keyword glslBuiltinVariable gl_InvocationID
|
||||
syn keyword glslBuiltinVariable gl_Layer
|
||||
syn keyword glslBuiltinVariable gl_LightModel
|
||||
syn keyword glslBuiltinVariable gl_LightSource
|
||||
syn keyword glslBuiltinVariable gl_LocalInvocationID
|
||||
syn keyword glslBuiltinVariable gl_LocalInvocationIndex
|
||||
syn keyword glslBuiltinVariable gl_ModelViewMatrix
|
||||
syn keyword glslBuiltinVariable gl_ModelViewMatrixInverse
|
||||
syn keyword glslBuiltinVariable gl_ModelViewMatrixInverseTranspose
|
||||
syn keyword glslBuiltinVariable gl_ModelViewMatrixTranspose
|
||||
syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrix
|
||||
syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixInverse
|
||||
syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixInverseTranspose
|
||||
syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixTranspose
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord0
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord1
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord2
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord3
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord4
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord5
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord6
|
||||
syn keyword glslBuiltinVariable gl_MultiTexCoord7
|
||||
syn keyword glslBuiltinVariable gl_Normal
|
||||
syn keyword glslBuiltinVariable gl_NormalMatrix
|
||||
syn keyword glslBuiltinVariable gl_NormalScale
|
||||
syn keyword glslBuiltinVariable gl_NumSamples
|
||||
syn keyword glslBuiltinVariable gl_NumWorkGroups
|
||||
syn keyword glslBuiltinVariable gl_ObjectPlaneQ
|
||||
syn keyword glslBuiltinVariable gl_ObjectPlaneR
|
||||
syn keyword glslBuiltinVariable gl_ObjectPlaneS
|
||||
syn keyword glslBuiltinVariable gl_ObjectPlaneT
|
||||
syn keyword glslBuiltinVariable gl_PatchVerticesIn
|
||||
syn keyword glslBuiltinVariable gl_Point
|
||||
syn keyword glslBuiltinVariable gl_PointCoord
|
||||
syn keyword glslBuiltinVariable gl_PointSize
|
||||
syn keyword glslBuiltinVariable gl_Position
|
||||
syn keyword glslBuiltinVariable gl_PrimitiveID
|
||||
syn keyword glslBuiltinVariable gl_PrimitiveIDIn
|
||||
syn keyword glslBuiltinVariable gl_ProjectionMatrix
|
||||
syn keyword glslBuiltinVariable gl_ProjectionMatrixInverse
|
||||
syn keyword glslBuiltinVariable gl_ProjectionMatrixInverseTranspose
|
||||
syn keyword glslBuiltinVariable gl_ProjectionMatrixTranspose
|
||||
syn keyword glslBuiltinVariable gl_SampleID
|
||||
syn keyword glslBuiltinVariable gl_SampleMask
|
||||
syn keyword glslBuiltinVariable gl_SampleMaskIn
|
||||
syn keyword glslBuiltinVariable gl_SamplePosition
|
||||
syn keyword glslBuiltinVariable gl_SecondaryColor
|
||||
syn keyword glslBuiltinVariable gl_TessCoord
|
||||
syn keyword glslBuiltinVariable gl_TessLevelInner
|
||||
syn keyword glslBuiltinVariable gl_TessLevelOuter
|
||||
syn keyword glslBuiltinVariable gl_TexCoord
|
||||
syn keyword glslBuiltinVariable gl_TextureEnvColor
|
||||
syn keyword glslBuiltinVariable gl_TextureMatrix
|
||||
syn keyword glslBuiltinVariable gl_TextureMatrixInverse
|
||||
syn keyword glslBuiltinVariable gl_TextureMatrixInverseTranspose
|
||||
syn keyword glslBuiltinVariable gl_TextureMatrixTranspose
|
||||
syn keyword glslBuiltinVariable gl_Vertex
|
||||
syn keyword glslBuiltinVariable gl_VertexID
|
||||
syn keyword glslBuiltinVariable gl_ViewportIndex
|
||||
syn keyword glslBuiltinVariable gl_WorkGroupID
|
||||
syn keyword glslBuiltinVariable gl_WorkGroupSize
|
||||
syn keyword glslBuiltinVariable gl_in
|
||||
syn keyword glslBuiltinVariable gl_out
|
||||
|
||||
" Built-in Functions
|
||||
syn keyword glslBuiltinFunction EmitStreamVertex
|
||||
syn keyword glslBuiltinFunction EmitVertex
|
||||
syn keyword glslBuiltinFunction EndPrimitive
|
||||
syn keyword glslBuiltinFunction EndStreamPrimitive
|
||||
syn keyword glslBuiltinFunction abs
|
||||
syn keyword glslBuiltinFunction acos
|
||||
syn keyword glslBuiltinFunction acosh
|
||||
syn keyword glslBuiltinFunction all
|
||||
syn keyword glslBuiltinFunction any
|
||||
syn keyword glslBuiltinFunction asin
|
||||
syn keyword glslBuiltinFunction asinh
|
||||
syn keyword glslBuiltinFunction atan
|
||||
syn keyword glslBuiltinFunction atanh
|
||||
syn keyword glslBuiltinFunction atomicAdd
|
||||
syn keyword glslBuiltinFunction atomicAnd
|
||||
syn keyword glslBuiltinFunction atomicCompSwap
|
||||
syn keyword glslBuiltinFunction atomicCounter
|
||||
syn keyword glslBuiltinFunction atomicCounterDecrement
|
||||
syn keyword glslBuiltinFunction atomicCounterIncrement
|
||||
syn keyword glslBuiltinFunction atomicExchange
|
||||
syn keyword glslBuiltinFunction atomicMax
|
||||
syn keyword glslBuiltinFunction atomicMin
|
||||
syn keyword glslBuiltinFunction atomicOr
|
||||
syn keyword glslBuiltinFunction atomicXor
|
||||
syn keyword glslBuiltinFunction barrier
|
||||
syn keyword glslBuiltinFunction bitCount
|
||||
syn keyword glslBuiltinFunction bitfieldExtract
|
||||
syn keyword glslBuiltinFunction bitfieldInsert
|
||||
syn keyword glslBuiltinFunction bitfieldReverse
|
||||
syn keyword glslBuiltinFunction ceil
|
||||
syn keyword glslBuiltinFunction clamp
|
||||
syn keyword glslBuiltinFunction cos
|
||||
syn keyword glslBuiltinFunction cosh
|
||||
syn keyword glslBuiltinFunction cross
|
||||
syn keyword glslBuiltinFunction dFdx
|
||||
syn keyword glslBuiltinFunction dFdy
|
||||
syn keyword glslBuiltinFunction degrees
|
||||
syn keyword glslBuiltinFunction determinant
|
||||
syn keyword glslBuiltinFunction distance
|
||||
syn keyword glslBuiltinFunction dot
|
||||
syn keyword glslBuiltinFunction equal
|
||||
syn keyword glslBuiltinFunction exp
|
||||
syn keyword glslBuiltinFunction exp2
|
||||
syn keyword glslBuiltinFunction faceforward
|
||||
syn keyword glslBuiltinFunction findLSB
|
||||
syn keyword glslBuiltinFunction findMSB
|
||||
syn keyword glslBuiltinFunction floatBitsToInt
|
||||
syn keyword glslBuiltinFunction floatBitsToUint
|
||||
syn keyword glslBuiltinFunction floor
|
||||
syn keyword glslBuiltinFunction fma
|
||||
syn keyword glslBuiltinFunction fract
|
||||
syn keyword glslBuiltinFunction frexp
|
||||
syn keyword glslBuiltinFunction ftransform
|
||||
syn keyword glslBuiltinFunction fwidth
|
||||
syn keyword glslBuiltinFunction greaterThan
|
||||
syn keyword glslBuiltinFunction greaterThanEqual
|
||||
syn keyword glslBuiltinFunction groupMemoryBarrier
|
||||
syn keyword glslBuiltinFunction imageAtomicAdd
|
||||
syn keyword glslBuiltinFunction imageAtomicAnd
|
||||
syn keyword glslBuiltinFunction imageAtomicCompSwap
|
||||
syn keyword glslBuiltinFunction imageAtomicExchange
|
||||
syn keyword glslBuiltinFunction imageAtomicMax
|
||||
syn keyword glslBuiltinFunction imageAtomicMin
|
||||
syn keyword glslBuiltinFunction imageAtomicOr
|
||||
syn keyword glslBuiltinFunction imageAtomicXor
|
||||
syn keyword glslBuiltinFunction imageLoad
|
||||
syn keyword glslBuiltinFunction imageSize
|
||||
syn keyword glslBuiltinFunction imageStore
|
||||
syn keyword glslBuiltinFunction imulExtended
|
||||
syn keyword glslBuiltinFunction intBitsToFloat
|
||||
syn keyword glslBuiltinFunction interpolateAtCentroid
|
||||
syn keyword glslBuiltinFunction interpolateAtOffset
|
||||
syn keyword glslBuiltinFunction interpolateAtSample
|
||||
syn keyword glslBuiltinFunction inverse
|
||||
syn keyword glslBuiltinFunction inversesqrt
|
||||
syn keyword glslBuiltinFunction isinf
|
||||
syn keyword glslBuiltinFunction isnan
|
||||
syn keyword glslBuiltinFunction ldexp
|
||||
syn keyword glslBuiltinFunction length
|
||||
syn keyword glslBuiltinFunction lessThan
|
||||
syn keyword glslBuiltinFunction lessThanEqual
|
||||
syn keyword glslBuiltinFunction log
|
||||
syn keyword glslBuiltinFunction log2
|
||||
syn keyword glslBuiltinFunction matrixCompMult
|
||||
syn keyword glslBuiltinFunction max
|
||||
syn keyword glslBuiltinFunction memoryBarrier
|
||||
syn keyword glslBuiltinFunction memoryBarrierAtomicCounter
|
||||
syn keyword glslBuiltinFunction memoryBarrierBuffer
|
||||
syn keyword glslBuiltinFunction memoryBarrierImage
|
||||
syn keyword glslBuiltinFunction memoryBarrierShared
|
||||
syn keyword glslBuiltinFunction min
|
||||
syn keyword glslBuiltinFunction mix
|
||||
syn keyword glslBuiltinFunction mod
|
||||
syn keyword glslBuiltinFunction modf
|
||||
syn keyword glslBuiltinFunction noise1
|
||||
syn keyword glslBuiltinFunction noise2
|
||||
syn keyword glslBuiltinFunction noise3
|
||||
syn keyword glslBuiltinFunction noise4
|
||||
syn keyword glslBuiltinFunction normalize
|
||||
syn keyword glslBuiltinFunction not
|
||||
syn keyword glslBuiltinFunction notEqual
|
||||
syn keyword glslBuiltinFunction outerProduct
|
||||
syn keyword glslBuiltinFunction packDouble2x32
|
||||
syn keyword glslBuiltinFunction packHalf2x16
|
||||
syn keyword glslBuiltinFunction packSnorm2x16
|
||||
syn keyword glslBuiltinFunction packSnorm4x8
|
||||
syn keyword glslBuiltinFunction packUnorm2x16
|
||||
syn keyword glslBuiltinFunction packUnorm4x8
|
||||
syn keyword glslBuiltinFunction pow
|
||||
syn keyword glslBuiltinFunction radians
|
||||
syn keyword glslBuiltinFunction reflect
|
||||
syn keyword glslBuiltinFunction refract
|
||||
syn keyword glslBuiltinFunction round
|
||||
syn keyword glslBuiltinFunction roundEven
|
||||
syn keyword glslBuiltinFunction shadow1D
|
||||
syn keyword glslBuiltinFunction shadow1DLod
|
||||
syn keyword glslBuiltinFunction shadow1DProj
|
||||
syn keyword glslBuiltinFunction shadow1DProjLod
|
||||
syn keyword glslBuiltinFunction shadow2D
|
||||
syn keyword glslBuiltinFunction shadow2DLod
|
||||
syn keyword glslBuiltinFunction shadow2DProj
|
||||
syn keyword glslBuiltinFunction shadow2DProjLod
|
||||
syn keyword glslBuiltinFunction sign
|
||||
syn keyword glslBuiltinFunction sin
|
||||
syn keyword glslBuiltinFunction sinh
|
||||
syn keyword glslBuiltinFunction smoothstep
|
||||
syn keyword glslBuiltinFunction sqrt
|
||||
syn keyword glslBuiltinFunction step
|
||||
syn keyword glslBuiltinFunction tan
|
||||
syn keyword glslBuiltinFunction tanh
|
||||
syn keyword glslBuiltinFunction texelFetch
|
||||
syn keyword glslBuiltinFunction texelFetchOffset
|
||||
syn keyword glslBuiltinFunction texture
|
||||
syn keyword glslBuiltinFunction texture1D
|
||||
syn keyword glslBuiltinFunction texture1DLod
|
||||
syn keyword glslBuiltinFunction texture1DProj
|
||||
syn keyword glslBuiltinFunction texture1DProjLod
|
||||
syn keyword glslBuiltinFunction texture2D
|
||||
syn keyword glslBuiltinFunction texture2DLod
|
||||
syn keyword glslBuiltinFunction texture2DProj
|
||||
syn keyword glslBuiltinFunction texture2DProjLod
|
||||
syn keyword glslBuiltinFunction texture3D
|
||||
syn keyword glslBuiltinFunction texture3DLod
|
||||
syn keyword glslBuiltinFunction texture3DProj
|
||||
syn keyword glslBuiltinFunction texture3DProjLod
|
||||
syn keyword glslBuiltinFunction textureCube
|
||||
syn keyword glslBuiltinFunction textureCubeLod
|
||||
syn keyword glslBuiltinFunction textureGather
|
||||
syn keyword glslBuiltinFunction textureGatherOffset
|
||||
syn keyword glslBuiltinFunction textureGatherOffsets
|
||||
syn keyword glslBuiltinFunction textureGrad
|
||||
syn keyword glslBuiltinFunction textureGradOffset
|
||||
syn keyword glslBuiltinFunction textureLod
|
||||
syn keyword glslBuiltinFunction textureLodOffset
|
||||
syn keyword glslBuiltinFunction textureOffset
|
||||
syn keyword glslBuiltinFunction textureProj
|
||||
syn keyword glslBuiltinFunction textureProjGrad
|
||||
syn keyword glslBuiltinFunction textureProjGradOffset
|
||||
syn keyword glslBuiltinFunction textureProjLod
|
||||
syn keyword glslBuiltinFunction textureProjLodOffset
|
||||
syn keyword glslBuiltinFunction textureProjOffset
|
||||
syn keyword glslBuiltinFunction textureQueryLevels
|
||||
syn keyword glslBuiltinFunction textureQueryLod
|
||||
syn keyword glslBuiltinFunction textureSize
|
||||
syn keyword glslBuiltinFunction transpose
|
||||
syn keyword glslBuiltinFunction trunc
|
||||
syn keyword glslBuiltinFunction uaddCarry
|
||||
syn keyword glslBuiltinFunction uintBitsToFloat
|
||||
syn keyword glslBuiltinFunction umulExtended
|
||||
syn keyword glslBuiltinFunction unpackDouble2x32
|
||||
syn keyword glslBuiltinFunction unpackHalf2x16
|
||||
syn keyword glslBuiltinFunction unpackSnorm2x16
|
||||
syn keyword glslBuiltinFunction unpackSnorm4x8
|
||||
syn keyword glslBuiltinFunction unpackUnorm2x16
|
||||
syn keyword glslBuiltinFunction unpackUnorm4x8
|
||||
syn keyword glslBuiltinFunction usubBorrow
|
||||
|
||||
hi def link glslConditional Conditional
|
||||
hi def link glslRepeat Repeat
|
||||
hi def link glslStatement Statement
|
||||
hi def link glslTodo Todo
|
||||
hi def link glslCommentL glslComment
|
||||
hi def link glslCommentStart glslComment
|
||||
hi def link glslComment Comment
|
||||
hi def link glslPreCondit PreCondit
|
||||
hi def link glslDefine Define
|
||||
hi def link glslTokenConcat glslPreProc
|
||||
hi def link glslPredefinedMacro Macro
|
||||
hi def link glslPreProc PreProc
|
||||
hi def link glslBoolean Boolean
|
||||
hi def link glslDecimalInt glslInteger
|
||||
hi def link glslOctalInt glslInteger
|
||||
hi def link glslHexInt glslInteger
|
||||
hi def link glslInteger Number
|
||||
hi def link glslFloat Float
|
||||
hi def link glslStructure Structure
|
||||
hi def link glslType Type
|
||||
hi def link glslQualifier StorageClass
|
||||
hi def link glslBuiltinConstant Constant
|
||||
hi def link glslBuiltinFunction Function
|
||||
hi def link glslBuiltinVariable Identifier
|
||||
hi def link glslSwizzle SpecialChar
|
||||
|
||||
if !exists("b:current_syntax")
|
||||
let b:current_syntax = "glsl"
|
||||
endif
|
||||
|
||||
" vim:set sts=2 sw=2 :
|
||||
|
||||
endif
|
||||
146
syntax/go.vim
146
syntax/go.vim
@@ -12,7 +12,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
" let OPTION_NAME = 0
|
||||
" in your ~/.vimrc file to disable particular options. You can also write:
|
||||
" let OPTION_NAME = 1
|
||||
" to enable particular options.
|
||||
" to enable particular options.
|
||||
" At present, all options default to on, except highlight of:
|
||||
" functions, methods and structs.
|
||||
"
|
||||
@@ -27,6 +27,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
" Highlights instances of tabs following spaces.
|
||||
" - go_highlight_trailing_whitespace_error
|
||||
" Highlights trailing white space.
|
||||
" - go_highlight_string_spellcheck
|
||||
" Specifies that strings should be spell checked
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -54,23 +56,31 @@ if !exists("g:go_highlight_trailing_whitespace_error")
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_operators")
|
||||
let g:go_highlight_operators = 0
|
||||
let g:go_highlight_operators = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_functions")
|
||||
let g:go_highlight_functions = 0
|
||||
let g:go_highlight_functions = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_methods")
|
||||
let g:go_highlight_methods = 0
|
||||
let g:go_highlight_methods = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_structs")
|
||||
let g:go_highlight_structs = 0
|
||||
let g:go_highlight_structs = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_interfaces")
|
||||
let g:go_highlight_interfaces = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_build_constraints")
|
||||
let g:go_highlight_build_constraints = 0
|
||||
let g:go_highlight_build_constraints = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_string_spellcheck")
|
||||
let g:go_highlight_string_spellcheck = 1
|
||||
endif
|
||||
|
||||
syn case match
|
||||
@@ -113,8 +123,8 @@ syn match goDeclaration /\<func\>/
|
||||
|
||||
|
||||
" Predefined functions and values
|
||||
syn keyword goBuiltins append cap close complex copy delete imag len
|
||||
syn keyword goBuiltins make new panic print println real recover
|
||||
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
|
||||
|
||||
hi def link goBuiltins Keyword
|
||||
@@ -147,13 +157,18 @@ hi def link goEscapeError Error
|
||||
|
||||
" Strings and their contents
|
||||
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
|
||||
syn region goRawString start=+`+ end=+`+
|
||||
if g:go_highlight_string_spellcheck != 0
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup,@Spell
|
||||
syn region goRawString start=+`+ end=+`+ contains=@Spell
|
||||
else
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
|
||||
syn region goRawString start=+`+ end=+`+
|
||||
endif
|
||||
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
|
||||
|
||||
hi def link goString String
|
||||
hi def link goRawString String
|
||||
hi def link goFormatSpecifier goSpecialString
|
||||
hi def link goFormatSpecifier goSpecialString
|
||||
|
||||
" Characters; their contents
|
||||
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
|
||||
@@ -199,9 +214,17 @@ endif
|
||||
" Spacing errors around the 'chan' keyword
|
||||
if g:go_highlight_chan_whitespace_error != 0
|
||||
" receive-only annotation on chan type
|
||||
syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@="
|
||||
"
|
||||
" \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan)
|
||||
" this prevents picking up 'chan<- chan<-' but not '<- chan'
|
||||
syn match goSpaceError display "\(\(\<chan\>\)\@<!<-\)\@<=\s\+\(\<chan\>\)\@="
|
||||
|
||||
" send-only annotation on chan type
|
||||
syn match goSpaceError display "\(\<chan\)\@<=\s\+\(<-\)\@="
|
||||
"
|
||||
" \(<-\)\@<!\<chan\> (only pick chan when it doesn't come after an arrow)
|
||||
" this prevents picking up '<-chan <-chan' but not 'chan <-'
|
||||
syn match goSpaceError display "\(\(<-\)\@<!\<chan\>\)\@<=\s\+\(<-\)\@="
|
||||
|
||||
" value-ignoring receives in a few contexts
|
||||
syn match goSpaceError display "\(\(^\|[={(,;]\)\s*<-\)\@<=\s\+"
|
||||
endif
|
||||
@@ -236,57 +259,84 @@ syn keyword goTodo contained NOTE
|
||||
hi def link goTodo Todo
|
||||
|
||||
|
||||
" Operators;
|
||||
" Operators;
|
||||
if g:go_highlight_operators != 0
|
||||
" match single-char operators: - + % < > ! & | ^ * =
|
||||
" and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
|
||||
syn match goOperator /[-+%<>!&|^*=]=\?/
|
||||
" match / and /=
|
||||
syn match goOperator /\/\%(=\|\ze[^/*]\)/
|
||||
" match two-char operators: << >> &^
|
||||
" and corresponding three-char operators: <<= >>= &^=
|
||||
syn match goOperator /\%(<<\|>>\|&^\)=\?/
|
||||
" match remaining two-char operators: := && || <- ++ --
|
||||
syn match goOperator /:=\|||\|<-\|++\|--/
|
||||
" match ...
|
||||
syn match goOperator /\.\.\./
|
||||
" match single-char operators: - + % < > ! & | ^ * =
|
||||
" and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
|
||||
syn match goOperator /[-+%<>!&|^*=]=\?/
|
||||
" match / and /=
|
||||
syn match goOperator /\/\%(=\|\ze[^/*]\)/
|
||||
" match two-char operators: << >> &^
|
||||
" and corresponding three-char operators: <<= >>= &^=
|
||||
syn match goOperator /\%(<<\|>>\|&^\)=\?/
|
||||
" match remaining two-char operators: := && || <- ++ --
|
||||
syn match goOperator /:=\|||\|<-\|++\|--/
|
||||
" match ...
|
||||
syn match goOperator /\.\.\./
|
||||
endif
|
||||
hi def link goOperator Operator
|
||||
hi def link goOperator Operator
|
||||
|
||||
" Functions;
|
||||
" Functions;
|
||||
if g:go_highlight_functions != 0
|
||||
syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/
|
||||
syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/
|
||||
syn match goFunction /\(func\s\+\)\@<=\w\+\((\)\@=/
|
||||
syn match goFunction /\()\s\+\)\@<=\w\+\((\)\@=/
|
||||
endif
|
||||
hi def link goFunction Function
|
||||
hi def link goFunction Function
|
||||
|
||||
" Methods;
|
||||
" Methods;
|
||||
if g:go_highlight_methods != 0
|
||||
syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/
|
||||
syn match goMethod /\(\.\)\@<=\w\+\((\)\@=/
|
||||
endif
|
||||
hi def link goMethod Type
|
||||
hi def link goMethod Type
|
||||
|
||||
" Structs;
|
||||
" Structs;
|
||||
if g:go_highlight_structs != 0
|
||||
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
|
||||
syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/
|
||||
syn match goStruct /\(.\)\@<=\w\+\({\)\@=/
|
||||
syn match goStructDef /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/
|
||||
endif
|
||||
hi def link goStruct Function
|
||||
hi def link goStruct Function
|
||||
hi def link goStructDef Function
|
||||
|
||||
" Interfaces;
|
||||
if g:go_highlight_interfaces != 0
|
||||
syn match goInterface /\(.\)\@<=\w\+\({\)\@=/
|
||||
syn match goInterfaceDef /\(type\s\+\)\@<=\w\+\(\s\+interface\s\+{\)\@=/
|
||||
endif
|
||||
hi def link goInterface Function
|
||||
hi def link goInterfaceDef Function
|
||||
|
||||
" Build Constraints
|
||||
if g:go_highlight_build_constraints != 0
|
||||
syn keyword goBuildOs contained ignore cgo android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows
|
||||
syn keyword goBuildArch contained 386 amd64 amd64p32 arm
|
||||
syn match goBuildDirective display contained "+build"
|
||||
syn region goBuildComment start="//\s*+build" end="$" contains=goBuildDirective,goBuildOs,goBuildArch
|
||||
syn region goBuildComment start="/\*\s*+build" end="\*/" contains=goBuildDirective,goBuildOs,goBuildArch
|
||||
endif
|
||||
syn match goBuildKeyword display contained "+build"
|
||||
" Highlight the known values of GOOS, GOARCH, and other +build options.
|
||||
syn keyword goBuildDirectives contained
|
||||
\ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9
|
||||
\ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64
|
||||
\ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc
|
||||
\ s390 s390x sparc sparc64 cgo ignore race
|
||||
|
||||
hi def link goBuildComment Comment
|
||||
hi def link goBuildOs Type
|
||||
hi def link goBuildArch Type
|
||||
hi def link goBuildDirective PreProc
|
||||
" Other words in the build directive are build tags not listed above, so
|
||||
" avoid highlighting them as comments by using a matchgroup just for the
|
||||
" start of the comment.
|
||||
" The rs=s+2 option lets the \s*+build portion be part of the inner region
|
||||
" instead of the matchgroup so it will be highlighted as a goBuildKeyword.
|
||||
syn region goBuildComment matchgroup=goBuildCommentStart
|
||||
\ start="//\s*+build\s"rs=s+2 end="$"
|
||||
\ contains=goBuildKeyword,goBuildDirectives
|
||||
hi def link goBuildCommentStart Comment
|
||||
hi def link goBuildDirectives Type
|
||||
hi def link goBuildKeyword PreProc
|
||||
|
||||
" One or more line comments that are followed immediately by a "package"
|
||||
" declaration are treated like package documentation, so these must be
|
||||
" matched as comments to avoid looking like working build constraints.
|
||||
" The he, me, and re options let the "package" itself be highlighted by
|
||||
" the usual rules.
|
||||
syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/
|
||||
\ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7
|
||||
\ contains=@goCommentGroup,@Spell
|
||||
hi def link goPackageComment Comment
|
||||
endif
|
||||
|
||||
|
||||
" Search backwards for a global declaration to start processing the syntax.
|
||||
|
||||
@@ -39,7 +39,7 @@ hi def link goRawString String
|
||||
|
||||
" Characters; their contents
|
||||
syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU
|
||||
syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
|
||||
syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup
|
||||
|
||||
hi def link goCharacter Character
|
||||
|
||||
@@ -67,8 +67,8 @@ hi def link goImaginary Number
|
||||
syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary
|
||||
syn keyword gotplControl contained if else end range with template
|
||||
syn keyword gotplFunctions contained and html index js len not or print printf println urlquery eq ne lt le gt ge
|
||||
syn match gotplVariable contained /\$[^ ]*\>/
|
||||
syn match goTplIdentifier contained /\.[^ ]*\>/
|
||||
syn match gotplVariable contained /\$[a-zA-Z0-9_]*\>/
|
||||
syn match goTplIdentifier contained /\.[^\s}]*\>/
|
||||
|
||||
hi def link gotplControl Keyword
|
||||
hi def link gotplFunctions Function
|
||||
|
||||
454
syntax/groovy.vim
Normal file
454
syntax/groovy.vim
Normal file
@@ -0,0 +1,454 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'groovy') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Groovy
|
||||
" Maintainer: Alessio Pace <billy.corgan@tiscali.it>
|
||||
" Version: 0.1.9b
|
||||
" URL: http://www.vim.org/scripts/script.php?script_id=945
|
||||
" Last Change: 6/4/2004
|
||||
|
||||
" This is my very first vim script, I hope to have
|
||||
" done it the right way.
|
||||
"
|
||||
" I must directly or indirectly thank the author of java.vim and ruby.vim:
|
||||
" I copied from them most of the stuff :-)
|
||||
"
|
||||
" Relies on html.vim
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
"
|
||||
" HOWTO USE IT (INSTALL):
|
||||
" [groovy is still not recognized by vim! :-( ]
|
||||
"
|
||||
" 1) copy the file in the (global or user's $HOME/.vim/syntax/) syntax folder
|
||||
"
|
||||
" 2) add this line to recognize groovy files by filename extension:
|
||||
"
|
||||
" au BufNewFile,BufRead *.groovy setf groovy
|
||||
" in the global vim filetype.vim file or inside $HOME/.vim/filetype.vim
|
||||
"
|
||||
" 3) add this part to recognize by content groovy script (no extension needed :-)
|
||||
"
|
||||
" if did_filetype()
|
||||
" finish
|
||||
" endif
|
||||
" if getline(1) =~ '^#!.*[/\\]groovy\>'
|
||||
" setf groovy
|
||||
" endif
|
||||
"
|
||||
" in the global scripts.vim file or in $HOME/.vim/scripts.vim
|
||||
"
|
||||
" 4) open/write a .groovy file or a groovy script :-)
|
||||
"
|
||||
" Let me know if you like it or send me patches, so that I can improve it
|
||||
" when I have time
|
||||
|
||||
" Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
" we define it here so that included files can test for it
|
||||
let main_syntax='groovy'
|
||||
endif
|
||||
|
||||
" don't use standard HiLink, it will not work with included syntax files
|
||||
if version < 508
|
||||
command! -nargs=+ GroovyHiLink hi link <args>
|
||||
else
|
||||
command! -nargs=+ GroovyHiLink hi def link <args>
|
||||
endif
|
||||
|
||||
" ##########################
|
||||
" Java stuff taken from java.vim
|
||||
" some characters that cannot be in a groovy program (outside a string)
|
||||
" syn match groovyError "[\\@`]"
|
||||
"syn match groovyError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/"
|
||||
"syn match groovyOK "\.\.\."
|
||||
|
||||
" keyword definitions
|
||||
syn keyword groovyExternal native package
|
||||
syn match groovyExternal "\<import\(\s\+static\>\)\?"
|
||||
syn keyword groovyError goto const
|
||||
syn keyword groovyConditional if else switch
|
||||
syn keyword groovyRepeat while for do
|
||||
syn keyword groovyBoolean true false
|
||||
syn keyword groovyConstant null
|
||||
syn keyword groovyTypedef this super
|
||||
syn keyword groovyOperator new instanceof
|
||||
syn keyword groovyType boolean char byte short int long float double
|
||||
syn keyword groovyType void
|
||||
syn keyword groovyType Integer Double Date Boolean Float String Array Vector List
|
||||
syn keyword groovyStatement return
|
||||
syn keyword groovyStorageClass static synchronized transient volatile final strictfp serializable
|
||||
syn keyword groovyExceptions throw try catch finally
|
||||
syn keyword groovyAssert assert
|
||||
syn keyword groovyMethodDecl synchronized throws
|
||||
syn keyword groovyClassDecl extends implements interface
|
||||
" to differentiate the keyword class from MyClass.class we use a match here
|
||||
syn match groovyTypedef "\.\s*\<class\>"ms=s+1
|
||||
syn keyword groovyClassDecl enum
|
||||
syn match groovyClassDecl "^class\>"
|
||||
syn match groovyClassDecl "[^.]\s*\<class\>"ms=s+1
|
||||
syn keyword groovyBranch break continue nextgroup=groovyUserLabelRef skipwhite
|
||||
syn match groovyUserLabelRef "\k\+" contained
|
||||
syn keyword groovyScopeDecl public protected private abstract
|
||||
|
||||
|
||||
if exists("groovy_highlight_groovy_lang_ids") || exists("groovy_highlight_groovy_lang") || exists("groovy_highlight_all")
|
||||
" groovy.lang.*
|
||||
syn keyword groovyLangClass Closure MetaMethod GroovyObject
|
||||
|
||||
syn match groovyJavaLangClass "\<System\>"
|
||||
syn keyword groovyJavaLangClass Cloneable Comparable Runnable Serializable Boolean Byte Class Object
|
||||
syn keyword groovyJavaLangClass Character CharSequence ClassLoader Compiler
|
||||
" syn keyword groovyJavaLangClass Integer Double Float Long
|
||||
syn keyword groovyJavaLangClass InheritableThreadLocal Math Number Object Package Process
|
||||
syn keyword groovyJavaLangClass Runtime RuntimePermission InheritableThreadLocal
|
||||
syn keyword groovyJavaLangClass SecurityManager Short StrictMath StackTraceElement
|
||||
syn keyword groovyJavaLangClass StringBuffer Thread ThreadGroup
|
||||
syn keyword groovyJavaLangClass ThreadLocal Throwable Void ArithmeticException
|
||||
syn keyword groovyJavaLangClass ArrayIndexOutOfBoundsException AssertionError
|
||||
syn keyword groovyJavaLangClass ArrayStoreException ClassCastException
|
||||
syn keyword groovyJavaLangClass ClassNotFoundException
|
||||
syn keyword groovyJavaLangClass CloneNotSupportedException Exception
|
||||
syn keyword groovyJavaLangClass IllegalAccessException
|
||||
syn keyword groovyJavaLangClass IllegalArgumentException
|
||||
syn keyword groovyJavaLangClass IllegalMonitorStateException
|
||||
syn keyword groovyJavaLangClass IllegalStateException
|
||||
syn keyword groovyJavaLangClass IllegalThreadStateException
|
||||
syn keyword groovyJavaLangClass IndexOutOfBoundsException
|
||||
syn keyword groovyJavaLangClass InstantiationException InterruptedException
|
||||
syn keyword groovyJavaLangClass NegativeArraySizeException NoSuchFieldException
|
||||
syn keyword groovyJavaLangClass NoSuchMethodException NullPointerException
|
||||
syn keyword groovyJavaLangClass NumberFormatException RuntimeException
|
||||
syn keyword groovyJavaLangClass SecurityException StringIndexOutOfBoundsException
|
||||
syn keyword groovyJavaLangClass UnsupportedOperationException
|
||||
syn keyword groovyJavaLangClass AbstractMethodError ClassCircularityError
|
||||
syn keyword groovyJavaLangClass ClassFormatError Error ExceptionInInitializerError
|
||||
syn keyword groovyJavaLangClass IllegalAccessError InstantiationError
|
||||
syn keyword groovyJavaLangClass IncompatibleClassChangeError InternalError
|
||||
syn keyword groovyJavaLangClass LinkageError NoClassDefFoundError
|
||||
syn keyword groovyJavaLangClass NoSuchFieldError NoSuchMethodError
|
||||
syn keyword groovyJavaLangClass OutOfMemoryError StackOverflowError
|
||||
syn keyword groovyJavaLangClass ThreadDeath UnknownError UnsatisfiedLinkError
|
||||
syn keyword groovyJavaLangClass UnsupportedClassVersionError VerifyError
|
||||
syn keyword groovyJavaLangClass VirtualMachineError
|
||||
|
||||
syn keyword groovyJavaLangObject clone equals finalize getClass hashCode
|
||||
syn keyword groovyJavaLangObject notify notifyAll toString wait
|
||||
|
||||
GroovyHiLink groovyLangClass groovyConstant
|
||||
GroovyHiLink groovyJavaLangClass groovyExternal
|
||||
GroovyHiLink groovyJavaLangObject groovyConstant
|
||||
syn cluster groovyTop add=groovyJavaLangObject,groovyJavaLangClass,groovyLangClass
|
||||
syn cluster groovyClasses add=groovyJavaLangClass,groovyLangClass
|
||||
endif
|
||||
|
||||
|
||||
" Groovy stuff
|
||||
syn match groovyOperator "\.\."
|
||||
syn match groovyOperator "<\{2,3}"
|
||||
syn match groovyOperator ">\{2,3}"
|
||||
syn match groovyOperator "->"
|
||||
syn match groovyExternal '^#!.*[/\\]groovy\>'
|
||||
syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
|
||||
|
||||
" Groovy JDK stuff
|
||||
syn keyword groovyJDKBuiltin as def in
|
||||
syn keyword groovyJDKOperOverl div minus plus abs round power multiply
|
||||
syn keyword groovyJDKMethods each call inject sort print println
|
||||
syn keyword groovyJDKMethods getAt putAt size push pop toList getText writeLine eachLine readLines
|
||||
syn keyword groovyJDKMethods withReader withStream withWriter withPrintWriter write read leftShift
|
||||
syn keyword groovyJDKMethods withWriterAppend readBytes splitEachLine
|
||||
syn keyword groovyJDKMethods newInputStream newOutputStream newPrintWriter newReader newWriter
|
||||
syn keyword groovyJDKMethods compareTo next previous isCase
|
||||
syn keyword groovyJDKMethods times step toInteger upto any collect dump every find findAll grep
|
||||
syn keyword groovyJDKMethods inspect invokeMethods join
|
||||
syn keyword groovyJDKMethods getErr getIn getOut waitForOrKill
|
||||
syn keyword groovyJDKMethods count tokenize asList flatten immutable intersect reverse reverseEach
|
||||
syn keyword groovyJDKMethods subMap append asWritable eachByte eachLine eachFile
|
||||
syn cluster groovyTop add=groovyJDKBuiltin,groovyJDKOperOverl,groovyJDKMethods
|
||||
|
||||
" no useful I think, so I comment it..
|
||||
"if filereadable(expand("<sfile>:p:h")."/groovyid.vim")
|
||||
" source <sfile>:p:h/groovyid.vim
|
||||
"endif
|
||||
|
||||
if exists("groovy_space_errors")
|
||||
if !exists("groovy_no_trail_space_error")
|
||||
syn match groovySpaceError "\s\+$"
|
||||
endif
|
||||
if !exists("groovy_no_tab_space_error")
|
||||
syn match groovySpaceError " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" it is a better case construct than java.vim to match groovy syntax
|
||||
syn region groovyLabelRegion transparent matchgroup=groovyLabel start="\<case\>" matchgroup=NONE end=":\|$" contains=groovyNumber,groovyString,groovyLangClass,groovyJavaLangClass
|
||||
syn match groovyUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=groovyLabel
|
||||
syn keyword groovyLabel default
|
||||
|
||||
if !exists("groovy_allow_cpp_keywords")
|
||||
syn keyword groovyError auto delete extern friend inline redeclared
|
||||
syn keyword groovyError register signed sizeof struct template typedef union
|
||||
syn keyword groovyError unsigned operator
|
||||
endif
|
||||
|
||||
" The following cluster contains all groovy groups except the contained ones
|
||||
syn cluster groovyTop add=groovyExternal,groovyError,groovyError,groovyBranch,groovyLabelRegion,groovyLabel,groovyConditional,groovyRepeat,groovyBoolean,groovyConstant,groovyTypedef,groovyOperator,groovyType,groovyType,groovyStatement,groovyStorageClass,groovyAssert,groovyExceptions,groovyMethodDecl,groovyClassDecl,groovyClassDecl,groovyClassDecl,groovyScopeDecl,groovyError,groovyError2,groovyUserLabel,groovyLangObject
|
||||
|
||||
|
||||
" Comments
|
||||
syn keyword groovyTodo contained TODO FIXME XXX
|
||||
if exists("groovy_comment_strings")
|
||||
syn region groovyCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=groovySpecial,groovyCommentStar,groovySpecialChar,@Spell
|
||||
syn region groovyComment2String contained start=+"+ end=+$\|"+ contains=groovySpecial,groovySpecialChar,@Spell
|
||||
syn match groovyCommentCharacter contained "'\\[^']\{1,6\}'" contains=groovySpecialChar
|
||||
syn match groovyCommentCharacter contained "'\\''" contains=groovySpecialChar
|
||||
syn match groovyCommentCharacter contained "'[^\\]'"
|
||||
syn cluster groovyCommentSpecial add=groovyCommentString,groovyCommentCharacter,groovyNumber
|
||||
syn cluster groovyCommentSpecial2 add=groovyComment2String,groovyCommentCharacter,groovyNumber
|
||||
endif
|
||||
syn region groovyComment start="/\*" end="\*/" contains=@groovyCommentSpecial,groovyTodo,@Spell
|
||||
syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1
|
||||
syn match groovyCommentStar contained "^\s*\*$"
|
||||
syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
|
||||
syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell
|
||||
GroovyHiLink groovyCommentString groovyString
|
||||
GroovyHiLink groovyComment2String groovyString
|
||||
GroovyHiLink groovyCommentCharacter groovyCharacter
|
||||
|
||||
syn cluster groovyTop add=groovyComment,groovyLineComment
|
||||
|
||||
if !exists("groovy_ignore_groovydoc") && main_syntax != 'jsp'
|
||||
syntax case ignore
|
||||
" syntax coloring for groovydoc comments (HTML)
|
||||
" syntax include @groovyHtml <sfile>:p:h/html.vim
|
||||
syntax include @groovyHtml runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
syn region groovyDocComment start="/\*\*" end="\*/" keepend contains=groovyCommentTitle,@groovyHtml,groovyDocTags,groovyTodo,@Spell
|
||||
syn region groovyCommentTitle contained matchgroup=groovyDocComment start="/\*\*" matchgroup=groovyCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@groovyHtml,groovyCommentStar,groovyTodo,@Spell,groovyDocTags
|
||||
|
||||
syn region groovyDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}"
|
||||
syn match groovyDocTags contained "@\(see\|param\|exception\|throws\|since\)\s\+\S\+" contains=groovyDocParam
|
||||
syn match groovyDocParam contained "\s\S\+"
|
||||
syn match groovyDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>"
|
||||
syntax case match
|
||||
endif
|
||||
|
||||
" match the special comment /**/
|
||||
syn match groovyComment "/\*\*/"
|
||||
|
||||
" Strings and constants
|
||||
syn match groovySpecialError contained "\\."
|
||||
syn match groovySpecialCharError contained "[^']"
|
||||
syn match groovySpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)"
|
||||
syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
|
||||
syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
|
||||
" syn region groovyELExpr start=+${+ end=+}+ keepend contained
|
||||
syn match groovyELExpr /\${.\{-}}/ contained
|
||||
GroovyHiLink groovyELExpr Identifier
|
||||
|
||||
" TODO: better matching. I am waiting to understand how it really works in groovy
|
||||
" syn region groovyClosureParamsBraces start=+|+ end=+|+ contains=groovyClosureParams
|
||||
" syn match groovyClosureParams "[ a-zA-Z0-9_*]\+" contained
|
||||
" GroovyHiLink groovyClosureParams Identifier
|
||||
|
||||
" next line disabled, it can cause a crash for a long line
|
||||
"syn match groovyStringError +"\([^"\\]\|\\.\)*$+
|
||||
|
||||
" disabled: in groovy strings or characters are written the same
|
||||
" syn match groovyCharacter "'[^']*'" contains=groovySpecialChar,groovySpecialCharError
|
||||
" syn match groovyCharacter "'\\''" contains=groovySpecialChar
|
||||
" syn match groovyCharacter "'[^\\]'"
|
||||
syn match groovyNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
||||
syn match groovyNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
||||
syn match groovyNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
||||
syn match groovyNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
||||
|
||||
" unicode characters
|
||||
syn match groovySpecial "\\u\d\{4\}"
|
||||
|
||||
syn cluster groovyTop add=groovyString,groovyCharacter,groovyNumber,groovySpecial,groovyStringError
|
||||
|
||||
if exists("groovy_highlight_functions")
|
||||
if groovy_highlight_functions == "indent"
|
||||
syn match groovyFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
||||
syn region groovyFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
||||
syn match groovyFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
||||
syn region groovyFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,@groovyClasses
|
||||
else
|
||||
" This line catches method declarations at any indentation>0, but it assumes
|
||||
" two things:
|
||||
" 1. class names are always capitalized (ie: Button)
|
||||
" 2. method names are never capitalized (except constructors, of course)
|
||||
syn region groovyFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=groovyScopeDecl,groovyType,groovyStorageClass,groovyComment,groovyLineComment,@groovyClasses
|
||||
endif
|
||||
syn match groovyBraces "[{}]"
|
||||
syn cluster groovyTop add=groovyFuncDef,groovyBraces
|
||||
endif
|
||||
|
||||
if exists("groovy_highlight_debug")
|
||||
|
||||
" Strings and constants
|
||||
syn match groovyDebugSpecial contained "\\\d\d\d\|\\."
|
||||
syn region groovyDebugString contained start=+"+ end=+"+ contains=groovyDebugSpecial
|
||||
syn match groovyDebugStringError +"\([^"\\]\|\\.\)*$+
|
||||
syn match groovyDebugCharacter contained "'[^\\]'"
|
||||
syn match groovyDebugSpecialCharacter contained "'\\.'"
|
||||
syn match groovyDebugSpecialCharacter contained "'\\''"
|
||||
syn match groovyDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
||||
syn match groovyDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
||||
syn match groovyDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
||||
syn match groovyDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
||||
syn keyword groovyDebugBoolean contained true false
|
||||
syn keyword groovyDebugType contained null this super
|
||||
syn region groovyDebugParen start=+(+ end=+)+ contained contains=groovyDebug.*,groovyDebugParen
|
||||
|
||||
" to make this work you must define the highlighting for these groups
|
||||
syn match groovyDebug "\<System\.\(out\|err\)\.print\(ln\)*\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
||||
syn match groovyDebug "\<p\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
||||
syn match groovyDebug "[A-Za-z][a-zA-Z0-9_]*\.printStackTrace\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
||||
syn match groovyDebug "\<trace[SL]\=\s*("me=e-1 contains=groovyDebug.* nextgroup=groovyDebugParen
|
||||
|
||||
syn cluster groovyTop add=groovyDebug
|
||||
|
||||
if version >= 508 || !exists("did_c_syn_inits")
|
||||
GroovyHiLink groovyDebug Debug
|
||||
GroovyHiLink groovyDebugString DebugString
|
||||
GroovyHiLink groovyDebugStringError groovyError
|
||||
GroovyHiLink groovyDebugType DebugType
|
||||
GroovyHiLink groovyDebugBoolean DebugBoolean
|
||||
GroovyHiLink groovyDebugNumber Debug
|
||||
GroovyHiLink groovyDebugSpecial DebugSpecial
|
||||
GroovyHiLink groovyDebugSpecialCharacter DebugSpecial
|
||||
GroovyHiLink groovyDebugCharacter DebugString
|
||||
GroovyHiLink groovyDebugParen Debug
|
||||
|
||||
GroovyHiLink DebugString String
|
||||
GroovyHiLink DebugSpecial Special
|
||||
GroovyHiLink DebugBoolean Boolean
|
||||
GroovyHiLink DebugType Type
|
||||
endif
|
||||
endif
|
||||
|
||||
" Match all Exception classes
|
||||
syn match groovyExceptions "\<Exception\>\|\<[A-Z]\{1,}[a-zA-Z0-9]*Exception\>"
|
||||
|
||||
|
||||
if !exists("groovy_minlines")
|
||||
let groovy_minlines = 10
|
||||
endif
|
||||
exec "syn sync ccomment groovyComment minlines=" . groovy_minlines
|
||||
|
||||
|
||||
" ###################
|
||||
" Groovy stuff
|
||||
" syn match groovyOperator "|[ ,a-zA-Z0-9_*]\+|"
|
||||
|
||||
" All groovy valid tokens
|
||||
" syn match groovyTokens ";\|,\|<=>\|<>\|:\|:=\|>\|>=\|=\|==\|<\|<=\|!=\|/\|/=\|\.\.|\.\.\.\|\~=\|\~=="
|
||||
" syn match groovyTokens "\*=\|&\|&=\|\*\|->\|\~\|+\|-\|/\|?\|<<<\|>>>\|<<\|>>"
|
||||
|
||||
" Must put explicit these ones because groovy.vim mark them as errors otherwise
|
||||
" syn match groovyTokens "<=>\|<>\|==\~"
|
||||
"syn cluster groovyTop add=groovyTokens
|
||||
|
||||
" Mark these as operators
|
||||
|
||||
" Hightlight brackets
|
||||
" syn match groovyBraces "[{}]"
|
||||
" syn match groovyBraces "[\[\]]"
|
||||
" syn match groovyBraces "[\|]"
|
||||
|
||||
if exists("groovy_mark_braces_in_parens_as_errors")
|
||||
syn match groovyInParen contained "[{}]"
|
||||
GroovyHiLink groovyInParen groovyError
|
||||
syn cluster groovyTop add=groovyInParen
|
||||
endif
|
||||
|
||||
" catch errors caused by wrong parenthesis
|
||||
syn region groovyParenT transparent matchgroup=groovyParen start="(" end=")" contains=@groovyTop,groovyParenT1
|
||||
syn region groovyParenT1 transparent matchgroup=groovyParen1 start="(" end=")" contains=@groovyTop,groovyParenT2 contained
|
||||
syn region groovyParenT2 transparent matchgroup=groovyParen2 start="(" end=")" contains=@groovyTop,groovyParenT contained
|
||||
syn match groovyParenError ")"
|
||||
GroovyHiLink groovyParenError groovyError
|
||||
|
||||
" catch errors caused by wrong square parenthesis
|
||||
syn region groovyParenT transparent matchgroup=groovyParen start="\[" end="\]" contains=@groovyTop,groovyParenT1
|
||||
syn region groovyParenT1 transparent matchgroup=groovyParen1 start="\[" end="\]" contains=@groovyTop,groovyParenT2 contained
|
||||
syn region groovyParenT2 transparent matchgroup=groovyParen2 start="\[" end="\]" contains=@groovyTop,groovyParenT contained
|
||||
syn match groovyParenError "\]"
|
||||
|
||||
" ###############################
|
||||
" java.vim default highlighting
|
||||
if version >= 508 || !exists("did_groovy_syn_inits")
|
||||
if version < 508
|
||||
let did_groovy_syn_inits = 1
|
||||
endif
|
||||
GroovyHiLink groovyFuncDef Function
|
||||
GroovyHiLink groovyBraces Function
|
||||
GroovyHiLink groovyBranch Conditional
|
||||
GroovyHiLink groovyUserLabelRef groovyUserLabel
|
||||
GroovyHiLink groovyLabel Label
|
||||
GroovyHiLink groovyUserLabel Label
|
||||
GroovyHiLink groovyConditional Conditional
|
||||
GroovyHiLink groovyRepeat Repeat
|
||||
GroovyHiLink groovyExceptions Exception
|
||||
GroovyHiLink groovyAssert Statement
|
||||
GroovyHiLink groovyStorageClass StorageClass
|
||||
GroovyHiLink groovyMethodDecl groovyStorageClass
|
||||
GroovyHiLink groovyClassDecl groovyStorageClass
|
||||
GroovyHiLink groovyScopeDecl groovyStorageClass
|
||||
GroovyHiLink groovyBoolean Boolean
|
||||
GroovyHiLink groovySpecial Special
|
||||
GroovyHiLink groovySpecialError Error
|
||||
GroovyHiLink groovySpecialCharError Error
|
||||
GroovyHiLink groovyString String
|
||||
GroovyHiLink groovyCharacter Character
|
||||
GroovyHiLink groovySpecialChar SpecialChar
|
||||
GroovyHiLink groovyNumber Number
|
||||
GroovyHiLink groovyError Error
|
||||
GroovyHiLink groovyStringError Error
|
||||
GroovyHiLink groovyStatement Statement
|
||||
GroovyHiLink groovyOperator Operator
|
||||
GroovyHiLink groovyComment Comment
|
||||
GroovyHiLink groovyDocComment Comment
|
||||
GroovyHiLink groovyLineComment Comment
|
||||
GroovyHiLink groovyConstant Constant
|
||||
GroovyHiLink groovyTypedef Typedef
|
||||
GroovyHiLink groovyTodo Todo
|
||||
|
||||
GroovyHiLink groovyCommentTitle SpecialComment
|
||||
GroovyHiLink groovyDocTags Special
|
||||
GroovyHiLink groovyDocParam Function
|
||||
GroovyHiLink groovyCommentStar groovyComment
|
||||
|
||||
GroovyHiLink groovyType Type
|
||||
GroovyHiLink groovyExternal Include
|
||||
|
||||
GroovyHiLink htmlComment Special
|
||||
GroovyHiLink htmlCommentPart Special
|
||||
GroovyHiLink groovySpaceError Error
|
||||
GroovyHiLink groovyJDKBuiltin Special
|
||||
GroovyHiLink groovyJDKOperOverl Operator
|
||||
GroovyHiLink groovyJDKMethods Function
|
||||
endif
|
||||
|
||||
delcommand GroovyHiLink
|
||||
|
||||
|
||||
let b:current_syntax = "groovy"
|
||||
if main_syntax == 'groovy'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
let b:spell_options="contained"
|
||||
|
||||
" vim: ts=8
|
||||
|
||||
endif
|
||||
@@ -13,101 +13,26 @@ elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
||||
syn region haskellRecordBlock matchgroup=haskellDelimiter start="{" end="}"
|
||||
\ contains=
|
||||
\ haskellType,
|
||||
\ haskellSeparator,
|
||||
\ haskellParens,
|
||||
\ haskellBrackets,
|
||||
\ haskellRecordField,
|
||||
\ haskellOperators,
|
||||
\ haskellDot,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellPragma,
|
||||
\ haskellForall
|
||||
else
|
||||
syn region haskellRecordBlock matchgroup=haskellDelimiter start="{" end="}"
|
||||
\ contains=
|
||||
\ haskellType,
|
||||
\ haskellSeparator,
|
||||
\ haskellParens,
|
||||
\ haskellBrackets,
|
||||
\ haskellRecordField,
|
||||
\ haskellOperators,
|
||||
\ haskellDot,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellPragma
|
||||
endif
|
||||
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
|
||||
syn region haskellImportList matchgroup=haskellDelimiter start="(" end=")"
|
||||
\ contains=
|
||||
\ haskellSeparator,
|
||||
\ haskellType,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellDot,
|
||||
\ haskellParens,
|
||||
\ haskellPatternKeyword
|
||||
else
|
||||
syn region haskellImportList matchgroup=haskellDelimiter start="(" end=")"
|
||||
\ contains=
|
||||
\ haskellSeparator,
|
||||
\ haskellType,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellDot,
|
||||
\ haskellParens
|
||||
end
|
||||
syn match haskellRecordField "[_a-z][a-zA-Z0-9_']*\s*::" contained
|
||||
syn match haskellRecordField contained containedin=haskellBlock
|
||||
\ "[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
|
||||
\ contains=
|
||||
\ haskellIdentifier,
|
||||
\ haskellOperators
|
||||
syn match haskellTopLevelDecl
|
||||
\ haskellOperators,
|
||||
\ haskellSeparator,
|
||||
\ haskellParens,
|
||||
syn match haskellTypeSig
|
||||
\ "^\s*\(where\s\+\|let\s\+\|default\s\+\)\?[_a-z][a-zA-Z0-9_']*\(,\s*[_a-z][a-zA-Z0-9_']*\)*\(\s*::\|\n\s\+::\)"
|
||||
\ contains=
|
||||
\ haskellWhere,
|
||||
\ haskellLet,
|
||||
\ haskellIdentifier,
|
||||
\ haskellOperators,
|
||||
\ haskellSeparator,
|
||||
\ haskellParens,
|
||||
\ haskellBrackets,
|
||||
\ haskellWhere,
|
||||
\ haskellLet,
|
||||
\ haskellDefault
|
||||
syn region haskellModuleBlock matchgroup=haskellBlockKeywords start="\<module\>" end="\<where\>"
|
||||
\ contains=haskellType,haskellDot,haskellImportList
|
||||
syn region haskellClassBlock
|
||||
\ matchgroup=haskellBlockKeywords
|
||||
\ start="^\<\(class\|instance\)\>"
|
||||
\ end="\<where\>\|^\<"
|
||||
\ contains=
|
||||
\ haskellType,
|
||||
\ haskellSeparator,
|
||||
\ haskellParens,
|
||||
\ haskellDot,
|
||||
\ haskellOperators,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellPragma
|
||||
syn keyword haskellDeclKeyword newtype data type family instance where contained
|
||||
syn region haskellDeclBlock keepend
|
||||
\ start="^\<\(newtype\|data\|type\)\>\s\+\(\<\(family\|instance\)\>\)\?"
|
||||
\ end="\<where\>\|=\|^\<"
|
||||
\ contains=
|
||||
\ haskellDeclKeyword,
|
||||
\ haskellType,
|
||||
\ haskellQuoted,
|
||||
\ haskellParens,
|
||||
\ haskellBrackets,
|
||||
\ haskellDot,
|
||||
\ haskellOperators,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellPragma
|
||||
syn match haskellAssocType "\s\+\<\(data\|type\|newtype\)\>"
|
||||
syn match haskellDeriving "\(deriving\s\+instance\|deriving\)"
|
||||
syn keyword haskelLWhere where
|
||||
syn keyword haskellLet let
|
||||
syn keyword haskellDeclKeyword module class instance newtype deriving in
|
||||
syn match haskellDecl "\<\(type\|data\)\>\s\+\(\<family\>\)\?"
|
||||
syn keyword haskellDefault default
|
||||
syn keyword haskellImportKeywords import qualified safe as hiding contained
|
||||
syn keyword haskellForeignKeywords foreign export import ccall safe unsafe interruptible capi prim contained
|
||||
@@ -117,19 +42,16 @@ syn region haskellForeignImport start="\<foreign\>" end="::" keepend
|
||||
\ haskellOperators,
|
||||
\ haskellForeignKeywords,
|
||||
\ haskellIdentifier
|
||||
syn region haskellImport
|
||||
\ start="^import"
|
||||
\ end="^\<"
|
||||
syn match haskellImport "^\<import\>\s\+\(\<safe\>\s\+\)\?\(\<qualified\>\s\+\)\?.\+\(\s\+\<as\>\s\+.\+\)\?\(\s\+\<hiding\>\)\?"
|
||||
\ contains=
|
||||
\ haskellParens,
|
||||
\ haskellOperators,
|
||||
\ haskellImportKeywords,
|
||||
\ haskellImportList,
|
||||
\ haskellType,
|
||||
\ haskellLineComment,
|
||||
\ haskellBlockComment,
|
||||
\ haskellDot
|
||||
syn keyword haskellStatement do case of in
|
||||
syn keyword haskellWhere where
|
||||
syn keyword haskellLet let
|
||||
\ haskellPragma,
|
||||
syn keyword haskellStatement do case of
|
||||
if exists('g:haskell_enable_static_pointers') && g:haskell_enable_static_pointers == 1
|
||||
syn keyword haskellStatic static
|
||||
endif
|
||||
@@ -137,12 +59,12 @@ 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
|
||||
syn region haskellBrackets matchgroup=haskellDelimiter start="\[" end="]" contains=TOP
|
||||
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 keyword haskellInfix infix infixl infixr
|
||||
syn keyword haskellBottom undefined error
|
||||
syn match haskellOperators "[-!#$%&\*\+/<=>\?@\\^|~:]\+\|\<_\>"
|
||||
syn match haskellOperators "[-!#$%&\*\+/<=>\?@\\^|~:.]\+\|\<_\>"
|
||||
syn match haskellQuote "\<'\+" contained
|
||||
syn match haskellQuotedType "[A-Z][a-zA-Z0-9_']*\>" contained
|
||||
syn region haskellQuoted start="\<'\+" end="\>"
|
||||
@@ -154,7 +76,6 @@ syn region haskellQuoted start="\<'\+" end="\>"
|
||||
\ haskellParens,
|
||||
\ haskellOperators,
|
||||
\ haskellIdentifier
|
||||
syn match haskellDot "\."
|
||||
syn match haskellLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
|
||||
\ contains=
|
||||
\ haskellTodo,
|
||||
@@ -164,22 +85,24 @@ syn region haskellString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
\ contains=@Spell
|
||||
syn match haskellIdentifier "[_a-z][a-zA-z0-9_']*" contained
|
||||
syn match haskellChar "\<'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'\>"
|
||||
syn match haskellType "\<[A-Z][a-zA-Z0-9_']*\>\n\?\s*"
|
||||
\ nextgroup=haskellBlockComment,haskellRecordBlock
|
||||
syn match haskellType "\<[A-Z][a-zA-Z0-9_']*\>"
|
||||
syn region haskellBlockComment start="{-" end="-}"
|
||||
\ contains=
|
||||
\ haskellBlockComment,
|
||||
\ haskellTodo,
|
||||
\ @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 haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
|
||||
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
|
||||
syn match haskellPreProc "^#.*$"
|
||||
syn keyword haskellTodo TODO FIXME contained
|
||||
" Treat a shebang line at the start of the file as a comment
|
||||
syn match haskellShebang "\%^#!.*$"
|
||||
if exists('g:haskell_enable_typeroles') && g:haskell_enable_typeroles == 1
|
||||
syn keyword haskellTypeRoles phantom representational nominal contained
|
||||
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="^\<" keepend
|
||||
syn region haskellTypeRoleBlock matchgroup=haskellTypeRoles start="type\s\+role" end="$" keepend
|
||||
\ contains=
|
||||
\ haskellType,
|
||||
\ haskellTypeRoles
|
||||
@@ -194,12 +117,7 @@ if exists('g:haskell_enable_arrowsyntax') && g:haskell_enable_arrowsyntax == 1
|
||||
syn keyword haskellArrowSyntax proc
|
||||
endif
|
||||
if exists('g:haskell_enable_pattern_synonyms') && g:haskell_enable_pattern_synonyms == 1
|
||||
syn region haskellPatternSynonym start="^\<pattern\>" end="=\|<-" keepend
|
||||
\ contains=
|
||||
\ haskellPatternKeyword,
|
||||
\ haskellType,
|
||||
\ haskellOperators
|
||||
syn keyword haskellPatternKeyword pattern contained
|
||||
syn keyword haskellPatternKeyword pattern
|
||||
endif
|
||||
|
||||
highlight def link haskellBottom Macro
|
||||
@@ -209,8 +127,6 @@ highlight def link haskellIdentifier Identifier
|
||||
highlight def link haskellForeignKeywords Structure
|
||||
highlight def link haskellDeriving Structure
|
||||
highlight def link haskellStatement Statement
|
||||
highlight def link haskellWhere Statement
|
||||
highlight def link haskellLet Statement
|
||||
highlight def link haskellDefault Statement
|
||||
highlight def link haskellConditional Conditional
|
||||
highlight def link haskellNumber Number
|
||||
@@ -221,8 +137,8 @@ highlight def link haskellInfix PreProc
|
||||
highlight def link haskellOperators Operator
|
||||
highlight def link haskellQuote Operator
|
||||
highlight def link haskellQuotedType Include
|
||||
highlight def link haskellDot Operator
|
||||
highlight def link haskellType Include
|
||||
highlight def link haskellShebang Comment
|
||||
highlight def link haskellLineComment Comment
|
||||
highlight def link haskellBlockComment Comment
|
||||
highlight def link haskellPragma SpecialComment
|
||||
@@ -235,6 +151,10 @@ highlight def link haskellAssocType Structure
|
||||
highlight def link haskellImportBlock Delimiter
|
||||
highlight def link haskellImportKeywords Structure
|
||||
highlight def link haskellDeclKeyword Structure
|
||||
highlight def link haskellDecl Structure
|
||||
highlight def link haskellWhere Structure
|
||||
highlight def link haskellLet Structure
|
||||
highlight def link haskellQuasiQuoted String
|
||||
|
||||
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
||||
highlight def link haskellForall Operator
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: HTML (version 5)
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Last Change: 2009 Aug 19
|
||||
" Language: HTML (version 5.1)
|
||||
" SVG (SVG 1.1 (Second Edition) )
|
||||
" Last Change: 2016 Jan 20
|
||||
" License: Public domain
|
||||
" (but let me know if you like :) )
|
||||
"
|
||||
" Note: This file just adds the new tags from HTML 5
|
||||
" Note: This file just add new tags from HTML 5
|
||||
" and don't replace default html.vim syntax file
|
||||
"
|
||||
" Modified: othree <othree@gmail.com>
|
||||
" Changes: update to Draft 13 January 2011
|
||||
" add complete new attributes
|
||||
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||
" Changes: update to Draft 2016 Jan 13
|
||||
" add microdata Attributes
|
||||
" add bdi element
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Modified: htdebeer <H.T.de.Beer@gmail.com>
|
||||
" Changes: add common SVG elements and attributes for inline SVG
|
||||
|
||||
" HTML 5 tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu nav output
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu menuitem nav output
|
||||
syn keyword htmlTagName contained progress ruby rt rp rb rtc section source summary time track video data
|
||||
syn keyword htmlTagName contained template content shadow
|
||||
syn keyword htmlTagName contained wbr bdi
|
||||
@@ -43,6 +42,7 @@ syn keyword htmlTagName contained glyph glyphRef hkern
|
||||
syn keyword htmlTagName contained linearGradient marker mask pattern radialGradient set stop
|
||||
syn keyword htmlTagName contained missing-glyph mpath
|
||||
syn keyword htmlTagName contained text textPath tref tspan vkern
|
||||
syn keyword htmlTagName contained metadata title
|
||||
|
||||
" Custom Element
|
||||
syn match htmlTagName contained "\<[a-z_]\([a-z0-9_.]\+\)\?\(\-[a-z0-9_.]\+\)\+\>"
|
||||
@@ -101,21 +101,21 @@ syn keyword htmlArg contained d descent diffuseConstant divisor dur dx dy
|
||||
syn keyword htmlArg contained edgeMode elevation end exponent externalResourcesRequired
|
||||
syn keyword htmlArg contained fill filterRes filterUnits font-family font-size font-stretch font-style font-variant font-weight format format from fx fy
|
||||
syn keyword htmlArg contained g1 g2 glyph-name glyphRef gradientTransform gradientUnits
|
||||
syn keyword htmlArg contained hanging height horiz-adv-x horiz-origin-y
|
||||
syn keyword htmlArg contained hanging height horiz-adv-x horiz-origin-x horiz-origin-y
|
||||
syn keyword htmlArg contained id ideographic in in2 intercept
|
||||
syn keyword htmlArg contained k k1 k2 k3 k4 kernelMatrix kernelUnitLength keyPoints keySplines keyTimes
|
||||
syn keyword htmlArg contained lang lengthAdjust limitingConeAngle local
|
||||
syn keyword htmlArg contained markerHeight markerUnits markerWidth maskContentUnits maskUnits mathematical max media method min mode name
|
||||
syn keyword htmlArg contained numOctaves
|
||||
syn keyword htmlArg contained offset offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload onzoom operator order orient orientation origin overline-position overline-thickness
|
||||
syn keyword htmlArg contained offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload onzoom operator order orient orientation origin overline-position overline-thickness
|
||||
syn keyword htmlArg contained panose-1 path pathLength patternContentUnits patternTransform patternUnits points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits
|
||||
syn keyword htmlArg contained r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry
|
||||
syn keyword htmlArg contained scale seed slope spacing specularConstant specularExponent spreadMethod startOffset stdDeviation stemh stemv stitchTiles strikethrough-position strikethrough-thickness string surfaceScale systemLanguage
|
||||
syn keyword htmlArg contained tableValues target targetX targetY textLength title to transform type u
|
||||
syn keyword htmlArg contained 1 u2 underline-position underline-thickness unicode unicode-range units-per-em
|
||||
syn keyword htmlArg contained tableValues target targetX targetY textLength title to transform type
|
||||
syn keyword htmlArg contained u1 u2 underline-position underline-thickness unicode unicode-range units-per-em
|
||||
syn keyword htmlArg contained v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget
|
||||
syn keyword htmlArg contained width widths
|
||||
syn keyword htmlArg contained x x-height x1 x2 xChannelSelector xlink:actuate xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:show xlink:title xlink:type xml:base xml:lang xml:space
|
||||
syn keyword htmlArg contained x x-height x1 x2 xChannelSelector xlink:actuate xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space
|
||||
syn keyword htmlArg contained y y1 y2 yChannelSelector
|
||||
syn keyword htmlArg contained z zoomAndPan
|
||||
syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode
|
||||
|
||||
@@ -18,6 +18,8 @@ silent! syntax include @htmlCoffeescript syntax/coffee.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlStylus syntax/stylus.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlCss syntax/css.vim
|
||||
unlet! b:current_syntax
|
||||
silent! syntax include @htmlMarkdown syntax/markdown.vim
|
||||
unlet! b:current_syntax
|
||||
|
||||
@@ -37,7 +39,7 @@ syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!"
|
||||
syn region jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
|
||||
syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent
|
||||
syn match jadeClassChar "\." contained nextgroup=jadeClass
|
||||
syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag
|
||||
syn match jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar
|
||||
syn match jadeIdChar "#[[{]\@!" contained nextgroup=jadeId
|
||||
syn match jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
|
||||
syn match jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent
|
||||
@@ -62,14 +64,14 @@ syn region jadeMarkdownFilter matchgroup=jadeFilter start=/^\z(\s*\):\%(markdow
|
||||
syn region jadeStylusFilter matchgroup=jadeFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
|
||||
syn region jadePlainFilter matchgroup=jadeFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
|
||||
|
||||
syn match jadeScriptConditional "^\s*\<\%(if\|else\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
|
||||
syn match jadeScriptConditional "^\s*\<\%(if\|else\|else if\|elif\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
|
||||
syn match jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
|
||||
syn region jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords
|
||||
syn keyword jadeScriptLoopKeywords for in contained
|
||||
|
||||
syn region jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend
|
||||
|
||||
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
|
||||
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
|
||||
syn region jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag
|
||||
syn region jadeCssBlock start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
|
||||
|
||||
|
||||
@@ -2,9 +2,21 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
||||
|
||||
" Vim syntax file
|
||||
" Language: JavaScript
|
||||
" Maintainer: vim-javascript community
|
||||
" URL: https://github.com/pangloss/vim-javascript
|
||||
" Maintainer: Kao Wei-Ko(othree) <othree@gmail.com>
|
||||
" Last Change: 2015-05-11
|
||||
" Version: 1.5
|
||||
" Changes: Go to https://github.com/othree/yajs.vim for recent changes.
|
||||
" Origin: https://github.com/jelera/vim-javascript-syntax
|
||||
" Credits: Jose Elera Campana, Zhao Yi, Claudio Fleiner, Scott Shattuck
|
||||
" (This file is based on their hard work), gumnos (From the #vim
|
||||
" IRC Channel in Freenode)
|
||||
|
||||
|
||||
" if exists("b:yajs_loaded")
|
||||
" finish
|
||||
" else
|
||||
" let b:yajs_loaded = 1
|
||||
" endif
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
@@ -14,322 +26,371 @@ if !exists("main_syntax")
|
||||
let main_syntax = 'javascript'
|
||||
endif
|
||||
|
||||
if !exists('g:javascript_conceal')
|
||||
let g:javascript_conceal = 0
|
||||
endif
|
||||
|
||||
"" Drop fold if it is set but VIM doesn't support it.
|
||||
let b:javascript_fold='true'
|
||||
if version < 600 " Don't support the old version
|
||||
unlet! b:javascript_fold
|
||||
endif
|
||||
|
||||
"" dollar sign is permittd anywhere in an identifier
|
||||
setlocal iskeyword+=$
|
||||
|
||||
syntax sync fromstart
|
||||
|
||||
syntax match jsNoise /\%(:\|,\|\;\|\.\)/
|
||||
|
||||
"" Program Keywords
|
||||
syntax keyword jsStorageClass const var let
|
||||
syntax keyword jsOperator delete instanceof typeof void new in
|
||||
syntax match jsOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/
|
||||
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 region jsImportContainer start="^\s\?import \?" end="$" contains=jsModules,jsModuleWords,jsComment,jsStringS,jsStringD,jsTemplateString
|
||||
|
||||
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,jsClass,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsAssignmentExpr
|
||||
|
||||
"" JavaScript comments
|
||||
syntax keyword jsCommentTodo TODO FIXME XXX TBD contained
|
||||
syntax region jsLineComment start=+\/\/+ end=+$+ keepend contains=jsCommentTodo,@Spell
|
||||
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
|
||||
|
||||
"" 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\|file\|fires\|kind\|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\|param\|property\)\>" 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\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||
|
||||
syntax region jsDocType start="{" end="}" oneline contained nextgroup=jsDocParam skipwhite
|
||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||
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 match jsTemplateVar "\${.\{-}}" contained
|
||||
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
|
||||
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\+\)\@<=\|\(\([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
||||
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<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 jsAssignmentExpr /\v%([a-zA-Z_$]\k*\.)*[a-zA-Z_$]\k*\s*\=/ contains=jsFuncAssignExpr,jsAssignExpIdent,jsPrototype,jsOperator,jsThis,jsNoise
|
||||
syntax match jsAssignExpIdent /\v[a-zA-Z_$]\k*\ze%(\s*\=)/ contained
|
||||
syntax match jsFuncAssignExpr /\v%(%([a-zA-Z_$]\k*\.)*[a-zA-Z_$]\k*\s*\=\s*){-1,}\ze%(function\s*\*?\s*\()/ contains=jsFuncAssignObjChain,jsFuncAssignIdent,jsFunction,jsPrototype,jsOperator,jsThis contained
|
||||
syntax match jsFuncAssignObjChain /\v%([a-zA-Z_$]\k*\.)+/ contains=jsPrototype,jsNoise contained
|
||||
syntax match jsFuncAssignIdent /\v[a-zA-Z_$]\k*\ze%(\s*\=)/ contained
|
||||
|
||||
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 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 : '')
|
||||
|
||||
"" 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 jsClass extends class
|
||||
syntax keyword jsException try catch throw finally
|
||||
|
||||
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Intl JSON Math console document window
|
||||
syntax match jsGlobalObjects /\%(Intl\.\)\@<=\(Collator\|DateTimeFormat\|NumberFormat\)/
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
" 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
|
||||
|
||||
" 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
|
||||
|
||||
" 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\|getElementsByTagName\|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,jsAssignmentExpr,jsImportContainer,jsExportContainer,jsClass
|
||||
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
|
||||
syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc fold
|
||||
syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc contained fold
|
||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf
|
||||
|
||||
"" catch errors caused by wrong parenthesis
|
||||
syntax match jsParensError ")\|}\|\]"
|
||||
syntax match jsParensErrA contained "\]"
|
||||
syntax match jsParensErrB contained ")"
|
||||
syntax match jsParensErrC contained "}"
|
||||
|
||||
if main_syntax == "javascript"
|
||||
syntax sync clear
|
||||
syntax sync ccomment jsComment minlines=200
|
||||
syntax sync match jsHighlight grouphere jsBlock /{/
|
||||
endif
|
||||
|
||||
exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
||||
|
||||
syntax match jsGenerator contained '\*' nextgroup=jsFuncName 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,jsAssignmentExpr nextgroup=jsFuncBlock keepend skipwhite skipempty
|
||||
syntax match jsFuncArgCommas contained ','
|
||||
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/
|
||||
syntax keyword jsArgsObj arguments contained containedin=jsFuncBlock
|
||||
|
||||
syntax match jsArrowFunction /=>/
|
||||
|
||||
" 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_javascript_syn_inits")
|
||||
let did_javascript_hilink = 1
|
||||
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 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 jsDocTypeNoParam Type
|
||||
HiLink jsDocParam Label
|
||||
HiLink jsStringS String
|
||||
HiLink jsStringD String
|
||||
HiLink jsTemplateString String
|
||||
HiLink jsTaggedTemplate StorageClass
|
||||
HiLink jsTernaryIfOperator Conditional
|
||||
HiLink jsRegexpString String
|
||||
HiLink jsRegexpBoundary SpecialChar
|
||||
HiLink jsRegexpQuantifier SpecialChar
|
||||
HiLink jsRegexpOr Conditional
|
||||
HiLink jsRegexpMod SpecialChar
|
||||
HiLink jsRegexpBackRef SpecialChar
|
||||
HiLink jsRegexpGroup jsRegexpString
|
||||
HiLink jsRegexpCharClass Character
|
||||
HiLink jsCharacter Character
|
||||
HiLink jsPrototype Special
|
||||
HiLink jsConditional Conditional
|
||||
HiLink jsBranch Conditional
|
||||
HiLink jsLabel Label
|
||||
HiLink jsReturn Statement
|
||||
HiLink jsRepeat Repeat
|
||||
HiLink jsStatement Statement
|
||||
HiLink jsException Exception
|
||||
HiLink jsKeyword Keyword
|
||||
HiLink jsArrowFunction Type
|
||||
HiLink jsFunction Type
|
||||
HiLink jsGenerator jsFunction
|
||||
HiLink jsFuncName Function
|
||||
HiLink jsArgsObj 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 jsClass Structure
|
||||
HiLink jsThis Special
|
||||
HiLink jsStatic Special
|
||||
HiLink jsSuper Special
|
||||
HiLink jsNan Number
|
||||
HiLink jsNull Type
|
||||
HiLink jsUndefined Type
|
||||
HiLink jsNumber Number
|
||||
HiLink jsFloat Float
|
||||
HiLink jsBooleanTrue Boolean
|
||||
HiLink jsBooleanFalse Boolean
|
||||
HiLink jsNoise Noise
|
||||
HiLink jsBrackets Noise
|
||||
HiLink jsParens Noise
|
||||
HiLink jsBraces Noise
|
||||
HiLink jsFuncBraces Noise
|
||||
HiLink jsFuncParens Noise
|
||||
HiLink jsSpecial Special
|
||||
HiLink jsTemplateVar Special
|
||||
HiLink jsGlobalObjects Special
|
||||
HiLink jsExceptions Special
|
||||
HiLink jsFutureKeys Special
|
||||
HiLink jsBuiltins Special
|
||||
HiLink jsModules Include
|
||||
HiLink jsModuleWords Include
|
||||
|
||||
HiLink jsDomErrNo Constant
|
||||
HiLink jsDomNodeConsts Constant
|
||||
HiLink jsDomElemAttrs Label
|
||||
HiLink jsDomElemFuncs PreProc
|
||||
|
||||
HiLink jsHtmlEvents Special
|
||||
HiLink jsHtmlElemAttrs Label
|
||||
HiLink jsHtmlElemFuncs PreProc
|
||||
|
||||
HiLink jsCssStyles Label
|
||||
|
||||
delcommand HiLink
|
||||
else
|
||||
finish
|
||||
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
|
||||
"Dollar sign is permitted anywhere in an identifier
|
||||
setlocal iskeyword-=$
|
||||
if &filetype =~ 'javascript'
|
||||
setlocal iskeyword+=$
|
||||
syntax cluster htmlJavaScript contains=TOP
|
||||
endif
|
||||
|
||||
" Vim's default html.vim highlights all javascript as 'Special'
|
||||
hi! def link javaScript NONE
|
||||
syntax sync fromstart
|
||||
|
||||
"Syntax coloring for Node.js shebang line
|
||||
syntax match shellbang "^#!.*node\>"
|
||||
syntax match shellbang "^#!.*iojs\>"
|
||||
|
||||
syntax match javascriptOpSymbols /:\ze\_[^+\-*/%\^=!<>&|?:]/ nextgroup=@javascriptStatement,javascriptCase skipwhite skipempty
|
||||
syntax match javascriptOpSymbols /[+\-*/%\^=!<>&|?:]\+/ contains=javascriptOpSymbol nextgroup=@javascriptExpression skipwhite skipempty
|
||||
|
||||
"JavaScript comments
|
||||
syntax keyword javascriptCommentTodo contained TODO FIXME XXX TBD
|
||||
syntax match javascriptLineComment "//.*" contains=@Spell,javascriptCommentTodo
|
||||
syntax region javascriptComment start="/\*" end="\*/" contains=@Spell,javascriptCommentTodo extend
|
||||
syntax cluster javascriptComments contains=javascriptDocComment,javascriptComment,javascriptLineComment
|
||||
|
||||
"JSDoc
|
||||
syntax case ignore
|
||||
|
||||
syntax region javascriptDocComment start="/\*\*" end="\*/" contains=javascriptDocNotation,javascriptCommentTodo,@Spell fold keepend
|
||||
syntax match javascriptDocNotation contained / @/ nextgroup=javascriptDocTags
|
||||
|
||||
syntax keyword javascriptDocTags contained constant constructor constructs function ignore inner private public readonly static
|
||||
syntax keyword javascriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct
|
||||
syntax keyword javascriptDocTags contained example global
|
||||
|
||||
" syntax keyword javascriptDocTags contained ngdoc nextgroup=javascriptDocNGDirective
|
||||
syntax keyword javascriptDocTags contained ngdoc scope priority animations
|
||||
syntax keyword javascriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=javascriptDocParam skipwhite
|
||||
syntax keyword javascriptDocNGDirective contained overview service object function method property event directive filter inputType error
|
||||
|
||||
syntax keyword javascriptDocTags contained abstract virtual access augments
|
||||
|
||||
syntax keyword javascriptDocTags contained arguments callback lends memberOf name type kind link mixes mixin tutorial nextgroup=javascriptDocParam skipwhite
|
||||
syntax keyword javascriptDocTags contained variation nextgroup=javascriptDocNumParam skipwhite
|
||||
|
||||
syntax keyword javascriptDocTags contained author class classdesc copyright default defaultvalue nextgroup=javascriptDocDesc skipwhite
|
||||
syntax keyword javascriptDocTags contained deprecated description external host nextgroup=javascriptDocDesc skipwhite
|
||||
syntax keyword javascriptDocTags contained file fileOverview overview namespace requires since version nextgroup=javascriptDocDesc skipwhite
|
||||
syntax keyword javascriptDocTags contained summary todo license preserve nextgroup=javascriptDocDesc skipwhite
|
||||
|
||||
syntax keyword javascriptDocTags contained borrows exports nextgroup=javascriptDocA skipwhite
|
||||
syntax keyword javascriptDocTags contained param arg argument property prop module nextgroup=javascriptDocNamedParamType,javascriptDocParamName skipwhite
|
||||
syntax keyword javascriptDocTags contained type nextgroup=javascriptDocParamType skipwhite
|
||||
syntax keyword javascriptDocTags contained define enum extends implements this typedef nextgroup=javascriptDocParamType skipwhite
|
||||
syntax keyword javascriptDocTags contained return returns throws exception nextgroup=javascriptDocParamType,javascriptDocParamName skipwhite
|
||||
syntax keyword javascriptDocTags contained see nextgroup=javascriptDocRef skipwhite
|
||||
|
||||
"syntax for event firing
|
||||
syntax keyword javascriptDocTags contained emits fires nextgroup=javascriptDocEventRef skipwhite
|
||||
|
||||
syntax keyword javascriptDocTags contained function func method nextgroup=javascriptDocName skipwhite
|
||||
syntax match javascriptDocName contained /\h\w*/
|
||||
|
||||
syntax keyword javascriptDocTags contained fires event nextgroup=javascriptDocEventRef skipwhite
|
||||
syntax match javascriptDocEventRef contained /\h\w*#\(\h\w*\:\)\?\h\w*/
|
||||
|
||||
syntax match javascriptDocNamedParamType contained /{.\+}/ nextgroup=javascriptDocParamName skipwhite
|
||||
syntax match javascriptDocParamName contained /\[\?[0-9a-zA-Z_\.]\+=\?[0-9a-zA-Z_\.]*\]\?/ nextgroup=javascriptDocDesc skipwhite
|
||||
syntax match javascriptDocParamType contained /{.\+}/ nextgroup=javascriptDocDesc skipwhite
|
||||
syntax match javascriptDocA contained /\%(#\|\w\|\.\|:\|\/\)\+/ nextgroup=javascriptDocAs skipwhite
|
||||
syntax match javascriptDocAs contained /\s*as\s*/ nextgroup=javascriptDocB skipwhite
|
||||
syntax match javascriptDocB contained /\%(#\|\w\|\.\|:\|\/\)\+/
|
||||
syntax match javascriptDocParam contained /\%(#\|\w\|\.\|:\|\/\|-\)\+/
|
||||
syntax match javascriptDocNumParam contained /\d\+/
|
||||
syntax match javascriptDocRef contained /\%(#\|\w\|\.\|:\|\/\)\+/
|
||||
syntax region javascriptDocLinkTag contained matchgroup=javascriptDocLinkTag start=/{/ end=/}/ contains=javascriptDocTags
|
||||
|
||||
syntax cluster javascriptDocs contains=javascriptDocParamType,javascriptDocNamedParamType,javascriptDocParam
|
||||
|
||||
if main_syntax == "javascript"
|
||||
syntax sync clear
|
||||
syntax sync ccomment javascriptComment minlines=200
|
||||
endif
|
||||
|
||||
syntax case match
|
||||
|
||||
syntax cluster javascriptAfterIdentifier contains=javascriptDotNotation,javascriptFuncCallArg,javascriptComputedProperty,javascriptWSymbols,@javascriptSymbols
|
||||
|
||||
syntax match javascriptIdentifierName /\<[^=<>!?+\-*\/%|&,;:. ~@#`"'\[\]\(\)\{\}\^0-9][^=<>!?+\-*\/%|&,;:. ~@#`"'\[\]\(\)\{\}\^]*/ nextgroup=@javascriptAfterIdentifier contains=@_semantic
|
||||
|
||||
"Block VariableStatement EmptyStatement ExpressionStatement IfStatement IterationStatement ContinueStatement BreakStatement ReturnStatement WithStatement LabelledStatement SwitchStatement ThrowStatement TryStatement DebuggerStatement
|
||||
|
||||
syntax cluster javascriptStatement contains=javascriptBlock,javascriptVariable,@javascriptExpression,javascriptConditional,javascriptRepeat,javascriptBranch,javascriptLabel,javascriptStatementKeyword,javascriptTry,javascriptDebugger
|
||||
|
||||
"Syntax in the JavaScript code
|
||||
" syntax match javascriptASCII contained /\\\d\d\d/
|
||||
syntax region javascriptTemplateSubstitution contained matchgroup=javascriptTemplateSB start=/\${/ end=/}/ contains=javascriptTemplateSBlock,javascriptTemplateSString
|
||||
syntax region javascriptTemplateSBlock contained start=/{/ end=/}/ contains=javascriptTemplateSBlock,javascriptTemplateSString transparent
|
||||
syntax region javascriptTemplateSString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ extend contains=javascriptTemplateSStringRB transparent
|
||||
syntax match javascriptTemplateSStringRB /}/ contained
|
||||
syntax region javascriptString start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax region javascriptTemplate start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ contains=javascriptTemplateSubstitution nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
" syntax match javascriptTemplateTag /\k\+/ nextgroup=javascriptTemplate
|
||||
syntax region javascriptArray matchgroup=javascriptBraces start=/\[/ end=/]/ contains=@javascriptValue,javascriptForComprehension,@javascriptComments nextgroup=@javascriptSymbols,@javascriptComments skipwhite skipempty
|
||||
|
||||
syntax match javascriptNumber /\<0[bB][01]\+\>/ nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax match javascriptNumber /\<0[oO][0-7]\+\>/ nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax match javascriptNumber /\<0[xX][0-9a-fA-F]\+\>/ nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax match javascriptNumber /[+-]\=\%(\d\+\.\d\+\|\d\+\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
|
||||
syntax cluster javascriptTypes contains=javascriptString,javascriptTemplate,javascriptRegexpString,javascriptNumber,javascriptBoolean,javascriptNull,javascriptArray
|
||||
syntax cluster javascriptValue contains=@javascriptTypes,@javascriptExpression,javascriptFuncKeyword,javascriptClassKeyword,javascriptObjectLiteral,javascriptIdentifier,javascriptIdentifierName,javascriptOperator,@javascriptSymbols
|
||||
|
||||
syntax match javascriptLabel /[a-zA-Z_$]\k*\_s*:/he=e-1 nextgroup=@javascriptValue,@javascriptStatement skipwhite skipempty
|
||||
syntax match javascriptObjectLabel contained /\k\+\_s*:/he=e-1 contains=javascriptObjectLabelColon nextgroup=@javascriptValue,@javascriptStatement skipwhite skipempty
|
||||
syntax match javascriptObjectLabelColon contained /:/ nextgroup=@javascriptValue,@javascriptStatement skipwhite skipempty
|
||||
" syntax match javascriptPropertyName contained /"[^"]\+"\s*:/he=e-1 nextgroup=@javascriptValue skipwhite skipempty
|
||||
" syntax match javascriptPropertyName contained /'[^']\+'\s*:/he=e-1 nextgroup=@javascriptValue skipwhite skipempty
|
||||
syntax region javascriptPropertyName contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ nextgroup=javascriptObjectLabelColon skipwhite skipempty
|
||||
syntax region javascriptComputedPropertyName contained matchgroup=javascriptPropertyName start=/\[/rs=s+1 end=/]/ contains=@javascriptValue nextgroup=javascriptObjectLabelColon skipwhite skipempty
|
||||
syntax region javascriptComputedProperty contained matchgroup=javascriptProperty start=/\[/rs=s+1 end=/]/ contains=@javascriptValue,@javascriptSymbols nextgroup=@javascriptAfterIdentifier skipwhite skipempty
|
||||
" Value for object, statement for label statement
|
||||
|
||||
syntax cluster javascriptTemplates contains=javascriptTemplate,javascriptTemplateSubstitution,javascriptTemplateSBlock,javascriptTemplateSString,javascriptTemplateSStringRB,javascriptTemplateSB
|
||||
syntax cluster javascriptStrings contains=javascriptProp,javascriptString,@javascriptTemplates,@javascriptComments,javascriptDocComment,javascriptRegexpString,javascriptPropertyName
|
||||
|
||||
"this
|
||||
|
||||
"JavaScript Prototype
|
||||
syntax keyword javascriptPrototype prototype
|
||||
|
||||
"Program Keywords
|
||||
syntax keyword javascriptIdentifier arguments this nextgroup=@javascriptAfterIdentifier
|
||||
syntax keyword javascriptVariable let var const
|
||||
syntax keyword javascriptOperator delete new instanceof typeof void in nextgroup=@javascriptValue,@javascriptTypes skipwhite skipempty
|
||||
syntax keyword javascriptForOperator contained in of
|
||||
syntax keyword javascriptBoolean true false nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax keyword javascriptNull null undefined nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax keyword javascriptMessage alert confirm prompt status
|
||||
syntax keyword javascriptGlobal self top parent
|
||||
|
||||
"Statement Keywords
|
||||
syntax keyword javascriptConditional if else switch
|
||||
syntax keyword javascriptConditionalElse else
|
||||
syntax keyword javascriptRepeat do while for nextgroup=javascriptLoopParen skipwhite skipempty
|
||||
syntax keyword javascriptBranch break continue
|
||||
syntax keyword javascriptCase case nextgroup=@javascriptTypes skipwhite
|
||||
syntax keyword javascriptDefault default
|
||||
syntax keyword javascriptStatementKeyword return with yield
|
||||
syntax keyword javascriptReturn return nextgroup=@javascriptValue skipwhite
|
||||
syntax keyword javascriptYield yield
|
||||
|
||||
syntax keyword javascriptTry try
|
||||
syntax keyword javascriptExceptions catch throw finally
|
||||
syntax keyword javascriptDebugger debugger
|
||||
|
||||
syntax match javascriptProp contained /[a-zA-Z_$][a-zA-Z0-9_$]*/ contains=@props,@_semantic transparent nextgroup=@javascriptAfterIdentifier
|
||||
syntax match javascriptMethod contained /[a-zA-Z_$][a-zA-Z0-9_$]*\ze(/ contains=@props transparent nextgroup=javascriptFuncCallArg
|
||||
syntax match javascriptDotNotation /\./ nextgroup=javascriptProp,javascriptMethod
|
||||
syntax match javascriptDotStyleNotation /\.style\./ nextgroup=javascriptDOMStyle transparent
|
||||
|
||||
runtime syntax/yajs/javascript.vim
|
||||
runtime syntax/yajs/es6-number.vim
|
||||
runtime syntax/yajs/es6-string.vim
|
||||
runtime syntax/yajs/es6-array.vim
|
||||
runtime syntax/yajs/es6-object.vim
|
||||
runtime syntax/yajs/es6-symbol.vim
|
||||
runtime syntax/yajs/es6-function.vim
|
||||
runtime syntax/yajs/es6-math.vim
|
||||
runtime syntax/yajs/es6-date.vim
|
||||
runtime syntax/yajs/es6-json.vim
|
||||
runtime syntax/yajs/es6-regexp.vim
|
||||
runtime syntax/yajs/es6-map.vim
|
||||
runtime syntax/yajs/es6-set.vim
|
||||
runtime syntax/yajs/es6-proxy.vim
|
||||
runtime syntax/yajs/es6-promise.vim
|
||||
runtime syntax/yajs/node.vim
|
||||
runtime syntax/yajs/web.vim
|
||||
|
||||
let javascript_props = 1
|
||||
|
||||
runtime syntax/yajs/event.vim
|
||||
syntax region javascriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=javascriptASCII,@events
|
||||
|
||||
"Import
|
||||
syntax region javascriptImportDef start=/import/ end=/;\|\n/ contains=javascriptImport,javascriptString,javascriptEndColons
|
||||
syntax keyword javascriptImport contained from as import
|
||||
syntax keyword javascriptExport export module
|
||||
|
||||
syntax region javascriptBlock matchgroup=javascriptBraces start=/\([\^:]\s\*\)\=\zs{/ end=/}/ contains=@htmlJavaScript
|
||||
|
||||
syntax region javascriptMethodDef contained start=/\(\(\(set\|get\)\_s\+\)\?\)[a-zA-Z_$]\k*\_s*(/ end=/)/ contains=javascriptMethodAccessor,javascriptMethodName,javascriptFuncArg nextgroup=javascriptBlock skipwhite keepend
|
||||
syntax region javascriptMethodArgs contained start=/(/ end=/)/ contains=javascriptFuncArg,@javascriptComments nextgroup=javascriptBlock skipwhite keepend
|
||||
syntax match javascriptMethodName contained /[a-zA-Z_$]\k*/ nextgroup=javascriptMethodArgs skipwhite skipempty
|
||||
syntax match javascriptMethodAccessor contained /\(set\|get\)\s\+\ze\k/ contains=javascriptMethodAccessorWords
|
||||
syntax keyword javascriptMethodAccessorWords contained get set
|
||||
syntax region javascriptMethodName contained matchgroup=javascriptPropertyName start=/\[/ end=/]/ contains=@javascriptValue nextgroup=javascriptMethodArgs skipwhite skipempty
|
||||
|
||||
syntax keyword javascriptAsyncFuncKeyword async await
|
||||
" syntax keyword javascriptFuncKeyword function nextgroup=javascriptFuncName,javascriptFuncArg skipwhite
|
||||
syntax keyword javascriptFuncKeyword function nextgroup=javascriptAsyncFunc,javascriptSyncFunc
|
||||
syntax match javascriptSyncFunc contained // nextgroup=javascriptFuncName,javascriptFuncArg skipwhite skipempty
|
||||
syntax match javascriptAsyncFunc contained /\s*\*\s*/ nextgroup=javascriptFuncName,javascriptFuncArg skipwhite skipempty
|
||||
syntax match javascriptFuncName contained /[a-zA-Z_$]\k*/ nextgroup=javascriptFuncArg skipwhite
|
||||
syntax match javascriptFuncArg contained /(\_[^()]*)/ contains=javascriptParens,javascriptFuncKeyword,javascriptFuncComma nextgroup=javascriptBlock skipwhite skipwhite skipempty
|
||||
syntax match javascriptFuncComma contained /,/
|
||||
|
||||
|
||||
"Class
|
||||
syntax keyword javascriptClassKeyword class nextgroup=javascriptClassName skipwhite
|
||||
syntax keyword javascriptClassSuper super
|
||||
syntax match javascriptClassName contained /\k\+/ nextgroup=javascriptClassBlock,javascriptClassExtends skipwhite
|
||||
syntax match javascriptClassSuperName contained /[a-zA-Z_$][a-zA-Z_$\[\]\.]*/ nextgroup=javascriptClassBlock skipwhite
|
||||
syntax keyword javascriptClassExtends contained extends nextgroup=javascriptClassSuperName skipwhite
|
||||
syntax region javascriptClassBlock contained matchgroup=javascriptBraces start=/{/ end=/}/ contains=javascriptMethodName,javascriptMethodAccessor,javascriptClassStatic,@javascriptComments
|
||||
syntax keyword javascriptClassStatic contained static nextgroup=javascriptMethodName,javascriptMethodAccessor skipwhite
|
||||
|
||||
|
||||
syntax keyword javascriptForComprehension contained for nextgroup=javascriptForComprehensionTail skipwhite skipempty
|
||||
syntax region javascriptForComprehensionTail contained matchgroup=javascriptParens start=/(/ end=/)/ contains=javascriptOfComprehension,@javascriptExpression nextgroup=javascriptForComprehension,javascriptIfComprehension,@javascriptExpression skipwhite skipempty
|
||||
syntax keyword javascriptOfComprehension contained of
|
||||
syntax keyword javascriptIfComprehension contained if nextgroup=javascriptIfComprehensionTail
|
||||
syntax region javascriptIfComprehensionTail contained matchgroup=javascriptParens start=/(/ end=/)/ contains=javascriptExpression nextgroup=javascriptForComprehension,javascriptIfComprehension skipwhite skipempty
|
||||
|
||||
syntax region javascriptObjectLiteral contained matchgroup=javascriptBraces start=/{/ end=/}/ contains=@javascriptComments,javascriptObjectLabel,javascriptPropertyName,javascriptMethodDef,javascriptComputedPropertyName,@javascriptValue
|
||||
|
||||
" syntax match javascriptBraces /[\[\]]/
|
||||
syntax match javascriptParens /[()]/
|
||||
" syntax match javascriptOpSymbols /[^+\-*/%\^=!<>&|?]\@<=\(<\|>\|<=\|>=\|==\|!=\|===\|!==\|+\|-\|*\|%\|++\|--\|<<\|>>\|>>>\|&\||\|^\|!\|\~\|&&\|||\|?\|=\|+=\|-=\|*=\|%=\|<<=\|>>=\|>>>=\|&=\||=\|^=\|\/\|\/=\)\ze\_[^+\-*/%\^=!<>&|?]/ nextgroup=@javascriptExpression skipwhite
|
||||
" syntax match javascriptInvalidOp contained /[+\-*/%\^=!<>&|?:]\+/
|
||||
syntax match javascriptOpSymbol contained /\(<\|>\|<=\|>=\|==\|!=\|===\|!==\|+\|*\|%\|++\|--\|<<\|>>\|>>>\|&\||\|^\|!\|\~\|&&\|||\|?\|=\|+=\|-=\|*=\|%=\|<<=\|>>=\|>>>=\|&=\||=\|^=\|\/\|\/=\)\ze\_[^+\-*/%\^=!<>&|?:]/ nextgroup=javascriptInvalidOp skipwhite skipempty
|
||||
syn region htmlScriptTag contained start=+<script+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
||||
syntax match javascriptWOpSymbols contained /\_s\+/ nextgroup=javascriptOpSymbols
|
||||
syntax match javascriptEndColons /[;,]/
|
||||
syntax match javascriptLogicSymbols /[^&|]\@<=\(&&\|||\)\ze\_[^&|]/ nextgroup=@javascriptExpression skipwhite skipempty
|
||||
syntax cluster javascriptSymbols contains=javascriptOpSymbols,javascriptLogicSymbols
|
||||
syntax match javascriptWSymbols contained /\_s\+/ nextgroup=@javascriptSymbols
|
||||
|
||||
syntax region javascriptRegexpString start="\(^\|&\||\|=\|(\|{\|;\|:\|\[\|!\)\@<=\_s*/[^/*]"me=e-1 skip="\\\\\|[^\\]\@<=\\/" end="/[gimy]\{0,2\}" oneline
|
||||
|
||||
syntax cluster javascriptEventTypes contains=javascriptEventString,javascriptTemplate,javascriptNumber,javascriptBoolean,javascriptNull
|
||||
syntax cluster javascriptOps contains=javascriptOpSymbols,javascriptLogicSymbols,javascriptOperator
|
||||
syntax region javascriptParenExp matchgroup=javascriptParens start=/(/ end=/)/ contains=@javascriptExpression nextgroup=@javascriptSymbols skipwhite skipempty
|
||||
syntax cluster javascriptExpression contains=javascriptArrowFuncDef,javascriptParenExp,@javascriptValue,javascriptObjectLiteral,javascriptFuncKeyword,javascriptYield,javascriptIdentifierName,javascriptRegexpString,@javascriptTypes,@javascriptOps,javascriptGlobal,jsxRegion
|
||||
syntax cluster javascriptEventExpression contains=javascriptArrowFuncDef,javascriptParenExp,@javascriptValue,javascriptObjectLiteral,javascriptFuncKeyword,javascriptIdentifierName,javascriptRegexpString,@javascriptEventTypes,@javascriptOps,javascriptGlobal,jsxRegion
|
||||
|
||||
syntax region javascriptLoopParen contained matchgroup=javascriptParens start=/(/ end=/)/ contains=javascriptVariable,javascriptForOperator,javascriptEndColons,@javascriptExpression nextgroup=javascriptBlock skipwhite skipempty
|
||||
|
||||
" syntax match javascriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=javascriptFuncCallArg
|
||||
syntax region javascriptFuncCallArg contained matchgroup=javascriptParens start=/(/ end=/)/ contains=@javascriptExpression,@javascriptComments nextgroup=@javascriptAfterIdentifier
|
||||
syntax cluster javascriptSymbols contains=javascriptOpSymbols,javascriptLogicSymbols
|
||||
syntax match javascriptWSymbols contained /\_s\+/ nextgroup=@javascriptSymbols
|
||||
syntax region javascriptEventFuncCallArg contained matchgroup=javascriptParens start=/(/ end=/)/ contains=@javascriptEventExpression,@javascriptComments
|
||||
|
||||
syntax match javascriptArrowFuncDef contained /([^)]*)\_s*=>/ contains=javascriptFuncArg,javascriptArrowFunc nextgroup=javascriptBlock skipwhite skipempty
|
||||
syntax match javascriptArrowFuncDef contained /[a-zA-Z_$][a-zA-Z0-9_$]*\_s*=>/ contains=javascriptArrowFuncArg,javascriptArrowFunc nextgroup=javascriptBlock skipwhite skipempty
|
||||
syntax match javascriptArrowFunc /=>/
|
||||
syntax match javascriptArrowFuncArg contained /[a-zA-Z_$]\k*/
|
||||
|
||||
runtime syntax/semhl.vim
|
||||
|
||||
if exists("did_javascript_hilink")
|
||||
HiLink javascriptEndColons Exception
|
||||
HiLink javascriptOpSymbols Normal
|
||||
HiLink javascriptLogicSymbols Boolean
|
||||
HiLink javascriptBraces Function
|
||||
HiLink javascriptParens Normal
|
||||
HiLink javascriptComment Comment
|
||||
HiLink javascriptLineComment Comment
|
||||
HiLink javascriptDocComment Comment
|
||||
HiLink javascriptCommentTodo Todo
|
||||
HiLink javascriptDocNotation SpecialComment
|
||||
HiLink javascriptDocTags SpecialComment
|
||||
HiLink javascriptDocNGParam javascriptDocParam
|
||||
HiLink javascriptDocParam Function
|
||||
HiLink javascriptDocNumParam Function
|
||||
HiLink javascriptDocEventRef Function
|
||||
HiLink javascriptDocNamedParamType Type
|
||||
HiLink javascriptDocParamName Type
|
||||
HiLink javascriptDocParamType Type
|
||||
HiLink javascriptString String
|
||||
HiLink javascriptTemplate String
|
||||
HiLink javascriptEventString String
|
||||
HiLink javascriptASCII Label
|
||||
HiLink javascriptTemplateSubstitution Label
|
||||
" HiLink javascriptTemplateSBlock Label
|
||||
" HiLink javascriptTemplateSString Label
|
||||
HiLink javascriptTemplateSStringRB javascriptTemplateSubstitution
|
||||
HiLink javascriptTemplateSB javascriptTemplateSubstitution
|
||||
HiLink javascriptRegexpString String
|
||||
HiLink javascriptGlobal Constant
|
||||
HiLink javascriptCharacter Character
|
||||
HiLink javascriptPrototype Type
|
||||
HiLink javascriptConditional Conditional
|
||||
HiLink javascriptConditionalElse Conditional
|
||||
HiLink javascriptCase Conditional
|
||||
HiLink javascriptDefault javascriptCase
|
||||
HiLink javascriptBranch Conditional
|
||||
HiLink javascriptIdentifier Structure
|
||||
HiLink javascriptVariable Identifier
|
||||
HiLink javascriptRepeat Repeat
|
||||
HiLink javascriptForComprehension Repeat
|
||||
HiLink javascriptIfComprehension Repeat
|
||||
HiLink javascriptOfComprehension Repeat
|
||||
HiLink javascriptForOperator Repeat
|
||||
HiLink javascriptStatementKeyword Statement
|
||||
HiLink javascriptReturn Statement
|
||||
HiLink javascriptYield Statement
|
||||
HiLink javascriptMessage Keyword
|
||||
HiLink javascriptOperator Identifier
|
||||
" HiLink javascriptType Type
|
||||
HiLink javascriptNull Boolean
|
||||
HiLink javascriptNumber Number
|
||||
HiLink javascriptBoolean Boolean
|
||||
HiLink javascriptObjectLabel javascriptLabel
|
||||
HiLink javascriptLabel Label
|
||||
HiLink javascriptPropertyName Label
|
||||
HiLink javascriptImport Special
|
||||
HiLink javascriptExport Special
|
||||
HiLink javascriptTry Special
|
||||
HiLink javascriptExceptions Special
|
||||
|
||||
HiLink javascriptMethodName Function
|
||||
HiLink javascriptMethodAccessor Operator
|
||||
|
||||
HiLink javascriptAsyncFuncKeyword Keyword
|
||||
HiLink javascriptFuncKeyword Keyword
|
||||
HiLink javascriptAsyncFunc Keyword
|
||||
HiLink javascriptArrowFunc Type
|
||||
HiLink javascriptFuncName Function
|
||||
HiLink javascriptFuncArg Special
|
||||
HiLink javascriptArrowFuncArg javascriptFuncArg
|
||||
HiLink javascriptFuncComma Operator
|
||||
|
||||
HiLink javascriptClassKeyword Keyword
|
||||
HiLink javascriptClassExtends Keyword
|
||||
HiLink javascriptClassName Function
|
||||
HiLink javascriptClassSuperName Function
|
||||
HiLink javascriptClassStatic StorageClass
|
||||
HiLink javascriptClassSuper keyword
|
||||
|
||||
HiLink shellbang Comment
|
||||
|
||||
highlight link javaScript NONE
|
||||
|
||||
delcommand HiLink
|
||||
unlet did_javascript_hilink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "javascript"
|
||||
if main_syntax == 'javascript'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
||||
139
syntax/jinja.vim
Normal file
139
syntax/jinja.vim
Normal file
@@ -0,0 +1,139 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Jinja template
|
||||
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
|
||||
" Last Change: 2008 May 9
|
||||
" Version: 1.1
|
||||
"
|
||||
" Known Bugs:
|
||||
" because of odd limitations dicts and the modulo operator
|
||||
" appear wrong in the template.
|
||||
"
|
||||
" Changes:
|
||||
"
|
||||
" 2008 May 9: Added support for Jinja2 changes (new keyword rules)
|
||||
|
||||
" .vimrc variable to disable html highlighting
|
||||
if !exists('g:jinja_syntax_html')
|
||||
let g:jinja_syntax_html=1
|
||||
endif
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'jinja'
|
||||
endif
|
||||
|
||||
" Pull in the HTML syntax.
|
||||
if g:jinja_syntax_html
|
||||
if version < 600
|
||||
so <sfile>:p:h/html.vim
|
||||
else
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
endif
|
||||
|
||||
syntax case match
|
||||
|
||||
" Jinja template built-in tags and parameters (without filter, macro, is and raw, they
|
||||
" have special threatment)
|
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import
|
||||
|
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter
|
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction
|
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName
|
||||
|
||||
" Variable Names
|
||||
syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none False True None loop super caller varargs kwargs
|
||||
|
||||
" Filters
|
||||
syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite nextgroup=jinjaFilter
|
||||
syn match jinjaFilter contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn match jinjaFunction contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn match jinjaBlockName contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
|
||||
" Jinja template constants
|
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\"/ end=/"/
|
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\'/ end=/'/
|
||||
syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/
|
||||
|
||||
" Operators
|
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/
|
||||
syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/
|
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute
|
||||
syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
|
||||
" Jinja template tag and variable blocks
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
|
||||
|
||||
syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
|
||||
|
||||
" Jinja template 'raw' tag
|
||||
syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment
|
||||
|
||||
" Jinja comments
|
||||
syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString
|
||||
|
||||
" Block start keywords. A bit tricker. We only highlight at the start of a
|
||||
" tag block and only if the name is not followed by a comma or equals sign
|
||||
" which usually means that we have to deal with an assignment.
|
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/
|
||||
|
||||
" and context modifiers
|
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\+context\>/
|
||||
|
||||
|
||||
" 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_jinja_syn_inits")
|
||||
if version < 508
|
||||
let did_jinja_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink jinjaPunctuation jinjaOperator
|
||||
HiLink jinjaAttribute jinjaVariable
|
||||
HiLink jinjaFunction jinjaFilter
|
||||
|
||||
HiLink jinjaTagDelim jinjaTagBlock
|
||||
HiLink jinjaVarDelim jinjaVarBlock
|
||||
HiLink jinjaCommentDelim jinjaComment
|
||||
HiLink jinjaRawDelim jinja
|
||||
|
||||
HiLink jinjaSpecial Special
|
||||
HiLink jinjaOperator Normal
|
||||
HiLink jinjaRaw Normal
|
||||
HiLink jinjaTagBlock PreProc
|
||||
HiLink jinjaVarBlock PreProc
|
||||
HiLink jinjaStatement Statement
|
||||
HiLink jinjaFilter Function
|
||||
HiLink jinjaBlockName Function
|
||||
HiLink jinjaVariable Identifier
|
||||
HiLink jinjaString Constant
|
||||
HiLink jinjaNumber Constant
|
||||
HiLink jinjaComment Comment
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "jinja"
|
||||
|
||||
if main_syntax == 'jinja'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
139
syntax/jinja2.vim
Normal file
139
syntax/jinja2.vim
Normal file
@@ -0,0 +1,139 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Jinja template
|
||||
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
|
||||
" Last Change: 2008 May 9
|
||||
" Version: 1.1
|
||||
"
|
||||
" Known Bugs:
|
||||
" because of odd limitations dicts and the modulo operator
|
||||
" appear wrong in the template.
|
||||
"
|
||||
" Changes:
|
||||
"
|
||||
" 2008 May 9: Added support for Jinja2 changes (new keyword rules)
|
||||
|
||||
" .vimrc variable to disable html highlighting
|
||||
if !exists('g:jinja_syntax_html')
|
||||
let g:jinja_syntax_html=1
|
||||
endif
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'jinja'
|
||||
endif
|
||||
|
||||
" Pull in the HTML syntax.
|
||||
if g:jinja_syntax_html
|
||||
if version < 600
|
||||
so <sfile>:p:h/html.vim
|
||||
else
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
endif
|
||||
|
||||
syntax case match
|
||||
|
||||
" Jinja template built-in tags and parameters (without filter, macro, is and raw, they
|
||||
" have special threatment)
|
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import
|
||||
|
||||
syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter
|
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction
|
||||
syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName
|
||||
|
||||
" Variable Names
|
||||
syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none False True None loop super caller varargs kwargs
|
||||
|
||||
" Filters
|
||||
syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite nextgroup=jinjaFilter
|
||||
syn match jinjaFilter contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn match jinjaFunction contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
syn match jinjaBlockName contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
|
||||
" Jinja template constants
|
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\"/ end=/"/
|
||||
syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\'/ end=/'/
|
||||
syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/
|
||||
|
||||
" Operators
|
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/
|
||||
syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/
|
||||
syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute
|
||||
syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/
|
||||
|
||||
" Jinja template tag and variable blocks
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
|
||||
syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
|
||||
|
||||
syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
|
||||
|
||||
" Jinja template 'raw' tag
|
||||
syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment
|
||||
|
||||
" Jinja comments
|
||||
syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString
|
||||
|
||||
" Block start keywords. A bit tricker. We only highlight at the start of a
|
||||
" tag block and only if the name is not followed by a comma or equals sign
|
||||
" which usually means that we have to deal with an assignment.
|
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/
|
||||
|
||||
" and context modifiers
|
||||
syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\+context\>/
|
||||
|
||||
|
||||
" 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_jinja_syn_inits")
|
||||
if version < 508
|
||||
let did_jinja_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink jinjaPunctuation jinjaOperator
|
||||
HiLink jinjaAttribute jinjaVariable
|
||||
HiLink jinjaFunction jinjaFilter
|
||||
|
||||
HiLink jinjaTagDelim jinjaTagBlock
|
||||
HiLink jinjaVarDelim jinjaVarBlock
|
||||
HiLink jinjaCommentDelim jinjaComment
|
||||
HiLink jinjaRawDelim jinja
|
||||
|
||||
HiLink jinjaSpecial Special
|
||||
HiLink jinjaOperator Normal
|
||||
HiLink jinjaRaw Normal
|
||||
HiLink jinjaTagBlock PreProc
|
||||
HiLink jinjaVarBlock PreProc
|
||||
HiLink jinjaStatement Statement
|
||||
HiLink jinjaFilter Function
|
||||
HiLink jinjaBlockName Function
|
||||
HiLink jinjaVariable Identifier
|
||||
HiLink jinjaString Constant
|
||||
HiLink jinjaNumber Constant
|
||||
HiLink jinjaComment Comment
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "jinja"
|
||||
|
||||
if main_syntax == 'jinja'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
105
syntax/kotlin.vim
Normal file
105
syntax/kotlin.vim
Normal file
@@ -0,0 +1,105 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Kotlin
|
||||
" Maintainer: Alexander Udalov
|
||||
" Latest Revision: 23 December 2015
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:current_syntax = "kotlin"
|
||||
|
||||
syn keyword ktStatement break continue return
|
||||
syn keyword ktConditional if else when
|
||||
syn keyword ktRepeat do for while
|
||||
syn keyword ktOperator as in is by
|
||||
syn keyword ktKeyword get set out super this where
|
||||
syn keyword ktException try catch finally throw
|
||||
|
||||
syn keyword ktInclude import package
|
||||
|
||||
syn keyword ktType Any Boolean Byte Char Double Float Int Long Nothing Short Unit
|
||||
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic
|
||||
syn keyword ktStructure class object interface fun val var constructor init
|
||||
|
||||
syn keyword ktReservedKeyword async typealias typeof yield
|
||||
|
||||
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 ktTodo TODO FIXME XXX contained
|
||||
syn match ktLineComment "//.*$" contains=ktTodo,@Spell
|
||||
syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell
|
||||
|
||||
syn match ktSpecialCharError "\v\\." contained
|
||||
syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
|
||||
syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
||||
syn region ktString start='"""' end='"""' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
||||
syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
|
||||
syn match ktCharacter "\v'\\''" contains=ktSpecialChar
|
||||
syn match ktCharacter "\v'[^\\]'"
|
||||
|
||||
" TODO: highlight label in 'this@Foo'
|
||||
syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?"
|
||||
syn match ktLabel "\v\w+\@"
|
||||
|
||||
syn match ktSimpleInterpolation "\v\$\h\w*" contained
|
||||
syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation
|
||||
|
||||
syn match ktNumber "\v<\d+[LFf]?"
|
||||
syn match ktNumber "\v<0[Xx]\x+L?"
|
||||
syn match ktNumber "\v<0[Bb]\d+L?"
|
||||
syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?"
|
||||
|
||||
syn match ktEscapedName "\v`.*`"
|
||||
|
||||
syn match ktExclExcl "!!"
|
||||
syn match ktArrow "->"
|
||||
|
||||
|
||||
|
||||
hi link ktStatement Statement
|
||||
hi link ktConditional Conditional
|
||||
hi link ktRepeat Repeat
|
||||
hi link ktOperator Operator
|
||||
hi link ktKeyword Keyword
|
||||
hi link ktException Exception
|
||||
hi link ktReservedKeyword Error
|
||||
|
||||
hi link ktInclude Include
|
||||
|
||||
hi link ktType Type
|
||||
hi link ktModifier StorageClass
|
||||
hi link ktStructure Structure
|
||||
hi link ktTypedef Typedef
|
||||
|
||||
hi link ktBoolean Boolean
|
||||
hi link ktConstant Constant
|
||||
|
||||
hi link ktTodo Todo
|
||||
hi link ktLineComment Comment
|
||||
hi link ktComment Comment
|
||||
hi link ktCommentMatchGroup Comment
|
||||
|
||||
hi link ktSpecialChar SpecialChar
|
||||
hi link ktSpecialCharError Error
|
||||
hi link ktString String
|
||||
hi link ktCharacter Character
|
||||
|
||||
hi link ktAnnotation Identifier
|
||||
hi link ktLabel Identifier
|
||||
|
||||
hi link ktSimpleInterpolation Identifier
|
||||
hi link ktComplexInterpolationBrace Identifier
|
||||
|
||||
hi link ktNumber Number
|
||||
hi link ktFloat Float
|
||||
|
||||
hi link ktExclExcl Special
|
||||
hi link ktArrow Structure
|
||||
|
||||
endif
|
||||
@@ -20,14 +20,20 @@ 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 case ignore
|
||||
@@ -87,16 +93,22 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start=
|
||||
|
||||
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 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
|
||||
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')
|
||||
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
|
||||
endif
|
||||
|
||||
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
|
||||
|
||||
204
syntax/nginx.vim
204
syntax/nginx.vim
@@ -11,12 +11,11 @@ setlocal iskeyword+=.
|
||||
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=+{+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
|
||||
syn region ngxString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=ngxVariableString oneline
|
||||
syn region ngxString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=ngxVariableString oneline
|
||||
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 keyword ngxBoolean on
|
||||
@@ -34,6 +33,7 @@ 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 ngxDirectiveImportant include
|
||||
syn keyword ngxDirectiveImportant root
|
||||
@@ -44,6 +44,8 @@ syn keyword ngxDirectiveImportant internal
|
||||
syn keyword ngxDirectiveImportant proxy_pass
|
||||
syn keyword ngxDirectiveImportant memcached_pass
|
||||
syn keyword ngxDirectiveImportant fastcgi_pass
|
||||
syn keyword ngxDirectiveImportant scgi_pass
|
||||
syn keyword ngxDirectiveImportant uwsgi_pass
|
||||
syn keyword ngxDirectiveImportant try_files
|
||||
|
||||
syn keyword ngxDirectiveControl break
|
||||
@@ -56,12 +58,15 @@ syn keyword ngxDirectiveError post_action
|
||||
|
||||
syn keyword ngxDirectiveDeprecated connections
|
||||
syn keyword ngxDirectiveDeprecated imap
|
||||
syn keyword ngxDirectiveDeprecated limit_zone
|
||||
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
||||
syn keyword ngxDirectiveDeprecated optimize_server_names
|
||||
syn keyword ngxDirectiveDeprecated satisfy_any
|
||||
syn keyword ngxDirectiveDeprecated so_keepalive
|
||||
|
||||
syn keyword ngxDirective accept_mutex
|
||||
syn keyword ngxDirective accept_mutex_delay
|
||||
syn keyword ngxDirective acceptex_read
|
||||
syn keyword ngxDirective access_log
|
||||
syn keyword ngxDirective add_after_body
|
||||
syn keyword ngxDirective add_before_body
|
||||
@@ -77,11 +82,14 @@ syn keyword ngxDirective auth_basic_user_file
|
||||
syn keyword ngxDirective auth_http
|
||||
syn keyword ngxDirective auth_http_header
|
||||
syn keyword ngxDirective auth_http_timeout
|
||||
syn keyword ngxDirective auth_request
|
||||
syn keyword ngxDirective auth_request_set
|
||||
syn keyword ngxDirective autoindex
|
||||
syn keyword ngxDirective autoindex_exact_size
|
||||
syn keyword ngxDirective autoindex_localtime
|
||||
syn keyword ngxDirective charset
|
||||
syn keyword ngxDirective charset_types
|
||||
syn keyword ngxDirective chunked_transfer_encoding
|
||||
syn keyword ngxDirective client_body_buffer_size
|
||||
syn keyword ngxDirective client_body_in_file_only
|
||||
syn keyword ngxDirective client_body_in_single_buffer
|
||||
@@ -105,32 +113,44 @@ syn keyword ngxDirective devpoll_changes
|
||||
syn keyword ngxDirective devpoll_events
|
||||
syn keyword ngxDirective directio
|
||||
syn keyword ngxDirective directio_alignment
|
||||
syn keyword ngxDirective disable_symlinks
|
||||
syn keyword ngxDirective empty_gif
|
||||
syn keyword ngxDirective env
|
||||
syn keyword ngxDirective epoll_events
|
||||
syn keyword ngxDirective error_log
|
||||
syn keyword ngxDirective etag
|
||||
syn keyword ngxDirective eventport_events
|
||||
syn keyword ngxDirective expires
|
||||
syn keyword ngxDirective fastcgi_bind
|
||||
syn keyword ngxDirective fastcgi_buffer_size
|
||||
syn keyword ngxDirective fastcgi_buffering
|
||||
syn keyword ngxDirective fastcgi_buffers
|
||||
syn keyword ngxDirective fastcgi_busy_buffers_size
|
||||
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_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_revalidate
|
||||
syn keyword ngxDirective fastcgi_cache_use_stale
|
||||
syn keyword ngxDirective fastcgi_cache_valid
|
||||
syn keyword ngxDirective fastcgi_catch_stderr
|
||||
syn keyword ngxDirective fastcgi_connect_timeout
|
||||
syn keyword ngxDirective fastcgi_force_ranges
|
||||
syn keyword ngxDirective fastcgi_hide_header
|
||||
syn keyword ngxDirective fastcgi_ignore_client_abort
|
||||
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_max_temp_file_size
|
||||
syn keyword ngxDirective fastcgi_next_upstream
|
||||
syn keyword ngxDirective fastcgi_next_upstream_timeout
|
||||
syn keyword ngxDirective fastcgi_next_upstream_tries
|
||||
syn keyword ngxDirective fastcgi_no_cache
|
||||
syn keyword ngxDirective fastcgi_param
|
||||
syn keyword ngxDirective fastcgi_pass_header
|
||||
syn keyword ngxDirective fastcgi_pass_request_body
|
||||
@@ -143,12 +163,15 @@ syn keyword ngxDirective fastcgi_store
|
||||
syn keyword ngxDirective fastcgi_store_access
|
||||
syn keyword ngxDirective fastcgi_temp_file_write_size
|
||||
syn keyword ngxDirective fastcgi_temp_path
|
||||
syn keyword ngxDirective fastcgi_upstream_fail_timeout
|
||||
syn keyword ngxDirective fastcgi_upstream_max_fails
|
||||
syn keyword ngxDirective flv
|
||||
syn keyword ngxDirective geoip_city
|
||||
syn keyword ngxDirective geoip_country
|
||||
syn keyword ngxDirective geoip_org
|
||||
syn keyword ngxDirective geoip_proxy
|
||||
syn keyword ngxDirective geoip_proxy_recursive
|
||||
syn keyword ngxDirective google_perftools_profiles
|
||||
syn keyword ngxDirective gunzip
|
||||
syn keyword ngxDirective gunzip_buffers
|
||||
syn keyword ngxDirective gzip
|
||||
syn keyword ngxDirective gzip_buffers
|
||||
syn keyword ngxDirective gzip_comp_level
|
||||
@@ -162,30 +185,40 @@ syn keyword ngxDirective gzip_static
|
||||
syn keyword ngxDirective gzip_types
|
||||
syn keyword ngxDirective gzip_vary
|
||||
syn keyword ngxDirective gzip_window
|
||||
syn keyword ngxDirective hash
|
||||
syn keyword ngxDirective if_modified_since
|
||||
syn keyword ngxDirective ignore_invalid_headers
|
||||
syn keyword ngxDirective image_filter
|
||||
syn keyword ngxDirective image_filter_buffer
|
||||
syn keyword ngxDirective image_filter_interlace
|
||||
syn keyword ngxDirective image_filter_jpeg_quality
|
||||
syn keyword ngxDirective image_filter_sharpen
|
||||
syn keyword ngxDirective image_filter_transparency
|
||||
syn keyword ngxDirective imap_auth
|
||||
syn keyword ngxDirective imap_capabilities
|
||||
syn keyword ngxDirective imap_client_buffer
|
||||
syn keyword ngxDirective index
|
||||
syn keyword ngxDirective iocp_threads
|
||||
syn keyword ngxDirective ip_hash
|
||||
syn keyword ngxDirective keepalive
|
||||
syn keyword ngxDirective keepalive_disable
|
||||
syn keyword ngxDirective keepalive_requests
|
||||
syn keyword ngxDirective keepalive_timeout
|
||||
syn keyword ngxDirective kqueue_changes
|
||||
syn keyword ngxDirective kqueue_events
|
||||
syn keyword ngxDirective large_client_header_buffers
|
||||
syn keyword ngxDirective least_conn
|
||||
syn keyword ngxDirective limit_conn
|
||||
syn keyword ngxDirective limit_conn_log_level
|
||||
syn keyword ngxDirective limit_conn_status
|
||||
syn keyword ngxDirective limit_conn_zone
|
||||
syn keyword ngxDirective limit_rate
|
||||
syn keyword ngxDirective limit_rate_after
|
||||
syn keyword ngxDirective limit_req
|
||||
syn keyword ngxDirective limit_req_log_level
|
||||
syn keyword ngxDirective limit_req_status
|
||||
syn keyword ngxDirective limit_req_zone
|
||||
syn keyword ngxDirective limit_zone
|
||||
syn keyword ngxDirective lingering_close
|
||||
syn keyword ngxDirective lingering_time
|
||||
syn keyword ngxDirective lingering_timeout
|
||||
syn keyword ngxDirective lock_file
|
||||
@@ -195,21 +228,27 @@ syn keyword ngxDirective log_subrequest
|
||||
syn keyword ngxDirective map_hash_bucket_size
|
||||
syn keyword ngxDirective map_hash_max_size
|
||||
syn keyword ngxDirective master_process
|
||||
syn keyword ngxDirective max_ranges
|
||||
syn keyword ngxDirective memcached_bind
|
||||
syn keyword ngxDirective memcached_buffer_size
|
||||
syn keyword ngxDirective memcached_connect_timeout
|
||||
syn keyword ngxDirective memcached_gzip_flag
|
||||
syn keyword ngxDirective memcached_next_upstream
|
||||
syn keyword ngxDirective memcached_next_upstream_timeout
|
||||
syn keyword ngxDirective memcached_next_upstream_tries
|
||||
syn keyword ngxDirective memcached_read_timeout
|
||||
syn keyword ngxDirective memcached_send_timeout
|
||||
syn keyword ngxDirective memcached_upstream_fail_timeout
|
||||
syn keyword ngxDirective memcached_upstream_max_fails
|
||||
syn keyword ngxDirective merge_slashes
|
||||
syn keyword ngxDirective min_delete_depth
|
||||
syn keyword ngxDirective modern_browser
|
||||
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 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
|
||||
@@ -218,6 +257,7 @@ syn keyword ngxDirective open_file_cache_valid
|
||||
syn keyword ngxDirective open_log_file_cache
|
||||
syn keyword ngxDirective output_buffers
|
||||
syn keyword ngxDirective override_charset
|
||||
syn keyword ngxDirective pcre_jit
|
||||
syn keyword ngxDirective perl
|
||||
syn keyword ngxDirective perl_modules
|
||||
syn keyword ngxDirective perl_require
|
||||
@@ -226,6 +266,7 @@ syn keyword ngxDirective pid
|
||||
syn keyword ngxDirective pop3_auth
|
||||
syn keyword ngxDirective pop3_capabilities
|
||||
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
|
||||
@@ -237,22 +278,33 @@ syn keyword ngxDirective proxy_buffering
|
||||
syn keyword ngxDirective proxy_buffers
|
||||
syn keyword ngxDirective proxy_busy_buffers_size
|
||||
syn keyword ngxDirective proxy_cache
|
||||
syn keyword ngxDirective proxy_cache_bypass
|
||||
syn keyword ngxDirective proxy_cache_key
|
||||
syn keyword ngxDirective proxy_cache_lock
|
||||
syn keyword ngxDirective proxy_cache_lock_timeout
|
||||
syn keyword ngxDirective proxy_cache_methods
|
||||
syn keyword ngxDirective proxy_cache_min_uses
|
||||
syn keyword ngxDirective proxy_cache_path
|
||||
syn keyword ngxDirective proxy_cache_revalidate
|
||||
syn keyword ngxDirective proxy_cache_use_stale
|
||||
syn keyword ngxDirective proxy_cache_valid
|
||||
syn keyword ngxDirective proxy_connect_timeout
|
||||
syn keyword ngxDirective proxy_cookie_domain
|
||||
syn keyword ngxDirective proxy_cookie_path
|
||||
syn keyword ngxDirective proxy_force_ranges
|
||||
syn keyword ngxDirective proxy_headers_hash_bucket_size
|
||||
syn keyword ngxDirective proxy_headers_hash_max_size
|
||||
syn keyword ngxDirective proxy_hide_header
|
||||
syn keyword ngxDirective proxy_http_version
|
||||
syn keyword ngxDirective proxy_ignore_client_abort
|
||||
syn keyword ngxDirective proxy_ignore_headers
|
||||
syn keyword ngxDirective proxy_intercept_errors
|
||||
syn keyword ngxDirective proxy_max_temp_file_size
|
||||
syn keyword ngxDirective proxy_method
|
||||
syn keyword ngxDirective proxy_next_upstream
|
||||
syn keyword ngxDirective proxy_next_upstream_timeout
|
||||
syn keyword ngxDirective proxy_next_upstream_tries
|
||||
syn keyword ngxDirective proxy_no_cache
|
||||
syn keyword ngxDirective proxy_pass_error_message
|
||||
syn keyword ngxDirective proxy_pass_header
|
||||
syn keyword ngxDirective proxy_pass_request_body
|
||||
@@ -263,18 +315,27 @@ syn keyword ngxDirective proxy_send_lowat
|
||||
syn keyword ngxDirective proxy_send_timeout
|
||||
syn keyword ngxDirective proxy_set_body
|
||||
syn keyword ngxDirective proxy_set_header
|
||||
syn keyword ngxDirective proxy_ssl_ciphers
|
||||
syn keyword ngxDirective proxy_ssl_crl
|
||||
syn keyword ngxDirective proxy_ssl_name
|
||||
syn keyword ngxDirective proxy_ssl_protocols
|
||||
syn keyword ngxDirective proxy_ssl_server_name
|
||||
syn keyword ngxDirective proxy_ssl_session_reuse
|
||||
syn keyword ngxDirective proxy_ssl_trusted_certificate
|
||||
syn keyword ngxDirective proxy_ssl_verify
|
||||
syn keyword ngxDirective proxy_ssl_verify_depth
|
||||
syn keyword ngxDirective proxy_store
|
||||
syn keyword ngxDirective proxy_store_access
|
||||
syn keyword ngxDirective proxy_temp_file_write_size
|
||||
syn keyword ngxDirective proxy_temp_path
|
||||
syn keyword ngxDirective proxy_timeout
|
||||
syn keyword ngxDirective proxy_upstream_fail_timeout
|
||||
syn keyword ngxDirective proxy_upstream_max_fails
|
||||
syn keyword ngxDirective random_index
|
||||
syn keyword ngxDirective read_ahead
|
||||
syn keyword ngxDirective real_ip_header
|
||||
syn keyword ngxDirective real_ip_recursive
|
||||
syn keyword ngxDirective recursive_error_pages
|
||||
syn keyword ngxDirective referer_hash_bucket_size
|
||||
syn keyword ngxDirective referer_hash_max_size
|
||||
syn keyword ngxDirective request_pool_size
|
||||
syn keyword ngxDirective reset_timedout_connection
|
||||
syn keyword ngxDirective resolver
|
||||
@@ -285,6 +346,45 @@ syn keyword ngxDirective rtsig_overflow_test
|
||||
syn keyword ngxDirective rtsig_overflow_threshold
|
||||
syn keyword ngxDirective rtsig_signo
|
||||
syn keyword ngxDirective satisfy
|
||||
syn keyword ngxDirective scgi_bind
|
||||
syn keyword ngxDirective scgi_buffer_size
|
||||
syn keyword ngxDirective scgi_buffering
|
||||
syn keyword ngxDirective scgi_buffers
|
||||
syn keyword ngxDirective scgi_busy_buffers_size
|
||||
syn keyword ngxDirective scgi_cache
|
||||
syn keyword ngxDirective scgi_cache_bypass
|
||||
syn keyword ngxDirective scgi_cache_key
|
||||
syn keyword ngxDirective scgi_cache_lock
|
||||
syn keyword ngxDirective scgi_cache_lock_timeout
|
||||
syn keyword ngxDirective scgi_cache_methods
|
||||
syn keyword ngxDirective scgi_cache_min_uses
|
||||
syn keyword ngxDirective scgi_cache_path
|
||||
syn keyword ngxDirective scgi_cache_revalidate
|
||||
syn keyword ngxDirective scgi_cache_use_stale
|
||||
syn keyword ngxDirective scgi_cache_valid
|
||||
syn keyword ngxDirective scgi_connect_timeout
|
||||
syn keyword ngxDirective scgi_force_ranges
|
||||
syn keyword ngxDirective scgi_hide_header
|
||||
syn keyword ngxDirective scgi_ignore_client_abort
|
||||
syn keyword ngxDirective scgi_ignore_headers
|
||||
syn keyword ngxDirective scgi_intercept_errors
|
||||
syn keyword ngxDirective scgi_max_temp_file_size
|
||||
syn keyword ngxDirective scgi_next_upstream
|
||||
syn keyword ngxDirective scgi_next_upstream_timeout
|
||||
syn keyword ngxDirective scgi_next_upstream_tries
|
||||
syn keyword ngxDirective scgi_no_cache
|
||||
syn keyword ngxDirective scgi_param
|
||||
syn keyword ngxDirective scgi_pass_header
|
||||
syn keyword ngxDirective scgi_pass_request_body
|
||||
syn keyword ngxDirective scgi_pass_request_headers
|
||||
syn keyword ngxDirective scgi_read_timeout
|
||||
syn keyword ngxDirective scgi_send_timeout
|
||||
syn keyword ngxDirective scgi_store
|
||||
syn keyword ngxDirective scgi_store_access
|
||||
syn keyword ngxDirective scgi_temp_file_write_size
|
||||
syn keyword ngxDirective scgi_temp_path
|
||||
syn keyword ngxDirective secure_link
|
||||
syn keyword ngxDirective secure_link_md5
|
||||
syn keyword ngxDirective secure_link_secret
|
||||
syn keyword ngxDirective send_lowat
|
||||
syn keyword ngxDirective send_timeout
|
||||
@@ -299,31 +399,50 @@ syn keyword ngxDirective smtp_auth
|
||||
syn keyword ngxDirective smtp_capabilities
|
||||
syn keyword ngxDirective smtp_client_buffer
|
||||
syn keyword ngxDirective smtp_greeting_delay
|
||||
syn keyword ngxDirective so_keepalive
|
||||
syn keyword ngxDirective source_charset
|
||||
syn keyword ngxDirective spdy_chunk_size
|
||||
syn keyword ngxDirective spdy_headers_comp
|
||||
syn keyword ngxDirective spdy_keepalive_timeout
|
||||
syn keyword ngxDirective spdy_max_concurrent_streams
|
||||
syn keyword ngxDirective spdy_pool_size
|
||||
syn keyword ngxDirective spdy_recv_buffer_size
|
||||
syn keyword ngxDirective spdy_recv_timeout
|
||||
syn keyword ngxDirective spdy_streams_index_size
|
||||
syn keyword ngxDirective ssi
|
||||
syn keyword ngxDirective ssi_ignore_recycled_buffers
|
||||
syn keyword ngxDirective ssi_last_modified
|
||||
syn keyword ngxDirective ssi_min_file_chunk
|
||||
syn keyword ngxDirective ssi_silent_errors
|
||||
syn keyword ngxDirective ssi_types
|
||||
syn keyword ngxDirective ssi_value_length
|
||||
syn keyword ngxDirective ssl
|
||||
syn keyword ngxDirective ssl_buffer_size
|
||||
syn keyword ngxDirective ssl_certificate
|
||||
syn keyword ngxDirective ssl_certificate_key
|
||||
syn keyword ngxDirective ssl_ciphers
|
||||
syn keyword ngxDirective ssl_client_certificate
|
||||
syn keyword ngxDirective ssl_crl
|
||||
syn keyword ngxDirective ssl_dhparam
|
||||
syn keyword ngxDirective ssl_ecdh_curve
|
||||
syn keyword ngxDirective ssl_engine
|
||||
syn keyword ngxDirective ssl_password_file
|
||||
syn keyword ngxDirective ssl_prefer_server_ciphers
|
||||
syn keyword ngxDirective ssl_protocols
|
||||
syn keyword ngxDirective ssl_session_cache
|
||||
syn keyword ngxDirective ssl_session_ticket_key
|
||||
syn keyword ngxDirective ssl_session_tickets
|
||||
syn keyword ngxDirective ssl_session_timeout
|
||||
syn keyword ngxDirective ssl_stapling
|
||||
syn keyword ngxDirective ssl_stapling_file
|
||||
syn keyword ngxDirective ssl_stapling_responder
|
||||
syn keyword ngxDirective ssl_stapling_verify
|
||||
syn keyword ngxDirective ssl_trusted_certificate
|
||||
syn keyword ngxDirective ssl_verify_client
|
||||
syn keyword ngxDirective ssl_verify_depth
|
||||
syn keyword ngxDirective starttls
|
||||
syn keyword ngxDirective stub_status
|
||||
syn keyword ngxDirective sub_filter
|
||||
syn keyword ngxDirective sub_filter_last_modified
|
||||
syn keyword ngxDirective sub_filter_once
|
||||
syn keyword ngxDirective sub_filter_types
|
||||
syn keyword ngxDirective tcp_nodelay
|
||||
@@ -345,9 +464,59 @@ syn keyword ngxDirective userid_name
|
||||
syn keyword ngxDirective userid_p3p
|
||||
syn keyword ngxDirective userid_path
|
||||
syn keyword ngxDirective userid_service
|
||||
syn keyword ngxDirective uwsgi_bind
|
||||
syn keyword ngxDirective uwsgi_buffer_size
|
||||
syn keyword ngxDirective uwsgi_buffering
|
||||
syn keyword ngxDirective uwsgi_buffers
|
||||
syn keyword ngxDirective uwsgi_busy_buffers_size
|
||||
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_timeout
|
||||
syn keyword ngxDirective uwsgi_cache_methods
|
||||
syn keyword ngxDirective uwsgi_cache_min_uses
|
||||
syn keyword ngxDirective uwsgi_cache_path
|
||||
syn keyword ngxDirective uwsgi_cache_revalidate
|
||||
syn keyword ngxDirective uwsgi_cache_use_stale
|
||||
syn keyword ngxDirective uwsgi_cache_valid
|
||||
syn keyword ngxDirective uwsgi_connect_timeout
|
||||
syn keyword ngxDirective uwsgi_force_ranges
|
||||
syn keyword ngxDirective uwsgi_hide_header
|
||||
syn keyword ngxDirective uwsgi_ignore_client_abort
|
||||
syn keyword ngxDirective uwsgi_ignore_headers
|
||||
syn keyword ngxDirective uwsgi_intercept_errors
|
||||
syn keyword ngxDirective uwsgi_max_temp_file_size
|
||||
syn keyword ngxDirective uwsgi_modifier1
|
||||
syn keyword ngxDirective uwsgi_modifier2
|
||||
syn keyword ngxDirective uwsgi_next_upstream
|
||||
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_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_send_timeout
|
||||
syn keyword ngxDirective uwsgi_ssl_ciphers
|
||||
syn keyword ngxDirective uwsgi_ssl_crl
|
||||
syn keyword ngxDirective uwsgi_ssl_name
|
||||
syn keyword ngxDirective uwsgi_ssl_protocols
|
||||
syn keyword ngxDirective uwsgi_ssl_server_name
|
||||
syn keyword ngxDirective uwsgi_ssl_session_reuse
|
||||
syn keyword ngxDirective uwsgi_ssl_trusted_certificate
|
||||
syn keyword ngxDirective uwsgi_ssl_verify
|
||||
syn keyword ngxDirective uwsgi_ssl_verify_depth
|
||||
syn keyword ngxDirective uwsgi_store
|
||||
syn keyword ngxDirective uwsgi_store_access
|
||||
syn keyword ngxDirective uwsgi_string
|
||||
syn keyword ngxDirective uwsgi_temp_file_write_size
|
||||
syn keyword ngxDirective uwsgi_temp_path
|
||||
syn keyword ngxDirective valid_referers
|
||||
syn keyword ngxDirective variables_hash_bucket_size
|
||||
syn keyword ngxDirective variables_hash_max_size
|
||||
syn keyword ngxDirective worker_aio_requests
|
||||
syn keyword ngxDirective worker_connections
|
||||
syn keyword ngxDirective worker_cpu_affinity
|
||||
syn keyword ngxDirective worker_priority
|
||||
@@ -359,6 +528,9 @@ syn keyword ngxDirective worker_threads
|
||||
syn keyword ngxDirective working_directory
|
||||
syn keyword ngxDirective xclient
|
||||
syn keyword ngxDirective xml_entities
|
||||
syn keyword ngxDirective xslt_last_modified
|
||||
syn keyword ngxDirective xslt_param
|
||||
syn keyword ngxDirective xslt_string_param
|
||||
syn keyword ngxDirective xslt_stylesheet
|
||||
syn keyword ngxDirective xslt_types
|
||||
|
||||
@@ -370,7 +542,7 @@ syn keyword ngxDirective xslt_types
|
||||
syn keyword ngxDirectiveThirdParty set_from_accept_language
|
||||
|
||||
" Access Key Module <http://wiki.nginx.org/NginxHttpAccessKeyModule>
|
||||
" Denies access unless the request URL contains an access key.
|
||||
" Denies access unless the request URL contains an access key.
|
||||
syn keyword ngxDirectiveThirdParty accesskey
|
||||
syn keyword ngxDirectiveThirdParty accesskey_arg
|
||||
syn keyword ngxDirectiveThirdParty accesskey_hashmethod
|
||||
@@ -524,7 +696,7 @@ syn keyword ngxDirectiveThirdParty mogilefs_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_tracker
|
||||
|
||||
" MP4 Streaming Lite Module <http://wiki.nginx.org/NginxMP4StreamingLite>
|
||||
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
|
||||
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
|
||||
syn keyword ngxDirectiveThirdParty mp4
|
||||
|
||||
" Nginx Notice Module <http://xph.us/software/nginx-notice/>
|
||||
|
||||
192
syntax/nim.vim
Normal file
192
syntax/nim.vim
Normal file
@@ -0,0 +1,192 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
|
||||
" 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
|
||||
|
||||
" Keep user-supplied options
|
||||
if !exists("nim_highlight_numbers")
|
||||
let nim_highlight_numbers = 1
|
||||
endif
|
||||
if !exists("nim_highlight_builtins")
|
||||
let nim_highlight_builtins = 1
|
||||
endif
|
||||
if !exists("nim_highlight_exceptions")
|
||||
let nim_highlight_exceptions = 1
|
||||
endif
|
||||
if !exists("nim_highlight_space_errors")
|
||||
let nim_highlight_space_errors = 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
|
||||
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 elif else end enum except export
|
||||
syn keyword nimKeyword finally for from
|
||||
syn keyword nimKeyword generic
|
||||
syn keyword nimKeyword if import in include interface is isnot iterator
|
||||
syn keyword nimKeyword lambda let
|
||||
syn keyword nimKeyword mixin using mod
|
||||
syn keyword nimKeyword nil not notin
|
||||
syn keyword nimKeyword object of or out
|
||||
syn keyword nimKeyword proc method macro template nextgroup=nimFunction skipwhite
|
||||
syn keyword nimKeyword ptr
|
||||
syn keyword nimKeyword raise ref return
|
||||
syn keyword nimKeyword shared shl shr static
|
||||
syn keyword nimKeyword try tuple type
|
||||
syn keyword nimKeyword var
|
||||
syn keyword nimKeyword when while with without
|
||||
syn keyword nimKeyword xor
|
||||
syn keyword nimKeyword yield
|
||||
|
||||
syn match nimFunction "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
||||
syn match nimClass "[a-zA-Z_][a-zA-Z0-9_]*" contained
|
||||
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 keyword nimTodo TODO FIXME XXX contained
|
||||
syn keyword nimBoolean true false
|
||||
|
||||
|
||||
" Strings
|
||||
syn region nimString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||
syn region nimString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||
syn region nimString start=+"""+ end=+"""+ keepend contains=nimEscape,nimEscapeError,@Spell
|
||||
syn region nimRawString matchgroup=Normal start=+[rR]"+ end=+"+ skip=+\\\\\|\\"+ contains=@Spell
|
||||
|
||||
syn match nimEscape +\\[abfnrtv'"\\]+ contained
|
||||
syn match nimEscape "\\\o\{1,3}" contained
|
||||
syn match nimEscape "\\x\x\{2}" contained
|
||||
syn match nimEscape "\(\\u\x\{4}\|\\U\x\{8}\)" contained
|
||||
syn match nimEscape "\\$"
|
||||
|
||||
syn match nimEscapeError "\\x\x\=\X" display contained
|
||||
|
||||
if nim_highlight_numbers == 1
|
||||
" numbers (including longs and complex)
|
||||
syn match nimNumber "\v<0x\x+(\'(i|I|f|F|u|U)(8|16|32|64))?>"
|
||||
syn match nimNumber "\v<[0-9_]+(\'(i|I|f|F|u|U)(8|16|32|64))?>"
|
||||
syn match nimNumber "\v[0-9]\.[0-9_]+([eE][+-]=[0-9_]+)=>"
|
||||
syn match nimNumber "\v<[0-9_]+(\.[0-9_]+)?([eE][+-]?[0-9_]+)?(\'(f|F)(32|64))?>"
|
||||
endif
|
||||
|
||||
if nim_highlight_builtins == 1
|
||||
" builtin functions, types and objects, not really part of the syntax
|
||||
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool
|
||||
syn keyword nimBuiltin char string cstring pointer range array openarray seq
|
||||
syn keyword nimBuiltin set Byte Natural Positive TObject PObject Conversion TResult TAddress
|
||||
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
|
||||
syn keyword nimBuiltin stdout stderr defined new high low sizeof succ pred
|
||||
syn keyword nimBuiltin inc dec newSeq len incl excl card ord chr ze ze64
|
||||
syn keyword nimBuiltin toU8 toU16 toU32 abs min max add repr
|
||||
syn match nimBuiltin "\<contains\>"
|
||||
syn keyword nimBuiltin toFloat toBiggestFloat toInt toBiggestInt addQuitProc
|
||||
syn keyword nimBuiltin copy setLen newString zeroMem copyMem moveMem
|
||||
syn keyword nimBuiltin equalMem alloc alloc0 realloc dealloc setLen assert
|
||||
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
|
||||
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
|
||||
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
||||
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAnd Sweep
|
||||
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
|
||||
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
|
||||
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
||||
syn keyword nimBuiltin FlushFile readFile write readLine writeln writeln
|
||||
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
|
||||
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
|
||||
syn keyword nimBuiltin fileHandle countdown countup items lines
|
||||
endif
|
||||
|
||||
if nim_highlight_exceptions == 1
|
||||
" builtin exceptions and warnings
|
||||
syn keyword nimException E_Base EAsynch ESynch ESystem EIO EOS
|
||||
syn keyword nimException ERessourceExhausted EArithmetic EDivByZero
|
||||
syn keyword nimException EOverflow EAccessViolation EAssertionFailed
|
||||
syn keyword nimException EControlC EInvalidValue EOutOfMemory EInvalidIndex
|
||||
syn keyword nimException EInvalidField EOutOfRange EStackOverflow
|
||||
syn keyword nimException ENoExceptionToReraise EInvalidObjectAssignment
|
||||
syn keyword nimException EInvalidObject EInvalidLibrary EInvalidKey
|
||||
syn keyword nimException EInvalidObjectConversion EFloatingPoint
|
||||
syn keyword nimException EFloatInvalidOp EFloatDivByZero EFloatOverflow
|
||||
syn keyword nimException EFloatInexact EDeadThread EResourceExhausted
|
||||
syn keyword nimException EFloatUnderflow
|
||||
endif
|
||||
|
||||
if nim_highlight_space_errors == 1
|
||||
" trailing whitespace
|
||||
syn match nimSpaceError display excludenl "\S\s\+$"ms=s+1
|
||||
" any tabs are illegal in nim
|
||||
syn match nimSpaceError display "\t"
|
||||
endif
|
||||
|
||||
syn sync match nimSync grouphere NONE "):$"
|
||||
syn sync maxlines=200
|
||||
syn sync minlines=2000
|
||||
|
||||
if version >= 508 || !exists("did_nim_syn_inits")
|
||||
if version <= 508
|
||||
let did_nim_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
" The default methods for highlighting. Can be overridden later
|
||||
HiLink nimBrackets Operator
|
||||
HiLink nimKeyword Keyword
|
||||
HiLink nimFunction Function
|
||||
HiLink nimConditional Conditional
|
||||
HiLink nimRepeat Repeat
|
||||
HiLink nimString String
|
||||
HiLink nimRawString String
|
||||
HiLink nimBoolean Boolean
|
||||
HiLink nimEscape Special
|
||||
HiLink nimOperator Operator
|
||||
HiLink nimPreCondit PreCondit
|
||||
HiLink nimComment Comment
|
||||
HiLink nimTodo Todo
|
||||
HiLink nimDecorator Define
|
||||
|
||||
if nim_highlight_numbers == 1
|
||||
HiLink nimNumber Number
|
||||
endif
|
||||
|
||||
if nim_highlight_builtins == 1
|
||||
HiLink nimBuiltin Number
|
||||
endif
|
||||
|
||||
if nim_highlight_exceptions == 1
|
||||
HiLink nimException Exception
|
||||
endif
|
||||
|
||||
if nim_highlight_space_errors == 1
|
||||
HiLink nimSpaceError Error
|
||||
endif
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "nim"
|
||||
|
||||
|
||||
endif
|
||||
131
syntax/nix.vim
Normal file
131
syntax/nix.vim
Normal file
@@ -0,0 +1,131 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
"
|
||||
" Syntax file for Nix
|
||||
"
|
||||
" TODO:
|
||||
" Emphasize :
|
||||
" Deemphasize ;
|
||||
" Consistent ()
|
||||
" rec (red?)
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Operators
|
||||
syn match nixOperator "\V++"
|
||||
syn match nixOperator "\V+"
|
||||
syn match nixOperator "\V!"
|
||||
syn match nixOperator "\V=="
|
||||
syn match nixOperator "\V!="
|
||||
syn match nixOperator "\V&&"
|
||||
syn match nixOperator "\V||"
|
||||
syn match nixOperator "\V->"
|
||||
|
||||
syn match nixOperator "\V-"
|
||||
syn match nixOperator "\V*"
|
||||
syn match nixOperator "\V/"
|
||||
syn match nixOperator "\V>"
|
||||
syn match nixOperator "\V<"
|
||||
|
||||
" Keywords
|
||||
syn keyword nixKeyword let in or assert inherit null with rec
|
||||
syn keyword nixConditional if else then
|
||||
syn keyword nixBoolean true false
|
||||
|
||||
" Builtins
|
||||
syn keyword nixBuiltin builtins abort add attrNames attrValues
|
||||
\ baseNameOf compareVersions concatLists currentSystem deepSeq
|
||||
\ derivation dirOf div elem elemAt filter filterSource fromJSON
|
||||
\ getAttr getEnv hasAttr hashString head import intersectAttrs
|
||||
\ isAttrs isList isFunction isString isInt isBool isNull length
|
||||
\ lessThan listToAttrs map mul parseDrvNames pathExists readDir
|
||||
\ readFile removeAttrs seq stringLength sub substring tail throw
|
||||
\ toFile toJSON toPath toString toXML trace typeOf tryEval
|
||||
|
||||
syn match nixpkgs "<nixpkgs>"
|
||||
syn match nixSpecialOper "\V@\|;\|,\|?\|..."
|
||||
|
||||
" Attribute Lists
|
||||
"syn match nixBrace "\v[(){}\[\]]|rec\s*\{"
|
||||
syn region nixSet matchgroup=nixBraces start="{" end="}" contains=ALL
|
||||
syn region nixRecSet matchgroup=nixBraces start="rec\s*{" end="}" contains=ALL
|
||||
syn region nixList matchgroup=nixBraces start="\[" end="\]" contains=ALLBUT,nixAttr
|
||||
syn match nixAttr "\v[0-9A-Za-z\-\_]+\ze\s*\=" contained
|
||||
|
||||
syn match nixInteger "\v<\d+>"
|
||||
|
||||
" Functions
|
||||
syn match nixFuncArg "\v\zs\w+\ze\s*:"
|
||||
|
||||
" TODO: Exclude ; and other illegal characters
|
||||
syn match nixPath "\v\S*/\S+|\S+/\S*"
|
||||
|
||||
" This operator is placed after nixPath to override nixPath's highlighting
|
||||
syn match nixOperator "\V//"
|
||||
|
||||
" Strings
|
||||
syn match nixStringIndentedEscapes +'''\|''\${\|''\\n\|''\\r\|''\\t+
|
||||
syn match nixStringEscapes +\\"\|\\\${\|\\n\|\\r\|\\t\|\\\\+
|
||||
syn region nixStringIndented
|
||||
\ start=+''+
|
||||
\ skip=+'''+
|
||||
\ end=+''+
|
||||
\ contains=nixAntiquotation,nixStringIndentedEscapes
|
||||
syn region nixString
|
||||
\ start=+"+
|
||||
\ skip=+\\"+
|
||||
\ end=+"+
|
||||
\ contains=nixAntiquotation,nixStringEscapes
|
||||
|
||||
" If this contains nixBrace, it ignores its own closing brace and syntax gets
|
||||
" thrown way off contains=ALLBUT,nixBrace
|
||||
syn region nixAntiquotation start=+\${+ end=+}+ contains=nixAntiQuotation
|
||||
|
||||
" Comments
|
||||
syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+ contains=nixTodos
|
||||
syn match nixEndOfLineComment "#.*$" contains=nixTodos
|
||||
syntax keyword nixTodos TODO XXX FIXME NOTE TODOS contained
|
||||
|
||||
" Special (Delimiter
|
||||
hi def link nixBraces Delimiter
|
||||
hi def link nixpkgs Special
|
||||
hi def link nixSpecialOper Special
|
||||
hi def link nixStringIndentedEscapes SpecialChar
|
||||
hi def link nixStringEscapes SpecialChar
|
||||
hi def link nixBuiltin Special
|
||||
hi def link nixOperator Operator
|
||||
|
||||
" Constants
|
||||
hi def link nixBoolean Boolean
|
||||
hi def link nixInteger Number
|
||||
hi def link nixString String
|
||||
hi def link nixStringIndented String
|
||||
|
||||
" Comments
|
||||
hi def link nixMultiLineComment Comment
|
||||
hi def link nixEndOfLineComment Comment
|
||||
|
||||
" Identifiers
|
||||
hi def link nixConditional Conditional
|
||||
hi def link nixKeyword Keyword
|
||||
hi def link nixOperator Operator
|
||||
hi def link nixException Exception
|
||||
hi def link nixAttr Identifier
|
||||
hi def link nixFuncArg Identifier
|
||||
|
||||
" PreProc
|
||||
hi def link nixAntiquotation Macro
|
||||
|
||||
" Underlined (html links)
|
||||
hi def link nixPath Underlined
|
||||
|
||||
" Error
|
||||
|
||||
syn sync maxlines=20000
|
||||
syn sync minlines=50000
|
||||
|
||||
let b:current_syntax = 'nix'
|
||||
|
||||
endif
|
||||
@@ -244,18 +244,18 @@ syn region perlAnglesDQ start=+<+ end=+>+ extend contained contains=perlAnglesD
|
||||
|
||||
|
||||
" Simple version of searches and matches
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgc]*+ contains=@perlInterpMatch keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgc]*+ contains=@perlInterpMatch keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgc]*+ contains=@perlInterpSQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgc]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlBracesDQ extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgc]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgcn]*+ contains=@perlInterpSQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgcn]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgcn]*+ contains=@perlInterpMatch,perlBracesDQ extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgcn]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgcn]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend
|
||||
|
||||
" Below some hacks to recognise the // variant. This is virtually impossible to catch in all
|
||||
" cases as the / is used in so many other ways, but these should be the most obvious ones.
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash extend
|
||||
|
||||
|
||||
" Substitutions
|
||||
@@ -268,12 +268,12 @@ syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcer]*+ keepend contained contains=@perlInterpDQ extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend
|
||||
syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcer]*+ contained contains=@perlInterpSQ keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcern]*+ keepend contained contains=@perlInterpDQ extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend
|
||||
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend
|
||||
syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcern]*+ contained contains=@perlInterpSQ keepend extend
|
||||
|
||||
" Translations
|
||||
" perlMatch is the first part, perlTranslation* is the second, translator part.
|
||||
@@ -424,7 +424,7 @@ if exists("perl_fold")
|
||||
endif
|
||||
|
||||
if exists("perl_fold_blocks")
|
||||
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
|
||||
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)for\%(each\)\=\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
|
||||
syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
|
||||
endif
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ let s:keywords = {
|
||||
\ ],
|
||||
\ "p6Operator": [
|
||||
\ "div xx x mod also leg cmp before after eq ne le lt not",
|
||||
\ "gt ge eqv ff fff and andthen or xor orelse extra lcm gcd",
|
||||
\ "gt ge eqv ff fff and andthen or xor orelse extra lcm gcd o",
|
||||
\ ],
|
||||
\ "p6Type": [
|
||||
\ "int int1 int2 int4 int8 int16 int32 int64",
|
||||
@@ -176,7 +176,7 @@ syn match p6Type display "\%(::\)\@2<!\%(Order\%(::Same\|::More\|::Less\)\?\|Boo
|
||||
" Don't put a "\+" at the end of the character class. That makes it so
|
||||
" greedy that the "%" " in "+%foo" won't be allowed to match as a sigil,
|
||||
" among other things
|
||||
syn match p6Operator display "[-+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅]"
|
||||
syn match p6Operator display "[-+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅∘]"
|
||||
syn match p6Operator display "\%(:\@1<!::\@2!\|::=\|\.::\)"
|
||||
" these require whitespace on the left side
|
||||
syn match p6Operator display "\%(\s\|^\)\@1<=\%(xx=\|p5=>\)"
|
||||
@@ -249,9 +249,10 @@ syn cluster p6Interp_qq
|
||||
\ add=@p6Interp_function
|
||||
\ add=@p6Interp_closure
|
||||
\ add=@p6Interp_backslash
|
||||
\ add=p6MatchVarSigil
|
||||
|
||||
syn region p6InterpScalar
|
||||
\ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\|\%(\d\+\|!\|/\|¢\)\)\)"
|
||||
\ end="\z1\zs"
|
||||
\ contained keepend
|
||||
@@ -266,7 +267,7 @@ syn region p6InterpScalar
|
||||
\ contains=TOP
|
||||
|
||||
syn region p6InterpArray
|
||||
\ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ end="\z1\zs"
|
||||
\ contained keepend
|
||||
\ contains=TOP
|
||||
@@ -280,7 +281,7 @@ syn region p6InterpArray
|
||||
\ contains=TOP
|
||||
|
||||
syn region p6InterpHash
|
||||
\ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ end="\z1\zs"
|
||||
\ contained keepend
|
||||
\ contains=TOP
|
||||
@@ -294,7 +295,7 @@ syn region p6InterpHash
|
||||
\ contains=TOP
|
||||
|
||||
syn region p6InterpFunction
|
||||
\ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(\.\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@1<!::\@!\)[A-Za-z_\xC0-\xFF]\@=\)\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\%(\.\^\?\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)"
|
||||
\ end="\z1\zs"
|
||||
\ contained keepend
|
||||
\ contains=TOP
|
||||
@@ -1950,7 +1951,7 @@ endif
|
||||
if exists("perl6_fold") || exists("perl6_extended_all")
|
||||
setl foldmethod=syntax
|
||||
syn region p6BlockFold
|
||||
\ start="^\z(\s*\)\%(my\|our\|augment\|multi\|proto\|only\)\?\s*\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\s\+\)\?\<\%(CATCH\|try\|ENTER\|LEAVE\|CHECK\|INIT\|BEGIN\|END\|KEEP\|UNDO\|PRE\|POST\|module\|package\|enum\|subset\|class\|sub\%(method\)\?\|multi\|method\|slang\|grammar\|regex\|token\|rule\)\>[^{]\+{\%(\s+\|#.*\)\?$"
|
||||
\ start="^\z(\s*\)\%(my\|our\|augment\|multi\|proto\|only\)\?\s*\%(\%([A-Za-z_\xC0-\xFF]\%([A-Za-z_\xC0-\xFF0-9]\|[-'][A-Za-z_\xC0-\xFF]\@=\)*\)\s\+\)\?\<\%(CATCH\|try\|ENTER\|LEAVE\|CHECK\|INIT\|BEGIN\|END\|KEEP\|UNDO\|PRE\|POST\|module\|package\|enum\|subset\|class\|sub\%(method\)\?\|multi\|method\|slang\|grammar\|regex\|token\|rule\)\>[^{]\+\%({\s*\%(#.*\)\?\)\?$"
|
||||
\ end="^\z1}"
|
||||
\ transparent fold keepend extend
|
||||
endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -88,6 +88,7 @@ syn keyword pythonStatement exec return
|
||||
syn keyword pythonStatement pass raise
|
||||
syn keyword pythonStatement global assert
|
||||
syn keyword pythonStatement lambda yield
|
||||
syn keyword pythonStatement async await
|
||||
syn keyword pythonStatement with nonlocal True False None
|
||||
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
||||
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
|
||||
@@ -210,7 +211,7 @@ if exists("python_highlight_builtins") && python_highlight_builtins != 0
|
||||
syn keyword pythonBuiltinObj Ellipsis NotImplemented
|
||||
|
||||
syn keyword pythonBuiltinFunc __import__ abs all any apply
|
||||
syn keyword pythonBuiltinFunc basestring bool buffer callable
|
||||
syn keyword pythonBuiltinFunc basestring bool buffer bytearray bytes callable
|
||||
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
|
||||
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
|
||||
syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr
|
||||
|
||||
137
syntax/qml.vim
Normal file
137
syntax/qml.vim
Normal file
@@ -0,0 +1,137 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: QML
|
||||
" Maintainer: Warwick Allison <warwick.allison@nokia.com>
|
||||
" Updaters:
|
||||
" URL:
|
||||
" Changes:
|
||||
" Last Change: 2009 Apr 30
|
||||
|
||||
" Based on javascript syntax (as is QML)
|
||||
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'qml'
|
||||
endif
|
||||
|
||||
" Drop fold if it set but vim doesn't support it.
|
||||
if version < 600 && exists("qml_fold")
|
||||
unlet qml_fold
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
|
||||
syn keyword qmlCommentTodo TODO FIXME XXX TBD contained
|
||||
syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
|
||||
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
||||
syn match qmlSpecial "\\\d\d\d\|\\."
|
||||
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc
|
||||
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc
|
||||
|
||||
syn match qmlCharacter "'\\.'"
|
||||
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||
syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||
syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@="
|
||||
syn match qmlNonBindingColon "?[^;]*:"
|
||||
syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:"
|
||||
|
||||
syn keyword qmlConditional if else switch
|
||||
syn keyword qmlRepeat while for do in
|
||||
syn keyword qmlBranch break continue
|
||||
syn keyword qmlOperator new delete instanceof typeof
|
||||
syn keyword qmlJsType Array Boolean Date Function Number Object String RegExp
|
||||
syn keyword qmlType action alias bool color date double enumeration font int list point real rect size string time url variant vector3d
|
||||
syn keyword qmlStatement return with
|
||||
syn keyword qmlBoolean true false
|
||||
syn keyword qmlNull null undefined
|
||||
syn keyword qmlIdentifier arguments this var
|
||||
syn keyword qmlLabel case default
|
||||
syn keyword qmlException try catch finally throw
|
||||
syn keyword qmlMessage alert confirm prompt status
|
||||
syn keyword qmlGlobal self
|
||||
syn keyword qmlDeclaration property signal
|
||||
syn keyword qmlReserved abstract boolean byte char class const debugger enum export extends final float goto implements import interface long native package pragma private protected public short static super synchronized throws transient volatile
|
||||
|
||||
if get(g:, 'qml_fold', 0)
|
||||
syn match qmlFunction "\<function\>"
|
||||
syn region qmlFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend
|
||||
|
||||
syn sync match qmlSync grouphere qmlFunctionFold "\<function\>"
|
||||
syn sync match qmlSync grouphere NONE "^}"
|
||||
|
||||
setlocal foldmethod=syntax
|
||||
setlocal foldtext=getline(v:foldstart)
|
||||
else
|
||||
syn keyword qmlFunction function
|
||||
syn match qmlBraces "[{}\[\]]"
|
||||
syn match qmlParens "[()]"
|
||||
endif
|
||||
|
||||
syn sync fromstart
|
||||
syn sync maxlines=100
|
||||
|
||||
if main_syntax == "qml"
|
||||
syn sync ccomment qmlComment
|
||||
endif
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_qml_syn_inits")
|
||||
if version < 508
|
||||
let did_qml_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink qmlComment Comment
|
||||
HiLink qmlLineComment Comment
|
||||
HiLink qmlCommentTodo Todo
|
||||
HiLink qmlSpecial Special
|
||||
HiLink qmlStringS String
|
||||
HiLink qmlStringD String
|
||||
HiLink qmlCharacter Character
|
||||
HiLink qmlNumber Number
|
||||
HiLink qmlConditional Conditional
|
||||
HiLink qmlRepeat Repeat
|
||||
HiLink qmlBranch Conditional
|
||||
HiLink qmlOperator Operator
|
||||
HiLink qmlJsType Type
|
||||
HiLink qmlType Type
|
||||
HiLink qmlObjectLiteralType Type
|
||||
HiLink qmlStatement Statement
|
||||
HiLink qmlFunction Function
|
||||
HiLink qmlBraces Function
|
||||
HiLink qmlError Error
|
||||
HiLink qmlNull Keyword
|
||||
HiLink qmlBoolean Boolean
|
||||
HiLink qmlRegexpString String
|
||||
|
||||
HiLink qmlIdentifier Identifier
|
||||
HiLink qmlLabel Label
|
||||
HiLink qmlException Exception
|
||||
HiLink qmlMessage Keyword
|
||||
HiLink qmlGlobal Keyword
|
||||
HiLink qmlReserved Keyword
|
||||
HiLink qmlDebug Debug
|
||||
HiLink qmlConstant Label
|
||||
HiLink qmlNonBindingColon NONE
|
||||
HiLink qmlBindingProperty Label
|
||||
HiLink qmlDeclaration Function
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "qml"
|
||||
if main_syntax == 'qml'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -32,7 +32,7 @@ endif
|
||||
|
||||
" Operators
|
||||
if exists("ruby_operators")
|
||||
syn match rubyOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||
syn match rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||
syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
||||
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
|
||||
endif
|
||||
@@ -82,13 +82,13 @@ syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedPare
|
||||
syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
|
||||
|
||||
" Numbers and ASCII Codes
|
||||
syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>" display
|
||||
syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display
|
||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display
|
||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display
|
||||
|
||||
" Identifiers
|
||||
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
||||
@@ -98,7 +98,7 @@ syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>
|
||||
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||
syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
|
||||
syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
|
||||
@@ -125,20 +125,19 @@ syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|o
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||
|
||||
" Generalized Regular Expression
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
|
||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||
|
||||
" Normal String and Shell Command Output
|
||||
if exists('ruby_spellcheck_strings')
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial,@Spell fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,@Spell fold
|
||||
else
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
|
||||
endif
|
||||
" Normal String
|
||||
let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : ''
|
||||
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" fold contains=@rubyStringSpecial' . s:spell_cluster
|
||||
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="''" end="''" skip="\\\\\|\\''" fold contains=rubyQuoteEscape' . s:spell_cluster
|
||||
|
||||
" Shell Command Output
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold
|
||||
|
||||
" Generalized Single Quoted String, Symbol and Array of Strings
|
||||
@@ -147,12 +146,13 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%q " end=" " skip="\\\\\|\\)" fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
|
||||
" Generalized Double Quoted String and Array of Strings and Shell Command Output
|
||||
" Note: %= is not matched here as the beginning of a double quoted string
|
||||
@@ -162,7 +162,7 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" en
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx] " end=" " skip="\\\\\|\\)" contains=@rubyStringSpecial fold
|
||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||
|
||||
" Array of Symbols
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||
@@ -173,26 +173,26 @@ syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" sk
|
||||
|
||||
" Array of interpolated Symbols
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
||||
|
||||
" Here Document
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
|
||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||
|
||||
if exists('main_syntax') && main_syntax == 'eruby'
|
||||
let b:ruby_no_expensive = 1
|
||||
@@ -205,7 +205,7 @@ syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyC
|
||||
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
|
||||
syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
|
||||
syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
||||
syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
||||
|
||||
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
|
||||
|
||||
@@ -244,7 +244,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
||||
" statements without 'do'
|
||||
syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(\\\n\s*\)\@<!\%(if\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||
|
||||
syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression
|
||||
syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression
|
||||
@@ -289,7 +289,7 @@ syn match rubySharpBang "\%^#!.*" display
|
||||
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
|
||||
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
|
||||
if !exists("ruby_no_comment_fold")
|
||||
syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
||||
syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
||||
syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold
|
||||
else
|
||||
syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell
|
||||
|
||||
@@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
|
||||
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
|
||||
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||
" Last Change: January 5, 2015
|
||||
" Last Change: January 29, 2015
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
@@ -26,9 +26,9 @@ syn keyword rustKeyword continue
|
||||
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty
|
||||
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
|
||||
syn keyword rustKeyword for in if impl let
|
||||
syn keyword rustKeyword loop once pub
|
||||
syn keyword rustKeyword loop pub
|
||||
syn keyword rustKeyword return super
|
||||
syn keyword rustKeyword unsafe virtual where while
|
||||
syn keyword rustKeyword unsafe where while
|
||||
syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty
|
||||
" FIXME: Scoped impl's name is also fallen in this category
|
||||
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
|
||||
@@ -45,7 +45,6 @@ syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:spac
|
||||
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||
|
||||
syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained
|
||||
syn keyword rustBoxPlacementExpr GC containedin=rustBoxPlacement
|
||||
" Ideally we'd have syntax rules set up to match arbitrary expressions. Since
|
||||
" we don't, we'll just define temporary contained rules to handle balancing
|
||||
" delimiters.
|
||||
@@ -58,13 +57,13 @@ syn match rustMacroRepeatCount ".\?[*+]" contained
|
||||
syn match rustMacroVariable "$\w\+"
|
||||
|
||||
" Reserved (but not yet used) keywords {{{2
|
||||
syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override macro
|
||||
syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro
|
||||
|
||||
" Built-in types {{{2
|
||||
syn keyword rustType isize usize float char bool u8 u16 u32 u64 f32
|
||||
syn keyword rustType isize usize char bool u8 u16 u32 u64 f32
|
||||
syn keyword rustType f64 i8 i16 i32 i64 str Self
|
||||
|
||||
" Things from the prelude (src/libstd/prelude.rs) {{{2
|
||||
" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2
|
||||
" This section is just straight transformation of the contents of the prelude,
|
||||
" to make it easy to update.
|
||||
|
||||
@@ -73,30 +72,27 @@ syn keyword rustTrait Copy Send Sized Sync
|
||||
syn keyword rustTrait Drop Fn FnMut FnOnce
|
||||
|
||||
" Reexported functions {{{3
|
||||
syn keyword rustFunction drop
|
||||
" There’s no point in highlighting these; when one writes drop( or drop::< it
|
||||
" gets the same highlighting anyway, and if someone writes `let drop = …;` we
|
||||
" don’t really want *that* drop to be highlighted.
|
||||
"syn keyword rustFunction drop
|
||||
|
||||
" Reexported types and traits {{{3
|
||||
syn keyword rustTrait Box
|
||||
syn keyword rustTrait CharExt
|
||||
syn keyword rustTrait ToOwned
|
||||
syn keyword rustTrait Clone
|
||||
syn keyword rustTrait PartialEq PartialOrd Eq Ord
|
||||
syn keyword rustTrait DoubleEndedIterator
|
||||
syn keyword rustTrait ExactSizeIterator
|
||||
syn keyword rustTrait Iterator IteratorExt Extend
|
||||
syn keyword rustTrait AsRef AsMut Into From
|
||||
syn keyword rustTrait Default
|
||||
syn keyword rustTrait Iterator Extend IntoIterator
|
||||
syn keyword rustTrait DoubleEndedIterator ExactSizeIterator
|
||||
syn keyword rustEnum Option
|
||||
syn keyword rustEnumVariant Some None
|
||||
syn keyword rustTrait PtrExt MutPtrExt
|
||||
syn keyword rustEnum Result
|
||||
syn keyword rustEnumVariant Ok Err
|
||||
syn keyword rustTrait AsSlice
|
||||
syn keyword rustTrait SliceExt SliceConcatExt
|
||||
syn keyword rustTrait Str StrExt
|
||||
syn keyword rustTrait SliceConcatExt
|
||||
syn keyword rustTrait String ToString
|
||||
syn keyword rustTrait Vec
|
||||
" FIXME: remove when path reform lands
|
||||
syn keyword rustTrait Path GenericPath
|
||||
" FIXME: remove when I/O reform lands
|
||||
syn keyword rustTrait Buffer Writer Reader Seek BufferPrelude
|
||||
|
||||
" Other syntax {{{2
|
||||
syn keyword rustSelf self
|
||||
@@ -122,13 +118,15 @@ syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
|
||||
" This isn't actually correct; a closure with no arguments can be `|| { }`.
|
||||
" Last, because the & in && isn't a sigil
|
||||
syn match rustOperator display "&&\|||"
|
||||
" This is rustArrowCharacter rather than rustArrow for the sake of matchparen,
|
||||
" so it skips the ->; see http://stackoverflow.com/a/30309949 for details.
|
||||
syn match rustArrowCharacter display "->"
|
||||
|
||||
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic
|
||||
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic
|
||||
|
||||
syn match rustEscapeError display contained /\\./
|
||||
syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/
|
||||
syn match rustEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{8}\)/
|
||||
syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/
|
||||
syn match rustStringContinuation display contained /\\\n\s*/
|
||||
syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation
|
||||
@@ -136,13 +134,16 @@ syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEs
|
||||
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
|
||||
|
||||
syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive
|
||||
syn region rustDerive start="derive(" end=")" contained contains=rustTrait
|
||||
syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait
|
||||
" This list comes from src/libsyntax/ext/deriving/mod.rs
|
||||
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).
|
||||
syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy
|
||||
|
||||
" Number literals
|
||||
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(s\|8\|16\|32\|64\)\)\="
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\="
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\="
|
||||
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\="
|
||||
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\="
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
|
||||
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="
|
||||
|
||||
" Special case for numbers of the form "1." which are float literals, unless followed by
|
||||
" an identifier, which makes them integer literals with a method call or field access,
|
||||
@@ -168,6 +169,7 @@ syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:g
|
||||
syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode
|
||||
syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid
|
||||
|
||||
syn match rustShebang /\%^#![^[].*/
|
||||
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
|
||||
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
|
||||
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
|
||||
@@ -200,6 +202,7 @@ hi def link rustOctNumber rustNumber
|
||||
hi def link rustBinNumber rustNumber
|
||||
hi def link rustIdentifierPrime rustIdentifier
|
||||
hi def link rustTrait rustType
|
||||
hi def link rustDeriveTrait rustTrait
|
||||
|
||||
hi def link rustMacroRepeatCount rustMacroRepeatDelimiters
|
||||
hi def link rustMacroRepeatDelimiters Macro
|
||||
@@ -220,6 +223,7 @@ hi def link rustEnumVariant rustConstant
|
||||
hi def link rustConstant Constant
|
||||
hi def link rustSelf Constant
|
||||
hi def link rustFloat Float
|
||||
hi def link rustArrowCharacter rustOperator
|
||||
hi def link rustOperator Operator
|
||||
hi def link rustKeyword Keyword
|
||||
hi def link rustReservedKeyword Error
|
||||
@@ -231,6 +235,7 @@ hi def link rustModPathSep Delimiter
|
||||
hi def link rustFunction Function
|
||||
hi def link rustFuncName Function
|
||||
hi def link rustFuncCall Function
|
||||
hi def link rustShebang Comment
|
||||
hi def link rustCommentLine Comment
|
||||
hi def link rustCommentLineDoc SpecialComment
|
||||
hi def link rustCommentBlock rustCommentLine
|
||||
@@ -249,7 +254,6 @@ hi def link rustInvalidBareKeyword Error
|
||||
hi def link rustExternCrate rustKeyword
|
||||
hi def link rustObsoleteExternMod Error
|
||||
hi def link rustBoxPlacementParens Delimiter
|
||||
hi def link rustBoxPlacementExpr rustKeyword
|
||||
|
||||
" Other Suggestions:
|
||||
" hi rustAttribute ctermfg=cyan
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user