mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74652b465d | ||
|
|
7575da2064 | ||
|
|
9b23910103 | ||
|
|
98e021e969 | ||
|
|
b8d9939329 | ||
|
|
0244e228fa | ||
|
|
ab61d2ac8e | ||
|
|
f42e1f477c |
12
README.md
12
README.md
@@ -23,6 +23,10 @@ A collection of language packs for Vim.
|
|||||||
|
|
||||||
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
||||||
|
|
||||||
|
NOTE: Not all features of listed language packs are available. We strip them from functionality slowing vim startup in general (for example we ignore `plugins` folder that is loaded regardless of file type, use `ftplugin` instead).
|
||||||
|
|
||||||
|
If you need full functionality of any plugin, please use it directly with your plugin manager.
|
||||||
|
|
||||||
## Language packs
|
## Language packs
|
||||||
|
|
||||||
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
|
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
|
||||||
@@ -80,15 +84,17 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)
|
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [pgsql](https://github.com/exu/pgsql.vim) (syntax, ftdetect)
|
- [pgsql](https://github.com/exu/pgsql.vim) (syntax, ftdetect)
|
||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect)
|
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)
|
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent, ftdetect)
|
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent, ftdetect)
|
||||||
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)
|
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect)
|
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftdetect)
|
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
||||||
|
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload, ftdetect)
|
||||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
|
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||||
|
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin, ftdetect)
|
||||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||||
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
|
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
|
||||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||||
@@ -105,7 +111,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin, ftdetect)
|
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin, ftdetect)
|
||||||
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
||||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
||||||
- [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin)
|
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
|
||||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||||
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
|
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
|
||||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
|||||||
|
|
||||||
setlocal iskeyword+=$ suffixesadd+=.js
|
setlocal iskeyword+=$ suffixesadd+=.js
|
||||||
|
|
||||||
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
|
if exists('b:undo_ftplugin')
|
||||||
|
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
|
||||||
|
else
|
||||||
|
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
|
|||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
" URL: http://github.com/kchmck/vim-coffee-script
|
||||||
" License: WTFPL
|
" License: WTFPL
|
||||||
|
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax_save = b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
||||||
" priority than hamlInterpolation.
|
" priority than hamlInterpolation.
|
||||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
||||||
@@ -14,4 +19,9 @@ syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
|||||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
\ contains=@hamlCoffeeScript,hamlInterpolation
|
||||||
\ keepend
|
\ keepend
|
||||||
|
|
||||||
|
if exists('s:current_syntax_save')
|
||||||
|
let b:current_syntax = s:current_syntax_save
|
||||||
|
unlet s:current_syntax_save
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
|
|||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
" URL: http://github.com/kchmck/vim-coffee-script
|
||||||
" License: WTFPL
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax_save = b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" Syntax highlighting for text/coffeescript script tags
|
" Syntax highlighting for text/coffeescript script tags
|
||||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
syn include @htmlCoffeeScript syntax/coffee.vim
|
||||||
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
||||||
@@ -12,6 +16,11 @@ syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
|||||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
||||||
\ containedin=htmlHead
|
\ containedin=htmlHead
|
||||||
|
|
||||||
|
if exists('s:current_syntax_save')
|
||||||
|
let b:current_syntax = s:current_syntax_save
|
||||||
|
unlet s:current_syntax_save
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||||
|
|
||||||
|
|||||||
21
autoload/python/utils.vim
Normal file
21
autoload/python/utils.vim
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
|
" Sometimes Python issues debugging messages
|
||||||
|
" which don't belong to a call stack context
|
||||||
|
" this function filters these messages
|
||||||
|
function! python#utils#fix_qflist() " {{{
|
||||||
|
let l:traceback = []
|
||||||
|
let l:qflist = getqflist()
|
||||||
|
|
||||||
|
for l:item in l:qflist
|
||||||
|
if !empty(l:item.type)
|
||||||
|
call add(l:traceback, l:item)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !empty(l:traceback)
|
||||||
|
call setqflist(l:traceback)
|
||||||
|
endif
|
||||||
|
endfunction " }}}
|
||||||
|
|
||||||
|
endif
|
||||||
9
build
9
build
@@ -7,6 +7,7 @@ DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftde
|
|||||||
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
||||||
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
|
DIRS_SYNTAX="syntax ftdetect after/syntax after/ftdetect"
|
||||||
DIRS_JAVASCRIPT="${DIRS} extras"
|
DIRS_JAVASCRIPT="${DIRS} extras"
|
||||||
|
DIRS_RM="$DIRS_JAVASCRIPT"
|
||||||
|
|
||||||
OUTPUT=""
|
OUTPUT=""
|
||||||
|
|
||||||
@@ -76,8 +77,10 @@ copy_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
concat_ftdetect() {
|
concat_ftdetect() {
|
||||||
|
echo "augroup filetypedetect" > tmp/polyglot.vim
|
||||||
cat config.vim >> tmp/polyglot.vim
|
cat config.vim >> tmp/polyglot.vim
|
||||||
for f in ftdetect/*; do (echo '" '"$f"; cat "${f}"; echo) >> tmp/polyglot.vim; done
|
for f in ftdetect/*; do (echo '" '"$f"; cat "${f}"; echo) >> tmp/polyglot.vim; done
|
||||||
|
echo "augroup END" >> tmp/polyglot.vim
|
||||||
rm -f ftdetect/*
|
rm -f ftdetect/*
|
||||||
mv tmp/polyglot.vim ftdetect/
|
mv tmp/polyglot.vim ftdetect/
|
||||||
}
|
}
|
||||||
@@ -161,8 +164,10 @@ PACKS="
|
|||||||
puppet:voxpupuli/vim-puppet
|
puppet:voxpupuli/vim-puppet
|
||||||
purescript:raichoo/purescript-vim
|
purescript:raichoo/purescript-vim
|
||||||
python:mitsuhiko/vim-python-combined
|
python:mitsuhiko/vim-python-combined
|
||||||
|
python-compiler:aliev/vim-compiler-python
|
||||||
qml:peterhoeg/vim-qml
|
qml:peterhoeg/vim-qml
|
||||||
r-lang:vim-scripts/R.vim
|
r-lang:vim-scripts/R.vim
|
||||||
|
raml:IN3D/vim-raml
|
||||||
ragel:jneen/ragel.vim
|
ragel:jneen/ragel.vim
|
||||||
rspec:sheerun/rspec.vim
|
rspec:sheerun/rspec.vim
|
||||||
ruby:vim-ruby/vim-ruby
|
ruby:vim-ruby/vim-ruby
|
||||||
@@ -179,7 +184,7 @@ PACKS="
|
|||||||
tmux:keith/tmux.vim
|
tmux:keith/tmux.vim
|
||||||
tomdoc:wellbredgrapefruit/tomdoc.vim
|
tomdoc:wellbredgrapefruit/tomdoc.vim
|
||||||
toml:cespare/vim-toml
|
toml:cespare/vim-toml
|
||||||
twig:evidens/vim-twig
|
twig:lumiliet/vim-twig
|
||||||
typescript:leafgarland/typescript-vim
|
typescript:leafgarland/typescript-vim
|
||||||
vala:tkztmk/vim-vala
|
vala:tkztmk/vim-vala
|
||||||
vbnet:vim-scripts/vbnet.vim
|
vbnet:vim-scripts/vbnet.vim
|
||||||
@@ -191,7 +196,7 @@ PACKS="
|
|||||||
"
|
"
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
rm -rf $DIRS_ALL
|
rm -rf $DIRS_RM
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|
||||||
printf "Downloading packs..."
|
printf "Downloading packs..."
|
||||||
|
|||||||
71
compiler/python.vim
Normal file
71
compiler/python.vim
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Unit testing tool for Python
|
||||||
|
" Maintainer: Ali Aliev <ali@aliev.me>
|
||||||
|
" Last Change: 2015 Nov 2
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let current_compiler = "python"
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Disable Python warnings
|
||||||
|
if !exists('$PYTHONWARNINGS')
|
||||||
|
let $PYTHONWARNINGS="ignore"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" For Flake8 first
|
||||||
|
CompilerSet efm =%E%f:%l:\ could\ not\ compile,
|
||||||
|
CompilerSet efm +=%-Z%p^,
|
||||||
|
CompilerSet efm +=%A%f:%l:%c:\ %t%n\ %m,
|
||||||
|
CompilerSet efm +=%A%f:%l:\ %t%n\ %m,
|
||||||
|
|
||||||
|
" Python errors are multi-lined. They often start with 'Traceback', so
|
||||||
|
" we want to capture that (with +G) and show it in the quickfix window
|
||||||
|
" because it explains the order of error messages.
|
||||||
|
|
||||||
|
CompilerSet efm +=%+GTraceback%.%#,
|
||||||
|
|
||||||
|
" The error message itself starts with a line with 'File' in it. There
|
||||||
|
" are a couple of variations, and we need to process a line beginning
|
||||||
|
" with whitespace followed by File, the filename in "", a line number,
|
||||||
|
" and optional further text. %E here indicates the start of a multi-line
|
||||||
|
" error message. The %\C at the end means that a case-sensitive search is
|
||||||
|
" required.
|
||||||
|
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l\\,%m%\\C,
|
||||||
|
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l%\\C,
|
||||||
|
|
||||||
|
" The possible continutation lines are idenitifed to Vim by %C. We deal
|
||||||
|
" with these in order of most to least specific to ensure a proper
|
||||||
|
" match. A pointer (^) identifies the column in which the error occurs
|
||||||
|
" (but will not be entirely accurate due to indention of Python code).
|
||||||
|
CompilerSet efm +=%C%p^,
|
||||||
|
|
||||||
|
" Any text, indented by more than two spaces contain useful information.
|
||||||
|
" We want this to appear in the quickfix window, hence %+.
|
||||||
|
CompilerSet efm +=%+C\ \ \ \ %.%#,
|
||||||
|
CompilerSet efm +=%+C\ \ %.%#,
|
||||||
|
|
||||||
|
" The last line (%Z) does not begin with any whitespace. We use a zero
|
||||||
|
" width lookahead (\&) to check this. The line contains the error
|
||||||
|
" message itself (%m)
|
||||||
|
CompilerSet efm +=%Z%\\S%\\&%m,
|
||||||
|
|
||||||
|
" We can ignore any other lines (%-G)
|
||||||
|
CompilerSet efm +=%-G%.%#
|
||||||
|
|
||||||
|
if filereadable("Makefile")
|
||||||
|
CompilerSet makeprg=make
|
||||||
|
else
|
||||||
|
CompilerSet makeprg=python
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim:foldmethod=marker:foldlevel=0
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -13,6 +13,10 @@ if !exists("g:typescript_compiler_options")
|
|||||||
let g:typescript_compiler_options = ""
|
let g:typescript_compiler_options = ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command! -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
|
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
|
||||||
|
|
||||||
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
||||||
|
|||||||
230
extras/flow.vim
230
extras/flow.vim
@@ -1,235 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
|
||||||
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
|
||||||
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
|
||||||
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
|
||||||
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
|
||||||
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
|
||||||
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
|
||||||
syntax keyword jsFlowDeclareKeyword contained declare
|
|
||||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
|
||||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
|
||||||
syntax match jsFlowNoise contained /[:;,<>]/
|
|
||||||
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
|
||||||
syntax keyword jsFlowStorageClass contained const var let
|
|
||||||
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsFlow PreProc
|
|
||||||
HiLink jsFlowReturn PreProc
|
|
||||||
HiLink jsFlowArray PreProc
|
|
||||||
HiLink jsFlowDeclareBlock PreProc
|
|
||||||
HiLink jsFlowObject PreProc
|
|
||||||
HiLink jsFlowParenRegion PreProc
|
|
||||||
HiLink jsFlowClass PreProc
|
|
||||||
HiLink jsFlowTypeObject PreProc
|
|
||||||
HiLink jsFlowTypeKey PreProc
|
|
||||||
HiLink jsFlowTypeValue PreProc
|
|
||||||
HiLink jsFlowClassProperty jsClassProperty
|
|
||||||
HiLink jsFlowType Type
|
|
||||||
HiLink jsFlowDeclareKeyword Type
|
|
||||||
HiLink jsFlowNoise Noise
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
|
||||||
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
|
||||||
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
|
||||||
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
|
||||||
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
|
||||||
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
|
||||||
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
|
||||||
syntax keyword jsFlowDeclareKeyword contained declare
|
|
||||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
|
||||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
|
||||||
syntax match jsFlowNoise contained /[:;,<>]/
|
|
||||||
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
|
||||||
syntax keyword jsFlowStorageClass contained const var let
|
|
||||||
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsFlow PreProc
|
|
||||||
HiLink jsFlowReturn PreProc
|
|
||||||
HiLink jsFlowArray PreProc
|
|
||||||
HiLink jsFlowDeclareBlock PreProc
|
|
||||||
HiLink jsFlowObject PreProc
|
|
||||||
HiLink jsFlowParenRegion PreProc
|
|
||||||
HiLink jsFlowClass PreProc
|
|
||||||
HiLink jsFlowTypeObject PreProc
|
|
||||||
HiLink jsFlowTypeKey PreProc
|
|
||||||
HiLink jsFlowTypeValue PreProc
|
|
||||||
HiLink jsFlowClassProperty jsClassProperty
|
|
||||||
HiLink jsFlowType Type
|
|
||||||
HiLink jsFlowDeclareKeyword Type
|
|
||||||
HiLink jsFlowNoise Noise
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
|
||||||
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
|
||||||
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
|
||||||
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
|
||||||
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
|
||||||
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
|
||||||
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
|
||||||
syntax keyword jsFlowDeclareKeyword contained declare
|
|
||||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
|
||||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
|
||||||
syntax match jsFlowNoise contained /[:;,<>]/
|
|
||||||
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
|
||||||
syntax keyword jsFlowStorageClass contained const var let
|
|
||||||
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsFlow PreProc
|
|
||||||
HiLink jsFlowReturn PreProc
|
|
||||||
HiLink jsFlowArray PreProc
|
|
||||||
HiLink jsFlowDeclareBlock PreProc
|
|
||||||
HiLink jsFlowObject PreProc
|
|
||||||
HiLink jsFlowParenRegion PreProc
|
|
||||||
HiLink jsFlowClass PreProc
|
|
||||||
HiLink jsFlowTypeObject PreProc
|
|
||||||
HiLink jsFlowTypeKey PreProc
|
|
||||||
HiLink jsFlowTypeValue PreProc
|
|
||||||
HiLink jsFlowClassProperty jsClassProperty
|
|
||||||
HiLink jsFlowType Type
|
|
||||||
HiLink jsFlowDeclareKeyword Type
|
|
||||||
HiLink jsFlowNoise Noise
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
|
||||||
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
|
||||||
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
|
||||||
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
|
||||||
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
|
||||||
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
|
||||||
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
|
||||||
syntax keyword jsFlowDeclareKeyword contained declare
|
|
||||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
|
||||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
|
||||||
syntax match jsFlowNoise contained /[:;,<>]/
|
|
||||||
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
|
||||||
syntax keyword jsFlowStorageClass contained const var let
|
|
||||||
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsFlow PreProc
|
|
||||||
HiLink jsFlowReturn PreProc
|
|
||||||
HiLink jsFlowArray PreProc
|
|
||||||
HiLink jsFlowDeclareBlock PreProc
|
|
||||||
HiLink jsFlowObject PreProc
|
|
||||||
HiLink jsFlowParenRegion PreProc
|
|
||||||
HiLink jsFlowClass PreProc
|
|
||||||
HiLink jsFlowTypeObject PreProc
|
|
||||||
HiLink jsFlowTypeKey PreProc
|
|
||||||
HiLink jsFlowTypeValue PreProc
|
|
||||||
HiLink jsFlowClassProperty jsClassProperty
|
|
||||||
HiLink jsFlowType Type
|
|
||||||
HiLink jsFlowDeclareKeyword Type
|
|
||||||
HiLink jsFlowNoise Noise
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax region jsFlowTypeStatement start=/type/ end=/=/ oneline skipwhite skipempty nextgroup=jsFlowTypeObject
|
|
||||||
syntax region jsFlowDeclareBlock start=/declare/ end=/[;\n]/ oneline contains=jsFlow,jsFlowDeclareKeyword,jsFlowStorageClass
|
|
||||||
syntax region jsFlow start=/:/ end=/\%(\%([),=;\n]\|{\%(.*}\)\@!\|\%({.*}\)\@<=\s*{\)\@=\|void\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock
|
|
||||||
syntax region jsFlowReturn contained start=/:/ end=/\%(\S\s*\%({\%(.*}\)\@!\)\@=\|\n\)/ contains=@jsFlowCluster oneline skipwhite skipempty nextgroup=jsFuncBlock keepend
|
|
||||||
syntax region jsFlowTypeObject contained start=/{/ end=/}/ contains=jsFlowTypeKey skipwhite skipempty nextgroup=jsFunctionBlock extend
|
|
||||||
syntax match jsFlowTypeKey contained /\<[0-9a-zA-Z_$?]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsFlowTypeValue
|
|
||||||
syntax region jsFlowTypeValue contained matchgroup=jsFlowNoise start=/:/ end=/[,}]/ contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ oneline contains=@jsFlowCluster
|
|
||||||
syntax region jsFlowArrow contained matchgroup=jsFlowNoise start=/(/ end=/)\s*=>/ oneline contains=@jsFlowCluster
|
|
||||||
syntax keyword jsFlowDeclareKeyword contained declare
|
|
||||||
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array function object Array
|
|
||||||
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlow
|
|
||||||
syntax match jsFlowNoise contained /[:;,<>]/
|
|
||||||
syntax cluster jsFlowCluster contains=jsFlowType,jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowArrow
|
|
||||||
syntax keyword jsFlowStorageClass contained const var let
|
|
||||||
syntax region jsFlowParenRegion contained start=/:\s*(/ end=/)\%(\s*:\)\@=/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsFlowClass contained matchgroup=jsFlowNoise start=/</ end=/>/ oneline contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsFlow PreProc
|
|
||||||
HiLink jsFlowReturn PreProc
|
|
||||||
HiLink jsFlowArray PreProc
|
|
||||||
HiLink jsFlowDeclareBlock PreProc
|
|
||||||
HiLink jsFlowObject PreProc
|
|
||||||
HiLink jsFlowParenRegion PreProc
|
|
||||||
HiLink jsFlowClass PreProc
|
|
||||||
HiLink jsFlowTypeObject PreProc
|
|
||||||
HiLink jsFlowTypeKey PreProc
|
|
||||||
HiLink jsFlowTypeValue PreProc
|
|
||||||
HiLink jsFlowClassProperty jsClassProperty
|
|
||||||
HiLink jsFlowType Type
|
|
||||||
HiLink jsFlowDeclareKeyword Type
|
|
||||||
HiLink jsFlowNoise Noise
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
|
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
|
||||||
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
|
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
|
||||||
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
|
||||||
|
|||||||
215
extras/jsdoc.vim
215
extras/jsdoc.vim
@@ -41,218 +41,3 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
|
||||||
|
|
||||||
" tags containing a param
|
|
||||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
|
||||||
" other tags (no extra syntax)
|
|
||||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
|
||||||
|
|
||||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
|
||||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsDocTags Special
|
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
|
||||||
|
|
||||||
" tags containing a param
|
|
||||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
|
||||||
" other tags (no extra syntax)
|
|
||||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
|
||||||
|
|
||||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
|
||||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsDocTags Special
|
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
|
||||||
|
|
||||||
" tags containing a param
|
|
||||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
|
||||||
" other tags (no extra syntax)
|
|
||||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
|
||||||
|
|
||||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
|
||||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsDocTags Special
|
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
|
||||||
|
|
||||||
" tags containing a param
|
|
||||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
|
||||||
" other tags (no extra syntax)
|
|
||||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
|
||||||
|
|
||||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
|
||||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsDocTags Special
|
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
"" syntax coloring for javadoc comments (HTML)
|
|
||||||
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
|
||||||
|
|
||||||
" tags containing a param
|
|
||||||
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
|
||||||
" tags containing type and param
|
|
||||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\)\>" skipwhite nextgroup=jsDocType
|
|
||||||
" tags containing type but no param
|
|
||||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
|
||||||
" tags containing references
|
|
||||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
|
||||||
" other tags (no extra syntax)
|
|
||||||
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
|
||||||
|
|
||||||
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
|
||||||
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
|
||||||
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
|
||||||
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
|
||||||
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.{-}]\|=\)\+"
|
|
||||||
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_javascript_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_javascript_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
HiLink jsDocTags Special
|
|
||||||
HiLink jsDocSeeTag Function
|
|
||||||
HiLink jsDocType Type
|
|
||||||
HiLink jsDocTypeBrackets jsDocType
|
|
||||||
HiLink jsDocTypeRecord jsDocType
|
|
||||||
HiLink jsDocTypeNoParam Type
|
|
||||||
HiLink jsDocParam Label
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|||||||
@@ -5,38 +5,3 @@ syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" n
|
|||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
|
||||||
|
|
||||||
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
|
||||||
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
augroup filetypedetect
|
||||||
" Enable jsx syntax by default
|
" Enable jsx syntax by default
|
||||||
if !exists('g:jsx_ext_required')
|
if !exists('g:jsx_ext_required')
|
||||||
let g:jsx_ext_required = 0
|
let g:jsx_ext_required = 0
|
||||||
@@ -615,7 +616,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
|
|||||||
" Version: 0.1
|
" Version: 0.1
|
||||||
|
|
||||||
if did_filetype()
|
if did_filetype()
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | set filetype=plantuml | endif
|
autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | set filetype=plantuml | endif
|
||||||
@@ -688,6 +689,18 @@ au FileType purescript let &l:commentstring='{--%s--}'
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" ftdetect/python.vim
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Unit testing tool for Python
|
||||||
|
" Maintainer: Ali Aliev <ali@aliev.me>
|
||||||
|
" Last Change: 2015 Nov 2
|
||||||
|
|
||||||
|
autocmd FileType python compiler python
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
" ftdetect/qml.vim
|
" ftdetect/qml.vim
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||||
|
|
||||||
@@ -695,6 +708,13 @@ autocmd BufRead,BufNewFile *.qml setfiletype qml
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" ftdetect/raml.vim
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||||
|
|
||||||
|
au BufRead,BufNewFile *.raml set ft=raml
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
" ftdetect/ruby.vim
|
" ftdetect/ruby.vim
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
||||||
|
|
||||||
@@ -736,7 +756,6 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby call s:setf('ruby')
|
|||||||
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
|
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
|
||||||
au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
||||||
|
|
||||||
" TODO: does anyone still use Rantfiles? Remove for Vim 8?
|
|
||||||
" Rantfile
|
" Rantfile
|
||||||
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
|
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
|
||||||
|
|
||||||
@@ -972,3 +991,4 @@ au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|
||||||
|
|
||||||
" Vim filetype plugin file
|
|
||||||
" Language: Perl 6
|
|
||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
|
||||||
" Last Change: {{LAST_CHANGE}}
|
|
||||||
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
|
||||||
"
|
|
||||||
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
|
|
||||||
|
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
|
|
||||||
" Make sure the continuation lines below do not cause problems in
|
|
||||||
" compatibility mode.
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
setlocal formatoptions-=t
|
|
||||||
setlocal formatoptions+=crqol
|
|
||||||
setlocal keywordprg=p6doc
|
|
||||||
|
|
||||||
setlocal comments=:#\|,:#=,:#
|
|
||||||
setlocal commentstring=#%s
|
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly Perl-related files
|
|
||||||
if has("gui_win32")
|
|
||||||
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
|
||||||
\ "Perl Modules (*.pm)\t*.pm\n" .
|
|
||||||
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
|
||||||
\ "All Files (*.*)\t*.*\n"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Provided by Ned Konz <ned at bike-nomad dot com>
|
|
||||||
"---------------------------------------------
|
|
||||||
setlocal include=\\<\\(use\\\|require\\)\\>
|
|
||||||
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
|
|
||||||
setlocal define=[^A-Za-z_]
|
|
||||||
|
|
||||||
" The following line changes a global variable but is necessary to make
|
|
||||||
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
|
|
||||||
" the problem. If this causes a " problem for you, add an
|
|
||||||
" after/ftplugin/perl6.vim file that contains
|
|
||||||
" set isfname-=:
|
|
||||||
set isfname+=:
|
|
||||||
setlocal iskeyword=@,48-57,_,192-255,-
|
|
||||||
|
|
||||||
" Set this once, globally.
|
|
||||||
if !exists("perlpath")
|
|
||||||
if executable("perl6")
|
|
||||||
try
|
|
||||||
if &shellxquote != '"'
|
|
||||||
let perlpath = system('perl6 -e "@*INC.join(q/,/).say"')
|
|
||||||
else
|
|
||||||
let perlpath = system("perl6 -e '@*INC.join(q/,/).say'")
|
|
||||||
endif
|
|
||||||
let perlpath = substitute(perlpath,',.$',',,','')
|
|
||||||
catch /E145:/
|
|
||||||
let perlpath = ".,,"
|
|
||||||
endtry
|
|
||||||
else
|
|
||||||
" If we can't call perl to get its path, just default to using the
|
|
||||||
" current directory and the directory of the current file.
|
|
||||||
let perlpath = ".,,"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Append perlpath to the existing path value, if it is set. Since we don't
|
|
||||||
" use += to do it because of the commas in perlpath, we have to handle the
|
|
||||||
" global / local settings, too.
|
|
||||||
if &l:path == ""
|
|
||||||
if &g:path == ""
|
|
||||||
let &l:path=perlpath
|
|
||||||
else
|
|
||||||
let &l:path=&g:path.",".perlpath
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let &l:path=&l:path.",".perlpath
|
|
||||||
endif
|
|
||||||
"---------------------------------------------
|
|
||||||
|
|
||||||
" Undo the stuff we changed.
|
|
||||||
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" .
|
|
||||||
\ " | unlet! b:browsefilter"
|
|
||||||
|
|
||||||
" Restore the saved compatibility options.
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -6,17 +6,33 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
|
|||||||
" Last Change: 19-Jun-2012
|
" Last Change: 19-Jun-2012
|
||||||
" Version: 0.1
|
" Version: 0.1
|
||||||
|
|
||||||
if exists("g:loaded_plantuml_plugin")
|
if exists("b:loaded_plantuml_plugin")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_plantuml_plugin = 1
|
let b:loaded_plantuml_plugin = 1
|
||||||
|
|
||||||
if !exists("g:plantuml_executable_script")
|
if !exists("g:plantuml_executable_script")
|
||||||
let g:plantuml_executable_script="plantuml"
|
let g:plantuml_executable_script="plantuml"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
autocmd Filetype plantuml let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
|
if exists("loaded_matchit")
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
let b:match_words =
|
||||||
|
\ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' .
|
||||||
|
\ ',\<if\>:\<elseif\>:\<else\>:\<endif\>' .
|
||||||
|
\ ',\<rnote\>:\<endrnote\>' .
|
||||||
|
\ ',\<hnote\>:\<endhnote\>' .
|
||||||
|
\ ',\<title\>:\<endtitle\>' .
|
||||||
|
\ ',\<\while\>:\<endwhile\>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
|
||||||
|
|
||||||
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
||||||
|
|
||||||
|
let b:endwise_addition = '\=index(["note","legend"], submatch(0))!=-1 ? "end " . submatch(0) : "end"'
|
||||||
|
let b:endwise_words = 'loop,group,alt,note,legend'
|
||||||
|
let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$'
|
||||||
|
let b:endwise_syngroups = 'plantumlKeyword'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
5
ftplugin/purescript.vim
Normal file
5
ftplugin/purescript.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1
|
||||||
|
|
||||||
|
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
|
||||||
|
|
||||||
|
endif
|
||||||
5
ftplugin/raml.vim
Normal file
5
ftplugin/raml.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||||
|
|
||||||
|
set ts=2 sts=2 sw=2 et
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -77,9 +77,9 @@ function! s:query_path(root) abort
|
|||||||
let prefix = ''
|
let prefix = ''
|
||||||
endif
|
endif
|
||||||
if &shellxquote == "'"
|
if &shellxquote == "'"
|
||||||
let path_check = prefix.'ruby -e --disable-gems"' . code . '"'
|
let path_check = prefix.'ruby --disable-gems -e "' . code . '"'
|
||||||
else
|
else
|
||||||
let path_check = prefix."ruby -e --disable-gems'" . code . "'"
|
let path_check = prefix."ruby --disable-gems -e '" . code . "'"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let cd = haslocaldir() ? 'lcd' : 'cd'
|
let cd = haslocaldir() ? 'lcd' : 'cd'
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ endif
|
|||||||
" This includeexpr isn't perfect, but it's a good start
|
" This includeexpr isn't perfect, but it's a good start
|
||||||
setlocal includeexpr=substitute(v:fname,'::','/','g')
|
setlocal includeexpr=substitute(v:fname,'::','/','g')
|
||||||
|
|
||||||
" NOT adding .rc as it's being phased out (0.7)
|
|
||||||
setlocal suffixesadd=.rs
|
setlocal suffixesadd=.rs
|
||||||
|
|
||||||
if exists("g:ftplugin_rust_source_path")
|
if exists("g:ftplugin_rust_source_path")
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ silent! setlocal formatoptions+=j
|
|||||||
|
|
||||||
" Just like c.vim, but additionally doesn't wrap text onto /** line when
|
" Just like c.vim, but additionally doesn't wrap text onto /** line when
|
||||||
" formatting. Doesn't bungle bulleted lists when formatting.
|
" formatting. Doesn't bungle bulleted lists when formatting.
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
if get(g:, 'scala_scaladoc_indent', 0)
|
||||||
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
else
|
||||||
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
endif
|
||||||
setlocal commentstring=//\ %s
|
setlocal commentstring=//\ %s
|
||||||
|
|
||||||
setlocal shiftwidth=2 softtabstop=2 expandtab
|
setlocal shiftwidth=2 softtabstop=2 expandtab
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ runtime! indent/elixir.vim
|
|||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
setlocal indentexpr=
|
setlocal indentexpr=
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
if exists("b:eelixir_subtype")
|
if exists("b:eelixir_subtype")
|
||||||
exe "runtime! indent/".b:eelixir_subtype.".vim"
|
exe "runtime! indent/".b:eelixir_subtype.".vim"
|
||||||
else
|
else
|
||||||
@@ -53,19 +56,21 @@ function! GetEelixirIndent(...)
|
|||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
elseif line =~# '\S\s*<%\s*end\s*%>'
|
elseif line =~# '\S\s*<%\s*end\s*%>'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
if line =~# '<%[=%]\=\s*.*\<do\s*%>'
|
if line =~# '<%[=%]\=\s*.*\(\<do\|->\)\s*%>' ||
|
||||||
let ind = ind + &sw
|
\ line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
||||||
elseif line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
let ind += &sw
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
endif
|
||||||
if cline =~# '^\s*%>\s*$'
|
if cline =~# '^\s*%>\s*$'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -2,141 +2,198 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
|||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
end
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal nosmartindent
|
setlocal nosmartindent
|
||||||
|
|
||||||
setlocal indentexpr=GetElixirIndent()
|
setlocal indentexpr=GetElixirIndent()
|
||||||
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
|
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue,0=\|>
|
||||||
|
|
||||||
if exists("*GetElixirIndent")
|
if exists("*GetElixirIndent")
|
||||||
finish
|
finish
|
||||||
endif
|
end
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
let s:no_colon_before = ':\@<!'
|
let s:no_colon_before = ':\@<!'
|
||||||
let s:no_colon_after = ':\@!'
|
let s:no_colon_after = ':\@!'
|
||||||
let s:symbols_end = '\]\|}\|)'
|
let s:symbols_end = '\]\|}\|)'
|
||||||
let s:symbols_start = '\[\|{\|('
|
let s:symbols_start = '\[\|{\|('
|
||||||
let s:arrow = '^.*->$'
|
let s:arrow = '^.*->$'
|
||||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||||
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
|
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
|
||||||
let s:block_start = '\<\%(do\|fn\)\>'
|
let s:block_start = '\<\%(do\|fn\)\>'
|
||||||
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
||||||
let s:block_end = 'end'
|
let s:block_end = 'end'
|
||||||
let s:starts_with_pipeline = '^\s*|>.*$'
|
let s:starts_with_pipeline = '^\s*|>.*$'
|
||||||
let s:ending_with_assignment = '=\s*$'
|
let s:ending_with_assignment = '=\s*$'
|
||||||
|
|
||||||
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow
|
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow
|
||||||
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
|
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
|
||||||
|
|
||||||
let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after
|
let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after
|
||||||
let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
|
let s:pair_middle = '^\s*\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
|
||||||
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
|
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
|
||||||
|
|
||||||
let s:inside_block = 0
|
|
||||||
|
|
||||||
function! GetElixirIndent()
|
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
|
||||||
|
|
||||||
" At the start of the file use zero indent.
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let opened_symbol = 0
|
|
||||||
let current_line = getline(v:lnum)
|
|
||||||
let last_line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
|
|
||||||
|
function! s:is_indentable_syntax()
|
||||||
" TODO: Remove these 2 lines
|
" TODO: Remove these 2 lines
|
||||||
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
|
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
|
||||||
" Vim is making some mess on parsing the syntax of 'end', it is being
|
" Vim is making some mess on parsing the syntax of 'end', it is being
|
||||||
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
|
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
|
||||||
|
call synID(s:current_line_ref, 1, 1)
|
||||||
" This forces vim to sync the syntax.
|
" This forces vim to sync the syntax.
|
||||||
call synID(v:lnum, 1, 1)
|
|
||||||
syntax sync fromstart
|
syntax sync fromstart
|
||||||
|
|
||||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
|
return synIDattr(synID(s:current_line_ref, 1, 1), "name")
|
||||||
|
\ !~ s:skip_syntax
|
||||||
|
endfunction
|
||||||
|
|
||||||
if last_line !~ s:arrow
|
function! s:indent_opened_symbol(ind)
|
||||||
let split_line = split(last_line, '\zs')
|
if s:opened_symbol > 0
|
||||||
let opened_symbol += count(split_line, '(') - count(split_line, ')')
|
if s:pending_parenthesis > 0
|
||||||
let opened_symbol += count(split_line, '[') - count(split_line, ']')
|
\ && s:last_line !~ '^\s*def'
|
||||||
let opened_symbol += count(split_line, '{') - count(split_line, '}')
|
\ && s:last_line !~ s:arrow
|
||||||
end
|
let b:old_ind = a:ind
|
||||||
|
return matchend(s:last_line, '(')
|
||||||
" if start symbol is followed by a character, indent based on the
|
" if start symbol is followed by a character, indent based on the
|
||||||
" whitespace after the symbol, otherwise use the default shiftwidth
|
" whitespace after the symbol, otherwise use the default shiftwidth
|
||||||
if last_line =~ '\('.s:symbols_start.'\).'
|
" Avoid negative indentation index
|
||||||
let opened_prefix = matchlist(last_line, '\('.s:symbols_start.'\)\s*')[0]
|
elseif s:last_line =~ '\('.s:symbols_start.'\).'
|
||||||
let ind += (opened_symbol * strlen(opened_prefix))
|
let regex = '\('.s:symbols_start.'\)\s*'
|
||||||
|
let opened_prefix = matchlist(s:last_line, regex)[0]
|
||||||
|
return a:ind + (s:opened_symbol * strlen(opened_prefix))
|
||||||
else
|
else
|
||||||
let ind += (opened_symbol * &sw)
|
return a:ind + (s:opened_symbol * &sw)
|
||||||
endif
|
|
||||||
|
|
||||||
if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords
|
|
||||||
let ind += &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if current_line =~ '^\s*\('.s:symbols_end.'\)'
|
|
||||||
let ind -= &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if last_line =~ s:ending_with_assignment && opened_symbol == 0
|
|
||||||
let b:old_ind = indent(lnum)
|
|
||||||
let ind += &sw
|
|
||||||
end
|
end
|
||||||
|
elseif s:opened_symbol < 0
|
||||||
|
let ind = get(b:, 'old_ind', a:ind + (s:opened_symbol * &sw))
|
||||||
|
let ind = float2nr(ceil(floor(ind)/&sw)*&sw)
|
||||||
|
return ind <= 0 ? 0 : ind
|
||||||
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
" if line starts with pipeline
|
function! s:indent_last_line_end_symbol_or_indent_keyword(ind)
|
||||||
" and last line ends with a pipeline,
|
if s:last_line =~ '^\s*\('.s:symbols_end.'\)'
|
||||||
" align them
|
\ || s:last_line =~ s:indent_keywords
|
||||||
if last_line =~ '|>.*$' &&
|
return a:ind + &sw
|
||||||
\ current_line =~ s:starts_with_pipeline
|
else
|
||||||
let ind = float2nr(match(last_line, '|>') / &sw) * &sw
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:indent_symbols_ending(ind)
|
||||||
|
if s:current_line =~ '^\s*\('.s:symbols_end.'\)'
|
||||||
|
return a:ind - &sw
|
||||||
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:indent_assignment(ind)
|
||||||
|
if s:last_line =~ s:ending_with_assignment
|
||||||
|
let b:old_ind = indent(s:last_line_ref) " FIXME: side effect
|
||||||
|
return a:ind + &sw
|
||||||
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:indent_pipeline(ind)
|
||||||
|
if s:last_line =~ s:starts_with_pipeline
|
||||||
|
\ && s:current_line =~ s:starts_with_pipeline
|
||||||
|
indent(s:last_line_ref)
|
||||||
|
elseif s:current_line =~ s:starts_with_pipeline
|
||||||
|
\ && s:last_line =~ '^[^=]\+=.\+$'
|
||||||
|
let b:old_ind = indent(s:last_line_ref)
|
||||||
" if line starts with pipeline
|
" if line starts with pipeline
|
||||||
" and last line is an attribution
|
" and last line is an attribution
|
||||||
" indents pipeline in same level as attribution
|
" indents pipeline in same level as attribution
|
||||||
elseif current_line =~ s:starts_with_pipeline &&
|
return match(s:last_line, '=\s*\zs[^ ]')
|
||||||
\ last_line =~ '^[^=]\+=.\+$'
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
if !exists('b:old_ind') || b:old_ind == 0
|
function! s:indent_after_pipeline(ind)
|
||||||
let b:old_ind = indent(lnum)
|
if s:last_line =~ s:starts_with_pipeline
|
||||||
end
|
if empty(substitute(s:current_line, ' ', '', 'g'))
|
||||||
let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw
|
\ || s:current_line =~ s:starts_with_pipeline
|
||||||
endif
|
return indent(s:last_line_ref)
|
||||||
|
elseif s:last_line !~ s:indent_keywords
|
||||||
|
return b:old_ind
|
||||||
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return a:ind
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
" if last line starts with pipeline
|
function! s:deindent_keyword(ind)
|
||||||
" and current line doesn't start with pipeline
|
if s:current_line =~ s:deindent_keywords
|
||||||
" returns the indentation before the pipeline
|
let bslnum = searchpair(
|
||||||
if last_line =~ s:starts_with_pipeline &&
|
\ s:pair_start,
|
||||||
\ current_line !~ s:starts_with_pipeline
|
\ s:pair_middle,
|
||||||
let ind = b:old_ind
|
\ s:pair_end,
|
||||||
endif
|
\ 'nbW',
|
||||||
|
\ s:block_skip
|
||||||
|
\ )
|
||||||
|
|
||||||
if current_line =~ s:deindent_keywords
|
return indent(bslnum)
|
||||||
let bslnum = searchpair(
|
else
|
||||||
\ s:pair_start,
|
return a:ind
|
||||||
\ s:pair_middle,
|
end
|
||||||
\ s:pair_end,
|
endfunction
|
||||||
\ 'nbW',
|
|
||||||
\ s:block_skip
|
|
||||||
\ )
|
|
||||||
|
|
||||||
let ind = indent(bslnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
function! s:indent_arrow(ind)
|
||||||
|
if s:current_line =~ s:arrow
|
||||||
" indent case statements '->'
|
" indent case statements '->'
|
||||||
if current_line =~ s:arrow
|
return a:ind + &sw
|
||||||
let ind += &sw
|
else
|
||||||
endif
|
return a:ind
|
||||||
endif
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
return ind
|
function! GetElixirIndent()
|
||||||
|
let s:current_line_ref = v:lnum
|
||||||
|
let s:last_line_ref = prevnonblank(s:current_line_ref - 1)
|
||||||
|
let s:current_line = getline(s:current_line_ref)
|
||||||
|
let s:last_line = getline(s:last_line_ref)
|
||||||
|
let s:pending_parenthesis = 0
|
||||||
|
let s:opened_symbol = 0
|
||||||
|
|
||||||
|
if s:last_line !~ s:arrow
|
||||||
|
let splitted_line = split(s:last_line, '\zs')
|
||||||
|
let s:pending_parenthesis =
|
||||||
|
\ + count(splitted_line, '(') - count(splitted_line, ')')
|
||||||
|
let s:opened_symbol =
|
||||||
|
\ + s:pending_parenthesis
|
||||||
|
\ + count(splitted_line, '[') - count(splitted_line, ']')
|
||||||
|
\ + count(splitted_line, '{') - count(splitted_line, '}')
|
||||||
|
end
|
||||||
|
|
||||||
|
if s:last_line_ref == 0
|
||||||
|
" At the start of the file use zero indent.
|
||||||
|
return 0
|
||||||
|
elseif !s:is_indentable_syntax()
|
||||||
|
" Current syntax is not indentable, keep last line indentation
|
||||||
|
return indent(s:last_line_ref)
|
||||||
|
else
|
||||||
|
let ind = indent(s:last_line_ref)
|
||||||
|
let ind = s:indent_opened_symbol(ind)
|
||||||
|
let ind = s:indent_symbols_ending(ind)
|
||||||
|
let ind = s:indent_pipeline(ind)
|
||||||
|
let ind = s:indent_after_pipeline(ind)
|
||||||
|
let ind = s:indent_assignment(ind)
|
||||||
|
let ind = s:indent_last_line_end_symbol_or_indent_keyword(ind)
|
||||||
|
let ind = s:deindent_keyword(ind)
|
||||||
|
let ind = s:indent_arrow(ind)
|
||||||
|
return ind
|
||||||
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ if exists("*GetErubyIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" this file uses line continuations
|
||||||
|
let s:cpo_sav = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
function! GetErubyIndent(...)
|
function! GetErubyIndent(...)
|
||||||
" The value of a single shift-width
|
" The value of a single shift-width
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
@@ -101,6 +105,9 @@ function! GetErubyIndent(...)
|
|||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_sav
|
||||||
|
unlet! s:cpo_sav
|
||||||
|
|
||||||
" vim:set sw=2 sts=2 ts=8 noet:
|
" vim:set sw=2 sts=2 ts=8 noet:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -63,15 +63,32 @@ setlocal indentexpr=GetHaskellIndent()
|
|||||||
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
|
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,<space>
|
||||||
|
|
||||||
function! s:isInBlock(hlstack)
|
function! s:isInBlock(hlstack)
|
||||||
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1
|
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:stripTrailingComment(line)
|
||||||
|
if a:line =~ '^\s*--\(-\+\|\s\+\)' || a:line =~ '^\s*{-'
|
||||||
|
return a:line
|
||||||
|
else
|
||||||
|
let l:stripped = split(a:line, '-- ')
|
||||||
|
if len(l:stripped) > 1
|
||||||
|
return substitute(l:stripped[0], '\s*$', '', '')
|
||||||
|
else
|
||||||
|
return a:line
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:isSYN(grp, line, col)
|
||||||
|
return index(s:getHLStack(a:line, a:col), a:grp) != -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:getNesting(hlstack)
|
function! s:getNesting(hlstack)
|
||||||
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens"')
|
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens" || v:val == "haskellBlockComment" || v:val == "haskellPragma" ')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:getHLStack()
|
function! s:getHLStack(line, col)
|
||||||
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
return map(synstack(a:line, a:col), 'synIDattr(v:val, "name")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" indent matching character
|
" indent matching character
|
||||||
@@ -110,14 +127,14 @@ function! s:indentGuard(pos, prevline)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetHaskellIndent()
|
function! GetHaskellIndent()
|
||||||
let l:hlstack = s:getHLStack()
|
let l:hlstack = s:getHLStack(line('.'), col('.'))
|
||||||
|
|
||||||
" do not indent in strings and quasiquotes
|
" do not indent in strings and quasiquotes
|
||||||
if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -1
|
if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -1
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:prevline = getline(v:lnum - 1)
|
let l:prevline = s:stripTrailingComment(getline(v:lnum - 1))
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
|
|
||||||
" indent multiline strings
|
" indent multiline strings
|
||||||
@@ -138,6 +155,9 @@ function! GetHaskellIndent()
|
|||||||
if l:line =~ '^\s*--'
|
if l:line =~ '^\s*--'
|
||||||
return match(l:prevline, '-- ')
|
return match(l:prevline, '-- ')
|
||||||
endif
|
endif
|
||||||
|
if l:prevline =~ '^\s*--'
|
||||||
|
return match(l:prevline, '\S')
|
||||||
|
endif
|
||||||
|
|
||||||
" { foo :: Int
|
" { foo :: Int
|
||||||
" >>,
|
" >>,
|
||||||
@@ -149,14 +169,18 @@ function! GetHaskellIndent()
|
|||||||
if s:isInBlock(l:hlstack)
|
if s:isInBlock(l:hlstack)
|
||||||
normal! 0
|
normal! 0
|
||||||
call search(',', 'cW')
|
call search(',', 'cW')
|
||||||
let l:n = s:getNesting(s:getHLStack())
|
let l:n = s:getNesting(s:getHLStack(line('.'), col('.')))
|
||||||
call search('[([{]', 'bW')
|
call search('[([{]', 'bW')
|
||||||
|
let l:cl = line('.')
|
||||||
|
let l:cc = col('.')
|
||||||
|
|
||||||
while l:n != s:getNesting(s:getHLStack())
|
while l:n != s:getNesting(s:getHLStack(l:cl, l:cc)) || s:isSYN('haskellString', l:cl, l:cc) || s:isSYN('haskellChar', l:cl, l:cc)
|
||||||
call search('[([{]', 'bW')
|
call search('[([{]', 'bW')
|
||||||
|
let l:cl = line('.')
|
||||||
|
let l:cc = col('.')
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
return col('.') - 1
|
return l:cc - 1
|
||||||
else
|
else
|
||||||
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
|
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
|
||||||
if l:s > -1
|
if l:s > -1
|
||||||
@@ -192,11 +216,20 @@ function! GetHaskellIndent()
|
|||||||
" >>>>y = 2
|
" >>>>y = 2
|
||||||
if l:prevline =~ '\C\<let\>\s\+.\+$'
|
if l:prevline =~ '\C\<let\>\s\+.\+$'
|
||||||
if l:line =~ '\C^\s*\<let\>'
|
if l:line =~ '\C^\s*\<let\>'
|
||||||
return match(l:prevline, '\C\<let\>')
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s
|
||||||
|
endif
|
||||||
elseif l:line =~ '\C^\s*\<in\>'
|
elseif l:line =~ '\C^\s*\<in\>'
|
||||||
return match(l:prevline, '\C\<let\>') + g:haskell_indent_in
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_in
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_let
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -225,20 +258,13 @@ function! GetHaskellIndent()
|
|||||||
return match(l:prevline, '\S') + &shiftwidth
|
return match(l:prevline, '\S') + &shiftwidth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"" where foo
|
|
||||||
"" >>>>>>bar
|
|
||||||
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
|
|
||||||
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
|
|
||||||
return match(l:prevline, ':: ')
|
|
||||||
else
|
|
||||||
return match(l:prevline, '\C\<where\>') + g:haskell_indent_where
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" do foo
|
" do foo
|
||||||
" >>>bar
|
" >>>bar
|
||||||
if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
|
if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
|
||||||
return match(l:prevline, '\C\<do\>') + g:haskell_indent_do
|
let l:s = match(l:prevline, '\C\<do\>')
|
||||||
|
if s:isSYN('haskellKeyword', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_do
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" case foo of
|
" case foo of
|
||||||
@@ -247,6 +273,19 @@ function! GetHaskellIndent()
|
|||||||
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
|
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"" where foo
|
||||||
|
"" >>>>>>bar
|
||||||
|
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
|
||||||
|
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
|
||||||
|
return match(l:prevline, ':: ')
|
||||||
|
else
|
||||||
|
let l:s = match(l:prevline, '\C\<where\>')
|
||||||
|
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_where
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" newtype Foo = Foo
|
" newtype Foo = Foo
|
||||||
" >>deriving
|
" >>deriving
|
||||||
if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
|
if l:prevline =~ '\C\s*\<\(newtype\|data\)\>[^{]\+' && l:line =~ '\C^\s*\<deriving\>'
|
||||||
|
|||||||
@@ -2,26 +2,26 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
|||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Javascript
|
" Language: Javascript
|
||||||
" Maintainer: vim-javascript community
|
" Maintainer: vim-javascript community
|
||||||
" URL: https://github.com/pangloss/vim-javascript
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
|
" Last Change: August 20, 2016
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists("b:did_indent")
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
" Now, set up our indentation expression and keys that trigger it.
|
" Now, set up our indentation expression and keys that trigger it.
|
||||||
setlocal indentexpr=GetJavascriptIndent()
|
setlocal indentexpr=GetJavascriptIndent()
|
||||||
setlocal nolisp
|
setlocal nolisp noautoindent nosmartindent
|
||||||
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
|
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
|
||||||
setlocal cinoptions+=j1,J1
|
setlocal cinoptions+=j1,J1
|
||||||
|
|
||||||
let b:undo_indent = 'setlocal indentexpr< indentkeys< cinoptions<'
|
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< cinoptions<'
|
||||||
|
|
||||||
" Only define the function once.
|
" Only define the function once.
|
||||||
if exists("*GetJavascriptIndent")
|
if exists('*GetJavascriptIndent')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -30,125 +30,120 @@ set cpo&vim
|
|||||||
|
|
||||||
" Get shiftwidth value
|
" Get shiftwidth value
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
func s:sw()
|
function s:sw()
|
||||||
return shiftwidth()
|
return shiftwidth()
|
||||||
endfunc
|
endfunction
|
||||||
else
|
else
|
||||||
func s:sw()
|
function s:sw()
|
||||||
return &sw
|
return &sw
|
||||||
endfunc
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*'
|
let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>'
|
||||||
let s:expr_case = s:line_pre . '\%(\%(case\>.*\)\|default\)\s*:\C'
|
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'
|
||||||
" Regex of syntax group names that are or delimit string or are comments.
|
" Regex of syntax group names that are or delimit string or are comments.
|
||||||
let s:syng_strcom = '\%(string\|regex\|special\|doc\|comment\|template\)\c'
|
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
|
||||||
|
|
||||||
" Regex of syntax group names that are strings or documentation.
|
" Regex of syntax group names that are strings or documentation.
|
||||||
let s:syng_comment = '\%(comment\|doc\)\c'
|
let s:syng_comment = '\%(comment\|doc\)'
|
||||||
|
|
||||||
" Expression used to check whether we should skip a match with searchpair().
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : s:IsSyn(line('.'),col('.'),'')"
|
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
|
||||||
|
|
||||||
func s:lookForParens(start,end,flags,time)
|
if has('reltime')
|
||||||
try
|
function s:GetPair(start,end,flags,time)
|
||||||
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,0,a:time)
|
return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time)
|
||||||
catch /E118/
|
endfunction
|
||||||
return searchpair(a:start,'',a:end,a:flags,0,0)
|
else
|
||||||
endtry
|
function s:GetPair(start,end,flags,n)
|
||||||
endfunc
|
return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0]))
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
let s:line_term = '\s*\%(\%(:\@<!\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$'
|
let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$'
|
||||||
|
|
||||||
" configurable regexes that define continuation lines, not including (, {, or [.
|
" configurable regexes that define continuation lines, not including (, {, or [.
|
||||||
if !exists('g:javascript_opfirst')
|
if !exists('g:javascript_opfirst')
|
||||||
let g:javascript_opfirst = '\%([,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)\C'
|
let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\([-/.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
|
||||||
endif
|
endif
|
||||||
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
|
|
||||||
|
|
||||||
if !exists('g:javascript_continuation')
|
if !exists('g:javascript_continuation')
|
||||||
let g:javascript_continuation = '\%([*,.?:^%]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)\C'
|
let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
|
||||||
let g:javascript_continuation .= s:line_term
|
let g:javascript_continuation .= s:line_term
|
||||||
|
|
||||||
function s:Onescope(lnum,text,add)
|
function s:OneScope(lnum,text,add)
|
||||||
return a:text =~ '\%(\<else\|\<do\|=>' . (a:add ? '\|\<try\|\<finally' : '' ) . '\)\C' . s:line_term ||
|
return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' :
|
||||||
\ (a:add && a:text =~ s:line_pre . s:line_term && getline(s:PrevCodeLine(a:lnum - 1)) =~ ')' . s:line_term) ||
|
\ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) ||
|
||||||
\ (cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1 &&
|
\ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) &&
|
||||||
\ s:lookForParens('(', ')', 'cbW', 100) > 0 &&
|
\ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
|
||||||
\ search((a:add ? '\%(function\*\|[A-Za-z_$][0-9A-Za-z_$]*\)\C' :
|
\ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) &&
|
||||||
\ '\<\%(for\%(\s+each\)\=\|if\|let\|switch\|while\|with\)\C') . '\_s*\%#','bW')) &&
|
\ expand('cword') !=# 'each' || search('\C\<for\_s\+\%#','nbW'))) ? expand('<cword>') : ''
|
||||||
\ (a:add || (expand("<cword>") == 'while' ? !s:lookForParens('\<do\>\C', '\<while\>\C','bW',100) : 1))
|
endfunction
|
||||||
|
|
||||||
|
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
||||||
|
function s:IsBlock()
|
||||||
|
return getline(line('.'))[col('.')-1] == '{' && !search(
|
||||||
|
\ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|\<in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') &&
|
||||||
|
\ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Auxiliary Functions {{{2
|
" Auxiliary Functions {{{2
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
|
||||||
function s:IsSyn(lnum, col, reg)
|
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~? (a:reg != '' ? a:reg : s:syng_strcom)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
||||||
function s:PrevCodeLine(lnum)
|
function s:PrevCodeLine(lnum)
|
||||||
let lnum = prevnonblank(a:lnum)
|
let l:lnum = prevnonblank(a:lnum)
|
||||||
while lnum > 0
|
while l:lnum
|
||||||
if !s:IsSyn(lnum, matchend(getline(lnum), '^\s*[^''"]'),'')
|
if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom
|
||||||
break
|
return l:lnum
|
||||||
endif
|
endif
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let l:lnum = prevnonblank(l:lnum - 1)
|
||||||
endwhile
|
endwhile
|
||||||
return lnum
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
" Check if line 'lnum' has a balanced amount of parentheses.
|
||||||
function s:LineHasOpeningBrackets(lnum)
|
function s:Balanced(lnum)
|
||||||
let open_0 = 0
|
let [open_0,open_2,open_4] = [0,0,0]
|
||||||
let open_2 = 0
|
let l:line = getline(a:lnum)
|
||||||
let open_4 = 0
|
let pos = match(l:line, '[][(){}]', 0)
|
||||||
let line = getline(a:lnum)
|
|
||||||
let pos = match(line, '[][(){}]', 0)
|
|
||||||
let last = 0
|
|
||||||
while pos != -1
|
while pos != -1
|
||||||
if !s:IsSyn(a:lnum, pos + 1, '')
|
if synIDattr(synID(a:lnum,pos + 1,0),'name') !~? s:syng_strcom
|
||||||
let idx = stridx('(){}[]', line[pos])
|
let idx = stridx('(){}[]', l:line[pos])
|
||||||
if idx % 2 == 0
|
if idx % 2 == 0
|
||||||
let open_{idx} = open_{idx} + 1
|
let open_{idx} = open_{idx} + 1
|
||||||
let last = pos
|
|
||||||
else
|
else
|
||||||
let open_{idx - 1} = open_{idx - 1} - 1
|
let open_{idx - 1} = open_{idx - 1} - 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let pos = match(line, '[][(){}]', pos + 1)
|
let pos = match(l:line, '[][(){}]', pos + 1)
|
||||||
endwhile
|
endwhile
|
||||||
return [(open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0 ? 1 : (open_2 == 0 ? 0 : 2)) .
|
return (!open_4 + !open_2 + !open_0) - 2
|
||||||
\ (open_4 > 0 ? 1 : (open_4 == 0 ? 0 : 2)), last]
|
|
||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
function GetJavascriptIndent()
|
function GetJavascriptIndent()
|
||||||
if !exists('b:js_cache')
|
if !exists('b:js_cache')
|
||||||
let b:js_cache = [0,0,0]
|
let b:js_cache = [0,0,0]
|
||||||
end
|
endif
|
||||||
" Get the current line.
|
" Get the current line.
|
||||||
let line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
" previous nonblank line number
|
let syns = synIDattr(synID(v:lnum, 1, 0), 'name')
|
||||||
let prevline = prevnonblank(v:lnum - 1)
|
|
||||||
" previous line of code
|
" start with strings,comments,etc.{{{2
|
||||||
let lnum = s:PrevCodeLine(v:lnum - 1)
|
if (l:line !~ '^[''"`]' && syns =~? '\%(string\|template\)') ||
|
||||||
if lnum == 0
|
\ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
if l:line !~ '^\%(\/\*\|\s*\/\/\)' && syns =~? s:syng_comment
|
||||||
|
return cindent(v:lnum)
|
||||||
|
endif
|
||||||
|
let l:lnum = s:PrevCodeLine(v:lnum - 1)
|
||||||
|
if l:lnum == 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" start with strings,comments,etc.{{{2
|
if (l:line =~# s:expr_case)
|
||||||
if (line !~ '^[''"`]' && s:IsSyn(v:lnum,1,'string\|template')) ||
|
|
||||||
\ (line !~ '^\s*[/*]' && s:IsSyn(v:lnum,1,s:syng_comment))
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
if line !~ '^\%(\/\*\|\s*\/\/\)' && s:IsSyn(v:lnum,1,s:syng_comment)
|
|
||||||
return cindent(v:lnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (line =~ s:expr_case)
|
|
||||||
let cpo_switch = &cpo
|
let cpo_switch = &cpo
|
||||||
set cpo+=%
|
set cpo+=%
|
||||||
let ind = cindent(v:lnum)
|
let ind = cindent(v:lnum)
|
||||||
@@ -157,41 +152,42 @@ function GetJavascriptIndent()
|
|||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" the containing paren, bracket, curly
|
" the containing paren, bracket, curly. Memoize, last lineNr either has the
|
||||||
let pcounts = [0]
|
" same scope or starts a new one, unless if it closed a scope.
|
||||||
if b:js_cache[0] >= lnum && b:js_cache[0] <= v:lnum && b:js_cache[0] &&
|
call cursor(v:lnum,1)
|
||||||
\ (b:js_cache[0] > lnum || map(pcounts,'s:LineHasOpeningBrackets(lnum)')[0][0] !~ '2')
|
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && b:js_cache[0] &&
|
||||||
let num = pcounts[0][0] =~ '1' ? lnum : b:js_cache[1]
|
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0)
|
||||||
if pcounts[0][0] =~'1'
|
let num = b:js_cache[1]
|
||||||
call cursor(lnum,pcounts[0][1])
|
elseif syns != '' && l:line[0] =~ '\s'
|
||||||
end
|
let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] :
|
||||||
|
\ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]']
|
||||||
|
let num = s:GetPair(pattern[0],pattern[1],'bW',2000)
|
||||||
else
|
else
|
||||||
call cursor(v:lnum,1)
|
let num = s:GetPair('[({[]','[])}]','bW',2000)
|
||||||
let syns = synIDattr(synID(v:lnum, 1, 1), 'name')
|
endif
|
||||||
if line[0] =~ '\s' && syns != ''
|
|
||||||
let pattern = syns =~? 'funcblock' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] : syns =~? 'jsbracket'? ['\[','\]'] :
|
|
||||||
\ ['(\|{\|\[',')\|}\|\]']
|
|
||||||
let num = s:lookForParens(pattern[0],pattern[1],'bW',2000)
|
|
||||||
else
|
|
||||||
let num = s:lookForParens('(\|{\|\[',')\|}\|\]','bW',2000)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
|
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
|
||||||
|
|
||||||
" most significant part
|
if l:line =~ s:line_pre . '[])}]'
|
||||||
if line =~ s:line_pre . '[])}]'
|
|
||||||
return indent(num)
|
return indent(num)
|
||||||
end
|
endif
|
||||||
let inb = num == 0 ? 1 : s:Onescope(num, strpart(getline(num),0,b:js_cache[2] - 1),1)
|
|
||||||
let switch_offset = (!inb || num == 0) || expand("<cword>") != 'switch' ? 0 : &cino !~ ':' || !has('float') ? s:sw() :
|
call cursor(b:js_cache[1],b:js_cache[2])
|
||||||
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (match(&cino,'.*:\zs[^,]*s') ? s:sw() : 1))
|
|
||||||
if ((line =~ g:javascript_opfirst ||
|
let swcase = getline(l:lnum) =~# s:expr_case
|
||||||
\ (getline(lnum) =~ g:javascript_continuation && getline(lnum) !~ s:expr_case)) &&
|
let pline = swcase ? getline(l:lnum) : substitute(getline(l:lnum), '\%(:\@<!\/\/.*\)$', '','')
|
||||||
\ inb) || (s:Onescope(lnum,getline(lnum),0) && line !~ s:line_pre . '{')
|
let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock())
|
||||||
|
let switch_offset = num == 0 || s:OneScope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) !=# 'switch' ? 0 :
|
||||||
|
\ &cino !~ ':' || !has('float') ? s:sw() :
|
||||||
|
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1))
|
||||||
|
|
||||||
|
" most significant, find the indent amount
|
||||||
|
if inb && !swcase && ((l:line =~# g:javascript_opfirst || pline =~# g:javascript_continuation) ||
|
||||||
|
\ num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\<\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)\>' &&
|
||||||
|
\ l:line !~ s:line_pre . '{')
|
||||||
return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset
|
return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset
|
||||||
elseif num > 0
|
elseif num > 0
|
||||||
return indent(num) + s:sw() + switch_offset
|
return indent(num) + s:sw() + switch_offset
|
||||||
end
|
endif
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
131
indent/perl6.vim
131
indent/perl6.vim
@@ -1,131 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|
||||||
|
|
||||||
" Vim indent file
|
|
||||||
" Language: Perl 6
|
|
||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
|
||||||
" Last Change: {{LAST_CHANGE}}
|
|
||||||
" Contributors: Andy Lester <andy@petdance.com>
|
|
||||||
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
|
||||||
"
|
|
||||||
" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr>
|
|
||||||
|
|
||||||
" Suggestions and improvements by :
|
|
||||||
" Aaron J. Sherman (use syntax for hints)
|
|
||||||
" Artem Chuprina (play nice with folding)
|
|
||||||
" TODO:
|
|
||||||
" This file still relies on stuff from the Perl 5 syntax file, which Perl 6
|
|
||||||
" does not use.
|
|
||||||
"
|
|
||||||
" Things that are not or not properly indented (yet) :
|
|
||||||
" - Continued statements
|
|
||||||
" print "foo",
|
|
||||||
" "bar";
|
|
||||||
" print "foo"
|
|
||||||
" if bar();
|
|
||||||
" - Multiline regular expressions (m//x)
|
|
||||||
" (The following probably needs modifying the perl syntax file)
|
|
||||||
" - qw() lists
|
|
||||||
" - Heredocs with terminators that don't match \I\i*
|
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
|
||||||
if exists("b:did_indent")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_indent = 1
|
|
||||||
|
|
||||||
" Is syntax highlighting active ?
|
|
||||||
let b:indent_use_syntax = has("syntax")
|
|
||||||
|
|
||||||
setlocal indentexpr=GetPerl6Indent()
|
|
||||||
|
|
||||||
" we reset it first because the Perl 5 indent file might have been loaded due
|
|
||||||
" to a .pl/pm file extension, and indent files don't clean up afterwards
|
|
||||||
setlocal indentkeys&
|
|
||||||
|
|
||||||
setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and
|
|
||||||
if !b:indent_use_syntax
|
|
||||||
setlocal indentkeys+=0=EO
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
function! GetPerl6Indent()
|
|
||||||
|
|
||||||
" Get the line to be indented
|
|
||||||
let cline = getline(v:lnum)
|
|
||||||
|
|
||||||
" Indent POD markers to column 0
|
|
||||||
if cline =~ '^\s*=\L\@!'
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Get current syntax item at the line's first char
|
|
||||||
let csynid = ''
|
|
||||||
if b:indent_use_syntax
|
|
||||||
let csynid = synIDattr(synID(v:lnum,1,0),"name")
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Don't reindent POD and heredocs
|
|
||||||
if csynid =~ "^p6Pod"
|
|
||||||
return indent(v:lnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" Now get the indent of the previous perl line.
|
|
||||||
|
|
||||||
" Find a non-blank line above the current line.
|
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
|
||||||
" Hit the start of the file, use zero indent.
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
" Skip heredocs, POD, and comments on 1st column
|
|
||||||
if b:indent_use_syntax
|
|
||||||
let skippin = 2
|
|
||||||
while skippin
|
|
||||||
let synid = synIDattr(synID(lnum,1,0),"name")
|
|
||||||
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
|
|
||||||
let lnum = prevnonblank(lnum - 1)
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
let skippin = 1
|
|
||||||
else
|
|
||||||
let skippin = 0
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
|
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
|
||||||
if cline =~ '^\s*[)}\]»>]'
|
|
||||||
let ind = ind - &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Indent lines that begin with 'or' or 'and'
|
|
||||||
if cline =~ '^\s*\(or\|and\)\>'
|
|
||||||
if line !~ '^\s*\(or\|and\)\>'
|
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
|
||||||
elseif line =~ '^\s*\(or\|and\)\>'
|
|
||||||
let ind = ind - &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ind
|
|
||||||
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
|
|
||||||
|
|
||||||
endif
|
|
||||||
58
indent/plantuml.vim
Normal file
58
indent/plantuml.vim
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetPlantUMLIndent()
|
||||||
|
setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,}
|
||||||
|
|
||||||
|
" only define the indent code once
|
||||||
|
if exists("*GetPlantUMLIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:incIndent =
|
||||||
|
\ '^\s*\(loop\|alt\|opt\|group\|critical\|else\|legend\|box\)\>\|' .
|
||||||
|
\ '^\s*\([hr]\?note\|ref\)\>[^:]*$\|' .
|
||||||
|
\ '^\s*title\s*$\|' .
|
||||||
|
\ '^\s*skinparam\>.*{\s*$\|' .
|
||||||
|
\ '^\s*state\>.*{'
|
||||||
|
|
||||||
|
let s:decIndent = '^\s*\(end\|else\|}\)'
|
||||||
|
|
||||||
|
function! GetPlantUMLIndent(...) abort
|
||||||
|
"for current line, use arg if given or v:lnum otherwise
|
||||||
|
let clnum = a:0 ? a:1 : v:lnum
|
||||||
|
|
||||||
|
if !s:insidePlantUMLTags(clnum)
|
||||||
|
return indent(clnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pnum = prevnonblank(clnum-1)
|
||||||
|
let pindent = indent(pnum)
|
||||||
|
let pline = getline(pnum)
|
||||||
|
let cline = getline(clnum)
|
||||||
|
|
||||||
|
if cline =~ s:decIndent
|
||||||
|
if pline =~ s:incIndent
|
||||||
|
return pindent
|
||||||
|
else
|
||||||
|
return pindent - shiftwidth()
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif pline =~ s:incIndent
|
||||||
|
return pindent + shiftwidth()
|
||||||
|
endif
|
||||||
|
|
||||||
|
return pindent
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:insidePlantUMLTags(lnum) abort
|
||||||
|
call cursor(a:lnum, 1)
|
||||||
|
return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -94,11 +94,12 @@ let s:end_skip_expr = s:skip_expr .
|
|||||||
\ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
|
\ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
|
||||||
|
|
||||||
" Regex that defines continuation lines, not including (, {, or [.
|
" Regex that defines continuation lines, not including (, {, or [.
|
||||||
let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
|
let s:non_bracket_continuation_regex =
|
||||||
|
\ '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'
|
||||||
|
|
||||||
" Regex that defines continuation lines.
|
" Regex that defines continuation lines.
|
||||||
let s:continuation_regex =
|
let s:continuation_regex =
|
||||||
\ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
|
\ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|:\@<![^[:alnum:]:][|&?]\|||\|&&\)\s*\%(#.*\)\=$'
|
||||||
|
|
||||||
" Regex that defines continuable keywords
|
" Regex that defines continuable keywords
|
||||||
let s:continuable_regex =
|
let s:continuable_regex =
|
||||||
@@ -108,6 +109,12 @@ let s:continuable_regex =
|
|||||||
" Regex that defines bracket continuations
|
" Regex that defines bracket continuations
|
||||||
let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
|
let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
|
||||||
|
|
||||||
|
" Regex that defines dot continuations
|
||||||
|
let s:dot_continuation_regex = '%\@<!\.\s*\%(#.*\)\=$'
|
||||||
|
|
||||||
|
" Regex that defines backslash continuations
|
||||||
|
let s:backslash_continuation_regex = '%\@<!\\\s*$'
|
||||||
|
|
||||||
" Regex that defines end of bracket continuation followed by another continuation
|
" Regex that defines end of bracket continuation followed by another continuation
|
||||||
let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex
|
let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex
|
||||||
|
|
||||||
@@ -196,7 +203,17 @@ function s:GetMSL(lnum)
|
|||||||
" Otherwise, terminate search as we have found our MSL already.
|
" Otherwise, terminate search as we have found our MSL already.
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
|
|
||||||
if s:Match(msl, s:leading_operator_regex)
|
if !s:Match(msl, s:backslash_continuation_regex) &&
|
||||||
|
\ s:Match(lnum, s:backslash_continuation_regex)
|
||||||
|
" If the current line doesn't end in a backslash, but the previous one
|
||||||
|
" does, look for that line's msl
|
||||||
|
"
|
||||||
|
" Example:
|
||||||
|
" foo = "bar" \
|
||||||
|
" "baz"
|
||||||
|
"
|
||||||
|
let msl = lnum
|
||||||
|
elseif s:Match(msl, s:leading_operator_regex)
|
||||||
" If the current line starts with a leading operator, keep its indent
|
" If the current line starts with a leading operator, keep its indent
|
||||||
" and keep looking for an MSL.
|
" and keep looking for an MSL.
|
||||||
let msl = lnum
|
let msl = lnum
|
||||||
@@ -221,18 +238,30 @@ function s:GetMSL(lnum)
|
|||||||
" three
|
" three
|
||||||
"
|
"
|
||||||
let msl = lnum
|
let msl = lnum
|
||||||
|
elseif s:Match(lnum, s:dot_continuation_regex) &&
|
||||||
|
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
||||||
|
" If the current line is a bracket continuation or a block-starter, but
|
||||||
|
" the previous is a dot, keep going to see if the previous line is the
|
||||||
|
" start of another continuation.
|
||||||
|
"
|
||||||
|
" Example:
|
||||||
|
" parent.
|
||||||
|
" method_call {
|
||||||
|
" three
|
||||||
|
"
|
||||||
|
let msl = lnum
|
||||||
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
|
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
|
||||||
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
||||||
" If the current line is a bracket continuation or a block-starter, but
|
" If the current line is a bracket continuation or a block-starter, but
|
||||||
" the previous is a non-bracket one, keep going to see if the previous
|
" the previous is a non-bracket one, respect the previous' indentation,
|
||||||
" line is a part of another continuation.
|
" and stop here.
|
||||||
"
|
"
|
||||||
" Example:
|
" Example:
|
||||||
" method_call one,
|
" method_call one,
|
||||||
" two {
|
" two {
|
||||||
" three
|
" three
|
||||||
"
|
"
|
||||||
let msl = lnum
|
return lnum
|
||||||
elseif s:Match(lnum, s:bracket_continuation_regex) &&
|
elseif s:Match(lnum, s:bracket_continuation_regex) &&
|
||||||
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
||||||
" If both lines are bracket continuations (the current may also be a
|
" If both lines are bracket continuations (the current may also be a
|
||||||
|
|||||||
@@ -378,12 +378,17 @@ function! GetScalaIndent()
|
|||||||
let prevline = scala#GetLine(prevlnum)
|
let prevline = scala#GetLine(prevlnum)
|
||||||
let curlnum = v:lnum
|
let curlnum = v:lnum
|
||||||
let curline = scala#GetLine(curlnum)
|
let curline = scala#GetLine(curlnum)
|
||||||
|
if get(g:, 'scala_scaladoc_indent', 0)
|
||||||
|
let star_indent = 2
|
||||||
|
else
|
||||||
|
let star_indent = 1
|
||||||
|
end
|
||||||
|
|
||||||
if prevline =~ '^\s*/\*\*'
|
if prevline =~ '^\s*/\*\*'
|
||||||
if prevline =~ '\*/\s*$'
|
if prevline =~ '\*/\s*$'
|
||||||
return ind
|
return ind
|
||||||
else
|
else
|
||||||
return ind + 1
|
return ind + star_indent
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -538,7 +543,7 @@ function! GetScalaIndent()
|
|||||||
if prevline =~ '^\s*\*/'
|
if prevline =~ '^\s*\*/'
|
||||||
\ || prevline =~ '*/\s*$'
|
\ || prevline =~ '*/\s*$'
|
||||||
call scala#ConditionalConfirm("18")
|
call scala#ConditionalConfirm("18")
|
||||||
let ind = ind - 1
|
let ind = ind - star_indent
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if scala#LineEndsInIncomplete(prevline)
|
if scala#LineEndsInIncomplete(prevline)
|
||||||
|
|||||||
80
indent/twig.vim
Normal file
80
indent/twig.vim
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
|
||||||
|
|
||||||
|
if exists("b:ran_once")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:ran_once = 1
|
||||||
|
|
||||||
|
let s:baseIndentExpr=&indentexpr
|
||||||
|
setlocal indentexpr=GetTwigIndent(v:lnum)
|
||||||
|
|
||||||
|
fun! GetTwigIndent(currentLineNumber)
|
||||||
|
let currentLine = getline(a:currentLineNumber)
|
||||||
|
let previousLineNumber = prevnonblank(a:currentLineNumber - 1)
|
||||||
|
let previousLine = getline(previousLineNumber)
|
||||||
|
|
||||||
|
if (previousLine =~ s:startStructures || previousLine =~ s:middleStructures) && (currentLine !~ s:endStructures && currentLine !~ s:middleStructures)
|
||||||
|
return indent(previousLineNumber) + &shiftwidth
|
||||||
|
elseif currentLine =~ s:endStructures || currentLine =~ s:middleStructures
|
||||||
|
let previousOpenStructureNumber = s:FindPreviousOpenStructure(a:currentLineNumber)
|
||||||
|
let previousOpenStructureLine = getline(previousOpenStructureNumber)
|
||||||
|
return indent(previousOpenStructureNumber)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:CallBaseIndent()
|
||||||
|
endf
|
||||||
|
|
||||||
|
function! s:CallBaseIndent()
|
||||||
|
exe 'redir => s:outputOfBaseIndent'
|
||||||
|
exe 'silent echo ' . s:baseIndentExpr
|
||||||
|
exe 'redir END'
|
||||||
|
return split(s:outputOfBaseIndent)[0]
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! s:FindPreviousOpenStructure(lineNumber)
|
||||||
|
let countOpen = 0
|
||||||
|
let countClosed = 0
|
||||||
|
let lineNumber = a:lineNumber
|
||||||
|
while lineNumber != 1 && countOpen <= countClosed
|
||||||
|
let lineNumber -= 1
|
||||||
|
let currentLine = getline(lineNumber)
|
||||||
|
|
||||||
|
if currentLine =~ s:startStructures
|
||||||
|
let countOpen += 1
|
||||||
|
elseif currentLine =~ s:endStructures
|
||||||
|
let countClosed += 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return lineNumber
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:StartStructure(name)
|
||||||
|
return '^\s*{%\s*' . a:name . '.*%}'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:EndStructure(name)
|
||||||
|
return '^\s*{%\s*end' . a:name . '.*%}'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Map(Fun, list)
|
||||||
|
if len(a:list) == 0
|
||||||
|
return []
|
||||||
|
else
|
||||||
|
return [a:Fun(a:list[0])] + s:Map(a:Fun, a:list[1:])
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
fun! s:BuildStructures()
|
||||||
|
let structures = ['if','for','block']
|
||||||
|
let mStructures = ['elseif','else']
|
||||||
|
let s:startStructures = join(s:Map(function('s:StartStructure'), structures), '\|')
|
||||||
|
let s:endStructures = join(s:Map(function('s:EndStructure'), structures), '\|')
|
||||||
|
let s:middleStructures = join(s:Map(function('s:StartStructure'), mStructures), '\|')
|
||||||
|
endfun
|
||||||
|
|
||||||
|
call s:BuildStructures()
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -34,7 +34,7 @@ hi def link coffeeConditional Conditional
|
|||||||
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
||||||
hi def link coffeeException Exception
|
hi def link coffeeException Exception
|
||||||
|
|
||||||
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\)\>/
|
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\)\>/
|
||||||
\ display
|
\ display
|
||||||
" The `own` keyword is only a keyword after `for`.
|
" The `own` keyword is only a keyword after `for`.
|
||||||
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
if !exists("main_syntax")
|
if !exists("main_syntax")
|
||||||
let main_syntax = 'eelixir'
|
let main_syntax = 'eelixir'
|
||||||
endif
|
endif
|
||||||
@@ -62,4 +65,7 @@ if main_syntax == 'eelixir'
|
|||||||
unlet main_syntax
|
unlet main_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -4,16 +4,22 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
" syncing starts 2000 lines before top line so docstrings don't screw things up
|
" syncing starts 2000 lines before top line so docstrings don't screw things up
|
||||||
syn sync minlines=2000
|
syn sync minlines=2000
|
||||||
|
|
||||||
syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition
|
syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@elixirDeclaration,elixirTodo,elixirArguments,elixirBlockDefinition
|
||||||
|
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
|
||||||
|
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
|
||||||
|
syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration
|
||||||
|
|
||||||
syn match elixirComment '#.*' contains=elixirTodo,@Spell
|
syn match elixirComment '^\s*#.*' contains=elixirTodo,@Spell
|
||||||
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||||
|
|
||||||
syn keyword elixirKeyword case when with cond for if unless try receive send
|
syn keyword elixirKeyword case when with cond for if unless try receive send
|
||||||
syn keyword elixirKeyword exit raise throw after rescue catch else
|
syn keyword elixirKeyword do end exit raise throw after rescue catch else
|
||||||
syn keyword elixirKeyword quote unquote super spawn spawn_link spawn_monitor
|
syn keyword elixirKeyword quote unquote super spawn spawn_link spawn_monitor
|
||||||
|
|
||||||
" Functions used on guards
|
" Functions used on guards
|
||||||
@@ -73,23 +79,20 @@ syn match elixirRegexCharClass "\[:\(alnum\|alpha\|ascii\|blank\|cntrl\|
|
|||||||
|
|
||||||
syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial
|
syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxfr]*" skip="\\\\" contains=@elixirRegexSpecial
|
||||||
|
|
||||||
syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation
|
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained
|
||||||
syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass
|
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("\)+ end=+\z1+ skip=+\\\\+ contains=@elixirStringContained
|
||||||
|
syn region elixirString matchgroup=elixirStringDelimiter start=+\z('''\)+ end=+^\s*\z1+ skip=+'\|\\\\+ contains=@elixirStringContained
|
||||||
syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'\|\\\\" contains=@elixirStringContained
|
syn region elixirString matchgroup=elixirStringDelimiter start=+\z("""\)+ end=+^\s*\z1+ skip=+"\|\\\\+ contains=@elixirStringContained
|
||||||
syn region elixirString matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained
|
|
||||||
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop
|
syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop
|
||||||
|
|
||||||
syn region elixirDocStringStart matchgroup=elixirDocString start=+"""+ end=+$+ oneline contains=ALLBUT,@elixirNotTop
|
syn match elixirDocString +\(@\w*doc\s*\)\@<=\%("""\_.\{-}\_^\s*"""\|".\{-\}"\)+ contains=elixirTodo,elixirInterpolation,@Spell fold
|
||||||
syn region elixirDocStringStart matchgroup=elixirDocString start=+'''+ end=+$+ oneline contains=ALLBUT,@elixirNotTop
|
|
||||||
syn region elixirDocString start=+\z("""\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold
|
|
||||||
syn region elixirDocString start=+\z('''\)+ end=+^\s*\zs\z1+ contains=elixirDocStringStart,elixirTodo,elixirInterpolation,@Spell keepend fold
|
|
||||||
|
|
||||||
syn match elixirAtomInterpolated ':\("\)\@=' contains=elixirString
|
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 match elixirString "\(\w\)\@<!?\%(\\\(x\d{1,2}\|\h{1,2}\h\@!\>\|0[0-7]{0,2}[0-7]\@!\>\|[^x0MC]\)\|(\\[MC]-)+\w\|[^\s\\]\)"
|
||||||
|
|
||||||
syn region elixirBlock matchgroup=elixirBlockDefinition start="\<do\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
|
syn region 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 elixirElseBlock matchgroup=elixirBlockDefinition start="\<else\>:\@!" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
|
||||||
|
syn region elixirAnonymousFunction matchgroup=elixirBlockDefinition start="\<fn\>" end="\<end\>" contains=ALLBUT,@elixirNotTop fold
|
||||||
|
|
||||||
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter
|
syn region elixirArguments start="(" end=")" contained contains=elixirOperator,elixirAtom,elixirPseudoVariable,elixirAlias,elixirBoolean,elixirVariable,elixirUnusedVariable,elixirNumber,elixirDocString,elixirAtomInterpolated,elixirRegex,elixirString,elixirStringDelimiter,elixirRegexDelimiter,elixirInterpolationDelimiter,elixirSigilDelimiter
|
||||||
|
|
||||||
@@ -140,8 +143,6 @@ syn match elixirOverridableDeclaration "[^[:space:];#<]\+" contained con
|
|||||||
syn match elixirExceptionDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
syn match elixirExceptionDeclaration "[^[:space:];#<]\+" contained contains=elixirAlias skipwhite skipnl
|
||||||
syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration skipwhite skipnl
|
syn match elixirCallbackDeclaration "[^[:space:];#<,()\[\]]\+" contained contains=elixirFunctionDeclaration skipwhite skipnl
|
||||||
|
|
||||||
syn cluster elixirDeclaration contains=elixirFunctionDeclaration,elixirModuleDeclaration,elixirProtocolDeclaration,elixirImplDeclaration,elixirRecordDeclaration,elixirMacroDeclaration,elixirDelegateDeclaration,elixirOverridableDeclaration,elixirExceptionDeclaration,elixirCallbackDeclaration,elixirStructDeclaration
|
|
||||||
|
|
||||||
hi def link elixirBlockDefinition Keyword
|
hi def link elixirBlockDefinition Keyword
|
||||||
hi def link elixirDefine Define
|
hi def link elixirDefine Define
|
||||||
hi def link elixirPrivateDefine Define
|
hi def link elixirPrivateDefine Define
|
||||||
@@ -157,6 +158,7 @@ hi def link elixirOverridableDefine Define
|
|||||||
hi def link elixirExceptionDefine Define
|
hi def link elixirExceptionDefine Define
|
||||||
hi def link elixirCallbackDefine Define
|
hi def link elixirCallbackDefine Define
|
||||||
hi def link elixirStructDefine Define
|
hi def link elixirStructDefine Define
|
||||||
|
hi def link elixirModuleDeclaration Type
|
||||||
hi def link elixirFunctionDeclaration Function
|
hi def link elixirFunctionDeclaration Function
|
||||||
hi def link elixirMacroDeclaration Macro
|
hi def link elixirMacroDeclaration Macro
|
||||||
hi def link elixirInclude Include
|
hi def link elixirInclude Include
|
||||||
@@ -172,7 +174,7 @@ hi def link elixirVariable Identifier
|
|||||||
hi def link elixirSelf Identifier
|
hi def link elixirSelf Identifier
|
||||||
hi def link elixirUnusedVariable Comment
|
hi def link elixirUnusedVariable Comment
|
||||||
hi def link elixirNumber Number
|
hi def link elixirNumber Number
|
||||||
hi def link elixirDocString String
|
hi def link elixirDocString Comment
|
||||||
hi def link elixirAtomInterpolated elixirAtom
|
hi def link elixirAtomInterpolated elixirAtom
|
||||||
hi def link elixirRegex elixirString
|
hi def link elixirRegex elixirString
|
||||||
hi def link elixirRegexEscape elixirSpecial
|
hi def link elixirRegexEscape elixirSpecial
|
||||||
@@ -189,4 +191,7 @@ hi def link elixirSigilDelimiter Delimiter
|
|||||||
|
|
||||||
let b:current_syntax = "elixir"
|
let b:current_syntax = "elixir"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite
|
|||||||
syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite
|
syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
|
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
|
||||||
syn match gitrebaseCommand ".*" contained
|
syn match gitrebaseCommand ".*" contained
|
||||||
syn match gitrebaseComment "^#.*" contains=gitrebaseHash
|
syn match gitrebaseComment "^\s*#.*" contains=gitrebaseHash
|
||||||
syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
|
syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
|
||||||
hi def link gitrebaseCommit gitrebaseHash
|
hi def link gitrebaseCommit gitrebaseHash
|
||||||
|
|||||||
@@ -127,12 +127,14 @@ hi def link goComplexes Type
|
|||||||
|
|
||||||
|
|
||||||
" Predefined functions and values
|
" Predefined functions and values
|
||||||
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
|
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 match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
|
||||||
syn keyword goBoolean iota true false nil
|
syn keyword goPredefinedIdentifiers nil iota
|
||||||
|
syn keyword goBoolean true false
|
||||||
|
|
||||||
hi def link goBuiltins Keyword
|
hi def link goBuiltins Keyword
|
||||||
hi def link goBoolean Boolean
|
hi def link goPredefinedIdentifiers Identifier
|
||||||
|
hi def link goBoolean Boolean
|
||||||
|
|
||||||
" Comments; their contents
|
" Comments; their contents
|
||||||
syn keyword goTodo contained TODO FIXME XXX BUG
|
syn keyword goTodo contained TODO FIXME XXX BUG
|
||||||
@@ -177,7 +179,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if g:go_highlight_format_strings != 0
|
if g:go_highlight_format_strings != 0
|
||||||
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
|
syn match goFormatSpecifier /\([^%]\(%%\)*\)\@<=%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
|
||||||
hi def link goFormatSpecifier goSpecialString
|
hi def link goFormatSpecifier goSpecialString
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -273,6 +275,7 @@ hi def link goSpaceError Error
|
|||||||
syn keyword goTodo contained NOTE
|
syn keyword goTodo contained NOTE
|
||||||
hi def link goTodo Todo
|
hi def link goTodo Todo
|
||||||
|
|
||||||
|
syn match goVarArgs /\.\.\./
|
||||||
|
|
||||||
" Operators;
|
" Operators;
|
||||||
if g:go_highlight_operators != 0
|
if g:go_highlight_operators != 0
|
||||||
@@ -287,9 +290,9 @@ if g:go_highlight_operators != 0
|
|||||||
" match remaining two-char operators: := && || <- ++ --
|
" match remaining two-char operators: := && || <- ++ --
|
||||||
syn match goOperator /:=\|||\|<-\|++\|--/
|
syn match goOperator /:=\|||\|<-\|++\|--/
|
||||||
" match ...
|
" match ...
|
||||||
syn match goOperator /\.\.\./
|
|
||||||
|
|
||||||
hi def link goPointerOperator Operator
|
hi def link goPointerOperator goOperator
|
||||||
|
hi def link goVarArgs goOperator
|
||||||
endif
|
endif
|
||||||
hi def link goOperator Operator
|
hi def link goOperator Operator
|
||||||
|
|
||||||
@@ -314,8 +317,7 @@ hi def link goMethod Type
|
|||||||
|
|
||||||
" Fields;
|
" Fields;
|
||||||
if g:go_highlight_fields != 0
|
if g:go_highlight_fields != 0
|
||||||
syn match goVarArgs /\.\.\.\w\+\>/
|
syn match goField /\.\w\+\([.\ \n\r\:\)\[,]\)\@=/hs=s+1
|
||||||
syn match goField /\.\a\+\([\ \n\r\:\)\[]\)\@=/hs=s+1
|
|
||||||
endif
|
endif
|
||||||
hi def link goField Identifier
|
hi def link goField Identifier
|
||||||
|
|
||||||
@@ -368,13 +370,27 @@ if g:go_highlight_build_constraints != 0
|
|||||||
hi def link goPackageComment Comment
|
hi def link goPackageComment Comment
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" :GoSameIds
|
|
||||||
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black
|
|
||||||
|
|
||||||
" :GoCoverage commands
|
" :GoCoverage commands
|
||||||
hi def link goCoverageNormalText Comment
|
hi def link goCoverageNormalText Comment
|
||||||
hi def goCoverageCovered ctermfg=green
|
|
||||||
hi def goCoverageUncover ctermfg=red
|
function! s:hi()
|
||||||
|
" :GoSameIds
|
||||||
|
if &background == 'dark'
|
||||||
|
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black
|
||||||
|
else
|
||||||
|
hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan
|
||||||
|
endif
|
||||||
|
|
||||||
|
" :GoCoverage commands
|
||||||
|
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
|
||||||
|
hi def goCoverageUncover ctermfg=red guifg=#F92672
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup vim-go-hi
|
||||||
|
autocmd!
|
||||||
|
autocmd ColorScheme * call s:hi()
|
||||||
|
augroup end
|
||||||
|
call s:hi()
|
||||||
|
|
||||||
" Search backwards for a global declaration to start processing the syntax.
|
" Search backwards for a global declaration to start processing the syntax.
|
||||||
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ syn match haskellTypeSig
|
|||||||
\ haskellOperators,
|
\ haskellOperators,
|
||||||
\ haskellSeparator,
|
\ haskellSeparator,
|
||||||
\ haskellParens
|
\ haskellParens
|
||||||
syn keyword haskelLWhere where
|
syn keyword haskellWhere where
|
||||||
syn keyword haskellLet let
|
syn keyword haskellLet let
|
||||||
syn keyword haskellDeclKeyword module class instance newtype deriving in
|
syn keyword haskellDeclKeyword module class instance newtype deriving in
|
||||||
syn match haskellDecl "\<\(type\|data\)\>\s\+\(\<family\>\)\?"
|
syn match haskellDecl "\<\(type\|data\)\>\s\+\(\<family\>\)\?"
|
||||||
@@ -95,7 +95,7 @@ syn region haskellBlockComment start="{-" end="-}"
|
|||||||
\ @Spell
|
\ @Spell
|
||||||
syn region haskellPragma start="{-#" end="#-}"
|
syn region haskellPragma start="{-#" end="#-}"
|
||||||
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
|
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
|
||||||
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-z][a-zA-z0-9_']*|" end="|\]"
|
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-zA-Z][a-zA-z0-9._']*|" end="|\]"
|
||||||
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
|
syn region haskellTHBlock matchgroup=haskellTH start="\[\(d\|t\|p\)\?|" end="|]" contains=TOP
|
||||||
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
|
syn region haskellTHDoubleBlock matchgroup=haskellTH start="\[||" end="||]" contains=TOP
|
||||||
syn match haskellPreProc "^#.*$"
|
syn match haskellPreProc "^#.*$"
|
||||||
@@ -145,26 +145,21 @@ highlight def link haskellChar String
|
|||||||
highlight def link haskellBacktick Operator
|
highlight def link haskellBacktick Operator
|
||||||
highlight def link haskellQuasiQuoted String
|
highlight def link haskellQuasiQuoted String
|
||||||
highlight def link haskellTodo Todo
|
highlight def link haskellTodo Todo
|
||||||
|
highlight def link haskellPreProc PreProc
|
||||||
|
highlight def link haskellAssocType Type
|
||||||
|
highlight def link haskellQuotedType Type
|
||||||
|
highlight def link haskellType Type
|
||||||
|
highlight def link haskellImportKeywords Include
|
||||||
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
|
if exists('g:haskell_classic_highlighting') && g:haskell_classic_highlighting == 1
|
||||||
highlight def link haskellPreProc PreProc
|
|
||||||
highlight def link haskellAssocType Type
|
|
||||||
highlight def link haskellImportKeywords Include
|
|
||||||
highlight def link haskellDeclKeyword Keyword
|
highlight def link haskellDeclKeyword Keyword
|
||||||
highlight def link haskellDecl Keyword
|
highlight def link haskellDecl Keyword
|
||||||
highlight def link haskellWhere Keyword
|
highlight def link haskellWhere Keyword
|
||||||
highlight def link haskellLet Keyword
|
highlight def link haskellLet Keyword
|
||||||
highlight def link haskellQuotedType Type
|
|
||||||
highlight def link haskellType Type
|
|
||||||
else
|
else
|
||||||
highlight def link haskellPreProc Macro
|
|
||||||
highlight def link haskellAssocType Structure
|
|
||||||
highlight def link haskellImportKeywords Structure
|
|
||||||
highlight def link haskellDeclKeyword Structure
|
highlight def link haskellDeclKeyword Structure
|
||||||
highlight def link haskellDecl Structure
|
highlight def link haskellDecl Structure
|
||||||
highlight def link haskellWhere Structure
|
highlight def link haskellWhere Structure
|
||||||
highlight def link haskellLet Structure
|
highlight def link haskellLet Structure
|
||||||
highlight def link haskellQuotedType Include
|
|
||||||
highlight def link haskellType Include
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
if exists('g:haskell_enable_quantification') && g:haskell_enable_quantification == 1
|
||||||
|
|||||||
1967
syntax/perl6.vim
1967
syntax/perl6.vim
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
|
|||||||
" TODO: There are some bugs, add << >>
|
" TODO: There are some bugs, add << >>
|
||||||
"
|
"
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if version < 600
|
if version < 600
|
||||||
@@ -22,12 +22,13 @@ let b:current_syntax = "plantuml"
|
|||||||
|
|
||||||
syntax sync minlines=100
|
syntax sync minlines=100
|
||||||
|
|
||||||
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(include\|ifdef\|define\|endif\)\s*.*/ contains=plantumlDir
|
syntax match plantumlPreProc /\%(^@startuml\|^@enduml\)\|!\%(include\|define\|undev\|ifdef\|endif\|ifndef\)\s*.*/ contains=plantumlDir
|
||||||
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
|
syntax region plantumlDir start=/\s\+/ms=s+1 end=/$/ contained
|
||||||
|
|
||||||
syntax keyword plantumlTypeKeyword namespace component package interface class interface enum object participant activity skinparam abstract
|
syntax keyword plantumlTypeKeyword actor participant usecase interface abstract enum component state object artifact folder rect node frame cloud database storage agent boundary control entity card
|
||||||
syntax keyword plantumlKeyword actor boundary control entity database partition title activate as deactivate note left right top bottom of end destroy
|
syntax keyword plantumlKeyword as also autonumber caption title newpage box alt opt loop par break critical note rnote hnote legend group left right of on link over end activate deactivate destroy create footbox hide show skinparam skin top bottom
|
||||||
syntax keyword plantumlKeyword if then else endif
|
syntax keyword plantumlKeyword package namespace page up down if else elseif endif partition footer header center rotate ref return is repeat start stop while endwhile fork again kill
|
||||||
|
syntax keyword plantumlKeyword then detach
|
||||||
|
|
||||||
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
|
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
|
||||||
syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/
|
syntax match plantumlColor /#[0-9A-Fa-f]\{6\}\>/
|
||||||
@@ -40,9 +41,9 @@ syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=p
|
|||||||
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained
|
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained
|
||||||
|
|
||||||
" Class
|
" Class
|
||||||
syntax region plantumlClass start=/{/ end=/\s*}/ contains=plantumlClassArrows,
|
syntax region plantumlClassString matchgroup=plantumlClass start=/\s*class\ze [^{]\+{/ end=/\s*\ze}/ contains=plantumlKeyword,
|
||||||
\ plantumlKeyword,
|
\ @plantumlClassOp
|
||||||
\ @plantumlClassOp
|
syntax match plantumlClass /\s*class\ze [^{]\+$/
|
||||||
|
|
||||||
syntax match plantumlClassPublic /+\w\+/ contained
|
syntax match plantumlClassPublic /+\w\+/ contained
|
||||||
syntax match plantumlClassPrivate /-\w\+/ contained
|
syntax match plantumlClassPrivate /-\w\+/ contained
|
||||||
@@ -52,7 +53,6 @@ syntax match plantumlClassPackPrivate /\~\w\+/ contained
|
|||||||
syntax cluster plantumlClassOp contains=plantumlClassPublic,
|
syntax cluster plantumlClassOp contains=plantumlClassPublic,
|
||||||
\ plantumlClassPrivate,
|
\ plantumlClassPrivate,
|
||||||
\ plantumlClassProtected,
|
\ plantumlClassProtected,
|
||||||
\ plantumlClassProtected,
|
|
||||||
\ plantumlClassPackPrivate
|
\ plantumlClassPackPrivate
|
||||||
|
|
||||||
" Strings
|
" Strings
|
||||||
@@ -154,6 +154,7 @@ highlight default link plantumlDirectedOrVerticalArrowLR Special
|
|||||||
highlight default link plantumlDirectedOrVerticalArrowRL Special
|
highlight default link plantumlDirectedOrVerticalArrowRL Special
|
||||||
highlight default link plantumlLabel Special
|
highlight default link plantumlLabel Special
|
||||||
highlight default link plantumlText Label
|
highlight default link plantumlText Label
|
||||||
|
highlight default link plantumlClass Type
|
||||||
highlight default link plantumlClassPublic Structure
|
highlight default link plantumlClassPublic Structure
|
||||||
highlight default link plantumlClassPrivate Macro
|
highlight default link plantumlClassPrivate Macro
|
||||||
highlight default link plantumlClassProtected Statement
|
highlight default link plantumlClassProtected Statement
|
||||||
|
|||||||
@@ -11,45 +11,167 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn keyword purescriptModule module
|
" Values
|
||||||
syn keyword purescriptImport foreign import hiding
|
syn match purescriptIdentifier "\<[_a-z]\(\w\|\'\)*\>"
|
||||||
syn region purescriptQualifiedImport start="\<qualified\>" contains=purescriptType,purescriptDot end="\<as\>"
|
syn match purescriptNumber "0[xX][0-9a-fA-F]\+\|0[oO][0-7]\|[0-9]\+"
|
||||||
syn keyword purescriptStructure data newtype type class instance derive where
|
syn match purescriptFloat "[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\="
|
||||||
syn keyword purescriptStatement forall do case of let in
|
syn keyword purescriptBoolean true false
|
||||||
syn keyword purescriptConditional if then else
|
|
||||||
syn match purescriptNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
|
" Delimiters
|
||||||
syn match purescriptFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
|
syn match purescriptDelimiter "[,;|.()[\]{}]"
|
||||||
syn match purescriptDelimiter "[(),;[\]{}]"
|
|
||||||
syn keyword purescriptInfix infix infixl infixr
|
" Constructor
|
||||||
syn match purescriptOperators "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
|
syn match purescriptConstructor "\<[A-Z]\w*\>"
|
||||||
syn match purescriptDot "\."
|
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
|
||||||
syn match purescriptType "\<\([A-Z][a-zA-Z0-9_]*\|_|_\)\>"
|
\ containedin=purescriptData,purescriptNewtype
|
||||||
syn match purescriptLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
|
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
|
||||||
syn match purescriptChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
|
|
||||||
syn match purescriptBacktick "`[A-Za-z][A-Za-z0-9_]*`"
|
" Type
|
||||||
syn region purescriptString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
syn match purescriptType "\<[A-Z]\w*\>" contained
|
||||||
syn region purescriptMultilineString start=+"""+ end=+"""+
|
\ containedin=purescriptTypeAlias
|
||||||
syn region purescriptBlockComment start="{-" end="-}" contains=purescriptBlockComment
|
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
|
||||||
|
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||||
|
\ containedin=purescriptData,purescriptNewtype,purescriptTypeAlias,purescriptFunctionDecl
|
||||||
|
syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^,.]\)*\>("rs=e-1 matchgroup=purescriptDelimiter end=")" contained extend
|
||||||
|
\ contains=purescriptConstructor,purescriptDelimiter
|
||||||
|
|
||||||
|
" Function
|
||||||
|
syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||||
|
syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend
|
||||||
|
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`"
|
||||||
|
|
||||||
|
" Module
|
||||||
|
syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl
|
||||||
|
syn match purescriptModuleKeyword "\<module\>"
|
||||||
|
syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>"
|
||||||
|
\ contains=purescriptModuleKeyword,purescriptModuleName
|
||||||
|
\ nextgroup=purescriptModuleParams skipwhite skipnl skipempty
|
||||||
|
syn region purescriptModuleParams start="(" end=")" fold contained keepend
|
||||||
|
\ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
|
||||||
|
\ nextgroup=purescriptImportParams skipwhite
|
||||||
|
|
||||||
|
" Import
|
||||||
|
syn match purescriptImportKeyword "\<\(foreign\|import\|qualified\)\>"
|
||||||
|
syn keyword purescriptAsKeyword as contained
|
||||||
|
syn keyword purescriptHidingKeyword hiding contained
|
||||||
|
syn match purescriptImport "\<import\>\s\+\(qualified\s\+\)\?\<\(\w\+\.\?\)*\>"
|
||||||
|
\ contains=purescriptImportKeyword,purescriptModuleName
|
||||||
|
\ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite
|
||||||
|
syn match purescriptImportParams "as\s\+\(\w\+\)" contained
|
||||||
|
\ contains=purescriptModuleName,purescriptAsKeyword
|
||||||
|
\ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite
|
||||||
|
syn match purescriptImportParams "hiding" contained
|
||||||
|
\ contains=purescriptHidingKeyword
|
||||||
|
\ nextgroup=purescriptModuleParams,purescriptImportParams skipwhite
|
||||||
|
|
||||||
|
" Function declaration
|
||||||
|
syn region purescriptFunctionDecl excludenl start="^\z(\s*\)\(foreign\s\+import\_s\+\)\?[_a-z]\(\w\|\'\)*\_s\{-}\(::\|∷\)" end="^\z1\=\S"me=s-1,re=s-1 keepend
|
||||||
|
\ contains=purescriptFunctionDeclStart,purescriptForall,purescriptOperatorType,purescriptOperatorTypeSig,purescriptType,purescriptTypeVar,purescriptDelimiter,@purescriptComment
|
||||||
|
syn match purescriptFunctionDeclStart "^\s*\(foreign\s\+import\_s\+\)\?\([_a-z]\(\w\|\'\)*\)\_s\{-}\(::\|∷\)" contained
|
||||||
|
\ contains=purescriptImportKeyword,purescriptFunction,purescriptOperatorType
|
||||||
|
syn keyword purescriptForall forall
|
||||||
|
syn match purescriptForall "∀"
|
||||||
|
|
||||||
|
" Keywords
|
||||||
|
syn keyword purescriptConditional if then else
|
||||||
|
syn keyword purescriptStatement do case of let in
|
||||||
|
syn keyword purescriptWhere where
|
||||||
|
syn match purescriptStructure "\<\(data\|newtype\|type\|class\)\>"
|
||||||
|
\ nextgroup=purescriptType skipwhite
|
||||||
|
syn keyword purescriptStructure derive
|
||||||
|
syn keyword purescriptStructure instance
|
||||||
|
\ nextgroup=purescriptFunction skipwhite
|
||||||
|
|
||||||
|
" Infix
|
||||||
|
syn match purescriptInfixKeyword "\<\(infix\|infixl\|infixr\)\>"
|
||||||
|
syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type\s\+\)\?\(\S\+\)\s\+as\>"
|
||||||
|
\ contains=purescriptInfixKeyword,purescriptNumber,purescriptAsKeyword,purescriptConstructor,purescriptStructure,purescriptFunction,purescriptBlockComment
|
||||||
|
\ nextgroup=purescriptFunction,purescriptOperator,@purescriptComment
|
||||||
|
|
||||||
|
" Operators
|
||||||
|
syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
|
||||||
|
syn match purescriptOperatorType "\(::\|∷\)"
|
||||||
|
\ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty
|
||||||
|
syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)"
|
||||||
|
syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained
|
||||||
|
\ nextgroup=purescriptType skipwhite skipnl skipempty
|
||||||
|
|
||||||
|
" Type definition
|
||||||
|
syn region purescriptData start="^data\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent
|
||||||
|
syn match purescriptDataStart "^data\s\+\([A-Z]\w*\)" contained
|
||||||
|
\ containedin=purescriptData
|
||||||
|
\ contains=purescriptStructure,purescriptType,purescriptTypeVar
|
||||||
|
syn match purescriptForeignData "\<foreign\s\+import\s\+data\>"
|
||||||
|
\ contains=purescriptImportKeyword,purescriptStructure
|
||||||
|
\ nextgroup=purescriptType skipwhite
|
||||||
|
|
||||||
|
syn region purescriptNewtype start="^newtype\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent
|
||||||
|
syn match purescriptNewtypeStart "^newtype\s\+\([A-Z]\w*\)" contained
|
||||||
|
\ containedin=purescriptNewtype
|
||||||
|
\ contains=purescriptStructure,purescriptType,purescriptTypeVar
|
||||||
|
|
||||||
|
syn region purescriptTypeAlias start="^type\s\+\([A-Z]\w*\)" end="^\S"me=s-1,re=s-1 transparent
|
||||||
|
syn match purescriptTypeAliasStart "^type\s\+\([A-Z]\w*\)" contained
|
||||||
|
\ containedin=purescriptTypeAlias
|
||||||
|
\ contains=purescriptStructure,purescriptType,purescriptTypeVar
|
||||||
|
|
||||||
|
" String
|
||||||
|
syn match purescriptChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
|
||||||
|
syn region purescriptString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||||
|
syn region purescriptMultilineString start=+"""+ end=+"""+ fold
|
||||||
|
|
||||||
|
" Comment
|
||||||
|
syn match purescriptLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
|
||||||
|
syn region purescriptBlockComment start="{-" end="-}" fold
|
||||||
|
\ contains=purescriptBlockComment
|
||||||
|
syn cluster purescriptComment contains=purescriptLineComment,purescriptBlockComment
|
||||||
|
|
||||||
|
syn sync minlines=50
|
||||||
|
|
||||||
|
" highlight links
|
||||||
|
highlight def link purescriptModuleKeyword purescriptKeyword
|
||||||
|
highlight def link purescriptModuleName Include
|
||||||
|
highlight def link purescriptModuleParams purescriptDelimiter
|
||||||
|
highlight def link purescriptImportKeyword purescriptKeyword
|
||||||
|
highlight def link purescriptAsKeyword purescriptKeyword
|
||||||
|
highlight def link purescriptHidingKeyword purescriptKeyword
|
||||||
|
|
||||||
highlight def link purescriptImport Structure
|
|
||||||
highlight def link purescriptQualifiedImport Structure
|
|
||||||
highlight def link purescriptModule Structure
|
|
||||||
highlight def link purescriptStructure Structure
|
|
||||||
highlight def link purescriptStatement Statement
|
|
||||||
highlight def link purescriptConditional Conditional
|
highlight def link purescriptConditional Conditional
|
||||||
|
highlight def link purescriptWhere purescriptKeyword
|
||||||
|
highlight def link purescriptInfixKeyword purescriptKeyword
|
||||||
|
|
||||||
|
highlight def link purescriptBoolean Boolean
|
||||||
highlight def link purescriptNumber Number
|
highlight def link purescriptNumber Number
|
||||||
highlight def link purescriptFloat Float
|
highlight def link purescriptFloat Float
|
||||||
|
|
||||||
highlight def link purescriptDelimiter Delimiter
|
highlight def link purescriptDelimiter Delimiter
|
||||||
highlight def link purescriptInfix PreProc
|
|
||||||
highlight def link purescriptOperators Operator
|
highlight def link purescriptOperatorTypeSig purescriptOperatorType
|
||||||
highlight def link purescriptDot Operator
|
highlight def link purescriptOperatorFunction purescriptOperatorType
|
||||||
highlight def link purescriptType Include
|
highlight def link purescriptOperatorType purescriptOperator
|
||||||
highlight def link purescriptLineComment Comment
|
|
||||||
highlight def link purescriptBlockComment Comment
|
highlight def link purescriptConstructorDecl purescriptConstructor
|
||||||
|
highlight def link purescriptConstructor purescriptFunction
|
||||||
|
|
||||||
|
highlight def link purescriptTypeVar Identifier
|
||||||
|
highlight def link purescriptForall purescriptStatement
|
||||||
|
|
||||||
|
highlight def link purescriptChar String
|
||||||
|
highlight def link purescriptBacktick purescriptOperator
|
||||||
highlight def link purescriptString String
|
highlight def link purescriptString String
|
||||||
highlight def link purescriptMultilineString String
|
highlight def link purescriptMultilineString String
|
||||||
highlight def link purescriptChar String
|
|
||||||
highlight def link purescriptBacktick Operator
|
highlight def link purescriptLineComment purescriptComment
|
||||||
|
highlight def link purescriptBlockComment purescriptComment
|
||||||
|
|
||||||
|
" purescript general highlights
|
||||||
|
highlight def link purescriptStructure purescriptKeyword
|
||||||
|
highlight def link purescriptKeyword Keyword
|
||||||
|
highlight def link purescriptStatement Statement
|
||||||
|
highlight def link purescriptOperator Operator
|
||||||
|
highlight def link purescriptFunction Function
|
||||||
|
highlight def link purescriptType Type
|
||||||
|
highlight def link purescriptComment Comment
|
||||||
|
|
||||||
let b:current_syntax = "purescript"
|
let b:current_syntax = "purescript"
|
||||||
|
|
||||||
|
|||||||
108
syntax/raml.vim
Normal file
108
syntax/raml.vim
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: RAML (RESTful API Modeling Language)
|
||||||
|
" Maintainer: Eric Hopkins <eric.on.tech@gmail.com>
|
||||||
|
" Last Change: 2016-02-29
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syn keyword ramlTodo contained TODO FIXME XXX NOTE
|
||||||
|
|
||||||
|
syn region ramlComment display oneline start='\%(^\|\s\)#' end='$'
|
||||||
|
\ contains=ramlTodo,@Spell
|
||||||
|
|
||||||
|
syn region ramlVersion display oneline start='#%RAML' end='$'
|
||||||
|
|
||||||
|
syn match ramlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
||||||
|
|
||||||
|
syn match ramlAnchor '&.\+'
|
||||||
|
|
||||||
|
syn match ramlAlias '\*.\+'
|
||||||
|
|
||||||
|
syn match ramlDelimiter '[-,:]'
|
||||||
|
syn match ramlBlock '[\[\]{}>|]'
|
||||||
|
syn match ramlOperator '[?+-]'
|
||||||
|
syn match ramlKey '\h\+\(?\)\?\ze\s*:'
|
||||||
|
syn match ramlKey '\w\+\(\s\+\w\+\)*\(?\)\?\ze\s*:'
|
||||||
|
syn match routeKey '\/\w\+\(\s\+\w\+\)*\ze\s*:'
|
||||||
|
syn match routeKey 'application\/\w\+\ze\s*:'
|
||||||
|
syn match routeParamKey '\/{\w\+}*\ze\s*:'
|
||||||
|
|
||||||
|
syn region ramlString matchgroup=ramlStringDelimiter
|
||||||
|
\ start=+\s"+ skip=+\\"+ end=+"+
|
||||||
|
\ contains=ramlEscape
|
||||||
|
syn region ramlString matchgroup=ramlStringDelimiter
|
||||||
|
\ start=+\s'+ skip=+''+ end=+'+
|
||||||
|
\ contains=ramlStringEscape
|
||||||
|
syn region ramlParameter matchgroup=ramlParameterDelimiter
|
||||||
|
\ start=+<<+ skip=+''+ end=+>>+
|
||||||
|
syn match ramlEscape contained display +\\[\\"abefnrtv^0_ NLP]+
|
||||||
|
syn match ramlEscape contained display '\\x\x\{2}'
|
||||||
|
syn match ramlEscape contained display '\\u\x\{4}'
|
||||||
|
syn match ramlEscape contained display '\\U\x\{8}'
|
||||||
|
syn match ramlEscape display '\\\%(\r\n\|[\r\n]\)'
|
||||||
|
syn match ramlStringEscape contained +''+
|
||||||
|
|
||||||
|
syn match ramlNumber display
|
||||||
|
\ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\='
|
||||||
|
syn match ramlNumber display '0\o\+'
|
||||||
|
syn match ramlNumber display '0x\x\+'
|
||||||
|
syn match ramlNumber display '([+-]\=[iI]nf)'
|
||||||
|
syn match ramlNumber display '(NaN)'
|
||||||
|
|
||||||
|
syn match ramlConstant '\<[~yn]\>'
|
||||||
|
syn keyword ramlConstant true True TRUE false False FALSE
|
||||||
|
syn keyword ramlConstant yes Yes on ON no No off OFF
|
||||||
|
syn keyword ramlConstant null Null NULL nil Nil NIL
|
||||||
|
|
||||||
|
syn keyword httpVerbs get post put delete head patch options
|
||||||
|
syn keyword ramlTypes string number integer date boolean file
|
||||||
|
|
||||||
|
syn match ramlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\='
|
||||||
|
|
||||||
|
syn region ramlDocumentHeader start='---' end='$' contains=ramlDirective
|
||||||
|
syn match ramlDocumentEnd '\.\.\.'
|
||||||
|
|
||||||
|
syn match ramlDirective contained '%[^:]\+:.\+'
|
||||||
|
|
||||||
|
hi def link ramlVersion String
|
||||||
|
hi def link routeInterpolation String
|
||||||
|
hi def link ramlInterpolation Constant
|
||||||
|
hi def link ramlTodo Todo
|
||||||
|
hi def link ramlComment Comment
|
||||||
|
hi def link ramlDocumentHeader PreProc
|
||||||
|
hi def link ramlDocumentEnd PreProc
|
||||||
|
hi def link ramlDirective Keyword
|
||||||
|
hi def link ramlNodeProperty Type
|
||||||
|
hi def link ramlAnchor Type
|
||||||
|
hi def link ramlAlias Type
|
||||||
|
hi def link ramlBlock Operator
|
||||||
|
hi def link ramlOperator Operator
|
||||||
|
hi def link routeParamKey SpecialChar
|
||||||
|
hi def link ramlKey Identifier
|
||||||
|
hi def link routeKey SpecialChar
|
||||||
|
hi def link ramlParameterDelimiter Type
|
||||||
|
hi def link ramlParameter Type
|
||||||
|
hi def link ramlString String
|
||||||
|
hi def link ramlStringDelimiter ramlString
|
||||||
|
hi def link ramlEscape SpecialChar
|
||||||
|
hi def link ramlStringEscape SpecialChar
|
||||||
|
hi def link ramlNumber Number
|
||||||
|
hi def link ramlConstant Constant
|
||||||
|
hi def link ramlTimestamp Number
|
||||||
|
hi def link httpVerbs Statement
|
||||||
|
hi def link ramlTypes Type
|
||||||
|
hi def link ramlDelimiter Delimiter
|
||||||
|
|
||||||
|
let b:current_syntax = "raml"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -16,6 +16,10 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" this file uses line continuations
|
||||||
|
let s:cpo_sav = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
" Folding Config {{{1
|
" Folding Config {{{1
|
||||||
if has("folding") && exists("ruby_fold")
|
if has("folding") && exists("ruby_fold")
|
||||||
setlocal foldmethod=syntax
|
setlocal foldmethod=syntax
|
||||||
@@ -140,7 +144,7 @@ endif
|
|||||||
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="
|
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="
|
||||||
|
|
||||||
syn match rubyBlockParameter "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contained
|
syn match rubyBlockParameter "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contained
|
||||||
syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter
|
syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\_s*\)\@32<=|" end="|" oneline display contains=rubyBlockParameter
|
||||||
|
|
||||||
syn match rubyInvalidVariable "$[^ A-Za-z_-]"
|
syn match rubyInvalidVariable "$[^ A-Za-z_-]"
|
||||||
syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]#
|
syn match rubyPredefinedVariable #$[!$&"'*+,./0:;<=>?@\`~]#
|
||||||
@@ -544,6 +548,9 @@ hi def link rubySpaceError rubyError
|
|||||||
" Postscript {{{1
|
" Postscript {{{1
|
||||||
let b:current_syntax = "ruby"
|
let b:current_syntax = "ruby"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_sav
|
||||||
|
unlet! s:cpo_sav
|
||||||
|
|
||||||
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: tmux(1) configuration file
|
" Language: tmux(1) configuration file
|
||||||
" Maintainer: Tiago Cunha <tcunha@users.sourceforge.net>
|
" Maintainer: Tiago Cunha <tcunha@users.sourceforge.net>
|
||||||
" Last Change: $Date: 2010-07-27 18:29:07 $
|
|
||||||
" License: This file is placed in the public domain.
|
" License: This file is placed in the public domain.
|
||||||
"
|
"
|
||||||
" To install this file:
|
" To install this file:
|
||||||
@@ -230,6 +229,8 @@ syn keyword tmuxOptsSet
|
|||||||
\ set-titles
|
\ set-titles
|
||||||
\ set-titles-string
|
\ set-titles-string
|
||||||
\ status
|
\ status
|
||||||
|
\ status-bg
|
||||||
|
\ status-fg
|
||||||
\ status-interval
|
\ status-interval
|
||||||
\ status-justify
|
\ status-justify
|
||||||
\ status-keys
|
\ status-keys
|
||||||
@@ -274,6 +275,7 @@ syn keyword tmuxOptsSetw
|
|||||||
\ window-active-style
|
\ window-active-style
|
||||||
\ window-status-activity-style
|
\ window-status-activity-style
|
||||||
\ window-status-bell-style
|
\ window-status-bell-style
|
||||||
|
\ window-status-current-bg
|
||||||
\ window-status-current-format
|
\ window-status-current-format
|
||||||
\ window-status-current-style
|
\ window-status-current-style
|
||||||
\ window-status-format
|
\ window-status-format
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math
|
|||||||
|
|
||||||
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
||||||
|
|
||||||
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type namespace from get set
|
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public type namespace from get set
|
||||||
"}}}
|
"}}}
|
||||||
"" typescript/DOM/HTML/CSS specified things"{{{
|
"" typescript/DOM/HTML/CSS specified things"{{{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user