mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96c5c20e41 | ||
|
|
18efda3933 | ||
|
|
bfc6ed9fba | ||
|
|
58709c49f6 | ||
|
|
3d5b784fa5 | ||
|
|
cef5e2d931 | ||
|
|
17ad302c54 | ||
|
|
1541356fe1 | ||
|
|
f3556c1eca | ||
|
|
4855e5ee82 | ||
|
|
bb85059bac | ||
|
|
11f53253ad | ||
|
|
9fe009095a | ||
|
|
dce9e8dec5 | ||
|
|
30c87b73de | ||
|
|
1713d35f06 | ||
|
|
5ddfa1ac28 | ||
|
|
dbe9bc927f | ||
|
|
d219055bc8 | ||
|
|
0e9041f29a | ||
|
|
a0b8a6e77f | ||
|
|
a61ab44810 | ||
|
|
dd4b5cbdd6 |
26
README.md
26
README.md
@@ -8,19 +8,25 @@ A collection of language packs for Vim.
|
|||||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||||
|
|
||||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||||
- It **installs and updates 100+ times faster** than 100+ packages it consist of.
|
- It **installs and updates 100+ times faster** than 100+ packages it consists of.
|
||||||
- Solid syntax and indentation support. Only the best language packs.
|
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||||
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
|
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
|
||||||
|
|
||||||
\*To be completely honest, concatenated `ftdetect` script takes around `3ms` to load.
|
\*To be completely honest, concatenated `ftdetect` script takes up to `17ms` to load.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim.
|
1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim.
|
||||||
2. Use this repository as submodule or package.
|
2. Use this repository as submodule or package.
|
||||||
|
|
||||||
|
For example when using [Plug](https://github.com/junegunn/vim-plug):
|
||||||
|
|
||||||
|
```
|
||||||
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
```
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
You can also use Vim 8 built-in package manager:
|
You can also use Vim 8 built-in package manager:
|
||||||
@@ -46,8 +52,10 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
||||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
|
- [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
|
||||||
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
|
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
|
||||||
|
- [carp](https://github.com/hellerve/carp-vim) (syntax)
|
||||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||||
|
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
||||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
||||||
@@ -77,10 +85,11 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
|
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
|
||||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
||||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
||||||
|
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
|
||||||
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
||||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
||||||
- [jsx](https://github.com/mxw/vim-jsx) (after)
|
- [jsx](https://github.com/mxw/vim-jsx) (after)
|
||||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent)
|
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent)
|
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent)
|
||||||
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
||||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
||||||
@@ -88,16 +97,15 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
||||||
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
||||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
||||||
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax)
|
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent)
|
||||||
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
||||||
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||||
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin)
|
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, ftplugin)
|
||||||
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
||||||
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
||||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||||
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
||||||
- [openscad](https://github.com/sirtaj/vim-openscad) (syntax, ftplugin)
|
|
||||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||||
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
|
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
|
||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
@@ -108,7 +116,8 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
|
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
|
||||||
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
||||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||||
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
- [python-ident](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
||||||
|
- [python](https://github.com/vim-python/python-syntax) (syntax)
|
||||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
|
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
|
||||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, autoload, ftplugin)
|
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, autoload, ftplugin)
|
||||||
@@ -121,6 +130,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
|
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
|
||||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin)
|
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin)
|
||||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
||||||
|
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
|
||||||
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
|
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
|
||||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
||||||
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
|
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ if !exists('g:terraform_remap_spacebar')
|
|||||||
let g:terraform_remap_spacebar = 0
|
let g:terraform_remap_spacebar = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:terraform_fold_sections')
|
||||||
|
let g:terraform_fold_sections = 0
|
||||||
|
endif
|
||||||
|
|
||||||
if g:terraform_align && exists(':Tabularize')
|
if g:terraform_align && exists(':Tabularize')
|
||||||
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
|
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
|
||||||
function! s:terraformalign()
|
function! s:terraformalign()
|
||||||
@@ -22,36 +26,39 @@ if g:terraform_align && exists(':Tabularize')
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:terraform_fold_sections
|
||||||
|
function! TerraformFolds()
|
||||||
|
let thisline = getline(v:lnum)
|
||||||
|
if match(thisline, '^resource') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^provider') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^module') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^variable') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^output') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^data') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^terraform') >= 0
|
||||||
|
return ">1"
|
||||||
|
elseif match(thisline, '^locals') >= 0
|
||||||
|
return ">1"
|
||||||
|
else
|
||||||
|
return "="
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
setlocal foldmethod=expr
|
||||||
|
setlocal foldexpr=TerraformFolds()
|
||||||
|
setlocal foldlevel=1
|
||||||
|
|
||||||
function! TerraformFolds()
|
function! TerraformFoldText()
|
||||||
let thisline = getline(v:lnum)
|
let foldsize = (v:foldend-v:foldstart)
|
||||||
if match(thisline, '^resource') >= 0
|
return getline(v:foldstart).' ('.foldsize.' lines)'
|
||||||
return ">1"
|
endfunction
|
||||||
elseif match(thisline, '^provider') >= 0
|
setlocal foldtext=TerraformFoldText()
|
||||||
return ">1"
|
endif
|
||||||
elseif match(thisline, '^module') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^variable') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^output') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^data') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^terraform') >= 0
|
|
||||||
return ">1"
|
|
||||||
else
|
|
||||||
return "="
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
setlocal foldmethod=expr
|
|
||||||
setlocal foldexpr=TerraformFolds()
|
|
||||||
setlocal foldlevel=1
|
|
||||||
|
|
||||||
function! TerraformFoldText()
|
|
||||||
let foldsize = (v:foldend-v:foldstart)
|
|
||||||
return getline(v:foldstart).' ('.foldsize.' lines)'
|
|
||||||
endfunction
|
|
||||||
setlocal foldtext=TerraformFoldText()
|
|
||||||
|
|
||||||
" Re-map the space bar to fold and unfold
|
" Re-map the space bar to fold and unfold
|
||||||
if get(g:, "terraform_remap_spacebar", 1)
|
if get(g:, "terraform_remap_spacebar", 1)
|
||||||
@@ -68,5 +75,4 @@ if get(g:, "terraform_align", 1)
|
|||||||
setlocal shiftwidth=2
|
setlocal shiftwidth=2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
|||||||
" Highlight function names.
|
" Highlight function names.
|
||||||
" -----------------------------------------------------------------------------
|
" -----------------------------------------------------------------------------
|
||||||
if !exists('g:cpp_no_function_highlight')
|
if !exists('g:cpp_no_function_highlight')
|
||||||
syn match cCustomParen "(" contains=cParen contains=cCppParen
|
syn match cCustomParen transparent "(" contains=cParen contains=cCppParen
|
||||||
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
|
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
|
||||||
hi def link cCustomFunc Function
|
hi def link cCustomFunc Function
|
||||||
endif
|
endif
|
||||||
@@ -32,7 +32,7 @@ endif
|
|||||||
if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
||||||
syn match cCustomDot "\." contained
|
syn match cCustomDot "\." contained
|
||||||
syn match cCustomPtr "->" contained
|
syn match cCustomPtr "->" contained
|
||||||
syn match cCustomMemVar "\(\.\|->\)\w\+" contains=cCustomDot,cCustomPtr
|
syn match cCustomMemVar "\(\.\|->\)\h\w*" contains=cCustomDot,cCustomPtr
|
||||||
hi def link cCustomMemVar Function
|
hi def link cCustomMemVar Function
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
|||||||
" Language: C++ Additions
|
" Language: C++ Additions
|
||||||
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
||||||
" URL: http://www.haeggblad.com
|
" URL: http://www.haeggblad.com
|
||||||
" Last Change: 12 Oct 2016
|
" Last Change: 1 Feb 2018
|
||||||
" Version: 0.6
|
" Version: 0.6
|
||||||
" Changelog:
|
" Changelog:
|
||||||
" 0.1 - initial version.
|
" 0.1 - initial version.
|
||||||
@@ -37,7 +37,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
|||||||
|
|
||||||
" Functions
|
" Functions
|
||||||
if !exists('g:cpp_no_function_highlight')
|
if !exists('g:cpp_no_function_highlight')
|
||||||
syn match cCustomParen "(" contains=cParen contains=cCppParen
|
syn match cCustomParen transparent "(" contains=cParen contains=cCppParen
|
||||||
syn match cCustomFunc "\w\+\s*(\@="
|
syn match cCustomFunc "\w\+\s*(\@="
|
||||||
hi def link cCustomFunc Function
|
hi def link cCustomFunc Function
|
||||||
endif
|
endif
|
||||||
@@ -855,6 +855,37 @@ syntax keyword cppSTLconstant WEOF
|
|||||||
syntax keyword cppSTLconstant WCHAR_MIN
|
syntax keyword cppSTLconstant WCHAR_MIN
|
||||||
syntax keyword cppSTLconstant WCHAR_MAX
|
syntax keyword cppSTLconstant WCHAR_MAX
|
||||||
|
|
||||||
|
" locale
|
||||||
|
syntax keyword cppSTLtype locale
|
||||||
|
syntax keyword cppSTLtype ctype_base
|
||||||
|
syntax keyword cppSTLtype codecvt_base
|
||||||
|
syntax keyword cppSTLtype messages_base
|
||||||
|
syntax keyword cppSTLtype time_base
|
||||||
|
syntax keyword cppSTLtype money_base
|
||||||
|
syntax keyword cppSTLtype ctype
|
||||||
|
syntax keyword cppSTLtype codecvt
|
||||||
|
syntax keyword cppSTLtype collate
|
||||||
|
syntax keyword cppSTLtype messages
|
||||||
|
syntax keyword cppSTLtype time_get
|
||||||
|
syntax keyword cppSTLtype time_put
|
||||||
|
syntax keyword cppSTLtype num_get
|
||||||
|
syntax keyword cppSTLtype num_put
|
||||||
|
syntax keyword cppSTLtype numpunct
|
||||||
|
syntax keyword cppSTLtype money_get
|
||||||
|
syntax keyword cppSTLtype money_put
|
||||||
|
syntax keyword cppSTLtype moneypunct
|
||||||
|
syntax keyword cppSTLtype ctype_byname
|
||||||
|
syntax keyword cppSTLtype codecvt_byname
|
||||||
|
syntax keyword cppSTLtype messages_byname
|
||||||
|
syntax keyword cppSTLtype collate_byname
|
||||||
|
syntax keyword cppSTLtype time_get_byname
|
||||||
|
syntax keyword cppSTLtype time_put_byname
|
||||||
|
syntax keyword cppSTLtype numpunct_byname
|
||||||
|
syntax keyword cppSTLtype moneypunct_byname
|
||||||
|
syntax keyword cppSTLfunction use_facet
|
||||||
|
syntax keyword cppSTLfunction has_facet
|
||||||
|
syntax keyword cppSTLfunction isspace isblank iscntrl isupper islower isalpha
|
||||||
|
syntax keyword cppSTLfunction isdigit ispunct isxdigit isalnum isprint isgraph
|
||||||
|
|
||||||
if !exists("cpp_no_cpp11")
|
if !exists("cpp_no_cpp11")
|
||||||
syntax keyword cppSTLconstant nullptr
|
syntax keyword cppSTLconstant nullptr
|
||||||
@@ -1766,6 +1797,9 @@ if !exists("cpp_no_cpp17")
|
|||||||
syntax keyword cppSTLfunction do_deallocate
|
syntax keyword cppSTLfunction do_deallocate
|
||||||
syntax keyword cppSTLfunction do_is_equal
|
syntax keyword cppSTLfunction do_is_equal
|
||||||
|
|
||||||
|
" mutex
|
||||||
|
syntax keyword cppSTLtype scoped_lock
|
||||||
|
|
||||||
" new
|
" new
|
||||||
syntax keyword cppSTLconstant hardware_destructive_interference_size
|
syntax keyword cppSTLconstant hardware_destructive_interference_size
|
||||||
syntax keyword cppSTLconstant hardware_constructive_interference_size
|
syntax keyword cppSTLconstant hardware_constructive_interference_size
|
||||||
@@ -1804,7 +1838,7 @@ if !exists("cpp_no_cpp17")
|
|||||||
syntax keyword cppSTLbool is_error_code_enum_v
|
syntax keyword cppSTLbool is_error_code_enum_v
|
||||||
syntax keyword cppSTLbool is_error_condition_enum_v
|
syntax keyword cppSTLbool is_error_condition_enum_v
|
||||||
|
|
||||||
" thread
|
" shared_mutex
|
||||||
syntax keyword cppSTLtype shared_mutex
|
syntax keyword cppSTLtype shared_mutex
|
||||||
|
|
||||||
" tuple
|
" tuple
|
||||||
@@ -1879,6 +1913,16 @@ if !exists("cpp_no_cpp17")
|
|||||||
syntax keyword cppSTLbool conjunction_v
|
syntax keyword cppSTLbool conjunction_v
|
||||||
syntax keyword cppSTLbool disjunction_v
|
syntax keyword cppSTLbool disjunction_v
|
||||||
syntax keyword cppSTLbool negation_v
|
syntax keyword cppSTLbool negation_v
|
||||||
|
syntax keyword cppSTLbool has_unique_object_representations_v
|
||||||
|
syntax keyword cppSTLbool is_swappable_v
|
||||||
|
syntax keyword cppSTLbool is_swappable_with_v
|
||||||
|
syntax keyword cppSTLbool is_nothrow_swappable_v
|
||||||
|
syntax keyword cppSTLbool is_nothrow_swappable_with_v
|
||||||
|
syntax keyword cppSTLbool is_invocable_v
|
||||||
|
syntax keyword cppSTLbool is_invocable_r_v
|
||||||
|
syntax keyword cppSTLbool is_nothrow_invocable_v
|
||||||
|
syntax keyword cppSTLbool is_nothrow_invocable_r_v
|
||||||
|
syntax keyword cppSTLbool is_aggregate_v
|
||||||
syntax keyword cppSTLconstant alignment_of_v
|
syntax keyword cppSTLconstant alignment_of_v
|
||||||
syntax keyword cppSTLconstant rank_v
|
syntax keyword cppSTLconstant rank_v
|
||||||
syntax keyword cppSTLconstant extent_v
|
syntax keyword cppSTLconstant extent_v
|
||||||
@@ -1888,6 +1932,19 @@ if !exists("cpp_no_cpp17")
|
|||||||
syntax keyword cppSTLtype conjunction
|
syntax keyword cppSTLtype conjunction
|
||||||
syntax keyword cppSTLtype disjunction
|
syntax keyword cppSTLtype disjunction
|
||||||
syntax keyword cppSTLtype negation
|
syntax keyword cppSTLtype negation
|
||||||
|
syntax keyword cppSTLtype void_t
|
||||||
|
syntax keyword cppSTLtype has_unique_object_representations
|
||||||
|
syntax keyword cppSTLtype is_swappable
|
||||||
|
syntax keyword cppSTLtype is_swappable_with
|
||||||
|
syntax keyword cppSTLtype is_nothrow_swappable
|
||||||
|
syntax keyword cppSTLtype is_nothrow_swappable_with
|
||||||
|
syntax keyword cppSTLtype is_invocable
|
||||||
|
syntax keyword cppSTLtype is_invocable_r
|
||||||
|
syntax keyword cppSTLtype is_nothrow_invocable
|
||||||
|
syntax keyword cppSTLtype is_nothrow_invocable_r
|
||||||
|
syntax keyword cppSTLtype invoke_result
|
||||||
|
syntax keyword cppSTLtype invoke_result_t
|
||||||
|
syntax keyword cppSTLtype is_aggregate
|
||||||
|
|
||||||
" unordered_map, unordered_set, unordered_multimap, unordered_multiset
|
" unordered_map, unordered_set, unordered_multimap, unordered_multiset
|
||||||
syntax keyword cppSTLtype node_type
|
syntax keyword cppSTLtype node_type
|
||||||
@@ -1921,6 +1978,12 @@ if !exists("cpp_no_cpp17")
|
|||||||
endif " C++17
|
endif " C++17
|
||||||
|
|
||||||
|
|
||||||
|
if !exists("cpp_no_cpp20")
|
||||||
|
" type_traits
|
||||||
|
syntax keyword cppSTLtype remove_cvref remove_cvref_t
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight
|
if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight
|
||||||
syntax keyword cppStatement concept
|
syntax keyword cppStatement concept
|
||||||
syntax keyword cppStorageClass requires
|
syntax keyword cppStorageClass requires
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
|||||||
" and generic Flow type annotations (http://flowtype.org/).
|
" and generic Flow type annotations (http://flowtype.org/).
|
||||||
syn region jsxRegion
|
syn region jsxRegion
|
||||||
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
||||||
\ skip=+<!--\_.\{-}-->+
|
\ skip=+<!--\_.\{-}-->+
|
||||||
\ end=+</\z1\_\s\{-}>+
|
\ end=+</\z1\_\s\{-}>+
|
||||||
\ end=+/>+
|
\ end=+/>+
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ syn match yamlBlock "[\[\]\{\}\|\>]"
|
|||||||
syn region yamlComment start="\#" end="$"
|
syn region yamlComment start="\#" end="$"
|
||||||
syn match yamlIndicator "#YAML:\S\+"
|
syn match yamlIndicator "#YAML:\S\+"
|
||||||
|
|
||||||
syn region yamlString start="'" end="'" skip="\\'"
|
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)'" end="'" skip="\\'"
|
||||||
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
||||||
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
||||||
syn match yamlEscape "\\\o\o\=\o\=" contained
|
syn match yamlEscape "\\\o\o\=\o\=" contained
|
||||||
|
|||||||
625
autoload/LaTeXtoUnicode.vim
Normal file
625
autoload/LaTeXtoUnicode.vim
Normal file
@@ -0,0 +1,625 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Support for LaTex-to-Unicode conversion as in the Julia REPL "
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
function! s:L2U_Setup()
|
||||||
|
|
||||||
|
call s:L2U_SetupGlobal()
|
||||||
|
|
||||||
|
" Keep track of whether LaTeX-to-Unicode is activated
|
||||||
|
" (used when filetype changes)
|
||||||
|
if !has_key(b:, "l2u_enabled")
|
||||||
|
let b:l2u_enabled = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Did we install the L2U tab mappings?
|
||||||
|
if !has_key(b:, "l2u_tab_set")
|
||||||
|
let b:l2u_tab_set = 0
|
||||||
|
endif
|
||||||
|
if !has_key(b:, "l2u_cmdtab_set")
|
||||||
|
let b:l2u_cmdtab_set = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Did we activate the L2U as-you-type substitutions?
|
||||||
|
if !has_key(b:, "l2u_autosub_set")
|
||||||
|
let b:l2u_autosub_set = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Following are some flags used to pass information between the function which
|
||||||
|
" attempts the LaTeX-to-Unicode completion and the fallback function
|
||||||
|
|
||||||
|
" Was a (possibly partial) completion found?
|
||||||
|
let b:l2u_found_completion = 0
|
||||||
|
" Is the cursor just after a single backslash
|
||||||
|
let b:l2u_singlebslash = 0
|
||||||
|
" Backup value of the completeopt settings
|
||||||
|
" (since we temporarily add the 'longest' setting while
|
||||||
|
" attempting LaTeX-to-Unicode)
|
||||||
|
let b:l2u_backup_commpleteopt = &completeopt
|
||||||
|
" Are we in the middle of a L2U tab completion?
|
||||||
|
let b:l2u_tab_completing = 0
|
||||||
|
" Are we calling the tab fallback?
|
||||||
|
let b:l2u_in_fallback = 0
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:L2U_SetupGlobal()
|
||||||
|
|
||||||
|
" Initialization of global and script-local variables
|
||||||
|
" is only performed once
|
||||||
|
if get(g:, "l2u_did_global_setup", 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:l2u_did_global_setup = 1
|
||||||
|
|
||||||
|
let g:l2u_symbols_dict = julia_latex_symbols#get_dict()
|
||||||
|
|
||||||
|
call s:L2U_deprecated_options()
|
||||||
|
|
||||||
|
if v:version < 704
|
||||||
|
let g:latex_to_unicode_tab = 0
|
||||||
|
let g:latex_to_unicode_auto = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" YouCompleteMe and neocomplcache/neocomplete/deoplete plug-ins do not work well
|
||||||
|
" with LaTeX symbols suggestions
|
||||||
|
if exists("g:loaded_youcompleteme") ||
|
||||||
|
\ exists("g:loaded_neocomplcache") ||
|
||||||
|
\ exists("g:loaded_neocomplete") ||
|
||||||
|
\ exists("g:loaded_deoplete")
|
||||||
|
let g:latex_to_unicode_suggestions = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" A hack to forcibly get out of completion mode: feed
|
||||||
|
" this string with feedkeys()
|
||||||
|
if has("win32") || has("win64")
|
||||||
|
if has("gui_running")
|
||||||
|
let s:l2u_esc_sequence = "\u0006"
|
||||||
|
else
|
||||||
|
let s:l2u_esc_sequence = "\u0006\b"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let s:l2u_esc_sequence = "\u0091\b"
|
||||||
|
end
|
||||||
|
|
||||||
|
" Trigger for the previous mapping of <Tab>
|
||||||
|
let s:l2u_fallback_trigger = "\u0091L2UFallbackTab"
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Each time the filetype changes, we may need to enable or
|
||||||
|
" disable the LaTeX-to-Unicode functionality
|
||||||
|
function! LaTeXtoUnicode#Refresh()
|
||||||
|
|
||||||
|
call s:L2U_Setup()
|
||||||
|
|
||||||
|
" by default, LaTeX-to-Unicode is only active on julia files
|
||||||
|
let file_types = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types", "julia"))
|
||||||
|
let file_types_blacklist = s:L2U_file_type_regex(get(g:, "latex_to_unicode_file_types_blacklist", "$^"))
|
||||||
|
|
||||||
|
if match(&filetype, file_types) < 0 || match(&filetype, file_types_blacklist) >= 0
|
||||||
|
if b:l2u_enabled
|
||||||
|
call LaTeXtoUnicode#Disable()
|
||||||
|
else
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
elseif !b:l2u_enabled
|
||||||
|
call LaTeXtoUnicode#Enable()
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LaTeXtoUnicode#Enable()
|
||||||
|
|
||||||
|
if b:l2u_enabled
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
call s:L2U_ResetLastCompletionInfo()
|
||||||
|
|
||||||
|
let b:l2u_enabled = 1
|
||||||
|
|
||||||
|
" If we're editing the first file upon opening vim, this will only init the
|
||||||
|
" command line mode mapping, and the full initialization will be performed by
|
||||||
|
" the autocmd triggered by InsertEnter, defined in /ftdetect.vim.
|
||||||
|
" Otherwise, if we're opening a file from within a running vim session, this
|
||||||
|
" will actually initialize all the LaTeX-to-Unicode substitutions.
|
||||||
|
call LaTeXtoUnicode#Init()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LaTeXtoUnicode#Disable()
|
||||||
|
if !b:l2u_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let b:l2u_enabled = 0
|
||||||
|
call LaTeXtoUnicode#Init()
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Translate old options to their new equivalents
|
||||||
|
function! s:L2U_deprecated_options()
|
||||||
|
for [new, old] in [["latex_to_unicode_tab", "julia_latex_to_unicode"],
|
||||||
|
\ ["latex_to_unicode_auto", "julia_auto_latex_to_unicode"],
|
||||||
|
\ ["latex_to_unicode_suggestions", "julia_latex_suggestions_enabled"],
|
||||||
|
\ ["latex_to_unicode_eager", "julia_latex_to_unicode_eager"]]
|
||||||
|
if !has_key(g:, new) && has_key(g:, old)
|
||||||
|
exec "let g:" . new . " = g:" . old
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:L2U_file_type_regex(ft)
|
||||||
|
if type(a:ft) == 3
|
||||||
|
let file_types = "\\%(" . join(a:ft, "\\|") . "\\)"
|
||||||
|
elseif type(a:ft) == 1
|
||||||
|
let file_types = a:ft
|
||||||
|
else
|
||||||
|
echoerr "invalid file_type specification"
|
||||||
|
endif
|
||||||
|
return "^" . file_types . "$"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Some data used to keep track of the previous completion attempt.
|
||||||
|
" Used to detect
|
||||||
|
" 1) if we just attempted the same completion, or
|
||||||
|
" 2) if backspace was just pressed while completing
|
||||||
|
" This function initializes and resets the required info
|
||||||
|
|
||||||
|
function! s:L2U_ResetLastCompletionInfo()
|
||||||
|
let b:l2u_completed_once = 0
|
||||||
|
let b:l2u_bs_while_completing = 0
|
||||||
|
let b:l2u_last_compl = {
|
||||||
|
\ 'line': '',
|
||||||
|
\ 'col0': -1,
|
||||||
|
\ 'col1': -1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" This function only detects whether an exact match is found for a LaTeX
|
||||||
|
" symbol in front of the cursor
|
||||||
|
function! s:L2U_ismatch()
|
||||||
|
let col1 = col('.')
|
||||||
|
let l = getline('.')
|
||||||
|
let col0 = match(l[0:col1-2], '\\[^[:space:]\\]\+$')
|
||||||
|
if col0 == -1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let base = l[col0 : col1-1]
|
||||||
|
return has_key(g:l2u_symbols_dict, base)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Helper function to sort suggestion entries
|
||||||
|
function! s:L2U_partmatches_sort(p1, p2)
|
||||||
|
return a:p1.word > a:p2.word ? 1 : a:p1.word < a:p2.word ? -1 : 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Helper function to fix display of Unicode compose characters
|
||||||
|
" in the suggestions menu (they are displayed on top of '◌')
|
||||||
|
function! s:L2U_fix_compose_chars(uni)
|
||||||
|
let u = matchstr(a:uni, '^.')
|
||||||
|
let isc = ("\u0300" <= u && u <= "\u036F") ||
|
||||||
|
\ ("\u1DC0" <= u && u <= "\u1DFF") ||
|
||||||
|
\ ("\u20D0" <= u && u <= "\u20FF") ||
|
||||||
|
\ ("\uFE20" <= u && u <= "\uFE2F")
|
||||||
|
return isc ? "\u25CC" . a:uni : a:uni
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Helper function to find the longest common prefix among
|
||||||
|
" partial completion matches (used when suggestions are disabled
|
||||||
|
" and in command line mode)
|
||||||
|
function! s:L2U_longest_common_prefix(partmatches)
|
||||||
|
let common = a:partmatches[0]
|
||||||
|
for i in range(1, len(a:partmatches)-1)
|
||||||
|
let p = a:partmatches[i]
|
||||||
|
if len(p) < len(common)
|
||||||
|
let common = common[0 : len(p)-1]
|
||||||
|
endif
|
||||||
|
for j in range(1, len(common)-1)
|
||||||
|
if p[j] != common[j]
|
||||||
|
let common = common[0 : j-1]
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
return common
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Omnicompletion function. Besides the usual two-stage omnifunc behaviour,
|
||||||
|
" it has the following peculiar features:
|
||||||
|
" *) keeps track of the previous completion attempt
|
||||||
|
" *) sets some info to be used by the fallback function
|
||||||
|
" *) either returns a list of completions if a partial match is found, or a
|
||||||
|
" Unicode char if an exact match is found
|
||||||
|
" *) forces its way out of completion mode through a hack in some cases
|
||||||
|
function! LaTeXtoUnicode#omnifunc(findstart, base)
|
||||||
|
if a:findstart
|
||||||
|
" first stage
|
||||||
|
" avoid infinite loop if the fallback happens to call omnicompletion
|
||||||
|
if b:l2u_in_fallback
|
||||||
|
let b:l2u_in_fallback = 0
|
||||||
|
return -3
|
||||||
|
endif
|
||||||
|
let b:l2u_in_fallback = 0
|
||||||
|
" set info for the callback
|
||||||
|
let b:l2u_tab_completing = 1
|
||||||
|
let b:l2u_found_completion = 1
|
||||||
|
" analyse current line
|
||||||
|
let col1 = col('.')
|
||||||
|
let l = getline('.')
|
||||||
|
let col0 = match(l[0:col1-2], '\\[^[:space:]\\]\+$')
|
||||||
|
" compare with previous completion attempt
|
||||||
|
let b:l2u_bs_while_completing = 0
|
||||||
|
let b:l2u_completed_once = 0
|
||||||
|
if col0 == b:l2u_last_compl['col0']
|
||||||
|
let prevl = b:l2u_last_compl['line']
|
||||||
|
if col1 == b:l2u_last_compl['col1'] && l ==# prevl
|
||||||
|
let b:l2u_completed_once = 1
|
||||||
|
elseif col1 == b:l2u_last_compl['col1'] - 1 && l ==# prevl[0 : col1-2] . prevl[col1 : -1]
|
||||||
|
let b:l2u_bs_while_completing = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" store completion info for next attempt
|
||||||
|
let b:l2u_last_compl['col0'] = col0
|
||||||
|
let b:l2u_last_compl['col1'] = col1
|
||||||
|
let b:l2u_last_compl['line'] = l
|
||||||
|
" is the cursor right after a backslash?
|
||||||
|
let b:l2u_singlebslash = (match(l[0:col1-2], '\\$') >= 0)
|
||||||
|
" completion not found
|
||||||
|
if col0 == -1
|
||||||
|
let b:l2u_found_completion = 0
|
||||||
|
call feedkeys(s:l2u_esc_sequence, 'n')
|
||||||
|
let col0 = -2
|
||||||
|
endif
|
||||||
|
return col0
|
||||||
|
else
|
||||||
|
" read settings (eager mode is implicit when suggestions are disabled)
|
||||||
|
let suggestions = get(g:, "latex_to_unicode_suggestions", 1)
|
||||||
|
let eager = get(g:, "latex_to_unicode_eager", 1) || !suggestions
|
||||||
|
" search for matches
|
||||||
|
let partmatches = []
|
||||||
|
let exact_match = 0
|
||||||
|
for k in keys(g:l2u_symbols_dict)
|
||||||
|
if k ==# a:base
|
||||||
|
let exact_match = 1
|
||||||
|
endif
|
||||||
|
if len(k) >= len(a:base) && k[0 : len(a:base)-1] ==# a:base
|
||||||
|
let menu = s:L2U_fix_compose_chars(g:l2u_symbols_dict[k])
|
||||||
|
if suggestions
|
||||||
|
call add(partmatches, {'word': k, 'menu': menu})
|
||||||
|
else
|
||||||
|
call add(partmatches, k)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
" exact matches are replaced with Unicode
|
||||||
|
" exceptions:
|
||||||
|
" *) we reached an exact match by pressing backspace while completing
|
||||||
|
" *) the exact match is one among many, and the eager setting is
|
||||||
|
" disabled, and it's the first time this completion is attempted
|
||||||
|
if exact_match && !b:l2u_bs_while_completing && (len(partmatches) == 1 || eager || b:l2u_completed_once)
|
||||||
|
" the completion is successful: reset the last completion info...
|
||||||
|
call s:L2U_ResetLastCompletionInfo()
|
||||||
|
" ...force our way out of completion mode...
|
||||||
|
call feedkeys(s:l2u_esc_sequence, 'n')
|
||||||
|
" ...return the Unicode symbol
|
||||||
|
return [g:l2u_symbols_dict[a:base]]
|
||||||
|
endif
|
||||||
|
if !empty(partmatches)
|
||||||
|
" here, only partial matches were found; either keep just the longest
|
||||||
|
" common prefix, or pass them on
|
||||||
|
if !suggestions
|
||||||
|
let partmatches = [s:L2U_longest_common_prefix(partmatches)]
|
||||||
|
else
|
||||||
|
call sort(partmatches, "s:L2U_partmatches_sort")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if empty(partmatches)
|
||||||
|
call feedkeys(s:l2u_esc_sequence, 'n')
|
||||||
|
let b:l2u_found_completion = 0
|
||||||
|
endif
|
||||||
|
return partmatches
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LaTeXtoUnicode#PutLiteral(k)
|
||||||
|
call feedkeys(a:k, 'ni')
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function which saves the current insert-mode mapping of a key sequence `s`
|
||||||
|
" and associates it with another key sequence `k` (e.g. stores the current
|
||||||
|
" <Tab> mapping into the Fallback trigger)
|
||||||
|
function! s:L2U_SetFallbackMapping(s, k)
|
||||||
|
let mmdict = maparg(a:s, 'i', 0, 1)
|
||||||
|
if empty(mmdict)
|
||||||
|
exe 'inoremap <buffer> ' . a:k . ' ' . a:s
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let rhs = mmdict["rhs"]
|
||||||
|
if rhs =~# '^<Plug>L2U'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let pre = '<buffer>'
|
||||||
|
if mmdict["silent"]
|
||||||
|
let pre = pre . '<silent>'
|
||||||
|
endif
|
||||||
|
if mmdict["expr"]
|
||||||
|
let pre = pre . '<expr>'
|
||||||
|
endif
|
||||||
|
if mmdict["noremap"]
|
||||||
|
let cmd = 'inoremap '
|
||||||
|
else
|
||||||
|
let cmd = 'imap '
|
||||||
|
" This is a nasty hack used to prevent infinite recursion. It's not a
|
||||||
|
" general solution.
|
||||||
|
if mmdict["expr"]
|
||||||
|
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
exe cmd . pre . ' ' . a:k . ' ' . rhs
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" This is the function which is mapped to <Tab>
|
||||||
|
function! LaTeXtoUnicode#Tab()
|
||||||
|
" the <Tab> is passed through to the fallback mapping if the completion
|
||||||
|
" menu is present, and it hasn't been raised by the L2U tab, and there
|
||||||
|
" isn't an exact match before the cursor when suggestions are disabled
|
||||||
|
if pumvisible() && !b:l2u_tab_completing && (get(g:, "latex_to_unicode_suggestions", 1) || !s:L2U_ismatch())
|
||||||
|
call feedkeys(s:l2u_fallback_trigger)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
" reset the in_fallback info
|
||||||
|
let b:l2u_in_fallback = 0
|
||||||
|
" temporary change to completeopt to use the `longest` setting, which is
|
||||||
|
" probably the only one which makes sense given that the goal of the
|
||||||
|
" completion is to substitute the final string
|
||||||
|
let b:l2u_backup_commpleteopt = &completeopt
|
||||||
|
set completeopt+=longest
|
||||||
|
set completeopt-=noinsert
|
||||||
|
" invoke omnicompletion; failure to perform LaTeX-to-Unicode completion is
|
||||||
|
" handled by the CompleteDone autocommand.
|
||||||
|
return "\<C-X>\<C-O>"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" This function is called at every CompleteDone event, and is meant to handle
|
||||||
|
" the failures of LaTeX-to-Unicode completion by calling a fallback
|
||||||
|
function! LaTeXtoUnicode#FallbackCallback()
|
||||||
|
if !b:l2u_tab_completing
|
||||||
|
" completion was not initiated by L2U, nothing to do
|
||||||
|
return
|
||||||
|
else
|
||||||
|
" completion was initiated by L2U, restore completeopt
|
||||||
|
let &completeopt = b:l2u_backup_commpleteopt
|
||||||
|
endif
|
||||||
|
" at this point L2U tab completion is over
|
||||||
|
let b:l2u_tab_completing = 0
|
||||||
|
" if the completion was successful do nothing
|
||||||
|
if b:l2u_found_completion == 1 || b:l2u_singlebslash == 1
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" fallback
|
||||||
|
let b:l2u_in_fallback = 1
|
||||||
|
call feedkeys(s:l2u_fallback_trigger)
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" This is the function which is mapped to <S-Tab> in command-line mode
|
||||||
|
function! LaTeXtoUnicode#CmdTab()
|
||||||
|
" first stage
|
||||||
|
" analyse command line
|
||||||
|
let col1 = getcmdpos() - 1
|
||||||
|
let l = getcmdline()
|
||||||
|
let col0 = match(l[0:col1-1], '\\[^[:space:]\\]\+$')
|
||||||
|
let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)
|
||||||
|
" completion not found
|
||||||
|
if col0 == -1
|
||||||
|
return l
|
||||||
|
endif
|
||||||
|
let base = l[col0 : col1-1]
|
||||||
|
" search for matches
|
||||||
|
let partmatches = []
|
||||||
|
let exact_match = 0
|
||||||
|
for k in keys(g:l2u_symbols_dict)
|
||||||
|
if k ==# base
|
||||||
|
let exact_match = 1
|
||||||
|
endif
|
||||||
|
if len(k) >= len(base) && k[0 : len(base)-1] ==# base
|
||||||
|
call add(partmatches, k)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if len(partmatches) == 0
|
||||||
|
return l
|
||||||
|
endif
|
||||||
|
" exact matches are replaced with Unicode
|
||||||
|
if exact_match
|
||||||
|
let unicode = g:l2u_symbols_dict[base]
|
||||||
|
if col0 > 0
|
||||||
|
let pre = l[0 : col0 - 1]
|
||||||
|
else
|
||||||
|
let pre = ''
|
||||||
|
endif
|
||||||
|
let posdiff = col1-col0 - len(unicode)
|
||||||
|
call setcmdpos(col1 - posdiff + 1)
|
||||||
|
return pre . unicode . l[col1 : -1]
|
||||||
|
endif
|
||||||
|
" no exact match: complete with the longest common prefix
|
||||||
|
let common = s:L2U_longest_common_prefix(partmatches)
|
||||||
|
if col0 > 0
|
||||||
|
let pre = l[0 : col0 - 1]
|
||||||
|
else
|
||||||
|
let pre = ''
|
||||||
|
endif
|
||||||
|
let posdiff = col1-col0 - len(common)
|
||||||
|
call setcmdpos(col1 - posdiff + 1)
|
||||||
|
return pre . common . l[col1 : -1]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Setup the L2U tab mapping
|
||||||
|
function! s:L2U_SetTab(wait_insert_enter)
|
||||||
|
if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled
|
||||||
|
cmap <buffer> <S-Tab> <Plug>L2UCmdTab
|
||||||
|
cnoremap <buffer> <Plug>L2UCmdTab <C-\>eLaTeXtoUnicode#CmdTab()<CR>
|
||||||
|
let b:l2u_cmdtab_set = 1
|
||||||
|
endif
|
||||||
|
if b:l2u_tab_set
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" g:did_insert_enter is set from an autocommand in ftdetect
|
||||||
|
if a:wait_insert_enter && !get(g:, "did_insert_enter", 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if !get(g:, "latex_to_unicode_tab", 1) || !b:l2u_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Backup the previous omnifunc (the check is probably not really needed)
|
||||||
|
if get(b:, "prev_omnifunc", "") != "LaTeXtoUnicode#omnifunc"
|
||||||
|
let b:prev_omnifunc = &omnifunc
|
||||||
|
endif
|
||||||
|
setlocal omnifunc=LaTeXtoUnicode#omnifunc
|
||||||
|
|
||||||
|
call s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
|
||||||
|
imap <buffer> <Tab> <Plug>L2UTab
|
||||||
|
inoremap <buffer><expr> <Plug>L2UTab LaTeXtoUnicode#Tab()
|
||||||
|
|
||||||
|
augroup L2UTab
|
||||||
|
autocmd! * <buffer>
|
||||||
|
" Every time a completion finishes, the fallback may be invoked
|
||||||
|
autocmd CompleteDone <buffer> call LaTeXtoUnicode#FallbackCallback()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
let b:l2u_tab_set = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Revert the LaTeX-to-Unicode tab mapping settings
|
||||||
|
function! s:L2U_UnsetTab()
|
||||||
|
if b:l2u_cmdtab_set
|
||||||
|
cunmap <buffer> <S-Tab>
|
||||||
|
let b:l2u_cmdtab_set = 0
|
||||||
|
endif
|
||||||
|
if !b:l2u_tab_set
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
exec "setlocal omnifunc=" . get(b:, "prev_omnifunc", "")
|
||||||
|
iunmap <buffer> <Tab>
|
||||||
|
if empty(maparg("<Tab>", "i"))
|
||||||
|
call s:L2U_SetFallbackMapping(s:l2u_fallback_trigger, '<Tab>')
|
||||||
|
endif
|
||||||
|
iunmap <buffer> <Plug>L2UTab
|
||||||
|
exe 'iunmap <buffer> ' . s:l2u_fallback_trigger
|
||||||
|
augroup L2UTab
|
||||||
|
autocmd! * <buffer>
|
||||||
|
augroup END
|
||||||
|
let b:l2u_tab_set = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function which looks for viable LaTeX-to-Unicode supstitutions as you type
|
||||||
|
function! LaTeXtoUnicode#AutoSub(...)
|
||||||
|
let vc = a:0 == 0 ? v:char : a:1
|
||||||
|
let col1 = col('.')
|
||||||
|
let lnum = line('.')
|
||||||
|
if col1 == 1
|
||||||
|
if a:0 > 1
|
||||||
|
call feedkeys(a:2, 'n')
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
let bs = (vc != "\n")
|
||||||
|
let l = getline(lnum)[0 : col1-1-bs] . v:char
|
||||||
|
let col0 = match(l, '\\\%([_^]\?[A-Za-z]\+\%' . col1 . 'c\%([^A-Za-z]\|$\)\|[_^]\%([0-9()=+-]\)\%' . col1 .'c\%(.\|$\)\)')
|
||||||
|
if col0 == -1
|
||||||
|
if a:0 > 1
|
||||||
|
call feedkeys(a:2, 'n')
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
let base = l[col0 : -1-bs]
|
||||||
|
let unicode = get(g:l2u_symbols_dict, base, '')
|
||||||
|
if empty(unicode)
|
||||||
|
if a:0 > 1
|
||||||
|
call feedkeys(a:2, 'n')
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
call feedkeys("\<C-G>u", 'n')
|
||||||
|
call feedkeys(repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence, 'nt')
|
||||||
|
call feedkeys("\<C-G>u", 'n')
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Setup the auto as-you-type LaTeX-to-Unicode substitution
|
||||||
|
function! s:L2U_SetAutoSub(wait_insert_enter)
|
||||||
|
if b:l2u_autosub_set
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" g:did_insert_enter is set from an autocommand in ftdetect
|
||||||
|
if a:wait_insert_enter && !get(g:, "did_insert_enter", 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if !get(g:, "latex_to_unicode_auto", 0) || !b:l2u_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" Viable substitutions are searched at every character insertion via the
|
||||||
|
" autocmd InsertCharPre. The <Enter> key does not seem to be catched in
|
||||||
|
" this way though, so we use a mapping for that case.
|
||||||
|
imap <buffer> <CR> <Plug>L2UAutoSub
|
||||||
|
inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "\<CR>")
|
||||||
|
|
||||||
|
augroup L2UAutoSub
|
||||||
|
autocmd! * <buffer>
|
||||||
|
autocmd InsertCharPre <buffer> call LaTeXtoUnicode#AutoSub()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
let b:l2u_autosub_set = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Revert the auto LaTeX-to-Unicode settings
|
||||||
|
function! s:L2U_UnsetAutoSub()
|
||||||
|
if !b:l2u_autosub_set
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
iunmap <buffer> <CR>
|
||||||
|
iunmap <buffer> <Plug>L2UAutoSub
|
||||||
|
augroup L2UAutoSub
|
||||||
|
autocmd! * <buffer>
|
||||||
|
augroup END
|
||||||
|
let b:l2u_autosub_set = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Initialization. Can be used to re-init when global settings have changed.
|
||||||
|
function! LaTeXtoUnicode#Init(...)
|
||||||
|
let wait_insert_enter = a:0 > 0 ? a:1 : 1
|
||||||
|
|
||||||
|
if !wait_insert_enter
|
||||||
|
augroup L2UInit
|
||||||
|
autocmd!
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:L2U_UnsetTab()
|
||||||
|
call s:L2U_UnsetAutoSub()
|
||||||
|
|
||||||
|
call s:L2U_SetTab(wait_insert_enter)
|
||||||
|
call s:L2U_SetAutoSub(wait_insert_enter)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LaTeXtoUnicode#Toggle()
|
||||||
|
call s:L2U_Setup()
|
||||||
|
if b:l2u_enabled
|
||||||
|
call LaTeXtoUnicode#Disable()
|
||||||
|
echo "LaTeX-to-Unicode disabled"
|
||||||
|
else
|
||||||
|
call LaTeXtoUnicode#Enable()
|
||||||
|
echo "LaTeX-to-Unicode enabled"
|
||||||
|
endif
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
89
autoload/cargo.vim
Normal file
89
autoload/cargo.vim
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
|
function! cargo#cmd(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo ". a:args
|
||||||
|
else
|
||||||
|
echom "Missing arguments"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#build(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo build " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo build"
|
||||||
|
endif
|
||||||
|
silent! clear
|
||||||
|
execute "!" . "cargo build"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#clean(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo clean " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo clean"
|
||||||
|
endif
|
||||||
|
silent! clear
|
||||||
|
execute "!" . "cargo clean"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#doc(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo doc " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo doc"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#new(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!cargo new " . a:args
|
||||||
|
:cd `=a:args`
|
||||||
|
else
|
||||||
|
echom "Missing arguments"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#init(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo init " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo init"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#run(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo run " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo run"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#test(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo test " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo test"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#bench(args)
|
||||||
|
silent! clear
|
||||||
|
if !a:args
|
||||||
|
execute "!" . "cargo bench " . a:args
|
||||||
|
else
|
||||||
|
execute "!" . "cargo bench"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -3,11 +3,21 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
let s:V = vital#of('crystal')
|
let s:V = vital#crystal#new()
|
||||||
let s:P = s:V.import('Process')
|
let s:P = s:V.import('Process')
|
||||||
let s:J = s:V.import('Web.JSON')
|
|
||||||
let s:C = s:V.import('ColorEcho')
|
let s:C = s:V.import('ColorEcho')
|
||||||
|
|
||||||
|
if exists('*json_decode')
|
||||||
|
function! s:decode_json(text) abort
|
||||||
|
return json_decode(a:text)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
let s:J = s:V.import('Web.JSON')
|
||||||
|
function! s:decode_json(text) abort
|
||||||
|
return s:J.decode(a:text)
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:echo_error(msg, ...) abort
|
function! s:echo_error(msg, ...) abort
|
||||||
echohl ErrorMsg
|
echohl ErrorMsg
|
||||||
if a:0 == 0
|
if a:0 == 0
|
||||||
@@ -102,7 +112,7 @@ function! crystal_lang#jump_to_definition(file, pos) abort
|
|||||||
return s:echo_error(cmd_result.output)
|
return s:echo_error(cmd_result.output)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let impl = s:J.decode(cmd_result.output)
|
let impl = s:decode_json(cmd_result.output)
|
||||||
if impl.status !=# 'ok'
|
if impl.status !=# 'ok'
|
||||||
return s:echo_error(impl.message)
|
return s:echo_error(impl.message)
|
||||||
endif
|
endif
|
||||||
@@ -149,7 +159,6 @@ endfunction
|
|||||||
|
|
||||||
function! crystal_lang#complete(findstart, base) abort
|
function! crystal_lang#complete(findstart, base) abort
|
||||||
if a:findstart
|
if a:findstart
|
||||||
echom 'find start'
|
|
||||||
return s:find_completion_start()
|
return s:find_completion_start()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -158,7 +167,7 @@ function! crystal_lang#complete(findstart, base) abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let contexts = s:J.decode(cmd_result.output)
|
let contexts = s:decode_json(cmd_result.output)
|
||||||
if contexts.status !=# 'ok'
|
if contexts.status !=# 'ok'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -271,59 +280,34 @@ function! crystal_lang#format_string(code, ...) abort
|
|||||||
return output
|
return output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_saved_states() abort
|
" crystal_lang#format(option_str [, on_save])
|
||||||
let result = {}
|
function! crystal_lang#format(option_str, ...) abort
|
||||||
let fname = bufname('%')
|
|
||||||
let current_winnr = winnr()
|
|
||||||
for i in range(1, winnr('$'))
|
|
||||||
let bufnr = winbufnr(i)
|
|
||||||
if bufnr == -1
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if bufname(bufnr) ==# fname
|
|
||||||
execute i 'wincmd w'
|
|
||||||
let result[i] = {
|
|
||||||
\ 'pos': getpos('.'),
|
|
||||||
\ 'screen': winsaveview()
|
|
||||||
\ }
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
execute current_winnr 'wincmd w'
|
|
||||||
return result
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! crystal_lang#format(option_str) abort
|
|
||||||
if !executable(g:crystal_compiler_command)
|
if !executable(g:crystal_compiler_command)
|
||||||
" Finish command silently
|
" Finish command silently
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let formatted = crystal_lang#format_string(join(getline(1, '$'), "\n"), a:option_str)
|
let on_save = a:0 > 0 ? a:1 : 0
|
||||||
let formatted = substitute(formatted, '\n$', '', '')
|
|
||||||
|
|
||||||
let sel_save = &l:selection
|
let before = join(getline(1, '$'), "\n")
|
||||||
let ve_save = &virtualedit
|
let formatted = crystal_lang#format_string(before, a:option_str)
|
||||||
let &l:selection = 'inclusive'
|
if !on_save
|
||||||
let &virtualedit = ''
|
let after = substitute(formatted, '\n$', '', '')
|
||||||
let [save_g_reg, save_g_regtype] = [getreg('g'), getregtype('g')]
|
if before ==# after
|
||||||
let windows_save = s:get_saved_states()
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
try
|
let view_save = winsaveview()
|
||||||
call setreg('g', formatted, 'v')
|
let pos_save = getpos('.')
|
||||||
silent normal! gg0vG$"gp
|
let lines = split(formatted, '\n')
|
||||||
finally
|
silent! undojoin
|
||||||
call setreg('g', save_g_reg, save_g_regtype)
|
if line('$') > len(lines)
|
||||||
let &l:selection = sel_save
|
execute len(lines) . ',$delete' '_'
|
||||||
let &virtualedit = ve_save
|
endif
|
||||||
let winnr = winnr()
|
call setline(1, lines)
|
||||||
for winnr in keys(windows_save)
|
call winrestview(view_save)
|
||||||
let w = windows_save[winnr]
|
call setpos('.', pos_save)
|
||||||
execute winnr 'wincmd w'
|
|
||||||
call setpos('.', w.pos)
|
|
||||||
call winrestview(w.screen)
|
|
||||||
endfor
|
|
||||||
execute winnr 'wincmd w'
|
|
||||||
endtry
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
|||||||
@@ -152,4 +152,13 @@ function! s:DotPackagesFile() abort
|
|||||||
return [v:false, '']
|
return [v:false, '']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Prevent writes to files in the pub cache.
|
||||||
|
function! dart#setModifiable() abort
|
||||||
|
let full_path = expand('%:p')
|
||||||
|
if full_path =~# '.pub-cache' ||
|
||||||
|
\ full_path =~# 'Pub\Cache'
|
||||||
|
setlocal nomodifiable
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -18,11 +18,15 @@ function! elixir#indent#indent(lnum)
|
|||||||
call s:debug("==> Indenting line " . lnum)
|
call s:debug("==> Indenting line " . lnum)
|
||||||
call s:debug("text = '" . text . "'")
|
call s:debug("text = '" . text . "'")
|
||||||
|
|
||||||
|
let [_, curs_lnum, curs_col, _] = getpos('.')
|
||||||
|
call cursor(lnum, 0)
|
||||||
|
|
||||||
let handlers = [
|
let handlers = [
|
||||||
\'top_of_file',
|
\'top_of_file',
|
||||||
\'starts_with_end',
|
\'starts_with_end',
|
||||||
\'starts_with_mid_or_end_block_keyword',
|
\'starts_with_mid_or_end_block_keyword',
|
||||||
\'following_trailing_do',
|
\'following_trailing_do',
|
||||||
|
\'following_trailing_rocket',
|
||||||
\'following_trailing_binary_operator',
|
\'following_trailing_binary_operator',
|
||||||
\'starts_with_pipe',
|
\'starts_with_pipe',
|
||||||
\'starts_with_close_bracket',
|
\'starts_with_close_bracket',
|
||||||
@@ -37,11 +41,13 @@ function! elixir#indent#indent(lnum)
|
|||||||
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
|
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
if indent != -1
|
if indent != -1
|
||||||
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
||||||
|
call cursor(curs_lnum, curs_col)
|
||||||
return indent
|
return indent
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call s:debug("defaulting")
|
call s:debug("defaulting")
|
||||||
|
call cursor(curs_lnum, curs_col)
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -166,7 +172,7 @@ function! s:get_base_indent(lnum, text)
|
|||||||
elseif s:ends_with(a:text, data_structure_close, a:lnum)
|
elseif s:ends_with(a:text, data_structure_close, a:lnum)
|
||||||
let data_structure_open = '\%(\[\|{\|(\)'
|
let data_structure_open = '\%(\[\|{\|(\)'
|
||||||
let close_match_idx = match(a:text, data_structure_close . '\s*$')
|
let close_match_idx = match(a:text, data_structure_close . '\s*$')
|
||||||
let _move = cursor(a:lnum, close_match_idx + 1)
|
call cursor(a:lnum, close_match_idx + 1)
|
||||||
let [open_match_lnum, open_match_col] = searchpairpos(data_structure_open, '', data_structure_close, 'bnW')
|
let [open_match_lnum, open_match_col] = searchpairpos(data_structure_open, '', data_structure_close, 'bnW')
|
||||||
let open_match_text = getline(open_match_lnum)
|
let open_match_text = getline(open_match_lnum)
|
||||||
return s:get_base_indent(open_match_lnum, open_match_text)
|
return s:get_base_indent(open_match_lnum, open_match_text)
|
||||||
@@ -175,7 +181,6 @@ function! s:get_base_indent(lnum, text)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" TODO: @jbodah 2017-03-31: remove
|
|
||||||
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
if s:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)
|
if s:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)
|
||||||
if s:starts_with(a:text, s:keyword('end'), a:lnum)
|
if s:starts_with(a:text, s:keyword('end'), a:lnum)
|
||||||
@@ -188,6 +193,14 @@ function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, p
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_following_trailing_rocket(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if s:ends_with(a:prev_nb_text, '->', a:prev_nb_lnum)
|
||||||
|
return indent(a:prev_nb_lnum) + s:sw()
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
|
||||||
|
|
||||||
function! fish#Indent()
|
function! fish#Indent()
|
||||||
|
let l:shiftwidth = shiftwidth()
|
||||||
let l:prevlnum = prevnonblank(v:lnum - 1)
|
let l:prevlnum = prevnonblank(v:lnum - 1)
|
||||||
if l:prevlnum ==# 0
|
if l:prevlnum ==# 0
|
||||||
return 0
|
return 0
|
||||||
@@ -8,15 +9,15 @@ function! fish#Indent()
|
|||||||
let l:indent = 0
|
let l:indent = 0
|
||||||
let l:prevline = getline(l:prevlnum)
|
let l:prevline = getline(l:prevlnum)
|
||||||
if l:prevline =~# '\v^\s*switch>'
|
if l:prevline =~# '\v^\s*switch>'
|
||||||
let l:indent = &shiftwidth * 2
|
let l:indent = l:shiftwidth * 2
|
||||||
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
|
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
|
||||||
let l:indent = &shiftwidth
|
let l:indent = l:shiftwidth
|
||||||
endif
|
endif
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
if l:line =~# '\v^\s*end>'
|
if l:line =~# '\v^\s*end>'
|
||||||
return indent(v:lnum) - (l:indent ==# 0 ? &shiftwidth : l:indent)
|
return indent(v:lnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent)
|
||||||
elseif l:line =~# '\v^\s*%(case|else)>'
|
elseif l:line =~# '\v^\s*%(case|else)>'
|
||||||
return indent(v:lnum) - &shiftwidth
|
return indent(v:lnum) - l:shiftwidth
|
||||||
endif
|
endif
|
||||||
return indent(l:prevlnum) + l:indent
|
return indent(l:prevlnum) + l:indent
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
188
autoload/julia.vim
Normal file
188
autoload/julia.vim
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
function! julia#set_syntax_version(jvers)
|
||||||
|
if &filetype != "julia"
|
||||||
|
echo "Not a Julia file"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
syntax clear
|
||||||
|
let b:julia_syntax_version = a:jvers
|
||||||
|
set filetype=julia
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia#toggle_deprecated_syntax()
|
||||||
|
if &filetype != "julia"
|
||||||
|
echo "Not a Julia file"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
syntax clear
|
||||||
|
let hd = get(b:, "julia_syntax_highlight_deprecated",
|
||||||
|
\ get(g:, "julia_syntax_highlight_deprecated", 0))
|
||||||
|
let b:julia_syntax_highlight_deprecated = hd ? 0 : 1
|
||||||
|
set filetype=julia
|
||||||
|
if b:julia_syntax_highlight_deprecated
|
||||||
|
echo "Highlighting of deprecated syntax enabled"
|
||||||
|
else
|
||||||
|
echo "Highlighting of deprecated syntax disabled"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists("loaded_matchit")
|
||||||
|
|
||||||
|
function! julia#toggle_function_blockassign()
|
||||||
|
let sav_pos = getcurpos()
|
||||||
|
let l = getline('.')
|
||||||
|
let c = match(l, '\C\m\<function\s\+.\+(')
|
||||||
|
if c != -1
|
||||||
|
return julia#function_block2assign()
|
||||||
|
endif
|
||||||
|
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*=\s*')
|
||||||
|
if c == -1
|
||||||
|
echohl WarningMsg | echo "Not on a function definition or assignment line" | echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
return julia#function_assign2block()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia#function_block2assign()
|
||||||
|
let sav_pos = getcurpos()
|
||||||
|
let l = getline('.')
|
||||||
|
let c = match(l, '\C\m\<function\s\+.\+(')
|
||||||
|
if c == -1
|
||||||
|
echohl WarningMsg | echo "Not on a function definition line" | echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let fpos = copy(sav_pos)
|
||||||
|
let fpos[2] = c+1
|
||||||
|
call setpos('.', fpos)
|
||||||
|
normal %
|
||||||
|
if line('.') != fpos[1]+2 || match(getline('.'), '\C\m^\s*end\s*$') == -1
|
||||||
|
echohl WarningMsg | echo "Only works with 3-lines functions" | echohl None
|
||||||
|
call setpos('.', sav_pos)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call setpos('.', fpos)
|
||||||
|
normal! f(
|
||||||
|
normal %
|
||||||
|
while line('.') == fpos[1] && match(l[col('.')-1:], '\C\m)(') == 0
|
||||||
|
normal! l
|
||||||
|
normal %
|
||||||
|
endwhile
|
||||||
|
if line('.') != fpos[1] || match(l[(col('.')-1):], '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*$') != 0
|
||||||
|
echohl WarningMsg | echo "Unrecognized function definition format" | echohl None
|
||||||
|
call setpos('.', sav_pos)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setpos('.', fpos)
|
||||||
|
normal! dwA = J
|
||||||
|
if match(getline('.')[(col('.')-1):], '\C\mreturn\>') == 0
|
||||||
|
normal! dw
|
||||||
|
endif
|
||||||
|
if match(getline('.')[(col('.')-1):], '\C\m\s*$') == 0
|
||||||
|
normal! F=C= nothing
|
||||||
|
endif
|
||||||
|
normal! jddk^
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia#function_assign2block()
|
||||||
|
let sav_pos = getcurpos()
|
||||||
|
let l = getline('.')
|
||||||
|
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*=\s*')
|
||||||
|
if c == -1
|
||||||
|
echohl WarningMsg | echo "Not on a function assignment-definition line" | echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
normal ^
|
||||||
|
while match(l[(col('.')-1):], '\%(\S\+\.\)*@') == 0
|
||||||
|
normal! W
|
||||||
|
endwhile
|
||||||
|
normal! ifunction
|
||||||
|
let l = getline('.')
|
||||||
|
let c = match(l, '\C\m)\%(::\S\+\)\?\%(\s\+where\s\+.*\)\?\s*\zs=\s*')
|
||||||
|
let eqpos = copy(sav_pos)
|
||||||
|
let eqpos[2] = c+1
|
||||||
|
call setpos('.', eqpos)
|
||||||
|
normal! cw
|
||||||
|
oend
|
||||||
|
normal %
|
||||||
|
s/\s*$// | noh
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" .
|
||||||
|
\ "\"#$'(,.:;=?@`\\U5B{" .
|
||||||
|
\ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF"
|
||||||
|
|
||||||
|
let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars
|
||||||
|
|
||||||
|
" the following excludes '!' since it can be used as an identifier,
|
||||||
|
" and '$' since it can be used in interpolations
|
||||||
|
" note that \U2D is '-'
|
||||||
|
let s:uniop_chars = "+\\U2D~¬√∛∜"
|
||||||
|
|
||||||
|
let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆⊈⊂⊄⊊←→∋∌⊕⊖⊞⊟∘∧⊗⊘↑↓∨⊠±"
|
||||||
|
|
||||||
|
" the following is a list of all remainig valid operator chars,
|
||||||
|
" but it's more efficient when expressed with ranges (see below)
|
||||||
|
" let s:binop_chars_extra = "↔↚↛↠↣↦↮⇎⇏⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←→" .
|
||||||
|
" \ "∝∊∍∥∦∷∺∻∽∾≁≃≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣" .
|
||||||
|
" \ "⊔∓∔∸≂≏⊎⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣" .
|
||||||
|
" \ "⊙⊚⊛⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗" .
|
||||||
|
" \ "⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯↑↓"
|
||||||
|
|
||||||
|
" same as above, but with character ranges, for performance
|
||||||
|
let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\U221D\\U2224-\\U222A\\U2237\\U2238\\U223A\\U223B\\U223D\\U223E\\U2240-\\U228B\\U228D-\\U229C\\U229E-\\U22A3\\U22A9\\U22AC\\U22AE\\U22B0-\\U22B7\\U22BB-\\U22BD\\U22C4-\\U22C7\\U22C9-\\U22D3\\U22D5-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\U27F7\\U27F9-\\U27FF\\U2900-\\U2918\\U291D-\\U2920\\U2944-\\U2970\\U29B7\\U29B8\\U29BC\\U29BE-\\U29C1\\U29E1\\U29E3-\\U29E5\\U29F4\\U29F6\\U29F7\\U29FA\\U29FB\\U2A07\\U2A08\\U2A1D\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC"
|
||||||
|
|
||||||
|
" a Julia identifier, sort of
|
||||||
|
let s:idregex = '[^' . s:nonidS_chars . '0-9!' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*'
|
||||||
|
|
||||||
|
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
|
||||||
|
\ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|:>\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
|
||||||
|
\ '\|' . '[' . s:uniop_chars . '!$]' .
|
||||||
|
\ '\|' . '\.\?[' . s:binop_chars . s:binop_chars_extra . ']' .
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
|
function! julia#idundercursor()
|
||||||
|
" TODO...
|
||||||
|
let w = expand('<cword>')
|
||||||
|
" let [l,c] = [line('.'),col('.')]
|
||||||
|
" let ll = getline(l)
|
||||||
|
return w
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia#gotodefinition()
|
||||||
|
let w = julia#idundercursor()
|
||||||
|
if empty(w)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
let [l,c] = [line('.'),col('.')]
|
||||||
|
let st = map(synstack(l,c), 'synIDattr(v:val, "name")')
|
||||||
|
let n = len(st)
|
||||||
|
if n > 0 && st[-1] =~# '^julia\%(\%(Range\|Ternary\|CTrans\)\?Operator\|\%(Possible\)\?SymbolS\?\|\%(Bl\|Rep\)\?Keyword\|Conditional\|ParDelim\|Char\|Colon\|Typedef\|Number\|Float\|Const\%(Generic\|Bool\)\|ComplexUnit\|\%(Special\|\%(Octal\|Hex\)Escape\)Char\|UniChar\%(Small\|Large\)\|Comment[LM]\|Todo\|Semicolon\)$'
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let comprehension = 0
|
||||||
|
let indollar = 0
|
||||||
|
for i in range(n-1, 0, -1)
|
||||||
|
if st[i] =~# '^juliaDollar\%(Var\|Par\|SqBra\)$'
|
||||||
|
let indollar = 1
|
||||||
|
endif
|
||||||
|
if !indollar && st[i] =~# '^julia\%(\a*String\|QuotedParBlockS\?\)$'
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
if st[i] =~# '^julia\%(ParBlock\%(InRange\)\?\|SqBraBlock\|\%(Dollar\|StringVars\)\%(Par\|SqBra\)\)$'
|
||||||
|
let comprehension = 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let s1 = search('\C\<' . w . '\s*=[^=]', 'bcWzs')
|
||||||
|
|
||||||
|
return
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
798
autoload/julia_blocks.vim
Normal file
798
autoload/julia_blocks.vim
Normal file
@@ -0,0 +1,798 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" Facilities for moving around Julia blocks (e.g. if/end, function/end etc.)
|
||||||
|
" (AKA a collection of horrible hacks)
|
||||||
|
|
||||||
|
let s:default_mappings = {
|
||||||
|
\ "moveblock_n" : "]]",
|
||||||
|
\ "moveblock_N" : "][",
|
||||||
|
\ "moveblock_p" : "[[",
|
||||||
|
\ "moveblock_P" : "[]",
|
||||||
|
\
|
||||||
|
\ "move_n" : "]j",
|
||||||
|
\ "move_N" : "]J",
|
||||||
|
\ "move_p" : "[j",
|
||||||
|
\ "move_P" : "[J",
|
||||||
|
\
|
||||||
|
\ "select_a" : "aj",
|
||||||
|
\ "select_i" : "ij",
|
||||||
|
\
|
||||||
|
\ "whereami" : "",
|
||||||
|
\ }
|
||||||
|
|
||||||
|
function! s:getmapchars(function)
|
||||||
|
if exists("g:julia_blocks_mappings") && has_key(g:julia_blocks_mappings, a:function)
|
||||||
|
return s:escape(g:julia_blocks_mappings[a:function])
|
||||||
|
else
|
||||||
|
return s:escape(s:default_mappings[a:function])
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:map_move(function, toend, backwards)
|
||||||
|
let chars = s:getmapchars(a:function)
|
||||||
|
if empty(chars)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let fn = "julia_blocks#" . a:function
|
||||||
|
let lhs = "<buffer> <nowait> <silent> " . chars . " "
|
||||||
|
let cnt = ":<C-U>let b:jlblk_count=v:count1"
|
||||||
|
exe "nnoremap " . lhs . cnt
|
||||||
|
\ . " <Bar> call " . fn . "()<CR>"
|
||||||
|
exe "onoremap " . lhs . cnt
|
||||||
|
\ . "<CR><Esc>:call julia_blocks#owrapper_move(v:operator, \"" . fn . "\", " . a:toend . ", " . a:backwards . ")<CR>"
|
||||||
|
exe "xnoremap " . lhs . cnt
|
||||||
|
\ . "<CR>gv<Esc>:call julia_blocks#vwrapper_move(\"" . fn . "\")<CR>"
|
||||||
|
let b:jlblk_mapped[a:function] = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#owrapper_move(oper, function, toend, backwards)
|
||||||
|
let F = function(a:function)
|
||||||
|
|
||||||
|
let save_redraw = &lazyredraw
|
||||||
|
let save_select = &selection
|
||||||
|
|
||||||
|
let restore_cmds = "\<Esc>"
|
||||||
|
\ . ":let &l:selection = \"" . save_select . "\"\<CR>"
|
||||||
|
\ . ":let &l:lazyredraw = " . save_redraw . "\<CR>"
|
||||||
|
\ . ":\<BS>"
|
||||||
|
|
||||||
|
setlocal lazyredraw
|
||||||
|
|
||||||
|
let start_pos = getpos('.')
|
||||||
|
let b:jlblk_abort_calls_esc = 0
|
||||||
|
call F()
|
||||||
|
let b:jlblk_abort_calls_esc = 1
|
||||||
|
let end_pos = getpos('.')
|
||||||
|
if start_pos == end_pos
|
||||||
|
call feedkeys(restore_cmds, 'n')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:selection = "inclusive"
|
||||||
|
if a:backwards || !a:toend
|
||||||
|
let &l:selection = "exclusive"
|
||||||
|
endif
|
||||||
|
if a:toend && a:backwards
|
||||||
|
let end_pos[2] += 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:compare_pos(start_pos, end_pos) > 0
|
||||||
|
let [start_pos, end_pos] = [end_pos, start_pos]
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setpos("'<", start_pos)
|
||||||
|
call setpos("'>", end_pos)
|
||||||
|
|
||||||
|
" NOTE: the 'c' operator behaves differently, for mysterious reasons. We
|
||||||
|
" simulate it with 'd' followed by 'i' instead
|
||||||
|
call feedkeys("gv" . (a:oper == "c" ? "d" : a:oper) . restore_cmds . (a:oper == "c" ? "i" : ""), 'n')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#vwrapper_move(function)
|
||||||
|
let F = function(a:function)
|
||||||
|
|
||||||
|
let s = getpos('.')
|
||||||
|
let b1 = getpos("'<")
|
||||||
|
let b2 = getpos("'>")
|
||||||
|
|
||||||
|
let b = b1 == s ? b2 : b1
|
||||||
|
call setpos('.', s)
|
||||||
|
let b:jlblk_abort_calls_esc = 0
|
||||||
|
call F()
|
||||||
|
let b:jlblk_abort_calls_esc = 1
|
||||||
|
let e = getpos('.')
|
||||||
|
call setpos('.', b)
|
||||||
|
exe "normal " . visualmode()
|
||||||
|
call setpos('.', e)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:unmap(function)
|
||||||
|
if !get(b:jlblk_mapped, a:function, 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let chars = s:getmapchars(a:function)
|
||||||
|
if empty(chars)
|
||||||
|
" shouldn't happen
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let mapids = a:function =~# "^move" ? ["n", "x", "o"] :
|
||||||
|
\ a:function =~# "^select" ? ["x", "o"] :
|
||||||
|
\ ["n"]
|
||||||
|
let fn = "julia_blocks#" . a:function
|
||||||
|
let cmd = "<buffer> " . chars
|
||||||
|
for m in mapids
|
||||||
|
exe m . "unmap " . cmd
|
||||||
|
endfor
|
||||||
|
let b:jlblk_mapped[a:function] = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:escape(chars)
|
||||||
|
let c = a:chars
|
||||||
|
let c = substitute(c, '|', '<Bar>', 'g')
|
||||||
|
return c
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:map_select(function)
|
||||||
|
let chars = s:getmapchars(a:function)
|
||||||
|
if empty(chars)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let fn = "julia_blocks#" . a:function
|
||||||
|
let lhs = "<buffer> <nowait> <silent> " . chars . " "
|
||||||
|
let cnt = ":<C-U>let b:jlblk_inwrapper=1<CR>:let b:jlblk_count=max([v:prevcount,1])<CR>"
|
||||||
|
exe "onoremap " . lhs . "<Esc>" . cnt
|
||||||
|
\ . ":call julia_blocks#owrapper_select(v:operator, \"" . fn . "\")<CR>"
|
||||||
|
exe "xnoremap " . lhs . cnt
|
||||||
|
\ . ":call julia_blocks#vwrapper_select(\"" . fn . "\")<CR>"
|
||||||
|
let b:jlblk_mapped[a:function] = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#owrapper_select(oper, function) ", toend, backwards)
|
||||||
|
let F = function(a:function)
|
||||||
|
|
||||||
|
let save_redraw = &lazyredraw
|
||||||
|
let save_select = &selection
|
||||||
|
|
||||||
|
let restore_cmds = "\<Esc>"
|
||||||
|
\ . ":let &l:selection = \"" . save_select . "\"\<CR>"
|
||||||
|
\ . ":let &l:lazyredraw = " . save_redraw . "\<CR>"
|
||||||
|
\ . ":\<BS>"
|
||||||
|
|
||||||
|
setlocal lazyredraw
|
||||||
|
|
||||||
|
let b:jlblk_abort_calls_esc = 0
|
||||||
|
let retF = F()
|
||||||
|
let b:jlblk_abort_calls_esc = 1
|
||||||
|
if empty(retF)
|
||||||
|
let b:jlblk_inwrapper = 0
|
||||||
|
call feedkeys(restore_cmds, 'n')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
let [start_pos, end_pos] = retF
|
||||||
|
|
||||||
|
if start_pos == end_pos
|
||||||
|
call feedkeys(restore_cmds, 'n')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:selection = "inclusive"
|
||||||
|
|
||||||
|
call setpos("'<", start_pos)
|
||||||
|
call setpos("'>", end_pos)
|
||||||
|
|
||||||
|
let b:jlblk_inwrapper = 0
|
||||||
|
" NOTE: the 'c' operator behaves differently, for mysterious reasons. We
|
||||||
|
" simulate it with 'd' followed by 'i' instead
|
||||||
|
call feedkeys("gv" . (a:oper == "c" ? "d" : a:oper) . restore_cmds . (a:oper == "c" ? "i" : ""), 'n')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#vwrapper_select(function)
|
||||||
|
let F = function(a:function)
|
||||||
|
|
||||||
|
let b:jlblk_abort_calls_esc = 0
|
||||||
|
let retF = F()
|
||||||
|
let b:jlblk_abort_calls_esc = 1
|
||||||
|
if empty(retF)
|
||||||
|
let b:jlblk_inwrapper = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
let [start_pos, end_pos] = retF
|
||||||
|
call setpos("'<", start_pos)
|
||||||
|
call setpos("'>", end_pos)
|
||||||
|
normal! gv
|
||||||
|
let b:jlblk_inwrapper = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:map_aux(function)
|
||||||
|
let chars = s:getmapchars(a:function)
|
||||||
|
if empty(chars)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let fn = "julia_blocks#" . a:function
|
||||||
|
let lhs = "<buffer> <nowait> <silent> " . chars . " "
|
||||||
|
exe "nnoremap " . lhs . ":<C-U>echo " . fn . "()<CR>"
|
||||||
|
let b:jlblk_mapped[a:function] = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:julia_blocks_functions = {
|
||||||
|
\ "moveblock_N": [1, 0],
|
||||||
|
\ "moveblock_n": [0, 0],
|
||||||
|
\ "moveblock_p": [0, 1],
|
||||||
|
\ "moveblock_P": [1, 1],
|
||||||
|
\
|
||||||
|
\ "move_N": [1, 0],
|
||||||
|
\ "move_n": [0, 0],
|
||||||
|
\ "move_p": [0, 1],
|
||||||
|
\ "move_P": [1, 1],
|
||||||
|
\
|
||||||
|
\ "select_a": [],
|
||||||
|
\ "select_i": [],
|
||||||
|
\
|
||||||
|
\ "whereami": [],
|
||||||
|
\ }
|
||||||
|
|
||||||
|
function! julia_blocks#init_mappings()
|
||||||
|
let b:jlblk_mapped = {}
|
||||||
|
for f in keys(s:julia_blocks_functions)
|
||||||
|
if f =~# "^move"
|
||||||
|
let [te, bw] = s:julia_blocks_functions[f]
|
||||||
|
call s:map_move(f, te, bw)
|
||||||
|
elseif f =~# "^select"
|
||||||
|
call s:map_select(f)
|
||||||
|
else
|
||||||
|
call s:map_aux(f)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call julia_blocks#select_reset()
|
||||||
|
augroup JuliaBlocks
|
||||||
|
au!
|
||||||
|
au InsertEnter *.jl call julia_blocks#select_reset()
|
||||||
|
au CursorMoved *.jl call s:cursor_moved()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" we would need some autocmd event associated with exiting from
|
||||||
|
" visual mode, but there isn't any, so we resort to this crude
|
||||||
|
" hack
|
||||||
|
" ACTUALLY this creates more problems than it solves, so the crude hack
|
||||||
|
" is just disabled
|
||||||
|
"vnoremap <buffer><silent><unique> <Esc> <Esc>:call julia_blocks#select_reset()<CR>
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#remove_mappings()
|
||||||
|
if exists("b:jlblk_mapped")
|
||||||
|
for f in keys(s:julia_blocks_functions)
|
||||||
|
call s:unmap(f)
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
unlet! b:jlblk_save_pos b:jlblk_view b:jlblk_count b:jlblk_abort_calls_esc
|
||||||
|
unlet! b:jlblk_inwrapper b:jlblk_did_select b:jlblk_doing_select
|
||||||
|
unlet! b:jlblk_last_start_pos b:jlblk_last_end_pos b:jlblk_last_mode
|
||||||
|
augroup JuliaBlocks
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
augroup! JuliaBlocks
|
||||||
|
let md = maparg("<Esc>", "x", 0, 1)
|
||||||
|
if !empty(md) && md["buffer"]
|
||||||
|
vunmap <buffer> <Esc>
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:restore_view()
|
||||||
|
"redraw! " would ensure correct behaviour, but is annoying
|
||||||
|
let pos = getpos('.')
|
||||||
|
if pos == b:jlblk_save_pos
|
||||||
|
call winrestview(b:jlblk_view)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let oldtopline = b:jlblk_view["topline"]
|
||||||
|
let newtopline = winsaveview()["topline"]
|
||||||
|
let l = pos[1]
|
||||||
|
if l >= oldtopline + &l:scrolloff && l <= oldtopline + winheight(0) - 1 - &l:scrolloff
|
||||||
|
if newtopline > oldtopline
|
||||||
|
exe ":normal! " . (newtopline - oldtopline) . "\<C-Y>"
|
||||||
|
elseif newtopline < oldtopline
|
||||||
|
exe ":normal! " . (oldtopline - newtopline) . "\<C-E>"
|
||||||
|
endif
|
||||||
|
" these reduce the scrolling to the minimum (which is maybe not
|
||||||
|
" standard ViM behaviour?)
|
||||||
|
elseif newtopline < oldtopline && (l - newtopline - &l:scrolloff) > 0
|
||||||
|
exe ":normal! " . (l - newtopline - &l:scrolloff) . "\<C-E>"
|
||||||
|
elseif newtopline > oldtopline && (newtopline + &l:scrolloff - l) > 0
|
||||||
|
exe ":normal! " . (l - newtopline - &l:scrolloff) . "\<C-E>"
|
||||||
|
endif
|
||||||
|
call setpos('.', pos) " make sure we didn't screw up
|
||||||
|
" (since winsaveview may not be up to date)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:abort()
|
||||||
|
call setpos('.', b:jlblk_save_pos)
|
||||||
|
call s:restore_view()
|
||||||
|
if get(b:, "jlblk_abort_calls_esc", 1)
|
||||||
|
call feedkeys("\<Esc>", 'n')
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:set_mark_tick(...)
|
||||||
|
" This could be a one-liner:
|
||||||
|
" call setpos("''", b:jlblk_save_pos)
|
||||||
|
" but we want to append to the jumplist,
|
||||||
|
" which setpos doesn't do
|
||||||
|
let p = getpos('.')
|
||||||
|
call setpos('.', b:jlblk_save_pos)
|
||||||
|
normal! m'
|
||||||
|
call setpos('.', p)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_save_pos(...)
|
||||||
|
if !exists("b:jlblk_save_pos") || (a:0 == 0) || (a:0 > 0 && a:1)
|
||||||
|
let b:jlblk_save_pos = getpos('.')
|
||||||
|
endif
|
||||||
|
let b:jlblk_view = winsaveview()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:on_end()
|
||||||
|
return getline('.')[col('.')-1] =~# '\k' && expand("<cword>") =~# b:julia_end_keywords
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:on_begin()
|
||||||
|
let [l,c] = [line('.'), col('.')]
|
||||||
|
normal! ^
|
||||||
|
let patt = '\%<'.(c+1).'c\(' . b:julia_begin_keywordsm . '\)\%>'.(c-1).'c'
|
||||||
|
let n = search(patt, 'Wnc', l)
|
||||||
|
call cursor(l, c)
|
||||||
|
return n > 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:matchit()
|
||||||
|
let lkj = exists(":lockjumps") == 2 ? "lockjumps " : ""
|
||||||
|
exe lkj . "normal %"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:move_before_begin()
|
||||||
|
call search(b:julia_begin_keywordsm, 'Wbc')
|
||||||
|
normal! h
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:cycle_until_end()
|
||||||
|
let pos = getpos('.')
|
||||||
|
while !s:on_end()
|
||||||
|
call s:matchit()
|
||||||
|
let c = 0
|
||||||
|
if getpos('.') == pos || c > 1000
|
||||||
|
" shouldn't happen, but let's avoid infinite loops anyway
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let c += 1
|
||||||
|
endwhile
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:moveto_block_delim(toend, backwards, ...)
|
||||||
|
let pattern = a:toend ? b:julia_end_keywords : b:julia_begin_keywordsm
|
||||||
|
let flags = a:backwards ? 'Wb' : 'W'
|
||||||
|
let cnt = a:0 > 0 ? a:1 : b:jlblk_count
|
||||||
|
if !a:toend && a:backwards && s:on_begin()
|
||||||
|
call s:move_before_begin()
|
||||||
|
endif
|
||||||
|
let ret = 0
|
||||||
|
for c in range(cnt)
|
||||||
|
if a:toend && a:backwards && s:on_end()
|
||||||
|
normal! l
|
||||||
|
normal! bh
|
||||||
|
endif
|
||||||
|
while 1
|
||||||
|
let searchret = search(pattern, flags)
|
||||||
|
if !searchret
|
||||||
|
return ret
|
||||||
|
endif
|
||||||
|
exe "let skip = " . b:match_skip
|
||||||
|
if !skip
|
||||||
|
let ret = 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfor
|
||||||
|
return ret
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:compare_pos(pos1, pos2)
|
||||||
|
if a:pos1[1] < a:pos2[1]
|
||||||
|
return -1
|
||||||
|
elseif a:pos1[1] > a:pos2[1]
|
||||||
|
return 1
|
||||||
|
elseif a:pos1[2] < a:pos2[2]
|
||||||
|
return -1
|
||||||
|
elseif a:pos1[2] > a:pos2[2]
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#move_N()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = s:moveto_block_delim(1, 0)
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
normal! e
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#move_n()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = s:moveto_block_delim(0, 0)
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#move_p()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = s:moveto_block_delim(0, 1)
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#move_P()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = s:moveto_block_delim(1, 1)
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
normal! e
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:moveto_currentblock_end()
|
||||||
|
let flags = 'W'
|
||||||
|
if s:on_end()
|
||||||
|
let flags .= 'c'
|
||||||
|
" NOTE: using "normal! lb" fails at the end of the file (?!)
|
||||||
|
normal! l
|
||||||
|
normal! b
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
|
||||||
|
if ret <= 0
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
normal! e
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#moveblock_N()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = 0
|
||||||
|
for c in range(b:jlblk_count)
|
||||||
|
let last_seen_pos = getpos('.')
|
||||||
|
if s:on_end()
|
||||||
|
normal! hel
|
||||||
|
let save_pos = getpos('.')
|
||||||
|
let ret_start = s:moveto_block_delim(0, 0, 1)
|
||||||
|
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
if s:on_end()
|
||||||
|
normal! h
|
||||||
|
endif
|
||||||
|
let ret_end = s:moveto_block_delim(1, 0, 1)
|
||||||
|
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
|
||||||
|
|
||||||
|
if ret_start && (!ret_end || s:compare_pos(start1_pos, end1_pos) < 0)
|
||||||
|
call setpos('.', start1_pos)
|
||||||
|
else
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let moveret = s:moveto_currentblock_end()
|
||||||
|
if !moveret && c == 0
|
||||||
|
let moveret = s:moveto_block_delim(0, 0, 1) && s:cycle_until_end()
|
||||||
|
if moveret
|
||||||
|
normal! e
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if !moveret
|
||||||
|
call setpos('.', last_seen_pos)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ret = 1
|
||||||
|
endfor
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#moveblock_n()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = 0
|
||||||
|
for c in range(b:jlblk_count)
|
||||||
|
let last_seen_pos = getpos('.')
|
||||||
|
|
||||||
|
call s:moveto_currentblock_end()
|
||||||
|
if s:moveto_block_delim(0, 0, 1)
|
||||||
|
let ret = 1
|
||||||
|
else
|
||||||
|
call setpos('.', last_seen_pos)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#moveblock_p()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = 0
|
||||||
|
for c in range(b:jlblk_count)
|
||||||
|
let last_seen_pos = getpos('.')
|
||||||
|
if s:on_begin()
|
||||||
|
call s:move_before_begin()
|
||||||
|
if s:on_end()
|
||||||
|
normal! l
|
||||||
|
endif
|
||||||
|
let save_pos = getpos('.')
|
||||||
|
let ret_start = s:moveto_block_delim(0, 1, 1)
|
||||||
|
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
let ret_end = s:moveto_block_delim(1, 1, 1)
|
||||||
|
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
|
||||||
|
|
||||||
|
if ret_end && (!ret_start || s:compare_pos(start1_pos, end1_pos) < 0)
|
||||||
|
call setpos('.', end1_pos)
|
||||||
|
else
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let moveret = s:moveto_currentblock_end()
|
||||||
|
if !moveret && c == 0
|
||||||
|
let moveret = s:moveto_block_delim(1, 1, 1)
|
||||||
|
endif
|
||||||
|
if !moveret
|
||||||
|
call setpos('.', last_seen_pos)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:matchit()
|
||||||
|
let ret = 1
|
||||||
|
endfor
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
call s:restore_view()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#moveblock_P()
|
||||||
|
call s:get_save_pos()
|
||||||
|
|
||||||
|
let ret = 0
|
||||||
|
for c in range(b:jlblk_count)
|
||||||
|
let last_seen_pos = getpos('.')
|
||||||
|
|
||||||
|
call s:moveto_currentblock_end()
|
||||||
|
if s:on_end()
|
||||||
|
call s:matchit()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:moveto_block_delim(1, 1, 1)
|
||||||
|
" NOTE: normal! he does not work unless &whichwrap inlcudes h
|
||||||
|
normal! h
|
||||||
|
normal! e
|
||||||
|
let ret = 1
|
||||||
|
else
|
||||||
|
call setpos('.', last_seen_pos)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !ret
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
call s:restore_view()
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#whereami()
|
||||||
|
let b:jlblk_count = v:count1
|
||||||
|
let save_redraw = &lazyredraw
|
||||||
|
setlocal lazyredraw
|
||||||
|
let pos = getpos('.')
|
||||||
|
let ret = julia_blocks#select_a('w')
|
||||||
|
if empty(ret)
|
||||||
|
call setpos('.', pos)
|
||||||
|
let &l:lazyredraw = save_redraw
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
let [start_pos, end_pos] = ret
|
||||||
|
let m = getline(start_pos[1])[start_pos[2]-1:]
|
||||||
|
|
||||||
|
" If cursor_moved was not forced from select_a, we force it now
|
||||||
|
" (TODO: this is *really* ugly)
|
||||||
|
if end_pos != pos
|
||||||
|
call s:cursor_moved(1)
|
||||||
|
endif
|
||||||
|
call setpos('.', pos)
|
||||||
|
call s:restore_view()
|
||||||
|
let &l:lazyredraw = save_redraw
|
||||||
|
return m
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Block text objects
|
||||||
|
|
||||||
|
function! s:find_block(current_mode)
|
||||||
|
|
||||||
|
let flags = 'W'
|
||||||
|
|
||||||
|
if b:jlblk_did_select
|
||||||
|
call setpos('.', b:jlblk_last_start_pos)
|
||||||
|
if !s:cycle_until_end()
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
if !(a:current_mode[0] == 'a' && a:current_mode == b:jlblk_last_mode)
|
||||||
|
let flags .= 'c'
|
||||||
|
endif
|
||||||
|
elseif s:on_end()
|
||||||
|
let flags .= 'c'
|
||||||
|
" NOTE: using "normal! lb" fails at the end of the file (?!)
|
||||||
|
normal! l
|
||||||
|
normal! b
|
||||||
|
endif
|
||||||
|
let searchret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
|
||||||
|
if searchret <= 0
|
||||||
|
if !b:jlblk_did_select
|
||||||
|
return s:abort()
|
||||||
|
else
|
||||||
|
call setpos('.', b:jlblk_last_end_pos)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let end_pos = getpos('.')
|
||||||
|
" Jump to match
|
||||||
|
call s:matchit()
|
||||||
|
let start_pos = getpos('.')
|
||||||
|
|
||||||
|
let b:jlblk_last_start_pos = copy(start_pos)
|
||||||
|
let b:jlblk_last_end_pos = copy(end_pos)
|
||||||
|
|
||||||
|
return [start_pos, end_pos]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:repeated_find(ai_mode)
|
||||||
|
let repeat = b:jlblk_count + (a:ai_mode == 'i' && v:count1 > 1 ? 1 : 0)
|
||||||
|
for c in range(repeat)
|
||||||
|
let current_mode = (c < repeat - 1 ? 'a' : a:ai_mode)
|
||||||
|
let ret_find_block = s:find_block(current_mode)
|
||||||
|
if empty(ret_find_block)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let [start_pos, end_pos] = ret_find_block
|
||||||
|
call setpos('.', end_pos)
|
||||||
|
let b:jlblk_last_mode = current_mode
|
||||||
|
if c < repeat - 1
|
||||||
|
let b:jlblk_doing_select = 0
|
||||||
|
let b:jlblk_did_select = 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return [start_pos, end_pos]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#select_a(...)
|
||||||
|
let mode_flag = a:0 > 0 ? a:1 : ''
|
||||||
|
call s:get_save_pos(!b:jlblk_did_select)
|
||||||
|
let current_pos = getpos('.')
|
||||||
|
let ret_find_block = s:repeated_find('a' . mode_flag)
|
||||||
|
if empty(ret_find_block)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let [start_pos, end_pos] = ret_find_block
|
||||||
|
|
||||||
|
call setpos('.', end_pos)
|
||||||
|
normal! e
|
||||||
|
let end_pos = getpos('.')
|
||||||
|
|
||||||
|
let b:jlblk_doing_select = 1
|
||||||
|
|
||||||
|
" CursorMove is only triggered if end_pos
|
||||||
|
" end_pos is different than the staring position;
|
||||||
|
" so when starting from the 'd' in 'end' we need to
|
||||||
|
" force it
|
||||||
|
if current_pos == end_pos
|
||||||
|
call s:cursor_moved(1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
return [start_pos, end_pos]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! julia_blocks#select_i()
|
||||||
|
call s:get_save_pos(!b:jlblk_did_select)
|
||||||
|
let current_pos = getpos('.')
|
||||||
|
let ret_find_block = s:repeated_find('i')
|
||||||
|
if empty(ret_find_block)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let [start_pos, end_pos] = ret_find_block
|
||||||
|
|
||||||
|
if end_pos[1] <= start_pos[1]+1
|
||||||
|
return s:abort()
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setpos('.', end_pos)
|
||||||
|
|
||||||
|
let b:jlblk_doing_select = 1
|
||||||
|
|
||||||
|
let start_pos[1] += 1
|
||||||
|
call setpos('.', start_pos)
|
||||||
|
normal! ^
|
||||||
|
let start_pos = getpos('.')
|
||||||
|
let end_pos[1] -= 1
|
||||||
|
let end_pos[2] = len(getline(end_pos[1]))
|
||||||
|
|
||||||
|
" CursorMove is only triggered if end_pos
|
||||||
|
" end_pos is different than the staring position;
|
||||||
|
" so when starting from the 'd' in 'end' we need to
|
||||||
|
" force it
|
||||||
|
if current_pos == end_pos
|
||||||
|
call s:cursor_moved(1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:set_mark_tick()
|
||||||
|
return [start_pos, end_pos]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function julia_blocks#select_reset()
|
||||||
|
let b:jlblk_did_select = 0
|
||||||
|
let b:jlblk_doing_select = 0
|
||||||
|
let b:jlblk_inwrapper = 0
|
||||||
|
let b:jlblk_last_mode = ""
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:cursor_moved(...)
|
||||||
|
if b:jlblk_inwrapper && !(a:0 > 0 && a:1)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let b:jlblk_did_select = b:jlblk_doing_select
|
||||||
|
let b:jlblk_doing_select = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
3316
autoload/julia_latex_symbols.vim
Normal file
3316
autoload/julia_latex_symbols.vim
Normal file
File diff suppressed because it is too large
Load Diff
31
autoload/vifm/globals.vim
Normal file
31
autoload/vifm/globals.vim
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
||||||
|
|
||||||
|
" common functions for vifm plugin related to globals
|
||||||
|
" Maintainer: xaizek <xaizek@posteo.net>
|
||||||
|
" Last Change: January 02, 2018
|
||||||
|
|
||||||
|
" Initializes global variables to defaults unless they are already set
|
||||||
|
function! vifm#globals#Init()
|
||||||
|
if !exists('g:vifm_exec')
|
||||||
|
let g:vifm_exec = 'vifm'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:vifm_exec_args')
|
||||||
|
let g:vifm_exec_args = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:vifm_term')
|
||||||
|
if has('win32')
|
||||||
|
if filereadable('C:\Windows\system32\cmd.exe')
|
||||||
|
let g:vifm_term = 'C:\Windows\system32\cmd.exe /C'
|
||||||
|
else
|
||||||
|
" If don't find use the integrate shell it work too
|
||||||
|
let g:vifm_term = ''
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:vifm_term = 'xterm -e'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
|
||||||
|
|
||||||
function! vital#of(name) abort
|
|
||||||
let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital')
|
|
||||||
let file = split(files, "\n")
|
|
||||||
if empty(file)
|
|
||||||
throw 'vital: version file not found: ' . a:name
|
|
||||||
endif
|
|
||||||
let ver = readfile(file[0], 'b')
|
|
||||||
if empty(ver)
|
|
||||||
throw 'vital: invalid version file: ' . a:name
|
|
||||||
endif
|
|
||||||
return vital#_{substitute(ver[0], '\W', '', 'g')}#new()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -1,313 +1,13 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
let s:self_version = expand('<sfile>:t:r')
|
let s:_plugin_name = expand('<sfile>:t:r')
|
||||||
let s:self_file = expand('<sfile>')
|
|
||||||
|
|
||||||
" Note: The extra argument to globpath() was added in Patch 7.2.051.
|
function! vital#{s:_plugin_name}#new() abort
|
||||||
let s:globpath_third_arg = v:version > 702 || v:version == 702 && has('patch51')
|
return vital#{s:_plugin_name[1:]}#new()
|
||||||
|
|
||||||
let s:loaded = {}
|
|
||||||
let s:cache_module_path = {}
|
|
||||||
let s:cache_sid = {}
|
|
||||||
|
|
||||||
let s:_vital_files_cache_runtimepath = ''
|
|
||||||
let s:_vital_files_cache = []
|
|
||||||
let s:_unify_path_cache = {}
|
|
||||||
|
|
||||||
function! s:import(name, ...) abort
|
|
||||||
let target = {}
|
|
||||||
let functions = []
|
|
||||||
for a in a:000
|
|
||||||
if type(a) == type({})
|
|
||||||
let target = a
|
|
||||||
elseif type(a) == type([])
|
|
||||||
let functions = a
|
|
||||||
endif
|
|
||||||
unlet a
|
|
||||||
endfor
|
|
||||||
let module = s:_import(a:name)
|
|
||||||
if empty(functions)
|
|
||||||
call extend(target, module, 'keep')
|
|
||||||
else
|
|
||||||
for f in functions
|
|
||||||
if has_key(module, f) && !has_key(target, f)
|
|
||||||
let target[f] = module[f]
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
return target
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:load(...) dict abort
|
function! vital#{s:_plugin_name}#function(funcname) abort
|
||||||
for arg in a:000
|
silent! return function(a:funcname)
|
||||||
let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg]
|
|
||||||
let target = split(join(as, ''), '\W\+')
|
|
||||||
let dict = self
|
|
||||||
let dict_type = type({})
|
|
||||||
while !empty(target)
|
|
||||||
let ns = remove(target, 0)
|
|
||||||
if !has_key(dict, ns)
|
|
||||||
let dict[ns] = {}
|
|
||||||
endif
|
|
||||||
if type(dict[ns]) == dict_type
|
|
||||||
let dict = dict[ns]
|
|
||||||
else
|
|
||||||
unlet dict
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
if exists('dict')
|
|
||||||
call extend(dict, s:_import(name))
|
|
||||||
endif
|
|
||||||
unlet arg
|
|
||||||
endfor
|
|
||||||
return self
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:unload() abort
|
|
||||||
let s:loaded = {}
|
|
||||||
let s:cache_sid = {}
|
|
||||||
let s:cache_module_path = {}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:exists(name) abort
|
|
||||||
return s:_get_module_path(a:name) !=# ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:search(pattern) abort
|
|
||||||
let paths = s:_vital_files(a:pattern)
|
|
||||||
let modules = sort(map(paths, 's:_file2module(v:val)'))
|
|
||||||
return s:_uniq(modules)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:expand_modules(entry, all) abort
|
|
||||||
if type(a:entry) == type([])
|
|
||||||
let candidates = s:_concat(map(copy(a:entry), 's:search(v:val)'))
|
|
||||||
if empty(candidates)
|
|
||||||
throw printf('vital: Any of module %s is not found', string(a:entry))
|
|
||||||
endif
|
|
||||||
if eval(join(map(copy(candidates), 'has_key(a:all, v:val)'), '+'))
|
|
||||||
let modules = []
|
|
||||||
else
|
|
||||||
let modules = [candidates[0]]
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let modules = s:search(a:entry)
|
|
||||||
if empty(modules)
|
|
||||||
throw printf('vital: Module %s is not found', a:entry)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
call filter(modules, '!has_key(a:all, v:val)')
|
|
||||||
for module in modules
|
|
||||||
let a:all[module] = 1
|
|
||||||
endfor
|
|
||||||
return modules
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_import(name) abort
|
|
||||||
if type(a:name) == type(0)
|
|
||||||
return s:_build_module(a:name)
|
|
||||||
endif
|
|
||||||
let path = s:_get_module_path(a:name)
|
|
||||||
if path ==# ''
|
|
||||||
throw 'vital: module not found: ' . a:name
|
|
||||||
endif
|
|
||||||
let sid = s:_get_sid_by_script(path)
|
|
||||||
if !sid
|
|
||||||
try
|
|
||||||
execute 'source' fnameescape(path)
|
|
||||||
catch /^Vim\%((\a\+)\)\?:E484/
|
|
||||||
throw 'vital: module not found: ' . a:name
|
|
||||||
catch /^Vim\%((\a\+)\)\?:E127/
|
|
||||||
" Ignore.
|
|
||||||
endtry
|
|
||||||
|
|
||||||
let sid = s:_get_sid_by_script(path)
|
|
||||||
endif
|
|
||||||
return s:_build_module(sid)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_get_module_path(name) abort
|
|
||||||
let key = a:name . '_'
|
|
||||||
if has_key(s:cache_module_path, key)
|
|
||||||
return s:cache_module_path[key]
|
|
||||||
endif
|
|
||||||
if s:_is_absolute_path(a:name) && filereadable(a:name)
|
|
||||||
return a:name
|
|
||||||
endif
|
|
||||||
if a:name ==# ''
|
|
||||||
let paths = [s:self_file]
|
|
||||||
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$'
|
|
||||||
let paths = s:_vital_files(a:name)
|
|
||||||
else
|
|
||||||
throw 'vital: Invalid module name: ' . a:name
|
|
||||||
endif
|
|
||||||
|
|
||||||
call filter(paths, 'filereadable(expand(v:val, 1))')
|
|
||||||
let path = get(paths, 0, '')
|
|
||||||
let s:cache_module_path[key] = path
|
|
||||||
return path
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_get_sid_by_script(path) abort
|
|
||||||
if has_key(s:cache_sid, a:path)
|
|
||||||
return s:cache_sid[a:path]
|
|
||||||
endif
|
|
||||||
|
|
||||||
let path = s:_unify_path(a:path)
|
|
||||||
for line in filter(split(s:_redir('scriptnames'), "\n"),
|
|
||||||
\ 'stridx(v:val, s:self_version) > 0')
|
|
||||||
let list = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$')
|
|
||||||
if !empty(list) && s:_unify_path(list[2]) ==# path
|
|
||||||
let s:cache_sid[a:path] = list[1] - 0
|
|
||||||
return s:cache_sid[a:path]
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_file2module(file) abort
|
|
||||||
let filename = fnamemodify(a:file, ':p:gs?[\\/]?/?')
|
|
||||||
let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$')
|
|
||||||
return join(split(tail, '[\\/]\+'), '.')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if filereadable(expand('<sfile>:r') . '.VIM')
|
|
||||||
" resolve() is slow, so we cache results.
|
|
||||||
" Note: On windows, vim can't expand path names from 8.3 formats.
|
|
||||||
" So if getting full path via <sfile> and $HOME was set as 8.3 format,
|
|
||||||
" vital load duplicated scripts. Below's :~ avoid this issue.
|
|
||||||
function! s:_unify_path(path) abort
|
|
||||||
if has_key(s:_unify_path_cache, a:path)
|
|
||||||
return s:_unify_path_cache[a:path]
|
|
||||||
endif
|
|
||||||
let value = tolower(fnamemodify(resolve(fnamemodify(
|
|
||||||
\ a:path, ':p')), ':~:gs?[\\/]?/?'))
|
|
||||||
let s:_unify_path_cache[a:path] = value
|
|
||||||
return value
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:_unify_path(path) abort
|
|
||||||
return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?'))
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
if s:globpath_third_arg
|
|
||||||
function! s:_runtime_files(path) abort
|
|
||||||
return split(globpath(&runtimepath, a:path, 1), "\n")
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:_runtime_files(path) abort
|
|
||||||
return split(globpath(&runtimepath, a:path), "\n")
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:_vital_files(pattern) abort
|
|
||||||
if s:_vital_files_cache_runtimepath !=# &runtimepath
|
|
||||||
let path = printf('autoload/vital/%s/**/*.vim', s:self_version)
|
|
||||||
let s:_vital_files_cache = s:_runtime_files(path)
|
|
||||||
let mod = ':p:gs?[\\/]\+?/?'
|
|
||||||
call map(s:_vital_files_cache, 'fnamemodify(v:val, mod)')
|
|
||||||
let s:_vital_files_cache_runtimepath = &runtimepath
|
|
||||||
endif
|
|
||||||
let target = substitute(a:pattern, '\.', '/', 'g')
|
|
||||||
let target = substitute(target, '\*', '[^/]*', 'g')
|
|
||||||
let regexp = printf('autoload/vital/%s/%s.vim', s:self_version, target)
|
|
||||||
return filter(copy(s:_vital_files_cache), 'v:val =~# regexp')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Copy from System.Filepath
|
|
||||||
if has('win16') || has('win32') || has('win64')
|
|
||||||
function! s:_is_absolute_path(path) abort
|
|
||||||
return a:path =~? '^[a-z]:[/\\]'
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:_is_absolute_path(path) abort
|
|
||||||
return a:path[0] ==# '/'
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:_build_module(sid) abort
|
|
||||||
if has_key(s:loaded, a:sid)
|
|
||||||
return copy(s:loaded[a:sid])
|
|
||||||
endif
|
|
||||||
let functions = s:_get_functions(a:sid)
|
|
||||||
|
|
||||||
let prefix = '<SNR>' . a:sid . '_'
|
|
||||||
let module = {}
|
|
||||||
for func in functions
|
|
||||||
let module[func] = function(prefix . func)
|
|
||||||
endfor
|
|
||||||
if has_key(module, '_vital_created')
|
|
||||||
call module._vital_created(module)
|
|
||||||
endif
|
|
||||||
let export_module = filter(copy(module), 'v:key =~# "^\\a"')
|
|
||||||
let s:loaded[a:sid] = get(g:, 'vital_debug', 0) ? module : export_module
|
|
||||||
if has_key(module, '_vital_loaded')
|
|
||||||
let V = vital#{s:self_version}#new()
|
|
||||||
call module._vital_loaded(V)
|
|
||||||
endif
|
|
||||||
return copy(s:loaded[a:sid])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if exists('+regexpengine')
|
|
||||||
function! s:_get_functions(sid) abort
|
|
||||||
let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid))
|
|
||||||
let map_pat = '<SNR>' . a:sid . '_\zs\w\+'
|
|
||||||
return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)')
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:_get_functions(sid) abort
|
|
||||||
let prefix = '<SNR>' . a:sid . '_'
|
|
||||||
let funcs = s:_redir('function')
|
|
||||||
let filter_pat = '^\s*function ' . prefix
|
|
||||||
let map_pat = prefix . '\zs\w\+'
|
|
||||||
return map(filter(split(funcs, "\n"),
|
|
||||||
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'),
|
|
||||||
\ 'matchstr(v:val, map_pat)')
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('*uniq')
|
|
||||||
function! s:_uniq(list) abort
|
|
||||||
return uniq(a:list)
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:_uniq(list) abort
|
|
||||||
let i = len(a:list) - 1
|
|
||||||
while 0 < i
|
|
||||||
if a:list[i] ==# a:list[i - 1]
|
|
||||||
call remove(a:list, i)
|
|
||||||
let i -= 2
|
|
||||||
else
|
|
||||||
let i -= 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return a:list
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:_concat(lists) abort
|
|
||||||
let result_list = []
|
|
||||||
for list in a:lists
|
|
||||||
let result_list += list
|
|
||||||
endfor
|
|
||||||
return result_list
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_redir(cmd) abort
|
|
||||||
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
|
|
||||||
set verbose=0 verbosefile=
|
|
||||||
redir => res
|
|
||||||
silent! execute a:cmd
|
|
||||||
redir END
|
|
||||||
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
|
|
||||||
return res
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! vital#{s:self_version}#new() abort
|
|
||||||
return s:_import('')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
" ___vital___
|
||||||
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
execute join(['function! vital#_crystal#ColorEcho#import() abort', printf("return map({'get_echorizer': '', 'echo': '', 'is_available': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
|
delfunction s:_SID
|
||||||
|
" ___vital___
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
" ___vital___
|
||||||
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
execute join(['function! vital#_crystal#Data#List#import() abort', printf("return map({'combinations': '', 'and': '', 'sort_by': '', 'foldr1': '', 'sort': '', 'flatten': '', 'has_index': '', 'find_indices': '', 'any': '', 'unshift': '', 'span': '', 'pop': '', 'binary_search': '', 'uniq_by': '', 'or': '', 'all': '', 'zip': '', 'find_last_index': '', 'find': '', 'partition': '', 'shift': '', 'permutations': '', 'break': '', 'max_by': '', 'foldl': '', 'foldr': '', 'find_index': '', 'drop_while': '', 'group_by': '', 'take_while': '', 'conj': '', 'push': '', 'char_range': '', 'cons': '', 'foldl1': '', 'intersect': '', 'concat': '', 'map_accum': '', 'clear': '', 'has_common_items': '', 'product': '', 'zip_fill': '', 'uniq': '', 'has': '', 'min_by': '', 'with_index': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
|
delfunction s:_SID
|
||||||
|
" ___vital___
|
||||||
" Utilities for list.
|
" Utilities for list.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -175,6 +184,11 @@ function! s:take_while(f, xs) abort
|
|||||||
return s:span(a:f, a:xs)[0]
|
return s:span(a:f, a:xs)[0]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" similar to Haskell's Data.List.dropWhile
|
||||||
|
function! s:drop_while(f, xs) abort
|
||||||
|
return s:span(a:f, a:xs)[1]
|
||||||
|
endfunction
|
||||||
|
|
||||||
" similar to Haskell's Data.List.partition
|
" similar to Haskell's Data.List.partition
|
||||||
function! s:partition(f, xs) abort
|
function! s:partition(f, xs) abort
|
||||||
return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')]
|
return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')]
|
||||||
@@ -271,14 +285,22 @@ endfunction
|
|||||||
|
|
||||||
" similar to Ruby's detect or Haskell's find.
|
" similar to Ruby's detect or Haskell's find.
|
||||||
function! s:find(list, default, f) abort
|
function! s:find(list, default, f) abort
|
||||||
|
let l:Call = type(a:f) is type(function('function'))
|
||||||
|
\ ? function('call')
|
||||||
|
\ : function('s:_call_string_expr')
|
||||||
|
|
||||||
for x in a:list
|
for x in a:list
|
||||||
if eval(substitute(a:f, 'v:val', string(x), 'g'))
|
if l:Call(a:f, [x])
|
||||||
return x
|
return x
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return a:default
|
return a:default
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:_call_string_expr(expr, args) abort
|
||||||
|
return map([a:args[0]], a:expr)[0]
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Returns the index of the first element which satisfies the given expr.
|
" Returns the index of the first element which satisfies the given expr.
|
||||||
function! s:find_index(xs, f, ...) abort
|
function! s:find_index(xs, f, ...) abort
|
||||||
let len = len(a:xs)
|
let len = len(a:xs)
|
||||||
@@ -426,7 +448,7 @@ function! s:combinations(list, r) abort
|
|||||||
if a:r > len(a:list)
|
if a:r > len(a:list)
|
||||||
return []
|
return []
|
||||||
elseif a:r < 0
|
elseif a:r < 0
|
||||||
throw 'vital: Data:List: {r} must be non-negative integer'
|
throw 'vital: Data.List: {r} must be non-negative integer'
|
||||||
endif
|
endif
|
||||||
let n = len(a:list)
|
let n = len(a:list)
|
||||||
let result = []
|
let result = []
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
" ___vital___
|
||||||
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
execute join(['function! vital#_crystal#Data#String#import() abort', printf("return map({'starts_with': '', 'split3': '', 'replace_first': '', 'chop': '', 'unescape': '', 'split_posix_text': '', 'replace': '', 'scan': '', 'strwidthpart': '', 'common_head': '', 'reverse': '', 'escape_pattern': '', 'trim_end': '', '_vital_depends': '', 'wrap': '', 'join_posix_lines': '', 'contains_multibyte': '', 'truncate_skipping': '', 'split_leftright': '', 'ends_with': '', 'nsplit': '', 'strwidthpart_reverse': '', 'unescape_pattern': '', 'levenshtein_distance': '', 'trim_start': '', 'justify_equal_spacing': '', 'nr2hex': '', 'iconv': '', 'pad_left': '', 'nr2enc_char': '', 'lines': '', 'repair_posix_text': '', 'nr2byte': '', 'trim': '', 'diffidx': '', 'truncate': '', 'split_by_displaywidth': '', '_vital_created': '', 'padding_by_displaywidth': '', 'hash': '', 'chomp': '', 'pad_between_letters': '', 'dstring': '', 'pad_both_sides': '', 'substitute_last': '', 'pad_right': '', 'remove_ansi_sequences': '', '_vital_loaded': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
|
delfunction s:_SID
|
||||||
|
" ___vital___
|
||||||
" Utilities for string.
|
" Utilities for string.
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -7,12 +16,21 @@ set cpo&vim
|
|||||||
|
|
||||||
function! s:_vital_loaded(V) abort
|
function! s:_vital_loaded(V) abort
|
||||||
let s:V = a:V
|
let s:V = a:V
|
||||||
let s:P = s:V.import('Prelude')
|
|
||||||
let s:L = s:V.import('Data.List')
|
let s:L = s:V.import('Data.List')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:_vital_depends() abort
|
function! s:_vital_depends() abort
|
||||||
return ['Prelude', 'Data.List']
|
return ['Data.List']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_vital_created(module) abort
|
||||||
|
" Expose script-local funcref
|
||||||
|
if exists('s:strchars')
|
||||||
|
let a:module.strchars = s:strchars
|
||||||
|
endif
|
||||||
|
if exists('s:wcswidth')
|
||||||
|
let a:module.wcswidth = s:wcswidth
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Substitute a:from => a:to by string.
|
" Substitute a:from => a:to by string.
|
||||||
@@ -61,7 +79,7 @@ function! s:common_head(strs) abort
|
|||||||
endif
|
endif
|
||||||
let strs = len == 2 ? a:strs : sort(copy(a:strs))
|
let strs = len == 2 ? a:strs : sort(copy(a:strs))
|
||||||
let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g')
|
let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g')
|
||||||
return pat == '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']')
|
return pat ==# '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Split to two elements of List. ([left, right])
|
" Split to two elements of List. ([left, right])
|
||||||
@@ -130,9 +148,7 @@ endfunction
|
|||||||
" even if a:str contains multibyte character(s).
|
" even if a:str contains multibyte character(s).
|
||||||
" s:strchars(str) {{{
|
" s:strchars(str) {{{
|
||||||
if exists('*strchars')
|
if exists('*strchars')
|
||||||
function! s:strchars(str) abort
|
let s:strchars = function('strchars')
|
||||||
return strchars(a:str)
|
|
||||||
endfunction
|
|
||||||
else
|
else
|
||||||
function! s:strchars(str) abort
|
function! s:strchars(str) abort
|
||||||
return strlen(substitute(copy(a:str), '.', 'x', 'g'))
|
return strlen(substitute(copy(a:str), '.', 'x', 'g'))
|
||||||
@@ -210,7 +226,7 @@ function! s:nr2byte(nr) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:nr2enc_char(charcode) abort
|
function! s:nr2enc_char(charcode) abort
|
||||||
if &encoding == 'utf-8'
|
if &encoding ==# 'utf-8'
|
||||||
return nr2char(a:charcode)
|
return nr2char(a:charcode)
|
||||||
endif
|
endif
|
||||||
let char = s:nr2byte(a:charcode)
|
let char = s:nr2byte(a:charcode)
|
||||||
@@ -222,7 +238,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:nr2hex(nr) abort
|
function! s:nr2hex(nr) abort
|
||||||
let n = a:nr
|
let n = a:nr
|
||||||
let r = ""
|
let r = ''
|
||||||
while n
|
while n
|
||||||
let r = '0123456789ABCDEF'[n % 16] . r
|
let r = '0123456789ABCDEF'[n % 16] . r
|
||||||
let n = n / 16
|
let n = n / 16
|
||||||
@@ -318,7 +334,7 @@ function! s:levenshtein_distance(str1, str2) abort
|
|||||||
let letters2 = split(a:str2, '\zs')
|
let letters2 = split(a:str2, '\zs')
|
||||||
let length1 = len(letters1)
|
let length1 = len(letters1)
|
||||||
let length2 = len(letters2)
|
let length2 = len(letters2)
|
||||||
let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), "0")')
|
let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), ''0'')')
|
||||||
|
|
||||||
for i1 in range(0, length1)
|
for i1 in range(0, length1)
|
||||||
let distances[i1][0] = i1
|
let distances[i1][0] = i1
|
||||||
@@ -373,7 +389,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
|
|||||||
|
|
||||||
let text = ''
|
let text = ''
|
||||||
while cs_index < len(cs)
|
while cs_index < len(cs)
|
||||||
if cs[cs_index] is "\n"
|
if cs[cs_index] is# "\n"
|
||||||
let text = s:padding_by_displaywidth(text, a:width, a:float)
|
let text = s:padding_by_displaywidth(text, a:width, a:float)
|
||||||
let lines += [text]
|
let lines += [text]
|
||||||
let text = ''
|
let text = ''
|
||||||
@@ -394,7 +410,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
|
|||||||
if a:is_wrap
|
if a:is_wrap
|
||||||
if a:width < w
|
if a:width < w
|
||||||
if a:width < strdisplaywidth(cs[cs_index])
|
if a:width < strdisplaywidth(cs[cs_index])
|
||||||
while get(cs, cs_index, "\n") isnot "\n"
|
while get(cs, cs_index, "\n") isnot# "\n"
|
||||||
let cs_index += 1
|
let cs_index += 1
|
||||||
endwhile
|
endwhile
|
||||||
continue
|
continue
|
||||||
@@ -403,7 +419,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
while get(cs, cs_index, "\n") isnot "\n"
|
while get(cs, cs_index, "\n") isnot# "\n"
|
||||||
let cs_index += 1
|
let cs_index += 1
|
||||||
endwhile
|
endwhile
|
||||||
continue
|
continue
|
||||||
@@ -440,8 +456,9 @@ function! s:truncate(str, width) abort
|
|||||||
" http://github.com/mattn/googlereader-vim/tree/master
|
" http://github.com/mattn/googlereader-vim/tree/master
|
||||||
|
|
||||||
if a:str =~# '^[\x00-\x7f]*$'
|
if a:str =~# '^[\x00-\x7f]*$'
|
||||||
return len(a:str) < a:width ?
|
return len(a:str) < a:width
|
||||||
\ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width)
|
\ ? printf('%-' . a:width . 's', a:str)
|
||||||
|
\ : strpart(a:str, 0, a:width)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let ret = a:str
|
let ret = a:str
|
||||||
@@ -471,57 +488,20 @@ function! s:truncate_skipping(str, max, footer_width, separator) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:strwidthpart(str, width) abort
|
function! s:strwidthpart(str, width) abort
|
||||||
if a:width <= 0
|
let str = tr(a:str, "\t", ' ')
|
||||||
return ''
|
let vcol = a:width + 2
|
||||||
endif
|
return matchstr(str, '.*\%<' . (vcol < 0 ? 0 : vcol) . 'v')
|
||||||
let strarr = split(a:str, '\zs')
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
let index = len(strarr)
|
|
||||||
let diff = (index + 1) / 2
|
|
||||||
let rightindex = index - 1
|
|
||||||
while width > a:width
|
|
||||||
let index = max([rightindex - diff + 1, 0])
|
|
||||||
let partwidth = s:wcswidth(join(strarr[(index):(rightindex)], ''))
|
|
||||||
if width - partwidth >= a:width || diff <= 1
|
|
||||||
let width -= partwidth
|
|
||||||
let rightindex = index - 1
|
|
||||||
endif
|
|
||||||
if diff > 1
|
|
||||||
let diff = diff / 2
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return index ? join(strarr[:index - 1], '') : ''
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:strwidthpart_reverse(str, width) abort
|
function! s:strwidthpart_reverse(str, width) abort
|
||||||
if a:width <= 0
|
let str = tr(a:str, "\t", ' ')
|
||||||
return ''
|
let vcol = s:wcswidth(str) - a:width
|
||||||
endif
|
return matchstr(str, '\%>' . (vcol < 0 ? 0 : vcol) . 'v.*')
|
||||||
let strarr = split(a:str, '\zs')
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
let strlen = len(strarr)
|
|
||||||
let diff = (strlen + 1) / 2
|
|
||||||
let leftindex = 0
|
|
||||||
let index = -1
|
|
||||||
while width > a:width
|
|
||||||
let index = min([leftindex + diff, strlen]) - 1
|
|
||||||
let partwidth = s:wcswidth(join(strarr[(leftindex):(index)], ''))
|
|
||||||
if width - partwidth >= a:width || diff <= 1
|
|
||||||
let width -= partwidth
|
|
||||||
let leftindex = index + 1
|
|
||||||
endif
|
|
||||||
if diff > 1
|
|
||||||
let diff = diff / 2
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return index < strlen ? join(strarr[(index + 1):], '') : ''
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if v:version >= 703
|
if v:version >= 703
|
||||||
" Use builtin function.
|
" Use builtin function.
|
||||||
function! s:wcswidth(str) abort
|
let s:wcswidth = function('strwidth')
|
||||||
return strwidth(a:str)
|
|
||||||
endfunction
|
|
||||||
else
|
else
|
||||||
function! s:wcswidth(str) abort
|
function! s:wcswidth(str) abort
|
||||||
if a:str =~# '^[\x00-\x7f]*$'
|
if a:str =~# '^[\x00-\x7f]*$'
|
||||||
@@ -564,9 +544,88 @@ else
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
function! s:remove_ansi_sequences(text) abort
|
||||||
|
return substitute(a:text, '\e\[\%(\%(\d\+;\)*\d\+\)\?[mK]', '', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:escape_pattern(str) abort
|
||||||
|
" escape characters for no-magic
|
||||||
|
return escape(a:str, '^$~.*[]\')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:unescape_pattern(str) abort
|
||||||
|
" unescape characters for no-magic
|
||||||
|
return s:unescape(a:str, '^$~.*[]\')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:unescape(str, chars) abort
|
||||||
|
let chars = map(split(a:chars, '\zs'), 'escape(v:val, ''^$~.*[]\'')')
|
||||||
|
return substitute(a:str, '\\\(' . join(chars, '\|') . '\)', '\1', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:iconv(expr, from, to) abort
|
||||||
|
if a:from ==# '' || a:to ==# '' || a:from ==? a:to
|
||||||
|
return a:expr
|
||||||
|
endif
|
||||||
|
let result = iconv(a:expr, a:from, a:to)
|
||||||
|
return empty(result) ? a:expr : result
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" A definition of a TEXT file is "A file that contains characters organized
|
||||||
|
" into one or more lines."
|
||||||
|
" A definition of a LINE is "A sequence of zero or more non- <newline>s
|
||||||
|
" plus a terminating <newline>"
|
||||||
|
" That's why {stdin} always ends with <newline> ideally. However, there are
|
||||||
|
" some programs which does not follow the POSIX rule and a Vim's way to join
|
||||||
|
" List into TEXT; join({text}, "\n"); does not add <newline> to the end of
|
||||||
|
" the last line.
|
||||||
|
" That's why add a trailing <newline> if it does not exist.
|
||||||
|
" REF:
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
|
||||||
|
" :help split()
|
||||||
|
" NOTE:
|
||||||
|
" it does nothing if the text is a correct POSIX text
|
||||||
|
function! s:repair_posix_text(text, ...) abort
|
||||||
|
let newline = get(a:000, 0, "\n")
|
||||||
|
return a:text =~# '\n$' ? a:text : a:text . newline
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" A definition of a TEXT file is "A file that contains characters organized
|
||||||
|
" into one or more lines."
|
||||||
|
" A definition of a LINE is "A sequence of zero or more non- <newline>s
|
||||||
|
" plus a terminating <newline>"
|
||||||
|
" REF:
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
|
||||||
|
function! s:join_posix_lines(lines, ...) abort
|
||||||
|
let newline = get(a:000, 0, "\n")
|
||||||
|
return join(a:lines, newline) . newline
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" A definition of a TEXT file is "A file that contains characters organized
|
||||||
|
" into one or more lines."
|
||||||
|
" A definition of a LINE is "A sequence of zero or more non- <newline>s
|
||||||
|
" plus a terminating <newline>"
|
||||||
|
" TEXT into List; split({text}, '\r\?\n', 1); add an extra empty line at the
|
||||||
|
" end of List because the end of TEXT ends with <newline> and keepempty=1 is
|
||||||
|
" specified. (btw. keepempty=0 cannot be used because it will remove
|
||||||
|
" emptylines in the head and the tail).
|
||||||
|
" That's why removing a trailing <newline> before proceeding to 'split' is required
|
||||||
|
" REF:
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
|
||||||
|
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
|
||||||
|
function! s:split_posix_text(text, ...) abort
|
||||||
|
let newline = get(a:000, 0, '\r\?\n')
|
||||||
|
let text = substitute(a:text, newline . '$', '', '')
|
||||||
|
return split(text, newline, 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
" vim:set et ts=2 sts=2 sw=2 tw=0:
|
" vim:set et ts=2 sts=2 sw=2 tw=0:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,389 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
if v:version ># 703 ||
|
|
||||||
\ (v:version is 703 && has('patch465'))
|
|
||||||
function! s:glob(expr) abort
|
|
||||||
return glob(a:expr, 1, 1)
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:glob(expr) abort
|
|
||||||
let R = glob(a:expr, 1)
|
|
||||||
return split(R, '\n')
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:globpath(path, expr) abort
|
|
||||||
let R = globpath(a:path, a:expr, 1)
|
|
||||||
return split(R, '\n')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Wrapper functions for type().
|
|
||||||
let [
|
|
||||||
\ s:__TYPE_NUMBER,
|
|
||||||
\ s:__TYPE_STRING,
|
|
||||||
\ s:__TYPE_FUNCREF,
|
|
||||||
\ s:__TYPE_LIST,
|
|
||||||
\ s:__TYPE_DICT,
|
|
||||||
\ s:__TYPE_FLOAT] = [
|
|
||||||
\ type(3),
|
|
||||||
\ type(""),
|
|
||||||
\ type(function('tr')),
|
|
||||||
\ type([]),
|
|
||||||
\ type({}),
|
|
||||||
\ has('float') ? type(str2float('0')) : -1]
|
|
||||||
" __TYPE_FLOAT = -1 when -float
|
|
||||||
" This doesn't match to anything.
|
|
||||||
|
|
||||||
" Number or Float
|
|
||||||
function! s:is_numeric(Value) abort
|
|
||||||
let _ = type(a:Value)
|
|
||||||
return _ ==# s:__TYPE_NUMBER
|
|
||||||
\ || _ ==# s:__TYPE_FLOAT
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Number
|
|
||||||
function! s:is_number(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_NUMBER
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Float
|
|
||||||
function! s:is_float(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_FLOAT
|
|
||||||
endfunction
|
|
||||||
" String
|
|
||||||
function! s:is_string(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_STRING
|
|
||||||
endfunction
|
|
||||||
" Funcref
|
|
||||||
function! s:is_funcref(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_FUNCREF
|
|
||||||
endfunction
|
|
||||||
" List
|
|
||||||
function! s:is_list(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_LIST
|
|
||||||
endfunction
|
|
||||||
" Dictionary
|
|
||||||
function! s:is_dict(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_DICT
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:truncate_skipping(str, max, footer_width, separator) abort
|
|
||||||
call s:_warn_deprecated("truncate_skipping", "Data.String.truncate_skipping")
|
|
||||||
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
if width <= a:max
|
|
||||||
let ret = a:str
|
|
||||||
else
|
|
||||||
let header_width = a:max - s:wcswidth(a:separator) - a:footer_width
|
|
||||||
let ret = s:strwidthpart(a:str, header_width) . a:separator
|
|
||||||
\ . s:strwidthpart_reverse(a:str, a:footer_width)
|
|
||||||
endif
|
|
||||||
|
|
||||||
return s:truncate(ret, a:max)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:truncate(str, width) abort
|
|
||||||
" Original function is from mattn.
|
|
||||||
" http://github.com/mattn/googlereader-vim/tree/master
|
|
||||||
|
|
||||||
call s:_warn_deprecated("truncate", "Data.String.truncate")
|
|
||||||
|
|
||||||
if a:str =~# '^[\x00-\x7f]*$'
|
|
||||||
return len(a:str) < a:width ?
|
|
||||||
\ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width)
|
|
||||||
endif
|
|
||||||
|
|
||||||
let ret = a:str
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
if width > a:width
|
|
||||||
let ret = s:strwidthpart(ret, a:width)
|
|
||||||
let width = s:wcswidth(ret)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if width < a:width
|
|
||||||
let ret .= repeat(' ', a:width - width)
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ret
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:strwidthpart(str, width) abort
|
|
||||||
call s:_warn_deprecated("strwidthpart", "Data.String.strwidthpart")
|
|
||||||
|
|
||||||
if a:width <= 0
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
let ret = a:str
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
while width > a:width
|
|
||||||
let char = matchstr(ret, '.$')
|
|
||||||
let ret = ret[: -1 - len(char)]
|
|
||||||
let width -= s:wcswidth(char)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return ret
|
|
||||||
endfunction
|
|
||||||
function! s:strwidthpart_reverse(str, width) abort
|
|
||||||
call s:_warn_deprecated("strwidthpart_reverse", "Data.String.strwidthpart_reverse")
|
|
||||||
|
|
||||||
if a:width <= 0
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
let ret = a:str
|
|
||||||
let width = s:wcswidth(a:str)
|
|
||||||
while width > a:width
|
|
||||||
let char = matchstr(ret, '^.')
|
|
||||||
let ret = ret[len(char) :]
|
|
||||||
let width -= s:wcswidth(char)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return ret
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if v:version >= 703
|
|
||||||
" Use builtin function.
|
|
||||||
function! s:wcswidth(str) abort
|
|
||||||
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth")
|
|
||||||
return strwidth(a:str)
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:wcswidth(str) abort
|
|
||||||
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth")
|
|
||||||
|
|
||||||
if a:str =~# '^[\x00-\x7f]*$'
|
|
||||||
return strlen(a:str)
|
|
||||||
end
|
|
||||||
|
|
||||||
let mx_first = '^\(.\)'
|
|
||||||
let str = a:str
|
|
||||||
let width = 0
|
|
||||||
while 1
|
|
||||||
let ucs = char2nr(substitute(str, mx_first, '\1', ''))
|
|
||||||
if ucs == 0
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
let width += s:_wcwidth(ucs)
|
|
||||||
let str = substitute(str, mx_first, '', '')
|
|
||||||
endwhile
|
|
||||||
return width
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" UTF-8 only.
|
|
||||||
function! s:_wcwidth(ucs) abort
|
|
||||||
let ucs = a:ucs
|
|
||||||
if (ucs >= 0x1100
|
|
||||||
\ && (ucs <= 0x115f
|
|
||||||
\ || ucs == 0x2329
|
|
||||||
\ || ucs == 0x232a
|
|
||||||
\ || (ucs >= 0x2e80 && ucs <= 0xa4cf
|
|
||||||
\ && ucs != 0x303f)
|
|
||||||
\ || (ucs >= 0xac00 && ucs <= 0xd7a3)
|
|
||||||
\ || (ucs >= 0xf900 && ucs <= 0xfaff)
|
|
||||||
\ || (ucs >= 0xfe30 && ucs <= 0xfe6f)
|
|
||||||
\ || (ucs >= 0xff00 && ucs <= 0xff60)
|
|
||||||
\ || (ucs >= 0xffe0 && ucs <= 0xffe6)
|
|
||||||
\ || (ucs >= 0x20000 && ucs <= 0x2fffd)
|
|
||||||
\ || (ucs >= 0x30000 && ucs <= 0x3fffd)
|
|
||||||
\ ))
|
|
||||||
return 2
|
|
||||||
endif
|
|
||||||
return 1
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95')
|
|
||||||
let s:is_cygwin = has('win32unix')
|
|
||||||
let s:is_mac = !s:is_windows && !s:is_cygwin
|
|
||||||
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
|
|
||||||
\ (!isdirectory('/proc') && executable('sw_vers')))
|
|
||||||
let s:is_unix = has('unix')
|
|
||||||
|
|
||||||
function! s:is_windows() abort
|
|
||||||
return s:is_windows
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:is_cygwin() abort
|
|
||||||
return s:is_cygwin
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:is_mac() abort
|
|
||||||
return s:is_mac
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:is_unix() abort
|
|
||||||
return s:is_unix
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_warn_deprecated(name, alternative) abort
|
|
||||||
try
|
|
||||||
echohl Error
|
|
||||||
echomsg "Prelude." . a:name . " is deprecated! Please use " . a:alternative . " instead."
|
|
||||||
finally
|
|
||||||
echohl None
|
|
||||||
endtry
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:smart_execute_command(action, word) abort
|
|
||||||
execute a:action . ' ' . (a:word == '' ? '' : '`=a:word`')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:escape_file_searching(buffer_name) abort
|
|
||||||
return escape(a:buffer_name, '*[]?{}, ')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:escape_pattern(str) abort
|
|
||||||
return escape(a:str, '~"\.^$[]*')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:getchar(...) abort
|
|
||||||
let c = call('getchar', a:000)
|
|
||||||
return type(c) == type(0) ? nr2char(c) : c
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:getchar_safe(...) abort
|
|
||||||
let c = s:input_helper('getchar', a:000)
|
|
||||||
return type(c) == type("") ? c : nr2char(c)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:input_safe(...) abort
|
|
||||||
return s:input_helper('input', a:000)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:input_helper(funcname, args) abort
|
|
||||||
let success = 0
|
|
||||||
if inputsave() !=# success
|
|
||||||
throw 'vital: Prelude: inputsave() failed'
|
|
||||||
endif
|
|
||||||
try
|
|
||||||
return call(a:funcname, a:args)
|
|
||||||
finally
|
|
||||||
if inputrestore() !=# success
|
|
||||||
throw 'vital: Prelude: inputrestore() failed'
|
|
||||||
endif
|
|
||||||
endtry
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:set_default(var, val) abort
|
|
||||||
if !exists(a:var) || type({a:var}) != type(a:val)
|
|
||||||
let {a:var} = a:val
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:substitute_path_separator(path) abort
|
|
||||||
return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:path2directory(path) abort
|
|
||||||
return s:substitute_path_separator(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':p:h'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_path2project_directory_git(path) abort
|
|
||||||
let parent = a:path
|
|
||||||
|
|
||||||
while 1
|
|
||||||
let path = parent . '/.git'
|
|
||||||
if isdirectory(path) || filereadable(path)
|
|
||||||
return parent
|
|
||||||
endif
|
|
||||||
let next = fnamemodify(parent, ':h')
|
|
||||||
if next == parent
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
let parent = next
|
|
||||||
endwhile
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_path2project_directory_svn(path) abort
|
|
||||||
let search_directory = a:path
|
|
||||||
let directory = ''
|
|
||||||
|
|
||||||
let find_directory = s:escape_file_searching(search_directory)
|
|
||||||
let d = finddir('.svn', find_directory . ';')
|
|
||||||
if d == ''
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
let directory = fnamemodify(d, ':p:h:h')
|
|
||||||
|
|
||||||
" Search parent directories.
|
|
||||||
let parent_directory = s:path2directory(
|
|
||||||
\ fnamemodify(directory, ':h'))
|
|
||||||
|
|
||||||
if parent_directory != ''
|
|
||||||
let d = finddir('.svn', parent_directory . ';')
|
|
||||||
if d != ''
|
|
||||||
let directory = s:_path2project_directory_svn(parent_directory)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return directory
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:_path2project_directory_others(vcs, path) abort
|
|
||||||
let vcs = a:vcs
|
|
||||||
let search_directory = a:path
|
|
||||||
|
|
||||||
let find_directory = s:escape_file_searching(search_directory)
|
|
||||||
let d = finddir(vcs, find_directory . ';')
|
|
||||||
if d == ''
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
return fnamemodify(d, ':p:h:h')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:path2project_directory(path, ...) abort
|
|
||||||
let is_allow_empty = get(a:000, 0, 0)
|
|
||||||
let search_directory = s:path2directory(a:path)
|
|
||||||
let directory = ''
|
|
||||||
|
|
||||||
" Search VCS directory.
|
|
||||||
for vcs in ['.git', '.bzr', '.hg', '.svn']
|
|
||||||
if vcs ==# '.git'
|
|
||||||
let directory = s:_path2project_directory_git(search_directory)
|
|
||||||
elseif vcs ==# '.svn'
|
|
||||||
let directory = s:_path2project_directory_svn(search_directory)
|
|
||||||
else
|
|
||||||
let directory = s:_path2project_directory_others(vcs, search_directory)
|
|
||||||
endif
|
|
||||||
if directory != ''
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" Search project file.
|
|
||||||
if directory == ''
|
|
||||||
for d in ['build.xml', 'prj.el', '.project', 'pom.xml', 'package.json',
|
|
||||||
\ 'Makefile', 'configure', 'Rakefile', 'NAnt.build',
|
|
||||||
\ 'P4CONFIG', 'tags', 'gtags']
|
|
||||||
let d = findfile(d, s:escape_file_searching(search_directory) . ';')
|
|
||||||
if d != ''
|
|
||||||
let directory = fnamemodify(d, ':p:h')
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
if directory == ''
|
|
||||||
" Search /src/ directory.
|
|
||||||
let base = s:substitute_path_separator(search_directory)
|
|
||||||
if base =~# '/src/'
|
|
||||||
let directory = base[: strridx(base, '/src/') + 3]
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if directory == '' && !is_allow_empty
|
|
||||||
" Use original path.
|
|
||||||
let directory = search_directory
|
|
||||||
endif
|
|
||||||
|
|
||||||
return s:substitute_path_separator(directory)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
||||||
|
|
||||||
" vim:set et ts=2 sts=2 sw=2 tw=0:
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
" ___vital___
|
||||||
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
execute join(['function! vital#_crystal#Process#import() abort', printf("return map({'shellescape': '', 'has_vimproc': '', 'system': '', 'iconv': '', 'spawn': '', 'get_last_status': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
|
delfunction s:_SID
|
||||||
|
" ___vital___
|
||||||
" TODO: move all comments to doc file.
|
" TODO: move all comments to doc file.
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
@@ -21,62 +30,36 @@ let s:need_trans = v:version < 704 || (v:version == 704 && !has('patch122'))
|
|||||||
|
|
||||||
let s:TYPE_DICT = type({})
|
let s:TYPE_DICT = type({})
|
||||||
let s:TYPE_LIST = type([])
|
let s:TYPE_LIST = type([])
|
||||||
let s:TYPE_STRING = type("")
|
let s:TYPE_STRING = type('')
|
||||||
|
|
||||||
|
|
||||||
" Execute program in the background from Vim.
|
|
||||||
" Return an empty string always.
|
|
||||||
"
|
|
||||||
" If a:expr is a List, shellescape() each argument.
|
|
||||||
" If a:expr is a String, the arguments are passed as-is.
|
|
||||||
"
|
|
||||||
" Windows:
|
|
||||||
" Using :!start , execute program without via cmd.exe.
|
|
||||||
" Spawning 'expr' with 'noshellslash'
|
|
||||||
" keep special characters from unwanted expansion.
|
|
||||||
" (see :help shellescape())
|
|
||||||
"
|
|
||||||
" Unix:
|
|
||||||
" using :! , execute program in the background by shell.
|
|
||||||
function! s:spawn(expr, ...) abort
|
function! s:spawn(expr, ...) abort
|
||||||
let shellslash = 0
|
if type(a:expr) is s:TYPE_LIST
|
||||||
if s:is_windows
|
let special = 1
|
||||||
let shellslash = &l:shellslash
|
let cmdline = join(map(a:expr, 's:shellescape(v:val, special)'), ' ')
|
||||||
setlocal noshellslash
|
elseif type(a:expr) is s:TYPE_STRING
|
||||||
|
let cmdline = a:expr
|
||||||
|
if a:0 && a:1
|
||||||
|
" for :! command
|
||||||
|
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
throw 'vital: Process: invalid argument (value type:' . type(a:expr) . ')'
|
||||||
|
endif
|
||||||
|
if s:is_windows
|
||||||
|
silent execute '!start' cmdline
|
||||||
|
else
|
||||||
|
silent execute '!' cmdline '&'
|
||||||
endif
|
endif
|
||||||
try
|
|
||||||
if type(a:expr) is s:TYPE_LIST
|
|
||||||
let special = 1
|
|
||||||
let cmdline = join(map(a:expr, 'shellescape(v:val, special)'), ' ')
|
|
||||||
elseif type(a:expr) is s:TYPE_STRING
|
|
||||||
let cmdline = a:expr
|
|
||||||
if a:0 && a:1
|
|
||||||
" for :! command
|
|
||||||
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g')
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
throw 'Process.spawn(): invalid argument (value type:'.type(a:expr).')'
|
|
||||||
endif
|
|
||||||
if s:is_windows
|
|
||||||
silent execute '!start' cmdline
|
|
||||||
else
|
|
||||||
silent execute '!' cmdline '&'
|
|
||||||
endif
|
|
||||||
finally
|
|
||||||
if s:is_windows
|
|
||||||
let &l:shellslash = shellslash
|
|
||||||
endif
|
|
||||||
endtry
|
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" iconv() wrapper for safety.
|
" iconv() wrapper for safety.
|
||||||
function! s:iconv(expr, from, to) abort
|
function! s:iconv(expr, from, to) abort
|
||||||
if a:from == '' || a:to == '' || a:from ==? a:to
|
if a:from ==# '' || a:to ==# '' || a:from ==? a:to
|
||||||
return a:expr
|
return a:expr
|
||||||
endif
|
endif
|
||||||
let result = iconv(a:expr, a:from, a:to)
|
let result = iconv(a:expr, a:from, a:to)
|
||||||
return result != '' ? result : a:expr
|
return result !=# '' ? result : a:expr
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check vimproc.
|
" Check vimproc.
|
||||||
@@ -128,7 +111,7 @@ function! s:system(str, ...) abort
|
|||||||
elseif type(a:1) is s:TYPE_STRING
|
elseif type(a:1) is s:TYPE_STRING
|
||||||
let args += [s:iconv(a:1, &encoding, 'char')]
|
let args += [s:iconv(a:1, &encoding, 'char')]
|
||||||
else
|
else
|
||||||
throw 'Process.system(): invalid argument (value type:'.type(a:1).')'
|
throw 'vital: Process: invalid argument (value type:' . type(a:1) . ')'
|
||||||
endif
|
endif
|
||||||
elseif a:0 >= 2
|
elseif a:0 >= 2
|
||||||
" {command} [, {input} [, {timeout}]]
|
" {command} [, {input} [, {timeout}]]
|
||||||
@@ -145,13 +128,16 @@ function! s:system(str, ...) abort
|
|||||||
elseif type(a:str) is s:TYPE_STRING
|
elseif type(a:str) is s:TYPE_STRING
|
||||||
let command = a:str
|
let command = a:str
|
||||||
else
|
else
|
||||||
throw 'Process.system(): invalid argument (value type:'.type(a:str).')'
|
throw 'vital: Process: invalid argument (value type:' . type(a:str) . ')'
|
||||||
endif
|
endif
|
||||||
if s:need_trans
|
if s:need_trans
|
||||||
let command = s:iconv(command, &encoding, 'char')
|
let command = s:iconv(command, &encoding, 'char')
|
||||||
endif
|
endif
|
||||||
let args = [command] + args
|
let args = [command] + args
|
||||||
if background && (use_vimproc || !s:is_windows)
|
if background && (use_vimproc || !s:is_windows)
|
||||||
|
if has('nvim')
|
||||||
|
throw "vital: Process: neovim's system() doesn't support background(&) process (cmdline:" . string(a:str) . ')'
|
||||||
|
endif
|
||||||
let args[0] = args[0] . ' &'
|
let args[0] = args[0] . ' &'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -167,8 +153,14 @@ function! s:get_last_status() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if s:is_windows
|
if s:is_windows
|
||||||
function! s:shellescape(command) abort
|
function! s:shellescape(...) abort
|
||||||
return substitute(a:command, '[&()[\]{}^=;!''+,`~]', '^\0', 'g')
|
try
|
||||||
|
let shellslash = &shellslash
|
||||||
|
set noshellslash
|
||||||
|
return call('shellescape', a:000)
|
||||||
|
finally
|
||||||
|
let &shellslash = shellslash
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function! s:shellescape(...) abort
|
function! s:shellescape(...) abort
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
" ___vital___
|
||||||
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
execute join(['function! vital#_crystal#Web#JSON#import() abort', printf("return map({'decode': '', '_vital_depends': '', '_vital_created': '', 'encode': '', '_vital_loaded': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
|
delfunction s:_SID
|
||||||
|
" ___vital___
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
@@ -15,11 +24,6 @@ function! s:_null() abort
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:const = {}
|
|
||||||
let s:const.true = function('s:_true')
|
|
||||||
let s:const.false = function('s:_false')
|
|
||||||
let s:const.null = function('s:_null')
|
|
||||||
|
|
||||||
function! s:_resolve(val, prefix) abort
|
function! s:_resolve(val, prefix) abort
|
||||||
let t = type(a:val)
|
let t = type(a:val)
|
||||||
if t == type('')
|
if t == type('')
|
||||||
@@ -36,6 +40,13 @@ endfunction
|
|||||||
|
|
||||||
function! s:_vital_created(module) abort
|
function! s:_vital_created(module) abort
|
||||||
" define constant variables
|
" define constant variables
|
||||||
|
if !exists('s:const')
|
||||||
|
let s:const = {}
|
||||||
|
let s:const.true = function('s:_true')
|
||||||
|
let s:const.false = function('s:_false')
|
||||||
|
let s:const.null = function('s:_null')
|
||||||
|
lockvar s:const
|
||||||
|
endif
|
||||||
call extend(a:module, s:const)
|
call extend(a:module, s:const)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -55,7 +66,7 @@ function! s:decode(json, ...) abort
|
|||||||
let settings = extend({
|
let settings = extend({
|
||||||
\ 'use_token': 0,
|
\ 'use_token': 0,
|
||||||
\}, get(a:000, 0, {}))
|
\}, get(a:000, 0, {}))
|
||||||
let json = iconv(a:json, "utf-8", &encoding)
|
let json = iconv(a:json, 'utf-8', &encoding)
|
||||||
let json = join(split(json, "\n"), '')
|
let json = join(split(json, "\n"), '')
|
||||||
let json = substitute(json, '\\u34;', '\\"', 'g')
|
let json = substitute(json, '\\u34;', '\\"', 'g')
|
||||||
let json = substitute(json, '\\u\(\x\x\x\x\)', '\=s:string.nr2enc_char("0x".submatch(1))', 'g')
|
let json = substitute(json, '\\u\(\x\x\x\x\)', '\=s:string.nr2enc_char("0x".submatch(1))', 'g')
|
||||||
@@ -75,7 +86,11 @@ endfunction
|
|||||||
" @vimlint(EVL102, 0, l:true)
|
" @vimlint(EVL102, 0, l:true)
|
||||||
" @vimlint(EVL102, 0, l:false)
|
" @vimlint(EVL102, 0, l:false)
|
||||||
|
|
||||||
function! s:encode(val) abort
|
function! s:encode(val, ...) abort
|
||||||
|
let settings = extend({
|
||||||
|
\ 'indent': 0,
|
||||||
|
\}, get(a:000, 0, {})
|
||||||
|
\)
|
||||||
if type(a:val) == 0
|
if type(a:val) == 0
|
||||||
return a:val
|
return a:val
|
||||||
elseif type(a:val) == 1
|
elseif type(a:val) == 1
|
||||||
@@ -83,7 +98,7 @@ function! s:encode(val) abort
|
|||||||
let json = substitute(json, "\r", '\\r', 'g')
|
let json = substitute(json, "\r", '\\r', 'g')
|
||||||
let json = substitute(json, "\n", '\\n', 'g')
|
let json = substitute(json, "\n", '\\n', 'g')
|
||||||
let json = substitute(json, "\t", '\\t', 'g')
|
let json = substitute(json, "\t", '\\t', 'g')
|
||||||
return iconv(json, &encoding, "utf-8")
|
return iconv(json, &encoding, 'utf-8')
|
||||||
elseif type(a:val) == 2
|
elseif type(a:val) == 2
|
||||||
if s:const.true == a:val
|
if s:const.true == a:val
|
||||||
return 'true'
|
return 'true'
|
||||||
@@ -96,14 +111,69 @@ function! s:encode(val) abort
|
|||||||
return string(a:val)
|
return string(a:val)
|
||||||
endif
|
endif
|
||||||
elseif type(a:val) == 3
|
elseif type(a:val) == 3
|
||||||
return '[' . join(map(copy(a:val), 's:encode(v:val)'), ',') . ']'
|
return s:_encode_list(a:val, settings)
|
||||||
elseif type(a:val) == 4
|
elseif type(a:val) == 4
|
||||||
return '{' . join(map(keys(a:val), 's:encode(v:val).":".s:encode(a:val[v:val])'), ',') . '}'
|
return s:_encode_dict(a:val, settings)
|
||||||
else
|
else
|
||||||
return string(a:val)
|
return string(a:val)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" @vimlint(EVL102, 1, l:ns)
|
||||||
|
function! s:_encode_list(val, settings) abort
|
||||||
|
if empty(a:val)
|
||||||
|
return '[]'
|
||||||
|
elseif !a:settings.indent
|
||||||
|
let encoded_candidates = map(copy(a:val), 's:encode(v:val, a:settings)')
|
||||||
|
return printf('[%s]', join(encoded_candidates, ','))
|
||||||
|
else
|
||||||
|
let previous_indent = get(a:settings, '_previous_indent')
|
||||||
|
let indent = previous_indent + a:settings.indent
|
||||||
|
let ns = extend(copy(a:settings), {
|
||||||
|
\ '_previous_indent': indent,
|
||||||
|
\})
|
||||||
|
let encoded_candidates = map(
|
||||||
|
\ copy(a:val),
|
||||||
|
\ printf('''%s'' . s:encode(v:val, ns)', repeat(' ', indent)),
|
||||||
|
\)
|
||||||
|
return printf(
|
||||||
|
\ "[\n%s\n%s]",
|
||||||
|
\ join(encoded_candidates, ",\n"),
|
||||||
|
\ repeat(' ', previous_indent)
|
||||||
|
\)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" @vimlint(EVL102, 0, l:ns)
|
||||||
|
|
||||||
|
" @vimlint(EVL102, 1, l:ns)
|
||||||
|
function! s:_encode_dict(val, settings) abort
|
||||||
|
if empty(a:val)
|
||||||
|
return '{}'
|
||||||
|
elseif !a:settings.indent
|
||||||
|
let encoded_candidates = map(keys(a:val),
|
||||||
|
\ 's:encode(v:val, a:settings) . '':'' . s:encode(a:val[v:val], a:settings)'
|
||||||
|
\)
|
||||||
|
return printf('{%s}', join(encoded_candidates, ','))
|
||||||
|
else
|
||||||
|
let previous_indent = get(a:settings, '_previous_indent')
|
||||||
|
let indent = previous_indent + a:settings.indent
|
||||||
|
let ns = extend(copy(a:settings), {
|
||||||
|
\ '_previous_indent': indent,
|
||||||
|
\})
|
||||||
|
let encoded_candidates = map(keys(a:val),
|
||||||
|
\ printf(
|
||||||
|
\ '''%s'' . s:encode(v:val, ns) . '': '' . s:encode(a:val[v:val], ns)',
|
||||||
|
\ repeat(' ', indent),
|
||||||
|
\ ),
|
||||||
|
\)
|
||||||
|
return printf("{\n%s\n%s}",
|
||||||
|
\ join(encoded_candidates, ",\n"),
|
||||||
|
\ repeat(' ', previous_indent),
|
||||||
|
\)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" @vimlint(EVL102, 0, l:ns)
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
|||||||
332
autoload/vital/crystal.vim
Normal file
332
autoload/vital/crystal.vim
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
let s:plugin_name = expand('<sfile>:t:r')
|
||||||
|
let s:vital_base_dir = expand('<sfile>:h')
|
||||||
|
let s:project_root = expand('<sfile>:h:h:h')
|
||||||
|
let s:is_vital_vim = s:plugin_name is# 'vital'
|
||||||
|
|
||||||
|
let s:loaded = {}
|
||||||
|
let s:cache_sid = {}
|
||||||
|
|
||||||
|
" function() wrapper
|
||||||
|
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||||
|
function! s:_function(fstr) abort
|
||||||
|
return function(a:fstr)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:_SID() abort
|
||||||
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
|
endfunction
|
||||||
|
let s:_s = '<SNR>' . s:_SID() . '_'
|
||||||
|
function! s:_function(fstr) abort
|
||||||
|
return function(substitute(a:fstr, 's:', s:_s, 'g'))
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! vital#{s:plugin_name}#new() abort
|
||||||
|
return s:new(s:plugin_name)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! vital#{s:plugin_name}#import(...) abort
|
||||||
|
if !exists('s:V')
|
||||||
|
let s:V = s:new(s:plugin_name)
|
||||||
|
endif
|
||||||
|
return call(s:V.import, a:000, s:V)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:Vital = {}
|
||||||
|
|
||||||
|
function! s:new(plugin_name) abort
|
||||||
|
let base = deepcopy(s:Vital)
|
||||||
|
let base._plugin_name = a:plugin_name
|
||||||
|
return base
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:vital_files() abort
|
||||||
|
if !exists('s:vital_files')
|
||||||
|
let s:vital_files = map(
|
||||||
|
\ s:is_vital_vim ? s:_global_vital_files() : s:_self_vital_files(),
|
||||||
|
\ 'fnamemodify(v:val, ":p:gs?[\\\\/]?/?")')
|
||||||
|
endif
|
||||||
|
return copy(s:vital_files)
|
||||||
|
endfunction
|
||||||
|
let s:Vital.vital_files = s:_function('s:vital_files')
|
||||||
|
|
||||||
|
function! s:import(name, ...) abort dict
|
||||||
|
let target = {}
|
||||||
|
let functions = []
|
||||||
|
for a in a:000
|
||||||
|
if type(a) == type({})
|
||||||
|
let target = a
|
||||||
|
elseif type(a) == type([])
|
||||||
|
let functions = a
|
||||||
|
endif
|
||||||
|
unlet a
|
||||||
|
endfor
|
||||||
|
let module = self._import(a:name)
|
||||||
|
if empty(functions)
|
||||||
|
call extend(target, module, 'keep')
|
||||||
|
else
|
||||||
|
for f in functions
|
||||||
|
if has_key(module, f) && !has_key(target, f)
|
||||||
|
let target[f] = module[f]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return target
|
||||||
|
endfunction
|
||||||
|
let s:Vital.import = s:_function('s:import')
|
||||||
|
|
||||||
|
function! s:load(...) abort dict
|
||||||
|
for arg in a:000
|
||||||
|
let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg]
|
||||||
|
let target = split(join(as, ''), '\W\+')
|
||||||
|
let dict = self
|
||||||
|
let dict_type = type({})
|
||||||
|
while !empty(target)
|
||||||
|
let ns = remove(target, 0)
|
||||||
|
if !has_key(dict, ns)
|
||||||
|
let dict[ns] = {}
|
||||||
|
endif
|
||||||
|
if type(dict[ns]) == dict_type
|
||||||
|
let dict = dict[ns]
|
||||||
|
else
|
||||||
|
unlet dict
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
if exists('dict')
|
||||||
|
call extend(dict, self._import(name))
|
||||||
|
endif
|
||||||
|
unlet arg
|
||||||
|
endfor
|
||||||
|
return self
|
||||||
|
endfunction
|
||||||
|
let s:Vital.load = s:_function('s:load')
|
||||||
|
|
||||||
|
function! s:unload() abort dict
|
||||||
|
let s:loaded = {}
|
||||||
|
let s:cache_sid = {}
|
||||||
|
unlet! s:vital_files
|
||||||
|
endfunction
|
||||||
|
let s:Vital.unload = s:_function('s:unload')
|
||||||
|
|
||||||
|
function! s:exists(name) abort dict
|
||||||
|
if a:name !~# '\v^\u\w*%(\.\u\w*)*$'
|
||||||
|
throw 'vital: Invalid module name: ' . a:name
|
||||||
|
endif
|
||||||
|
return s:_module_path(a:name) isnot# ''
|
||||||
|
endfunction
|
||||||
|
let s:Vital.exists = s:_function('s:exists')
|
||||||
|
|
||||||
|
function! s:search(pattern) abort dict
|
||||||
|
let paths = s:_extract_files(a:pattern, self.vital_files())
|
||||||
|
let modules = sort(map(paths, 's:_file2module(v:val)'))
|
||||||
|
return s:_uniq(modules)
|
||||||
|
endfunction
|
||||||
|
let s:Vital.search = s:_function('s:search')
|
||||||
|
|
||||||
|
function! s:plugin_name() abort dict
|
||||||
|
return self._plugin_name
|
||||||
|
endfunction
|
||||||
|
let s:Vital.plugin_name = s:_function('s:plugin_name')
|
||||||
|
|
||||||
|
function! s:_self_vital_files() abort
|
||||||
|
let builtin = printf('%s/__%s__/', s:vital_base_dir, s:plugin_name)
|
||||||
|
let installed = printf('%s/_%s/', s:vital_base_dir, s:plugin_name)
|
||||||
|
let base = builtin . ',' . installed
|
||||||
|
return split(globpath(base, '**/*.vim', 1), "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_global_vital_files() abort
|
||||||
|
let pattern = 'autoload/vital/__*__/**/*.vim'
|
||||||
|
return split(globpath(&runtimepath, pattern, 1), "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_extract_files(pattern, files) abort
|
||||||
|
let tr = {'.': '/', '*': '[^/]*', '**': '.*'}
|
||||||
|
let target = substitute(a:pattern, '\.\|\*\*\?', '\=tr[submatch(0)]', 'g')
|
||||||
|
let regexp = printf('autoload/vital/[^/]\+/%s.vim$', target)
|
||||||
|
return filter(a:files, 'v:val =~# regexp')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_file2module(file) abort
|
||||||
|
let filename = fnamemodify(a:file, ':p:gs?[\\/]?/?')
|
||||||
|
let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$')
|
||||||
|
return join(split(tail, '[\\/]\+'), '.')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" @param {string} name e.g. Data.List
|
||||||
|
function! s:_import(name) abort dict
|
||||||
|
if has_key(s:loaded, a:name)
|
||||||
|
return copy(s:loaded[a:name])
|
||||||
|
endif
|
||||||
|
let module = self._get_module(a:name)
|
||||||
|
if has_key(module, '_vital_created')
|
||||||
|
call module._vital_created(module)
|
||||||
|
endif
|
||||||
|
let export_module = filter(copy(module), 'v:key =~# "^\\a"')
|
||||||
|
" Cache module before calling module.vital_loaded() to avoid cyclic
|
||||||
|
" dependences but remove the cache if module._vital_loaded() fails.
|
||||||
|
" let s:loaded[a:name] = export_module
|
||||||
|
let s:loaded[a:name] = export_module
|
||||||
|
if has_key(module, '_vital_loaded')
|
||||||
|
try
|
||||||
|
call module._vital_loaded(vital#{s:plugin_name}#new())
|
||||||
|
catch
|
||||||
|
unlet s:loaded[a:name]
|
||||||
|
throw 'vital: fail to call ._vital_loaded(): ' . v:exception
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
return copy(s:loaded[a:name])
|
||||||
|
endfunction
|
||||||
|
let s:Vital._import = s:_function('s:_import')
|
||||||
|
|
||||||
|
" s:_get_module() returns module object wihch has all script local functions.
|
||||||
|
function! s:_get_module(name) abort dict
|
||||||
|
let funcname = s:_import_func_name(self.plugin_name(), a:name)
|
||||||
|
try
|
||||||
|
return call(funcname, [])
|
||||||
|
catch /^Vim\%((\a\+)\)\?:E117/
|
||||||
|
return s:_get_builtin_module(a:name)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_get_builtin_module(name) abort
|
||||||
|
return s:sid2sfuncs(s:_module_sid(a:name))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if s:is_vital_vim
|
||||||
|
" For vital.vim, we can use s:_get_builtin_module directly
|
||||||
|
let s:Vital._get_module = s:_function('s:_get_builtin_module')
|
||||||
|
else
|
||||||
|
let s:Vital._get_module = s:_function('s:_get_module')
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:_import_func_name(plugin_name, module_name) abort
|
||||||
|
return printf('vital#_%s#%s#import', a:plugin_name, s:_dot_to_sharp(a:module_name))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_module_sid(name) abort
|
||||||
|
let path = s:_module_path(a:name)
|
||||||
|
if !filereadable(path)
|
||||||
|
throw 'vital: module not found: ' . a:name
|
||||||
|
endif
|
||||||
|
let vital_dir = s:is_vital_vim ? '__\w\+__' : printf('_\{1,2}%s\%%(__\)\?', s:plugin_name)
|
||||||
|
let base = join([vital_dir, ''], '[/\\]\+')
|
||||||
|
let p = base . substitute('' . a:name, '\.', '[/\\\\]\\+', 'g')
|
||||||
|
let sid = s:_sid(path, p)
|
||||||
|
if !sid
|
||||||
|
call s:_source(path)
|
||||||
|
let sid = s:_sid(path, p)
|
||||||
|
if !sid
|
||||||
|
throw printf('vital: cannot get <SID> from path: %s', path)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return sid
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_module_path(name) abort
|
||||||
|
return get(s:_extract_files(a:name, s:vital_files()), 0, '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_module_sid_base_dir() abort
|
||||||
|
return s:is_vital_vim ? &rtp : s:project_root
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_dot_to_sharp(name) abort
|
||||||
|
return substitute(a:name, '\.', '#', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:_source(path) abort
|
||||||
|
execute 'source' fnameescape(a:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" @vimlint(EVL102, 1, l:_)
|
||||||
|
" @vimlint(EVL102, 1, l:__)
|
||||||
|
function! s:_sid(path, filter_pattern) abort
|
||||||
|
let unified_path = s:_unify_path(a:path)
|
||||||
|
if has_key(s:cache_sid, unified_path)
|
||||||
|
return s:cache_sid[unified_path]
|
||||||
|
endif
|
||||||
|
for line in filter(split(s:_execute(':scriptnames'), "\n"), 'v:val =~# a:filter_pattern')
|
||||||
|
let [_, sid, path; __] = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$')
|
||||||
|
if s:_unify_path(path) is# unified_path
|
||||||
|
let s:cache_sid[unified_path] = sid
|
||||||
|
return s:cache_sid[unified_path]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" We want to use a execute() builtin function instead of s:_execute(),
|
||||||
|
" however there is a bug in execute().
|
||||||
|
" execute() returns empty string when it is called in
|
||||||
|
" completion function of user defined ex command.
|
||||||
|
" https://github.com/vim-jp/issues/issues/1129
|
||||||
|
function! s:_execute(cmd) abort
|
||||||
|
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
|
||||||
|
set verbose=0 verbosefile=
|
||||||
|
redir => res
|
||||||
|
silent! execute a:cmd
|
||||||
|
redir END
|
||||||
|
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
|
||||||
|
return res
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if filereadable(expand('<sfile>:r') . '.VIM') " is case-insensitive or not
|
||||||
|
let s:_unify_path_cache = {}
|
||||||
|
" resolve() is slow, so we cache results.
|
||||||
|
" Note: On windows, vim can't expand path names from 8.3 formats.
|
||||||
|
" So if getting full path via <sfile> and $HOME was set as 8.3 format,
|
||||||
|
" vital load duplicated scripts. Below's :~ avoid this issue.
|
||||||
|
function! s:_unify_path(path) abort
|
||||||
|
if has_key(s:_unify_path_cache, a:path)
|
||||||
|
return s:_unify_path_cache[a:path]
|
||||||
|
endif
|
||||||
|
let value = tolower(fnamemodify(resolve(fnamemodify(
|
||||||
|
\ a:path, ':p')), ':~:gs?[\\/]?/?'))
|
||||||
|
let s:_unify_path_cache[a:path] = value
|
||||||
|
return value
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:_unify_path(path) abort
|
||||||
|
return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?'))
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
" copied and modified from Vim.ScriptLocal
|
||||||
|
let s:SNR = join(map(range(len("\<SNR>")), '"[\\x" . printf("%0x", char2nr("\<SNR>"[v:val])) . "]"'), '')
|
||||||
|
function! s:sid2sfuncs(sid) abort
|
||||||
|
let fs = split(s:_execute(printf(':function /^%s%s_', s:SNR, a:sid)), "\n")
|
||||||
|
let r = {}
|
||||||
|
let pattern = printf('\m^function\s<SNR>%d_\zs\w\{-}\ze(', a:sid)
|
||||||
|
for fname in map(fs, 'matchstr(v:val, pattern)')
|
||||||
|
let r[fname] = function(s:_sfuncname(a:sid, fname))
|
||||||
|
endfor
|
||||||
|
return r
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"" Return funcname of script local functions with SID
|
||||||
|
function! s:_sfuncname(sid, funcname) abort
|
||||||
|
return printf('<SNR>%s_%s', a:sid, a:funcname)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists('*uniq')
|
||||||
|
function! s:_uniq(list) abort
|
||||||
|
return uniq(a:list)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:_uniq(list) abort
|
||||||
|
let i = len(a:list) - 1
|
||||||
|
while 0 < i
|
||||||
|
if a:list[i] ==# a:list[i - 1]
|
||||||
|
call remove(a:list, i)
|
||||||
|
endif
|
||||||
|
let i -= 1
|
||||||
|
endwhile
|
||||||
|
return a:list
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
10
autoload/vital/crystal.vital
Normal file
10
autoload/vital/crystal.vital
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
|
crystal
|
||||||
|
bee84ae23effb0510137ad177e98c94d8b3657a6
|
||||||
|
|
||||||
|
Process
|
||||||
|
Web.JSON
|
||||||
|
ColorEcho
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -62,7 +62,7 @@ let charset = [
|
|||||||
\ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ]
|
\ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ]
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
let autofill_tokens = ['on', 'off', 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo']
|
let autofill_tokens = ['on', 'off', 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'organization-title', 'username', 'new-password', 'current-password', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo', 'tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'email', 'impp']
|
||||||
|
|
||||||
" Attributes_and_Settings: {{{
|
" Attributes_and_Settings: {{{
|
||||||
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
|
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
|
||||||
@@ -82,6 +82,7 @@ let attributes_value = {
|
|||||||
\ 'action': ['URL', ''],
|
\ 'action': ['URL', ''],
|
||||||
\ 'allowfullscreen': ['Bool', ''],
|
\ 'allowfullscreen': ['Bool', ''],
|
||||||
\ 'allowpaymentrequest': ['Bool', ''],
|
\ 'allowpaymentrequest': ['Bool', ''],
|
||||||
|
\ 'allowpresentation': ['Bool', ''],
|
||||||
\ 'allowusermedia': ['Bool', ''],
|
\ 'allowusermedia': ['Bool', ''],
|
||||||
\ 'alt': ['Text', ''],
|
\ 'alt': ['Text', ''],
|
||||||
\ 'async': ['Bool', ''],
|
\ 'async': ['Bool', ''],
|
||||||
@@ -579,11 +580,11 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'iframe': [
|
\ 'iframe': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowusermedia': []})
|
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': []})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'img': [
|
\ 'img': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']})
|
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': ['anonymous', 'use-credentials']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'input': [
|
\ 'input': [
|
||||||
\ [],
|
\ [],
|
||||||
@@ -615,7 +616,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'link': [
|
\ 'link': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', '']})
|
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', ''], 'as': ['report', 'document', 'document', 'object', 'embed', 'audio', 'font', 'image', 'audioworklet', 'paintworklet', 'script', 'serviceworker', 'sharedworker', 'worker', 'style', 'track', 'video', 'image', 'manifest', 'xslt', 'fetch', '']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'main': [
|
\ 'main': [
|
||||||
\ flow_elements + ['style'],
|
\ flow_elements + ['style'],
|
||||||
|
|||||||
24
build
24
build
@@ -5,7 +5,7 @@ set -E
|
|||||||
DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin"
|
DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin"
|
||||||
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
|
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
|
||||||
DIRS_ALL="syntax indent compiler autoload ftplugin after"
|
DIRS_ALL="syntax indent compiler autoload ftplugin after"
|
||||||
DIRS_SYNTAX="syntax after/syntax"
|
DIRS_SYNTAX="syntax indent after/syntax after/indent"
|
||||||
DIRS_JAVASCRIPT="${DIRS} extras"
|
DIRS_JAVASCRIPT="${DIRS} extras"
|
||||||
DIRS_RM="$DIRS_JAVASCRIPT"
|
DIRS_RM="$DIRS_JAVASCRIPT"
|
||||||
|
|
||||||
@@ -52,6 +52,13 @@ extract() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
output "${subdirs##, })\n"
|
||||||
|
|
||||||
|
if (echo "julia coffee-script elixir fish git plantuml scala swift" | fgrep -q "$name"); then
|
||||||
|
echo "Skipping ftdetect installation of $name"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
for f in ${dir}/ftdetect/*; do
|
for f in ${dir}/ftdetect/*; do
|
||||||
(
|
(
|
||||||
echo "augroup filetypedetect";
|
echo "augroup filetypedetect";
|
||||||
@@ -62,7 +69,6 @@ extract() {
|
|||||||
) >> tmp/polyglot.vim;
|
) >> tmp/polyglot.vim;
|
||||||
done
|
done
|
||||||
|
|
||||||
output "${subdirs##, })\n"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
mv tmp/polyglot.vim ftdetect/
|
mv tmp/polyglot.vim ftdetect/
|
||||||
@@ -80,7 +86,7 @@ extract() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy_dir() {
|
copy_dir() {
|
||||||
for file in $(find "$1/$2" -name '*.vim'); do
|
for file in $(find "$1/$2" -name '*.vim' -o -name '*.vital'); do
|
||||||
file_path="$(dirname "${file##$1/}")"
|
file_path="$(dirname "${file##$1/}")"
|
||||||
mkdir -p "$file_path"
|
mkdir -p "$file_path"
|
||||||
touch "$file_path/$(basename "$file")"
|
touch "$file_path/$(basename "$file")"
|
||||||
@@ -118,8 +124,10 @@ PACKS="
|
|||||||
c++11:octol/vim-cpp-enhanced-highlight
|
c++11:octol/vim-cpp-enhanced-highlight
|
||||||
c/c++:vim-jp/vim-cpp
|
c/c++:vim-jp/vim-cpp
|
||||||
caddyfile:isobit/vim-caddyfile
|
caddyfile:isobit/vim-caddyfile
|
||||||
|
carp:hellerve/carp-vim
|
||||||
cjsx:mtscout6/vim-cjsx
|
cjsx:mtscout6/vim-cjsx
|
||||||
clojure:guns/vim-clojure-static
|
clojure:guns/vim-clojure-static
|
||||||
|
cmake:pboettch/vim-cmake-syntax
|
||||||
coffee-script:kchmck/vim-coffee-script
|
coffee-script:kchmck/vim-coffee-script
|
||||||
cryptol:victoredwardocallaghan/cryptol.vim
|
cryptol:victoredwardocallaghan/cryptol.vim
|
||||||
crystal:rhysd/vim-crystal
|
crystal:rhysd/vim-crystal
|
||||||
@@ -136,7 +144,6 @@ PACKS="
|
|||||||
fsharp:fsharp/vim-fsharp:_BASIC
|
fsharp:fsharp/vim-fsharp:_BASIC
|
||||||
git:tpope/vim-git
|
git:tpope/vim-git
|
||||||
gmpl:maelvalais/gmpl.vim
|
gmpl:maelvalais/gmpl.vim
|
||||||
openscad:sirtaj/vim-openscad
|
|
||||||
glsl:tikhomirov/vim-glsl
|
glsl:tikhomirov/vim-glsl
|
||||||
gnuplot:vim-scripts/gnuplot-syntax-highlighting
|
gnuplot:vim-scripts/gnuplot-syntax-highlighting
|
||||||
go:fatih/vim-go:_BASIC
|
go:fatih/vim-go:_BASIC
|
||||||
@@ -151,9 +158,10 @@ PACKS="
|
|||||||
javascript:pangloss/vim-javascript:_JAVASCRIPT
|
javascript:pangloss/vim-javascript:_JAVASCRIPT
|
||||||
jenkins:martinda/Jenkinsfile-vim-syntax
|
jenkins:martinda/Jenkinsfile-vim-syntax
|
||||||
json:elzr/vim-json
|
json:elzr/vim-json
|
||||||
|
json5:GutenYe/json5.vim
|
||||||
jst:briancollins/vim-jst
|
jst:briancollins/vim-jst
|
||||||
jsx:mxw/vim-jsx:_ALL
|
jsx:mxw/vim-jsx:_ALL
|
||||||
julia:dcjones/julia-minimalist-vim
|
julia:JuliaEditorSupport/julia-vim
|
||||||
kotlin:udalov/kotlin-vim
|
kotlin:udalov/kotlin-vim
|
||||||
latex:LaTeX-Box-Team/LaTeX-Box
|
latex:LaTeX-Box-Team/LaTeX-Box
|
||||||
less:groenewege/vim-less
|
less:groenewege/vim-less
|
||||||
@@ -165,7 +173,7 @@ PACKS="
|
|||||||
mathematica:rsmenon/vim-mathematica
|
mathematica:rsmenon/vim-mathematica
|
||||||
nginx:chr4/nginx.vim
|
nginx:chr4/nginx.vim
|
||||||
nim:zah/nim.vim:_BASIC
|
nim:zah/nim.vim:_BASIC
|
||||||
nix:spwhitt/vim-nix
|
nix:LnL7/vim-nix
|
||||||
objc:b4winckler/vim-objc
|
objc:b4winckler/vim-objc
|
||||||
ocaml:jrk/vim-ocaml
|
ocaml:jrk/vim-ocaml
|
||||||
octave:vim-scripts/octave.vim--
|
octave:vim-scripts/octave.vim--
|
||||||
@@ -179,8 +187,9 @@ PACKS="
|
|||||||
pug:digitaltoad/vim-pug
|
pug:digitaltoad/vim-pug
|
||||||
puppet:voxpupuli/vim-puppet
|
puppet:voxpupuli/vim-puppet
|
||||||
purescript:purescript-contrib/purescript-vim
|
purescript:purescript-contrib/purescript-vim
|
||||||
python:mitsuhiko/vim-python-combined
|
python:vim-python/python-syntax
|
||||||
python-compiler:aliev/vim-compiler-python
|
python-compiler:aliev/vim-compiler-python
|
||||||
|
python-ident:Vimjas/vim-python-pep8-indent
|
||||||
qml:peterhoeg/vim-qml
|
qml:peterhoeg/vim-qml
|
||||||
r-lang:vim-scripts/R.vim
|
r-lang:vim-scripts/R.vim
|
||||||
racket:wlangstroth/vim-racket
|
racket:wlangstroth/vim-racket
|
||||||
@@ -193,6 +202,7 @@ PACKS="
|
|||||||
scala:derekwyatt/vim-scala
|
scala:derekwyatt/vim-scala
|
||||||
scss:cakebaker/scss-syntax.vim
|
scss:cakebaker/scss-syntax.vim
|
||||||
slim:slim-template/vim-slim
|
slim:slim-template/vim-slim
|
||||||
|
slime:slime-lang/vim-slime-syntax
|
||||||
solidity:tomlion/vim-solidity
|
solidity:tomlion/vim-solidity
|
||||||
stylus:wavded/vim-stylus
|
stylus:wavded/vim-stylus
|
||||||
swift:keith/swift.vim
|
swift:keith/swift.vim
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
|||||||
"
|
"
|
||||||
" compiler/go.vim: Vim compiler file for Go.
|
" compiler/go.vim: Vim compiler file for Go.
|
||||||
|
|
||||||
if exists("current_compiler")
|
if exists("g:current_compiler")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let current_compiler = "go"
|
let g:current_compiler = "go"
|
||||||
|
|
||||||
if exists(":CompilerSet") != 2
|
if exists(":CompilerSet") != 2
|
||||||
command -nargs=* CompilerSet setlocal <args>
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
|||||||
60
config.vim
60
config.vim
@@ -9,3 +9,63 @@ if !exists('g:vim_json_syntax_conceal')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let g:filetype_euphoria = 'elixir'
|
let g:filetype_euphoria = 'elixir'
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
let g:python_highlight_all = 1
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
if v:version < 704
|
||||||
|
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
|
||||||
|
" which didn't define b:undo_ftplugin on older Vim versions
|
||||||
|
" (*.jl files are recognized as lisp)
|
||||||
|
autocmd BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
||||||
|
endif
|
||||||
|
|
||||||
|
autocmd BufRead,BufNewFile *.jl set filetype=julia
|
||||||
|
|
||||||
|
" coffeescript
|
||||||
|
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
|
||||||
|
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
|
||||||
|
|
||||||
|
|
||||||
|
" elixir
|
||||||
|
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||||
|
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||||
|
|
||||||
|
" fish
|
||||||
|
autocmd BufRead,BufNewFile *.fish setfiletype fish
|
||||||
|
autocmd BufRead fish_funced_*_*.fish call search('^$')
|
||||||
|
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
|
||||||
|
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
|
||||||
|
autocmd BufNewFile ~/.config/fish/functions/*.fish
|
||||||
|
\ call append(0, ['function '.expand('%:t:r'),
|
||||||
|
\'',
|
||||||
|
\'end']) |
|
||||||
|
\ 2
|
||||||
|
|
||||||
|
" git
|
||||||
|
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
||||||
|
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
||||||
|
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
|
||||||
|
|
||||||
|
" plantuml
|
||||||
|
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
|
||||||
|
|
||||||
|
" scala
|
||||||
|
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
|
||||||
|
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
||||||
|
|
||||||
|
" swift
|
||||||
|
autocmd BufNewFile,BufRead *.swift set filetype=swift
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,66 @@ if !exists('g:vim_json_syntax_conceal')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let g:filetype_euphoria = 'elixir'
|
let g:filetype_euphoria = 'elixir'
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
let g:python_highlight_all = 1
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
if v:version < 704
|
||||||
|
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
|
||||||
|
" which didn't define b:undo_ftplugin on older Vim versions
|
||||||
|
" (*.jl files are recognized as lisp)
|
||||||
|
autocmd BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
||||||
|
endif
|
||||||
|
|
||||||
|
autocmd BufRead,BufNewFile *.jl set filetype=julia
|
||||||
|
|
||||||
|
" coffeescript
|
||||||
|
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
||||||
|
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
|
||||||
|
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
|
||||||
|
|
||||||
|
|
||||||
|
" elixir
|
||||||
|
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||||
|
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||||
|
|
||||||
|
" fish
|
||||||
|
autocmd BufRead,BufNewFile *.fish setfiletype fish
|
||||||
|
autocmd BufRead fish_funced_*_*.fish call search('^$')
|
||||||
|
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
|
||||||
|
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
|
||||||
|
autocmd BufNewFile ~/.config/fish/functions/*.fish
|
||||||
|
\ call append(0, ['function '.expand('%:t:r'),
|
||||||
|
\'',
|
||||||
|
\'end']) |
|
||||||
|
\ 2
|
||||||
|
|
||||||
|
" git
|
||||||
|
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
||||||
|
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
||||||
|
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
|
||||||
|
|
||||||
|
" plantuml
|
||||||
|
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
|
||||||
|
|
||||||
|
" scala
|
||||||
|
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
|
||||||
|
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
||||||
|
|
||||||
|
" swift
|
||||||
|
autocmd BufNewFile,BufRead *.swift set filetype=swift
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" apiblueprint:sheerun/apiblueprint.vim
|
" apiblueprint:sheerun/apiblueprint.vim
|
||||||
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
|
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
|
||||||
@@ -78,6 +138,11 @@ augroup filetypedetect
|
|||||||
au BufNewFile,BufRead Caddyfile set ft=caddyfile
|
au BufNewFile,BufRead Caddyfile set ft=caddyfile
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
" carp:hellerve/carp-vim
|
||||||
|
au BufRead,BufNewFile *.carp set filetype=carp
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" cjsx:mtscout6/vim-cjsx
|
" cjsx:mtscout6/vim-cjsx
|
||||||
augroup CJSX
|
augroup CJSX
|
||||||
@@ -92,36 +157,7 @@ autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" coffee-script:kchmck/vim-coffee-script
|
" cmake:pboettch/vim-cmake-syntax
|
||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <mick@kochm.co>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
|
||||||
|
|
||||||
function! s:DetectCoffee()
|
|
||||||
if getline(1) =~ '^#!.*\<coffee\>'
|
|
||||||
set filetype=coffee
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" coffee-script:kchmck/vim-coffee-script
|
|
||||||
" Language: Literate CoffeeScript
|
|
||||||
" Maintainer: Michael Smith <michael@diglumi.com>
|
|
||||||
" URL: https://github.com/mintplant/vim-literate-coffeescript
|
|
||||||
" License: MIT
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
|
|
||||||
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
|
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
@@ -165,23 +201,6 @@ augroup filetypedetect
|
|||||||
" dockerfile:docker/docker::/contrib/syntax/vim/
|
" dockerfile:docker/docker::/contrib/syntax/vim/
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" elixir:elixir-lang/vim-elixir
|
|
||||||
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
|
||||||
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
|
||||||
au BufRead,BufNewFile * call s:DetectElixir()
|
|
||||||
|
|
||||||
function! s:setf(filetype) abort
|
|
||||||
let &filetype = a:filetype
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:DetectElixir()
|
|
||||||
if getline(1) =~ '^#!.*\<elixir\>'
|
|
||||||
call s:setf('elixir')
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" elm:ElmCast/elm-vim
|
" elm:ElmCast/elm-vim
|
||||||
" detection for Elm (http://elm-lang.org/)
|
" detection for Elm (http://elm-lang.org/)
|
||||||
@@ -229,34 +248,7 @@ augroup END
|
|||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" erlang:vim-erlang/vim-erlang-runtime
|
" erlang:vim-erlang/vim-erlang-runtime
|
||||||
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl set ft=erlang
|
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl,*.escript set ft=erlang
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" fish:dag/vim-fish
|
|
||||||
autocmd BufRead,BufNewFile *.fish setfiletype fish
|
|
||||||
|
|
||||||
" Detect fish scripts by the shebang line.
|
|
||||||
autocmd BufRead *
|
|
||||||
\ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' |
|
|
||||||
\ setlocal filetype=fish |
|
|
||||||
\ endif
|
|
||||||
|
|
||||||
" Move cursor to first empty line when using funced.
|
|
||||||
autocmd BufRead fish_funced_*_*.fish call search('^$')
|
|
||||||
|
|
||||||
" Fish histories are YAML documents.
|
|
||||||
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
|
|
||||||
|
|
||||||
" Universal variable storages should not be hand edited.
|
|
||||||
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
|
|
||||||
|
|
||||||
" Mimic `funced` when manually creating functions.
|
|
||||||
autocmd BufNewFile ~/.config/fish/functions/*.fish
|
|
||||||
\ call append(0, ['function '.expand('%:t:r'),
|
|
||||||
\'',
|
|
||||||
\'end']) |
|
|
||||||
\ 2
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
@@ -265,42 +257,11 @@ augroup filetypedetect
|
|||||||
autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp
|
autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" git:tpope/vim-git
|
|
||||||
" Git
|
|
||||||
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
|
||||||
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
|
|
||||||
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
|
||||||
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
|
||||||
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
|
||||||
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
|
|
||||||
autocmd BufNewFile,BufRead *.git/**
|
|
||||||
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
|
|
||||||
\ set ft=git |
|
|
||||||
\ endif
|
|
||||||
|
|
||||||
" This logic really belongs in scripts.vim
|
|
||||||
autocmd BufNewFile,BufRead,StdinReadPost *
|
|
||||||
\ if getline(1) =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' |
|
|
||||||
\ set ft=git |
|
|
||||||
\ endif
|
|
||||||
autocmd BufNewFile,BufRead *
|
|
||||||
\ if getline(1) =~ '^From \x\{40\} Mon Sep 17 00:00:00 2001$' |
|
|
||||||
\ set filetype=gitsendemail |
|
|
||||||
\ endif
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" gmpl:maelvalais/gmpl.vim
|
" gmpl:maelvalais/gmpl.vim
|
||||||
au BufRead,BufNewFile *.mod set filetype=gmpl
|
au BufRead,BufNewFile *.mod set filetype=gmpl
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" openscad:sirtaj/vim-openscad
|
|
||||||
au BufRead,BufNewFile *.scad setfiletype openscad
|
|
||||||
an 50.80.265 &Syntax.NO.OpenSCAD :cal SetSyn("openscad")<CR>
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" glsl:tikhomirov/vim-glsl
|
" glsl:tikhomirov/vim-glsl
|
||||||
" Language: OpenGL Shading Language
|
" Language: OpenGL Shading Language
|
||||||
@@ -319,6 +280,8 @@ augroup END
|
|||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" go:fatih/vim-go:_BASIC
|
" go:fatih/vim-go:_BASIC
|
||||||
|
" vint: -ProhibitAutocmdWithNoGroup
|
||||||
|
|
||||||
" We take care to preserve the user's fileencodings and fileformats,
|
" We take care to preserve the user's fileencodings and fileformats,
|
||||||
" because those settings are global (not buffer local), yet we want
|
" because those settings are global (not buffer local), yet we want
|
||||||
" to override them for loading Go files, which are defined to be UTF-8.
|
" to override them for loading Go files, which are defined to be UTF-8.
|
||||||
@@ -339,6 +302,7 @@ function! s:gofiletype_post()
|
|||||||
let &g:fileencodings = s:current_fileencodings
|
let &g:fileencodings = s:current_fileencodings
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Note: should not use augroup in ftdetect (see :help ftdetect)
|
||||||
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
||||||
au BufRead *.go call s:gofiletype_pre("go")
|
au BufRead *.go call s:gofiletype_pre("go")
|
||||||
au BufReadPost *.go call s:gofiletype_post()
|
au BufReadPost *.go call s:gofiletype_post()
|
||||||
@@ -390,7 +354,7 @@ augroup filetypedetect
|
|||||||
" i3:PotatoesMaster/i3-vim-syntax
|
" i3:PotatoesMaster/i3-vim-syntax
|
||||||
augroup i3_ftdetect
|
augroup i3_ftdetect
|
||||||
au!
|
au!
|
||||||
au BufRead,BufNewFile *i3/config set ft=i3
|
au BufRead,BufNewFile *i3/config,*sway/config set ft=i3
|
||||||
augroup END
|
augroup END
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
@@ -432,8 +396,15 @@ augroup END
|
|||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" json:elzr/vim-json
|
" json:elzr/vim-json
|
||||||
autocmd BufNewFile,BufRead *.json setlocal filetype=json
|
autocmd BufNewFile,BufRead *.json setlocal filetype=json
|
||||||
|
autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json
|
||||||
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
|
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
|
||||||
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
|
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
|
||||||
|
autocmd BufNewFile,BufRead *.template setlocal filetype=json
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
" json5:GutenYe/json5.vim
|
||||||
|
au BufNewFile,BufRead *.json5 setfiletype json5
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
@@ -486,16 +457,6 @@ autocmd BufNewFile,BufRead *.js
|
|||||||
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
|
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" julia:dcjones/julia-minimalist-vim
|
|
||||||
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
|
|
||||||
" which doesn't define b:undo_ftplugin
|
|
||||||
" (*.jt files are recognized as lisp)
|
|
||||||
au BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
|
||||||
|
|
||||||
au BufRead,BufNewFile *.jl set filetype=julia
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" kotlin:udalov/kotlin-vim
|
" kotlin:udalov/kotlin-vim
|
||||||
autocmd BufNewFile,BufRead *.kt setfiletype kotlin
|
autocmd BufNewFile,BufRead *.kt setfiletype kotlin
|
||||||
@@ -588,8 +549,14 @@ au BufNewFile,BufRead *.nim,*.nims set filetype=nim
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" nix:spwhitt/vim-nix
|
" nix:LnL7/vim-nix
|
||||||
autocmd BufNewFile,BufRead *.nix setfiletype nix
|
" Vim filetype detect
|
||||||
|
" Language: Nix
|
||||||
|
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||||
|
" URL: https://github.com/LnL7/vim-nix
|
||||||
|
|
||||||
|
au BufRead,BufNewFile *.nix set filetype=nix
|
||||||
|
au FileType nix setl sw=2 sts=2 et iskeyword+=-
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
@@ -666,16 +633,6 @@ augroup filetypedetect
|
|||||||
" php:StanAngeloff/php.vim
|
" php:StanAngeloff/php.vim
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" plantuml:aklt/plantuml-syntax
|
|
||||||
if did_filetype()
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | set filetype=plantuml | endif
|
|
||||||
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" powershell:PProvost/vim-ps1
|
" powershell:PProvost/vim-ps1
|
||||||
" Vim ftdetect plugin file
|
" Vim ftdetect plugin file
|
||||||
@@ -743,7 +700,7 @@ au FileType purescript let &l:commentstring='{--%s--}'
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" python:mitsuhiko/vim-python-combined
|
" python:vim-python/python-syntax
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
@@ -756,6 +713,10 @@ augroup filetypedetect
|
|||||||
autocmd FileType python compiler python
|
autocmd FileType python compiler python
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
" python-ident:Vimjas/vim-python-pep8-indent
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" qml:peterhoeg/vim-qml
|
" qml:peterhoeg/vim-qml
|
||||||
autocmd BufRead,BufNewFile *.qml setfiletype qml
|
autocmd BufRead,BufNewFile *.qml setfiletype qml
|
||||||
@@ -911,21 +872,6 @@ augroup filetypedetect
|
|||||||
au BufRead,BufNewFile *.sbt set filetype=sbt.scala
|
au BufRead,BufNewFile *.sbt set filetype=sbt.scala
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" scala:derekwyatt/vim-scala
|
|
||||||
fun! s:DetectScala()
|
|
||||||
if getline(1) =~# '^#!\(/usr\)\?/bin/env\s\+scalas\?'
|
|
||||||
set filetype=scala
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
au BufRead,BufNewFile *.scala set filetype=scala
|
|
||||||
au BufRead,BufNewFile * call s:DetectScala()
|
|
||||||
|
|
||||||
" Install vim-sbt for additional syntax highlighting.
|
|
||||||
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" scss:cakebaker/scss-syntax.vim
|
" scss:cakebaker/scss-syntax.vim
|
||||||
au BufRead,BufNewFile *.scss setfiletype scss
|
au BufRead,BufNewFile *.scss setfiletype scss
|
||||||
@@ -937,6 +883,11 @@ augroup filetypedetect
|
|||||||
autocmd BufNewFile,BufRead *.slim setfiletype slim
|
autocmd BufNewFile,BufRead *.slim setfiletype slim
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
augroup filetypedetect
|
||||||
|
" slime:slime-lang/vim-slime-syntax
|
||||||
|
autocmd BufNewFile,BufRead *.slime set filetype=slime
|
||||||
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" solidity:tomlion/vim-solidity
|
" solidity:tomlion/vim-solidity
|
||||||
au BufNewFile,BufRead *.sol setf solidity
|
au BufNewFile,BufRead *.sol setf solidity
|
||||||
@@ -949,22 +900,6 @@ autocmd BufNewFile,BufReadPost *.styl set filetype=stylus
|
|||||||
autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
|
autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
" swift:keith/swift.vim
|
|
||||||
autocmd BufNewFile,BufRead *.swift set filetype=swift
|
|
||||||
autocmd BufRead * call s:Swift()
|
|
||||||
function! s:Swift()
|
|
||||||
if !empty(&filetype)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let line = getline(1)
|
|
||||||
if line =~ "^#!.*swift"
|
|
||||||
setfiletype swift
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" sxhkd:baskerville/vim-sxhkdrc
|
" sxhkd:baskerville/vim-sxhkdrc
|
||||||
if &compatible || v:version < 603
|
if &compatible || v:version < 603
|
||||||
@@ -1021,8 +956,8 @@ augroup END
|
|||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" toml:cespare/vim-toml
|
" toml:cespare/vim-toml
|
||||||
" Rust uses several TOML config files that are not named with .toml.
|
" Go dep and Rust use several TOML config files that are not named with .toml.
|
||||||
autocmd BufNewFile,BufRead *.toml,Cargo.lock,*/.cargo/config set filetype=toml
|
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config set filetype=toml
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
|||||||
if exists('+regexpengine') && ('®expengine' == 0)
|
if exists('+regexpengine') && ('®expengine' == 0)
|
||||||
setlocal regexpengine=1
|
setlocal regexpengine=1
|
||||||
endif
|
endif
|
||||||
set path+=./../templates,./../files
|
set path+=./../templates,./../files,templates,files
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -50,18 +50,17 @@ command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expa
|
|||||||
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
|
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
|
||||||
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
||||||
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
||||||
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>)
|
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0)
|
||||||
|
|
||||||
nnoremap <Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
||||||
nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
||||||
nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
|
nnoremap <buffer><Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
|
||||||
nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
|
nnoremap <buffer><Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
|
||||||
nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
|
nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
|
||||||
nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR>
|
nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR>
|
||||||
|
|
||||||
augroup plugin-ft-crystal
|
augroup plugin-ft-crystal
|
||||||
autocmd!
|
autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif
|
||||||
autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
if get(g:, 'crystal_define_mappings', 1)
|
if get(g:, 'crystal_define_mappings', 1)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
if (exists("b:did_ftplugin"))
|
if exists('b:did_ftplugin')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
" Matchit support
|
" Matchit support
|
||||||
if exists("loaded_matchit") && !exists("b:match_words")
|
if exists('loaded_matchit') && !exists('b:match_words')
|
||||||
let b:match_ignorecase = 0
|
let b:match_ignorecase = 0
|
||||||
|
|
||||||
let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
|
let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
|
||||||
@@ -32,9 +32,30 @@ let &l:path =
|
|||||||
setlocal includeexpr=elixir#util#get_filename(v:fname)
|
setlocal includeexpr=elixir#util#get_filename(v:fname)
|
||||||
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
|
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
|
||||||
|
|
||||||
|
if empty(&formatprg)
|
||||||
|
setlocal formatprg=mix\ format\ -
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:define = 'def\(macro|guard|delegate\)p'
|
||||||
|
|
||||||
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
||||||
|
|
||||||
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< '.
|
let b:block_begin = '\<\(do$\|fn\>\)'
|
||||||
\ '| unlet! b:match_ignorecase b:match_words'
|
let b:block_end = '\<end\>'
|
||||||
|
|
||||||
|
nnoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
|
||||||
|
nnoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
|
||||||
|
nnoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
|
||||||
|
nnoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
|
||||||
|
|
||||||
|
onoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
|
||||||
|
onoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
|
||||||
|
onoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
|
||||||
|
onoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
|
||||||
|
|
||||||
|
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
||||||
|
|
||||||
|
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<'.
|
||||||
|
\ '| unlet! b:match_ignorecase b:match_words b:block_begin b:block_end'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ endif
|
|||||||
" Use the 'man' wrapper function in fish to include fish's man pages.
|
" Use the 'man' wrapper function in fish to include fish's man pages.
|
||||||
" Have to use a script for this; 'fish -c man' would make the the man page an
|
" Have to use a script for this; 'fish -c man' would make the the man page an
|
||||||
" argument to fish instead of man.
|
" argument to fish instead of man.
|
||||||
execute 'setlocal keywordprg=fish\ '.expand('<sfile>:p:h:h').'/bin/man.fish'
|
execute 'setlocal keywordprg=fish\ '.fnameescape(expand('<sfile>:p:h:h').'/bin/man.fish')
|
||||||
|
|
||||||
let b:match_words =
|
let b:match_words =
|
||||||
\ escape('<%(begin|function|if|switch|while|for)>:<end>', '<>%|)')
|
\ escape('<%(begin|function|if|switch|while|for)>:<end>', '<>%|)')
|
||||||
|
|||||||
99
ftplugin/julia.vim
Normal file
99
ftplugin/julia.vim
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Julia
|
||||||
|
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
|
||||||
|
" Last Change: 2014 may 29
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
setlocal include=^\\s*\\%(reload\\\|include\\)\\>
|
||||||
|
setlocal suffixesadd=.jl
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#=%s=#
|
||||||
|
setlocal cinoptions+=#1
|
||||||
|
setlocal define=^\\s*macro\\>
|
||||||
|
|
||||||
|
let b:julia_vim_loaded = 1
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<"
|
||||||
|
\ . " define< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<"
|
||||||
|
\ . " | unlet! b:julia_vim_loaded"
|
||||||
|
|
||||||
|
" MatchIt plugin support
|
||||||
|
if exists("loaded_matchit")
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
|
||||||
|
" note: begin_keywords must contain all blocks in order
|
||||||
|
" for nested-structures-skipping to work properly
|
||||||
|
let b:julia_begin_keywords = '\%(\%(\.\s*\)\@<!\|\%(@\s*.\s*\)\@<=\)\<\%(\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>'
|
||||||
|
let s:macro_regex = '@\%(#\@!\S\)\+\s\+'
|
||||||
|
let s:nomacro = '\%(' . s:macro_regex . '\)\@<!'
|
||||||
|
let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+'
|
||||||
|
let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|'
|
||||||
|
\ . '\%(' . s:nomacro . b:julia_begin_keywords . '\)'
|
||||||
|
let b:julia_end_keywords = '\<end\>'
|
||||||
|
|
||||||
|
" note: this function relies heavily on the syntax file
|
||||||
|
function! JuliaGetMatchWords()
|
||||||
|
let [l,c] = [line('.'),col('.')]
|
||||||
|
let attr = synIDattr(synID(l, c, 1),"name")
|
||||||
|
let c1 = c
|
||||||
|
while attr == 'juliaMacro'
|
||||||
|
normal! W
|
||||||
|
if line('.') > l || col('.') == c1
|
||||||
|
call cursor(l, c)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
let attr = synIDattr(synID(l, col('.'), 1),"name")
|
||||||
|
let c1 = col('.')
|
||||||
|
endwhile
|
||||||
|
call cursor(l, c)
|
||||||
|
if attr == 'juliaConditional'
|
||||||
|
return b:julia_begin_keywordsm . ':\<\%(elseif\|else\)\>:' . b:julia_end_keywords
|
||||||
|
elseif attr =~ '\<\%(juliaRepeat\|juliaRepKeyword\)\>'
|
||||||
|
return b:julia_begin_keywordsm . ':\<\%(break\|continue\)\>:' . b:julia_end_keywords
|
||||||
|
elseif attr == 'juliaBlKeyword'
|
||||||
|
return b:julia_begin_keywordsm . ':' . b:julia_end_keywords
|
||||||
|
elseif attr == 'juliaException'
|
||||||
|
return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords
|
||||||
|
endif
|
||||||
|
return '\<\>:\<\>'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let b:match_words = 'JuliaGetMatchWords()'
|
||||||
|
|
||||||
|
" we need to skip everything within comments, strings and
|
||||||
|
" the 'end' keyword when it is used as a range rather than as
|
||||||
|
" the end of a block
|
||||||
|
let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~ '
|
||||||
|
\ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeEnd\\|SymbolS\\?\\|Comment[LM]\\|\\%([bv]\\|ip\\|MIME\\|Shell\\|Doc\\)\\?String\\|RegEx\\)\\>"'
|
||||||
|
|
||||||
|
let b:undo_ftplugin = b:undo_ftplugin
|
||||||
|
\ . " | unlet! b:match_words b:match_skip b:match_ignorecase"
|
||||||
|
\ . " | unlet! b:julia_begin_keywords b:julia_end_keywords"
|
||||||
|
\ . " | delfunction JuliaGetMatchWords"
|
||||||
|
\ . " | call julia_blocks#remove_mappings()"
|
||||||
|
|
||||||
|
if get(g:, "julia_blocks", 1)
|
||||||
|
call julia_blocks#init_mappings()
|
||||||
|
let b:undo_ftplugin .= " | call julia_blocks#remove_mappings()"
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has("gui_win32")
|
||||||
|
let b:browsefilter = "Julia Source Files (*.jl)\t*.jl\n"
|
||||||
|
let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter"
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -2,11 +2,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
|||||||
|
|
||||||
" Mail file type extension to pick files for attachments via vifm
|
" Mail file type extension to pick files for attachments via vifm
|
||||||
" Maintainer: xaizek <xaizek@posteo.net>
|
" Maintainer: xaizek <xaizek@posteo.net>
|
||||||
" Last Change: January 23, 2016
|
" Last Change: January 02, 2018
|
||||||
|
|
||||||
" Insert attachment picked via vifm after 'Subject' header
|
" Insert attachment picked via vifm after 'Subject' header
|
||||||
function! s:AddMailAttacments()
|
function! s:AddMailAttachments()
|
||||||
" TODO: reduce duplication between this file and plugins/vifm.vim
|
call vifm#globals#Init()
|
||||||
|
|
||||||
|
" XXX: similar code is in plugins/vifm.vim, but it's different in details
|
||||||
let l:listf = tempname()
|
let l:listf = tempname()
|
||||||
|
|
||||||
if !has('nvim')
|
if !has('nvim')
|
||||||
@@ -26,7 +28,7 @@ function! s:AddMailAttacments()
|
|||||||
else
|
else
|
||||||
" Work around handicapped neovim...
|
" Work around handicapped neovim...
|
||||||
let callback = { 'listf': l:listf }
|
let callback = { 'listf': l:listf }
|
||||||
function! callback.on_exit(id, code)
|
function! callback.on_exit(id, code, event)
|
||||||
buffer #
|
buffer #
|
||||||
silent! bdelete! #
|
silent! bdelete! #
|
||||||
call s:HandleRunResults(a:code, self.listf)
|
call s:HandleRunResults(a:code, self.listf)
|
||||||
@@ -59,7 +61,7 @@ function! s:HandleRunResults(exitcode, listf)
|
|||||||
call delete(a:listf)
|
call delete(a:listf)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
nnoremap <buffer> <silent> <localleader>a :call <sid>AddMailAttacments()<cr>
|
nnoremap <buffer> <silent> <localleader>a :call <sid>AddMailAttachments()<cr>
|
||||||
|
|
||||||
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
|
" vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
" Vim filetype plugin
|
||||||
finish
|
" Language: Nix
|
||||||
endif
|
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||||
let b:did_ftplugin=1
|
" URL: https://github.com/LnL7/vim-nix
|
||||||
|
|
||||||
setlocal comments=
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
|
||||||
|
setlocal comments=:#
|
||||||
setlocal commentstring=#\ %s
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
" Nixpkgs indent settings
|
|
||||||
setlocal tabstop=2
|
|
||||||
setlocal softtabstop=2
|
|
||||||
setlocal shiftwidth=2
|
|
||||||
setlocal expandtab
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
|
|
||||||
|
|
||||||
" Blatantly stolen from vim74\ftplugin\c.vim
|
|
||||||
|
|
||||||
" Set 'formatoptions' to break comment lines but not other lines,
|
|
||||||
" and insert the comment leader when hitting <CR> or using "o".
|
|
||||||
setlocal fo-=t fo+=croql
|
|
||||||
|
|
||||||
" Set 'comments' to format dashed lists in comments.
|
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
|
||||||
|
|
||||||
" Win32 can filter files in the browse dialog
|
|
||||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
|
||||||
let b:browsefilter = "OpenSCAD Source Files (*.scad)\t*.scad\n" .
|
|
||||||
\ "All Files (*.*)\t*.*\n"
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -31,8 +31,6 @@ else
|
|||||||
endif
|
endif
|
||||||
unlet s:delims
|
unlet s:delims
|
||||||
|
|
||||||
let b:undo_ftplugin = ""
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ setlocal commentstring=//\ %s
|
|||||||
" " and insert the comment leader when hitting <CR> or using "o".
|
" " and insert the comment leader when hitting <CR> or using "o".
|
||||||
setlocal formatoptions-=t formatoptions+=croql
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
|
|
||||||
setlocal suffixesadd+=.ts
|
setlocal suffixesadd+=.ts,.tsx
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl fo< ofu< com< cms<"
|
let b:undo_ftplugin = "setl fo< ofu< com< cms<"
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ runtime! ftplugin/html.vim
|
|||||||
|
|
||||||
setlocal suffixesadd+=.vue
|
setlocal suffixesadd+=.vue
|
||||||
|
|
||||||
|
if !exists('g:no_plugin_maps') && !exists('g:no_vue_maps')
|
||||||
|
nnoremap <silent> <buffer> [[ :call search('^<\(template\<Bar>script\<Bar>style\)', 'bW')<CR>
|
||||||
|
nnoremap <silent> <buffer> ]] :call search('^<\(template\<Bar>script\<Bar>style\)', 'W')<CR>
|
||||||
|
nnoremap <silent> <buffer> [] :call search('^</\(template\<Bar>script\<Bar>style\)', 'bW')<CR>
|
||||||
|
nnoremap <silent> <buffer> ][ :call search('^</\(template\<Bar>script\<Bar>style\)', 'W')<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
if exists('g:loaded_ale')
|
if exists('g:loaded_ale')
|
||||||
let g:ale_linters = get(g:, 'ale_linters', {})
|
let g:ale_linters = get(g:, 'ale_linters', {})
|
||||||
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])
|
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let b:did_indent = 1
|
|||||||
|
|
||||||
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
|
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
|
||||||
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim\|php\|' .
|
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim\|php\|' .
|
||||||
\ 'component\|slot\|prepend'
|
\ 'component\|slot\|prepend\|auth\|guest'
|
||||||
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
|
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
|
||||||
|
|
||||||
if exists('g:blade_custom_directives_pairs')
|
if exists('g:blade_custom_directives_pairs')
|
||||||
|
|||||||
@@ -9,14 +9,13 @@ setlocal nolisp
|
|||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal indentexpr=GetCaddyfileIndent(v:lnum)
|
setlocal indentexpr=GetCaddyfileIndent(v:lnum)
|
||||||
setlocal indentkeys+=<:>,0=},0=)
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
" setlocal cindent
|
|
||||||
|
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
func s:sw()
|
function! s:sw()
|
||||||
return shiftwidth()
|
return shiftwidth()
|
||||||
endfunc
|
endfunc
|
||||||
else
|
else
|
||||||
func s:sw()
|
function! s:sw()
|
||||||
return &sw
|
return &sw
|
||||||
endfunc
|
endfunc
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -192,11 +192,7 @@ if exists("*searchpairpos")
|
|||||||
" Check if form is a reader conditional, that is, it is prefixed by #?
|
" Check if form is a reader conditional, that is, it is prefixed by #?
|
||||||
" or @#?
|
" or @#?
|
||||||
function! s:is_reader_conditional_special_case(position)
|
function! s:is_reader_conditional_special_case(position)
|
||||||
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Returns 1 for opening brackets, -1 for _anything else_.
|
" Returns 1 for opening brackets, -1 for _anything else_.
|
||||||
@@ -294,6 +290,19 @@ if exists("*searchpairpos")
|
|||||||
return paren
|
return paren
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If the keyword begins with #, check if it is an anonymous
|
||||||
|
" function or set, in which case we indent by the shiftwidth
|
||||||
|
" (minus one if g:clojure_align_subforms = 1), or if it is
|
||||||
|
" ignored, in which case we use the ( position for indent.
|
||||||
|
if w[0] == "#"
|
||||||
|
" TODO: Handle #=() and other rare reader invocations?
|
||||||
|
if w[1] == '(' || w[1] == '{'
|
||||||
|
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
|
||||||
|
elseif w[1] == '_'
|
||||||
|
return paren
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" Test words without namespace qualifiers and leading reader macro
|
" Test words without namespace qualifiers and leading reader macro
|
||||||
" metacharacters.
|
" metacharacters.
|
||||||
"
|
"
|
||||||
|
|||||||
93
indent/cmake.vim
Normal file
93
indent/cmake.vim
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cmake') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: CMake (ft=cmake)
|
||||||
|
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
||||||
|
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
|
||||||
|
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
|
||||||
|
" Last Change: 2017 Aug 30
|
||||||
|
"
|
||||||
|
" Licence: The CMake license applies to this file. See
|
||||||
|
" https://cmake.org/licensing
|
||||||
|
" This implies that distribution with Vim is allowed
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
let s:keepcpo= &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
setlocal indentexpr=CMakeGetIndent(v:lnum)
|
||||||
|
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*CMakeGetIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
fun! CMakeGetIndent(lnum)
|
||||||
|
let this_line = getline(a:lnum)
|
||||||
|
|
||||||
|
" Find a non-blank line above the current line.
|
||||||
|
let lnum = a:lnum
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
let previous_line = getline(lnum)
|
||||||
|
|
||||||
|
" Hit the start of the file, use zero indent.
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let ind = indent(lnum)
|
||||||
|
|
||||||
|
let or = '\|'
|
||||||
|
" Regular expressions used by line indentation function.
|
||||||
|
let cmake_regex_comment = '#.*'
|
||||||
|
let cmake_regex_identifier = '[A-Za-z][A-Za-z0-9_]*'
|
||||||
|
let cmake_regex_quoted = '"\([^"\\]\|\\.\)*"'
|
||||||
|
let cmake_regex_arguments = '\(' . cmake_regex_quoted .
|
||||||
|
\ or . '\$(' . cmake_regex_identifier . ')' .
|
||||||
|
\ or . '[^()\\#"]' . or . '\\.' . '\)*'
|
||||||
|
|
||||||
|
let cmake_indent_comment_line = '^\s*' . cmake_regex_comment
|
||||||
|
let cmake_indent_blank_regex = '^\s*$'
|
||||||
|
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
|
||||||
|
\ '\s*(' . cmake_regex_arguments .
|
||||||
|
\ '\(' . cmake_regex_comment . '\)\?$'
|
||||||
|
|
||||||
|
let cmake_indent_close_regex = '^' . cmake_regex_arguments .
|
||||||
|
\ ')\s*' .
|
||||||
|
\ '\(' . cmake_regex_comment . '\)\?$'
|
||||||
|
|
||||||
|
let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
|
||||||
|
let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
|
||||||
|
|
||||||
|
" Add
|
||||||
|
if previous_line =~? cmake_indent_comment_line " Handle comments
|
||||||
|
let ind = ind
|
||||||
|
else
|
||||||
|
if previous_line =~? cmake_indent_begin_regex
|
||||||
|
let ind = ind + shiftwidth()
|
||||||
|
endif
|
||||||
|
if previous_line =~? cmake_indent_open_regex
|
||||||
|
let ind = ind + shiftwidth()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Subtract
|
||||||
|
if this_line =~? cmake_indent_end_regex
|
||||||
|
let ind = ind - shiftwidth()
|
||||||
|
endif
|
||||||
|
if previous_line =~? cmake_indent_close_regex
|
||||||
|
let ind = ind - shiftwidth()
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfun
|
||||||
|
|
||||||
|
let &cpo = s:keepcpo
|
||||||
|
unlet s:keepcpo
|
||||||
|
|
||||||
|
endif
|
||||||
433
indent/cython.vim
Normal file
433
indent/cython.vim
Normal file
@@ -0,0 +1,433 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-ident') == -1
|
||||||
|
|
||||||
|
" PEP8 compatible Python indent file
|
||||||
|
" Language: Python
|
||||||
|
" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
|
||||||
|
" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
|
||||||
|
" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
|
||||||
|
" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
|
||||||
|
" License: CC0
|
||||||
|
"
|
||||||
|
" vim-python-pep8-indent - A nicer Python indentation style for vim.
|
||||||
|
" Written in 2004 by David Bustos <bustos@caltech.edu>
|
||||||
|
" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
|
||||||
|
" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
|
||||||
|
" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
|
||||||
|
"
|
||||||
|
" To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
" and related and neighboring rights to this software to the public domain
|
||||||
|
" worldwide. This software is distributed without any warranty.
|
||||||
|
" You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
" with this software. If not, see
|
||||||
|
" <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
|
||||||
|
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
||||||
|
|
||||||
|
if !exists('g:python_pep8_indent_multiline_string')
|
||||||
|
let g:python_pep8_indent_multiline_string = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:block_rules = {
|
||||||
|
\ '^\s*elif\>': ['if', 'elif'],
|
||||||
|
\ '^\s*except\>': ['try', 'except'],
|
||||||
|
\ '^\s*finally\>': ['try', 'except', 'else']
|
||||||
|
\ }
|
||||||
|
let s:block_rules_multiple = {
|
||||||
|
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
|
||||||
|
\ }
|
||||||
|
" Pairs to look for when searching for opening parenthesis.
|
||||||
|
" The value is the maximum offset in lines.
|
||||||
|
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
|
||||||
|
|
||||||
|
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
|
||||||
|
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
|
||||||
|
else
|
||||||
|
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
|
||||||
|
endif
|
||||||
|
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||||
|
|
||||||
|
" Skip strings and comments. Return 1 for chars to skip.
|
||||||
|
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||||
|
" are inserted temporarily into the buffer.
|
||||||
|
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "\\vstring|comment|jedi\\S"'
|
||||||
|
|
||||||
|
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "\\vcomment|jedi\\S"'
|
||||||
|
|
||||||
|
" Also ignore anything concealed.
|
||||||
|
" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
|
||||||
|
function! s:is_concealed(line, col)
|
||||||
|
let concealed = synconcealed(a:line, a:col)
|
||||||
|
return len(concealed) && concealed[0]
|
||||||
|
endfunction
|
||||||
|
if has('conceal')
|
||||||
|
let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "comment"'
|
||||||
|
|
||||||
|
" Use 'shiftwidth()' instead of '&sw'.
|
||||||
|
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
function! s:sw()
|
||||||
|
return shiftwidth()
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:sw()
|
||||||
|
return &shiftwidth
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:pair_sort(x, y)
|
||||||
|
if a:x[0] == a:y[0]
|
||||||
|
return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1
|
||||||
|
else
|
||||||
|
return a:x[0] > a:y[0] ? 1 : -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find backwards the closest open parenthesis/bracket/brace.
|
||||||
|
function! s:find_opening_paren(...)
|
||||||
|
" optional arguments: line and column (defaults to 1) to search around
|
||||||
|
if a:0 > 0
|
||||||
|
let view = winsaveview()
|
||||||
|
call cursor(a:1, a:0 > 1 ? a:2 : 1)
|
||||||
|
let ret = s:find_opening_paren()
|
||||||
|
call winrestview(view)
|
||||||
|
return ret
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Return if cursor is in a comment.
|
||||||
|
exe 'if' s:skip_search '| return [0, 0] | endif'
|
||||||
|
|
||||||
|
let nearest = [0, 0]
|
||||||
|
for [p, maxoff] in items(s:paren_pairs)
|
||||||
|
let stopline = max([0, line('.') - maxoff, nearest[0]])
|
||||||
|
let next = searchpairpos(
|
||||||
|
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
|
||||||
|
if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
|
||||||
|
let nearest = next
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return nearest
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find the start of a multi-line statement
|
||||||
|
function! s:find_start_of_multiline_statement(lnum)
|
||||||
|
let lnum = a:lnum
|
||||||
|
while lnum > 0
|
||||||
|
if getline(lnum - 1) =~# '\\$'
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
else
|
||||||
|
let [paren_lnum, _] = s:find_opening_paren(lnum)
|
||||||
|
if paren_lnum < 1
|
||||||
|
return lnum
|
||||||
|
else
|
||||||
|
let lnum = paren_lnum
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find possible indent(s) of the block starter that matches the current line.
|
||||||
|
function! s:find_start_of_block(lnum, types, multiple)
|
||||||
|
let r = []
|
||||||
|
let types = copy(a:types)
|
||||||
|
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||||
|
let lnum = a:lnum
|
||||||
|
let last_indent = indent(lnum) + 1
|
||||||
|
while lnum > 0 && last_indent > 0
|
||||||
|
let indent = indent(lnum)
|
||||||
|
if indent < last_indent
|
||||||
|
for type in types
|
||||||
|
let re = '\v^\s*'.type.'>'
|
||||||
|
if getline(lnum) =~# re
|
||||||
|
if !a:multiple
|
||||||
|
return [indent]
|
||||||
|
endif
|
||||||
|
if index(r, indent) == -1
|
||||||
|
let r += [indent]
|
||||||
|
endif
|
||||||
|
" Remove any handled type, e.g. 'if'.
|
||||||
|
call remove(types, index(types, type))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let last_indent = indent(lnum)
|
||||||
|
endif
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return r
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Is "expr" true for every position in "lnum", beginning at "start"?
|
||||||
|
" (optionally up to a:1 / 4th argument)
|
||||||
|
function! s:match_expr_on_line(expr, lnum, start, ...)
|
||||||
|
let text = getline(a:lnum)
|
||||||
|
let end = a:0 ? a:1 : len(text)
|
||||||
|
if a:start > end
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let save_pos = getpos('.')
|
||||||
|
let r = 1
|
||||||
|
for i in range(a:start, end)
|
||||||
|
call cursor(a:lnum, i)
|
||||||
|
if !(eval(a:expr) || text[i-1] =~# '\s')
|
||||||
|
let r = 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
return r
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Line up with open parenthesis/bracket/brace.
|
||||||
|
function! s:indent_like_opening_paren(lnum)
|
||||||
|
let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum)
|
||||||
|
if paren_lnum <= 0
|
||||||
|
return -2
|
||||||
|
endif
|
||||||
|
let text = getline(paren_lnum)
|
||||||
|
let base = indent(paren_lnum)
|
||||||
|
|
||||||
|
let nothing_after_opening_paren = s:match_expr_on_line(
|
||||||
|
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
||||||
|
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
||||||
|
|
||||||
|
if nothing_after_opening_paren
|
||||||
|
if starts_with_closing_paren
|
||||||
|
let res = base
|
||||||
|
else
|
||||||
|
let res = base + s:sw()
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Indent to match position of opening paren.
|
||||||
|
let res = paren_col
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line is the continuation of a control statement
|
||||||
|
" indent further to distinguish the continuation line
|
||||||
|
" from the next logical line.
|
||||||
|
if text =~# b:control_statement && res == base + s:sw()
|
||||||
|
return base + s:sw() * 2
|
||||||
|
else
|
||||||
|
return res
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Match indent of first block of this type.
|
||||||
|
function! s:indent_like_block(lnum)
|
||||||
|
let text = getline(a:lnum)
|
||||||
|
for [multiple, block_rules] in [
|
||||||
|
\ [0, s:block_rules],
|
||||||
|
\ [1, s:block_rules_multiple]]
|
||||||
|
for [line_re, blocks] in items(block_rules)
|
||||||
|
if text !~# line_re
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
|
||||||
|
if !len(indents)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
if len(indents) == 1
|
||||||
|
return indents[0]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Multiple valid indents, e.g. for 'else' with both try and if.
|
||||||
|
let indent = indent(a:lnum)
|
||||||
|
if index(indents, indent) != -1
|
||||||
|
" The indent is valid, keep it.
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
" Fallback to the first/nearest one.
|
||||||
|
return indents[0]
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
return -2
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:indent_like_previous_line(lnum)
|
||||||
|
let lnum = prevnonblank(a:lnum - 1)
|
||||||
|
|
||||||
|
" No previous line, keep current indent.
|
||||||
|
if lnum < 1
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let text = getline(lnum)
|
||||||
|
let start = s:find_start_of_multiline_statement(lnum)
|
||||||
|
let base = indent(start)
|
||||||
|
let current = indent(a:lnum)
|
||||||
|
|
||||||
|
" Jump to last character in previous line.
|
||||||
|
call cursor(lnum, len(text))
|
||||||
|
let ignore_last_char = eval(s:skip_special_chars)
|
||||||
|
|
||||||
|
" Search for final colon that is not inside something to be ignored.
|
||||||
|
while 1
|
||||||
|
let curpos = getpos('.')[2]
|
||||||
|
if curpos == 1 | break | endif
|
||||||
|
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
|
||||||
|
normal! h
|
||||||
|
continue
|
||||||
|
elseif text[curpos-1] ==# ':'
|
||||||
|
return base + s:sw()
|
||||||
|
endif
|
||||||
|
break
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if text =~# '\\$' && !ignore_last_char
|
||||||
|
" If this line is the continuation of a control statement
|
||||||
|
" indent further to distinguish the continuation line
|
||||||
|
" from the next logical line.
|
||||||
|
if getline(start) =~# b:control_statement
|
||||||
|
return base + s:sw() * 2
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Nest (other) explicit continuations only one level deeper.
|
||||||
|
return base + s:sw()
|
||||||
|
endif
|
||||||
|
|
||||||
|
let empty = getline(a:lnum) =~# '^\s*$'
|
||||||
|
|
||||||
|
" Current and prev line are empty, next is not -> indent like next.
|
||||||
|
if empty && a:lnum > 1 &&
|
||||||
|
\ (getline(a:lnum - 1) =~# '^\s*$') &&
|
||||||
|
\ !(getline(a:lnum + 1) =~# '^\s*$')
|
||||||
|
return indent(a:lnum + 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous statement was a stop-execution statement or a pass
|
||||||
|
if getline(start) =~# s:stop_statement
|
||||||
|
" Remove one level of indentation if the user hasn't already dedented
|
||||||
|
if empty || current > base - s:sw()
|
||||||
|
return base - s:sw()
|
||||||
|
endif
|
||||||
|
" Otherwise, trust the user
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty && s:is_dedented_already(current, base)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" In all other cases, line up with the start of the previous statement.
|
||||||
|
return base
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" If this line is dedented and the number of indent spaces is valid
|
||||||
|
" (multiple of the indentation size), trust the user.
|
||||||
|
function! s:is_dedented_already(current, base)
|
||||||
|
let dedent_size = a:current - a:base
|
||||||
|
return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Is the syntax at lnum (and optionally cnum) a python string?
|
||||||
|
function! s:is_python_string(lnum, ...)
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let linelen = len(line)
|
||||||
|
if linelen < 1
|
||||||
|
let linelen = 1
|
||||||
|
endif
|
||||||
|
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
|
||||||
|
for cnum in cols
|
||||||
|
if match(map(synstack(a:lnum, cnum),
|
||||||
|
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
endfor
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! GetPythonPEPIndent(lnum)
|
||||||
|
" First line has indent 0
|
||||||
|
if a:lnum == 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let prevline = getline(a:lnum-1)
|
||||||
|
|
||||||
|
" Multilinestrings: continous, docstring or starting.
|
||||||
|
if s:is_python_string(a:lnum-1, len(prevline))
|
||||||
|
\ && (s:is_python_string(a:lnum, 1)
|
||||||
|
\ || match(line, '^\%("""\|''''''\)') != -1)
|
||||||
|
|
||||||
|
" Indent closing quotes as the line with the opening ones.
|
||||||
|
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
|
||||||
|
if match_quotes != -1
|
||||||
|
" closing multiline string
|
||||||
|
let quotes = line[match_quotes:(match_quotes+2)]
|
||||||
|
let pairpos = searchpairpos(quotes, '', quotes, 'b')
|
||||||
|
if pairpos[0] != 0
|
||||||
|
return indent(pairpos[0])
|
||||||
|
else
|
||||||
|
" TODO: test to cover this!
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_python_string(a:lnum-1)
|
||||||
|
" Previous line is (completely) a string.
|
||||||
|
return indent(a:lnum-1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
||||||
|
" docstring.
|
||||||
|
return indent(a:lnum-1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
|
||||||
|
\ get(g:, 'python_pep8_indent_multiline_string', 0))
|
||||||
|
if match(prevline, '\v%("""|'''''')$') != -1
|
||||||
|
" Opening multiline string, started in previous line.
|
||||||
|
if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
|
||||||
|
\ || match(line, '\v^\s+$') != -1
|
||||||
|
" <CR> with empty line or to split up 'foo("""bar' into
|
||||||
|
" 'foo("""' and 'bar'.
|
||||||
|
if indent_multi == -2
|
||||||
|
return indent(a:lnum-1) + s:sw()
|
||||||
|
endif
|
||||||
|
return indent_multi
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keep existing indent.
|
||||||
|
if match(line, '\v^\s*\S') != -1
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if indent_multi != -2
|
||||||
|
return indent_multi
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:indent_like_opening_paren(a:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Parens: If we can find an open parenthesis/bracket/brace, line up with it.
|
||||||
|
let indent = s:indent_like_opening_paren(a:lnum)
|
||||||
|
if indent >= -1
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Blocks: Match indent of first block of this type.
|
||||||
|
let indent = s:indent_like_block(a:lnum)
|
||||||
|
if indent >= -1
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:indent_like_previous_line(a:lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -8,6 +8,7 @@ if exists("b:did_indent")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal autoindent cindent
|
setlocal autoindent cindent
|
||||||
|
setlocal formatoptions+=roq
|
||||||
|
|
||||||
" vim:set sts=2 sw=2 :
|
" vim:set sts=2 sw=2 :
|
||||||
|
|
||||||
|
|||||||
@@ -296,9 +296,20 @@ function! GetHaskellIndent()
|
|||||||
|
|
||||||
"" where foo
|
"" where foo
|
||||||
"" >>>>>>bar
|
"" >>>>>>bar
|
||||||
|
""
|
||||||
|
"" where foo :: Int
|
||||||
|
"" >>>>>>>>>>-> Int
|
||||||
|
""
|
||||||
|
"" where foo x
|
||||||
|
"" >>>>>>>>|
|
||||||
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
|
if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
|
||||||
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
|
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
|
||||||
return match(l:prevline, ':: ')
|
return match(l:prevline, ':: ')
|
||||||
|
elseif l:line =~ '^\s*|\s'
|
||||||
|
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 + g:haskell_indent_guard
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let l:s = match(l:prevline, '\C\<where\>')
|
let l:s = match(l:prevline, '\C\<where\>')
|
||||||
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)
|
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
|||||||
" Language: Javascript
|
" Language: Javascript
|
||||||
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
||||||
" URL: https://github.com/pangloss/vim-javascript
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
" Last Change: September 18, 2017
|
" Last Change: December 4, 2017
|
||||||
|
|
||||||
" 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')
|
||||||
@@ -12,10 +12,6 @@ if exists('b:did_indent')
|
|||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
" indent correctly if inside <script>
|
|
||||||
" vim/vim@690afe1 for the switch from cindent
|
|
||||||
let b:html_indent_script1 = 'inc'
|
|
||||||
|
|
||||||
" 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 autoindent nolisp nosmartindent
|
setlocal autoindent nolisp nosmartindent
|
||||||
@@ -27,13 +23,6 @@ setlocal indentkeys+=0],0)
|
|||||||
|
|
||||||
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
||||||
|
|
||||||
" Regex of syntax group names that are or delimit string or are comments.
|
|
||||||
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
|
|
||||||
let b:syng_str = get(b:,'syng_str','string\|template\|special')
|
|
||||||
" template strings may want to be excluded when editing graphql:
|
|
||||||
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
|
||||||
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
|
||||||
|
|
||||||
" Only define the function once.
|
" Only define the function once.
|
||||||
if exists('*GetJavascriptIndent')
|
if exists('*GetJavascriptIndent')
|
||||||
finish
|
finish
|
||||||
@@ -42,6 +31,23 @@ endif
|
|||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
|
" indent correctly if inside <script>
|
||||||
|
" vim/vim@690afe1 for the switch from cindent
|
||||||
|
" overridden with b:html_indent_script1
|
||||||
|
call extend(g:,{'html_indent_script1': 'inc'},'keep')
|
||||||
|
|
||||||
|
" Regex of syntax group names that are or delimit string or are comments.
|
||||||
|
let s:bvars = {
|
||||||
|
\ 'syng_strcom': 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!',
|
||||||
|
\ 'syng_str': 'string\|template\|special' }
|
||||||
|
" template strings may want to be excluded when editing graphql:
|
||||||
|
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
||||||
|
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
||||||
|
|
||||||
|
function s:GetVars()
|
||||||
|
call extend(b:,extend(s:bvars,{'js_cache': [0,0,0]}),'keep')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Get shiftwidth value
|
" Get shiftwidth value
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
function s:sw()
|
function s:sw()
|
||||||
@@ -106,9 +112,7 @@ endfunction
|
|||||||
function s:SkipFunc()
|
function s:SkipFunc()
|
||||||
if s:top_col == 1
|
if s:top_col == 1
|
||||||
throw 'out of bounds'
|
throw 'out of bounds'
|
||||||
endif
|
elseif s:check_in
|
||||||
let s:top_col = 0
|
|
||||||
if s:check_in
|
|
||||||
if eval(s:skip_expr)
|
if eval(s:skip_expr)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
@@ -117,11 +121,14 @@ function s:SkipFunc()
|
|||||||
if eval(s:skip_expr)
|
if eval(s:skip_expr)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) && eval(s:skip_expr)
|
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
|
||||||
let s:check_in = 1
|
if eval(s:skip_expr)
|
||||||
return 1
|
let s:check_in = 1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
|
||||||
endif
|
endif
|
||||||
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
|
|
||||||
let [s:looksyn, s:top_col] = getpos('.')[1:2]
|
let [s:looksyn, s:top_col] = getpos('.')[1:2]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -161,19 +168,29 @@ function s:Token()
|
|||||||
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
|
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:PreviousToken()
|
function s:PreviousToken(...)
|
||||||
let l:col = col('.')
|
let [l:pos, tok] = [getpos('.'), '']
|
||||||
if search('\m\k\{1,}\|\S','ebW')
|
if search('\m\k\{1,}\|\S','ebW')
|
||||||
if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm)
|
if getline('.')[col('.')-2:col('.')-1] == '*/'
|
||||||
if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
|
if eval(s:in_comm) && !s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
|
||||||
return s:Token()
|
call setpos('.',l:pos)
|
||||||
|
else
|
||||||
|
let tok = s:Token()
|
||||||
endif
|
endif
|
||||||
call cursor(a:firstline, l:col)
|
|
||||||
else
|
else
|
||||||
return s:Token()
|
let two = a:0 || line('.') != l:pos[1] ? strridx(getline('.')[:col('.')],'//') + 1 : 0
|
||||||
|
if two && eval(s:in_comm)
|
||||||
|
call cursor(0,two)
|
||||||
|
let tok = s:PreviousToken(1)
|
||||||
|
if tok is ''
|
||||||
|
call setpos('.',l:pos)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let tok = s:Token()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return ''
|
return tok
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:Pure(f,...)
|
function s:Pure(f,...)
|
||||||
@@ -217,30 +234,29 @@ let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
|||||||
let s:continuation = get(g:,'javascript_continuation',
|
let s:continuation = get(g:,'javascript_continuation',
|
||||||
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||||
|
|
||||||
function s:Continues(ln,con)
|
function s:Continues()
|
||||||
let tok = matchstr(a:con[-15:],s:continuation)
|
let tok = matchstr(strpart(getline('.'),col('.')-15,15),s:continuation)
|
||||||
if tok =~ '[a-z:]'
|
if tok =~ '[a-z:]'
|
||||||
call cursor(a:ln, len(a:con))
|
|
||||||
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
|
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
|
||||||
elseif tok !~ '[/>]'
|
elseif tok !~ '[/>]'
|
||||||
return tok isnot ''
|
return tok isnot ''
|
||||||
endif
|
endif
|
||||||
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
|
return s:SynAt(line('.'),col('.')) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if line 'lnum' has a balanced amount of parentheses.
|
" Check if line 'lnum' has a balanced amount of parentheses.
|
||||||
function s:Balanced(lnum)
|
function s:Balanced(lnum,line)
|
||||||
let [l:open, l:line] = [0, getline(a:lnum)]
|
let l:open = 0
|
||||||
let pos = match(l:line, '[][(){}]')
|
let pos = match(a:line, '[][(){}]')
|
||||||
while pos != -1
|
while pos != -1
|
||||||
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
|
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
|
||||||
let l:open += match(' ' . l:line[pos],'[[({]')
|
let l:open += matchend(a:line[pos],'[[({]')
|
||||||
if l:open < 0
|
if l:open < 0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ?
|
let pos = match(a:line, !l:open ? '[][(){}]' : '()' =~ a:line[pos] ?
|
||||||
\ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1)
|
\ '[()]' : '{}' =~ a:line[pos] ? '[{}]' : '[][]', pos + 1)
|
||||||
endwhile
|
endwhile
|
||||||
return !l:open
|
return !l:open
|
||||||
endfunction
|
endfunction
|
||||||
@@ -253,28 +269,36 @@ function s:OneScope()
|
|||||||
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
|
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
|
||||||
elseif s:Token() =~# '^else$\|^do$'
|
elseif s:Token() =~# '^else$\|^do$'
|
||||||
return s:Pure('s:PreviousToken') != '.'
|
return s:Pure('s:PreviousToken') != '.'
|
||||||
|
elseif strpart(getline('.'),col('.')-2,2) == '=>'
|
||||||
|
call cursor(0,col('.')-1)
|
||||||
|
return s:PreviousToken() != ')' || s:GetPair('(', ')', 'bW', s:skip_expr)
|
||||||
endif
|
endif
|
||||||
return strpart(getline('.'),col('.')-2,2) == '=>'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:DoWhile()
|
function s:DoWhile()
|
||||||
let cpos = searchpos('\m\<','cbW')
|
let cpos = searchpos('\m\<','cbW')
|
||||||
if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
|
while s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
|
||||||
if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ?
|
if s:LookingAt() =~ '\a'
|
||||||
\ 'Previous' : ''}Token() ==# 'do' && s:IsBlock()
|
if s:Pure('s:IsBlock')
|
||||||
return 1
|
if s:LookingAt() ==# 'd'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
elseif s:LookingAt() != '}' || !s:GetPair('{','}','bW',s:skip_expr)
|
||||||
|
break
|
||||||
endif
|
endif
|
||||||
call call('cursor',cpos)
|
endwhile
|
||||||
endif
|
call call('cursor',cpos)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" returns total offset from braceless contexts. 'num' is the lineNr which
|
" returns total offset from braceless contexts. 'num' is the lineNr which
|
||||||
" encloses the entire context, 'cont' if whether a:firstline is a continued
|
" encloses the entire context, 'cont' if whether a:firstline is a continued
|
||||||
" expression, which could have started in a braceless context
|
" expression, which could have started in a braceless context
|
||||||
function s:IsContOne(num,cont)
|
function s:IsContOne(cont)
|
||||||
let [l:num, b_l] = [a:num + !a:num, 0]
|
let [l:num, pind] = b:js_cache[1] ?
|
||||||
let pind = a:num ? indent(a:num) + s:sw() : 0
|
\ [b:js_cache[1], indent(b:js_cache[1]) + s:sw()] : [1,0]
|
||||||
let ind = indent('.') + !a:cont
|
let [ind, b_l] = [indent('.') + !a:cont, 0]
|
||||||
while line('.') > l:num && ind > pind || line('.') == l:num
|
while line('.') > l:num && ind > pind || line('.') == l:num
|
||||||
if indent('.') < ind && s:OneScope()
|
if indent('.') < ind && s:OneScope()
|
||||||
let b_l += 1
|
let b_l += 1
|
||||||
@@ -292,14 +316,15 @@ function s:IsContOne(num,cont)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:IsSwitch()
|
function s:IsSwitch()
|
||||||
call call('cursor',b:js_cache[1:])
|
return search('\m\C\%'.join(b:js_cache[1:],'l\%').
|
||||||
return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z)
|
\ 'c{\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nW'.s:z)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
||||||
function s:IsBlock()
|
function s:IsBlock()
|
||||||
let tok = s:PreviousToken()
|
let tok = s:PreviousToken()
|
||||||
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
|
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
|
||||||
|
let s:in_jsx = 1
|
||||||
return tok != '{'
|
return tok != '{'
|
||||||
elseif tok =~ '\k'
|
elseif tok =~ '\k'
|
||||||
if tok ==# 'type'
|
if tok ==# 'type'
|
||||||
@@ -324,7 +349,7 @@ function s:IsBlock()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function GetJavascriptIndent()
|
function GetJavascriptIndent()
|
||||||
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
call s:GetVars()
|
||||||
let s:synid_cache = [[],[]]
|
let s:synid_cache = [[],[]]
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
" use synstack as it validates syn state and works in an empty line
|
" use synstack as it validates syn state and works in an empty line
|
||||||
@@ -332,13 +357,11 @@ function GetJavascriptIndent()
|
|||||||
|
|
||||||
" start with strings,comments,etc.
|
" start with strings,comments,etc.
|
||||||
if s:stack[-1] =~? 'comment\|doc'
|
if s:stack[-1] =~? 'comment\|doc'
|
||||||
if l:line =~ '^\s*\*'
|
if l:line !~ '^\s*\/[/*]'
|
||||||
return cindent(v:lnum)
|
return l:line =~ '^\s*\*' ? cindent(v:lnum) : -1
|
||||||
elseif l:line !~ '^\s*\/[/*]'
|
|
||||||
return -1
|
|
||||||
endif
|
endif
|
||||||
elseif s:stack[-1] =~? b:syng_str
|
elseif s:stack[-1] =~? b:syng_str
|
||||||
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
|
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1,getline(v:lnum-1))
|
||||||
let b:js_cache[0] = v:lnum
|
let b:js_cache[0] = v:lnum
|
||||||
endif
|
endif
|
||||||
return -1
|
return -1
|
||||||
@@ -350,7 +373,7 @@ function GetJavascriptIndent()
|
|||||||
if s:PreviousToken() is ''
|
if s:PreviousToken() is ''
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]]
|
let [l:lnum, lcol, pline] = getpos('.')[1:2] + [getline('.')[:col('.')-1]]
|
||||||
|
|
||||||
let l:line = substitute(l:line,'^\s*','','')
|
let l:line = substitute(l:line,'^\s*','','')
|
||||||
let l:line_raw = l:line
|
let l:line_raw = l:line
|
||||||
@@ -365,7 +388,7 @@ function GetJavascriptIndent()
|
|||||||
call cursor(v:lnum,1)
|
call cursor(v:lnum,1)
|
||||||
let idx = index([']',')','}'],l:line[0])
|
let idx = index([']',')','}'],l:line[0])
|
||||||
if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
|
if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
|
||||||
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum)
|
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum,pline)
|
||||||
call call('cursor',b:js_cache[1:])
|
call call('cursor',b:js_cache[1:])
|
||||||
else
|
else
|
||||||
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
|
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
|
||||||
@@ -386,10 +409,10 @@ function GetJavascriptIndent()
|
|||||||
|
|
||||||
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
|
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
|
||||||
|
|
||||||
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
|
let [num_ind, is_op, b_l, l:switch_offset, s:in_jsx] = [s:Nat(indent(num)),0,0,0,0]
|
||||||
if !num || s:LookingAt() == '{' && s:IsBlock()
|
if !num || s:LookingAt() == '{' && s:IsBlock()
|
||||||
let ilnum = line('.')
|
let ilnum = line('.')
|
||||||
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
|
if num && !s:in_jsx && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
|
||||||
if ilnum == num
|
if ilnum == num
|
||||||
let [num, num_ind] = [line('.'), indent('.')]
|
let [num, num_ind] = [line('.'), indent('.')]
|
||||||
endif
|
endif
|
||||||
@@ -403,28 +426,27 @@ function GetJavascriptIndent()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if idx == -1 && pline[-1:] !~ '[{;]'
|
if idx == -1 && pline[-1:] !~ '[{;]'
|
||||||
|
call cursor(l:lnum, lcol)
|
||||||
let sol = matchstr(l:line,s:opfirst)
|
let sol = matchstr(l:line,s:opfirst)
|
||||||
if sol is '' || sol == '/' && s:SynAt(v:lnum,
|
if sol is '' || sol == '/' && s:SynAt(v:lnum,
|
||||||
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
|
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
|
||||||
if s:Continues(l:lnum,pline)
|
if s:Continues()
|
||||||
let is_op = s:sw()
|
let is_op = s:sw()
|
||||||
endif
|
endif
|
||||||
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$'
|
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' &&
|
||||||
call cursor(l:lnum, len(pline))
|
\ s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
|
||||||
if s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
|
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
|
||||||
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
|
\ (s:PreviousToken() == ']' || s:LookingAt() =~ '\k' &&
|
||||||
\ (s:PreviousToken() == ']' || s:Token() =~ '\k' &&
|
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
|
||||||
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
|
return num_ind + s:sw()
|
||||||
return num_ind + s:sw()
|
|
||||||
endif
|
|
||||||
let is_op = s:sw()
|
|
||||||
else
|
else
|
||||||
let is_op = s:sw()
|
let is_op = s:sw()
|
||||||
endif
|
endif
|
||||||
call cursor(l:lnum, len(pline))
|
call cursor(l:lnum, lcol)
|
||||||
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw()
|
let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()
|
||||||
endif
|
endif
|
||||||
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
|
elseif idx == -1 && s:LookingAt() == '(' && &cino =~ '(' &&
|
||||||
|
\ (search('\m\S','nbW',num) || s:ParseCino('U'))
|
||||||
let pval = s:ParseCino('(')
|
let pval = s:ParseCino('(')
|
||||||
if !pval
|
if !pval
|
||||||
let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
|
let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
|
||||||
@@ -438,10 +460,10 @@ function GetJavascriptIndent()
|
|||||||
|
|
||||||
" main return
|
" main return
|
||||||
if l:line =~ '^[])}]\|^|}'
|
if l:line =~ '^[])}]\|^|}'
|
||||||
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
|
if l:line_raw[0] == ')'
|
||||||
if s:ParseCino('M')
|
if s:ParseCino('M')
|
||||||
return indent(l:lnum)
|
return indent(l:lnum)
|
||||||
elseif &cino =~# 'm' && !s:ParseCino('m')
|
elseif num && &cino =~# 'm' && !s:ParseCino('m')
|
||||||
return virtcol('.') - 1
|
return virtcol('.') - 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -449,6 +471,10 @@ function GetJavascriptIndent()
|
|||||||
elseif num
|
elseif num
|
||||||
return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
|
return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
|
||||||
endif
|
endif
|
||||||
|
let nest = get(get(b:,'hi_indent',{}),'blocklnr')
|
||||||
|
if nest
|
||||||
|
return indent(nest) + s:sw() + b_l + is_op
|
||||||
|
endif
|
||||||
return b_l + is_op
|
return b_l + is_op
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
225
indent/julia.vim
225
indent/julia.vim
@@ -3,13 +3,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Julia
|
" Language: Julia
|
||||||
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
|
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
|
||||||
" Last Change: 2011 dec 11
|
" Last Change: 2016 jun 16
|
||||||
" Notes: based on Bram Moneaar's indent file for vim
|
" Notes: originally based on Bram Molenaar's indent file for vim
|
||||||
|
|
||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
|
|
||||||
setlocal indentexpr=GetJuliaIndent()
|
setlocal indentexpr=GetJuliaIndent()
|
||||||
setlocal indentkeys+==end,=else,=catch,=finally
|
setlocal indentkeys+==end,=else,=catch,=finally,),],}
|
||||||
setlocal indentkeys-=0#
|
setlocal indentkeys-=0#
|
||||||
setlocal indentkeys-=:
|
setlocal indentkeys-=:
|
||||||
setlocal indentkeys-=0{
|
setlocal indentkeys-=0{
|
||||||
@@ -21,12 +21,16 @@ if exists("*GetJuliaIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:skipPatterns = '\<julia\%(Comment\)\>'
|
let s:skipPatterns = '\<julia\%(Comprehension\%(For\|If\)\|RangeEnd\|CommentL\|\%([bsv]\|ip\|big\|MIME\|Shell\|Printf\|Doc\)\=String\|RegEx\|SymbolS\?\)\>'
|
||||||
|
|
||||||
function JuliaMatch(lnum, str, regex, st)
|
function JuliaMatch(lnum, str, regex, st, ...)
|
||||||
let s = a:st
|
let s = a:st
|
||||||
|
let e = a:0 > 0 ? a:1 : -1
|
||||||
while 1
|
while 1
|
||||||
let f = match(a:str, a:regex, s)
|
let f = match(a:str, a:regex, s)
|
||||||
|
if e >= 0 && f >= e
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
if f >= 0
|
if f >= 0
|
||||||
let attr = synIDattr(synID(a:lnum,f+1,1),"name")
|
let attr = synIDattr(synID(a:lnum,f+1,1),"name")
|
||||||
if attr =~ s:skipPatterns
|
if attr =~ s:skipPatterns
|
||||||
@@ -39,15 +43,16 @@ function JuliaMatch(lnum, str, regex, st)
|
|||||||
return f
|
return f
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function GetJuliaNestingStruct(lnum)
|
function GetJuliaNestingStruct(lnum, ...)
|
||||||
" Auxiliary function to inspect the block structure of a line
|
" Auxiliary function to inspect the block structure of a line
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
let s = 0
|
let s = a:0 > 0 ? a:1 : 0
|
||||||
|
let e = a:0 > 1 ? a:2 : -1
|
||||||
let blocks_stack = []
|
let blocks_stack = []
|
||||||
let num_closed_blocks = 0
|
let num_closed_blocks = 0
|
||||||
while 1
|
while 1
|
||||||
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\=\|while\|for\|try\|catch\|finally\|function\|macro\|begin\|type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s)
|
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\=\|while\|for\|try\|catch\|finally\|\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\%(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s, e)
|
||||||
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s)
|
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s, e)
|
||||||
|
|
||||||
if fb < 0 && fe < 0
|
if fb < 0 && fe < 0
|
||||||
" No blocks found
|
" No blocks found
|
||||||
@@ -128,9 +133,13 @@ function GetJuliaNestingStruct(lnum)
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|function\|macro\|begin\|type\|immutable\|let\|quote\|do\)\>', s)
|
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|\%(staged\)\?function\|macro\|begin\|\%(mutable\s\+\)\?struct\|\%(\%(abstract\|primitive\)\s\+\)\?type\|immutable\|let\|quote\|do\)\>', s)
|
||||||
if i >= 0 && i == fb
|
if i >= 0 && i == fb
|
||||||
let s = i+1
|
if match(line, '\<\%(mutable\|abstract\|primitive\)', i) != -1
|
||||||
|
let s = i+11
|
||||||
|
else
|
||||||
|
let s = i+1
|
||||||
|
endif
|
||||||
call add(blocks_stack, 'other')
|
call add(blocks_stack, 'other')
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@@ -158,6 +167,128 @@ function GetJuliaNestingStruct(lnum)
|
|||||||
return [num_open_blocks, num_closed_blocks]
|
return [num_open_blocks, num_closed_blocks]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function GetJuliaNestingBrackets(lnum, c)
|
||||||
|
" Auxiliary function to inspect the brackets structure of a line
|
||||||
|
let line = getline(a:lnum)[0 : (a:c - 1)]
|
||||||
|
let s = 0
|
||||||
|
let brackets_stack = []
|
||||||
|
let last_closed_bracket = -1
|
||||||
|
while 1
|
||||||
|
let fb = JuliaMatch(a:lnum, line, '[([{]', s)
|
||||||
|
let fe = JuliaMatch(a:lnum, line, '[])}]', s)
|
||||||
|
|
||||||
|
if fb < 0 && fe < 0
|
||||||
|
" No brackets found
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if fb >= 0 && (fb < fe || fe < 0)
|
||||||
|
" The first occurrence is an opening bracket
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, '(', s)
|
||||||
|
if i >= 0 && i == fb
|
||||||
|
let s = i+1
|
||||||
|
call add(brackets_stack, ['par',i])
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, '\[', s)
|
||||||
|
if i >= 0 && i == fb
|
||||||
|
let s = i+1
|
||||||
|
call add(brackets_stack, ['sqbra',i])
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, '{', s)
|
||||||
|
if i >= 0 && i == fb
|
||||||
|
let s = i+1
|
||||||
|
call add(brackets_stack, ['curbra',i])
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Note: it should be impossible to get here
|
||||||
|
break
|
||||||
|
|
||||||
|
else
|
||||||
|
" The first occurrence is a closing bracket
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, ')', s)
|
||||||
|
if i >= 0 && i == fe
|
||||||
|
let s = i+1
|
||||||
|
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'par'
|
||||||
|
call remove(brackets_stack, -1)
|
||||||
|
else
|
||||||
|
let last_closed_bracket = i + 1
|
||||||
|
endif
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, ']', s)
|
||||||
|
if i >= 0 && i == fe
|
||||||
|
let s = i+1
|
||||||
|
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'sqbra'
|
||||||
|
call remove(brackets_stack, -1)
|
||||||
|
else
|
||||||
|
let last_closed_bracket = i + 1
|
||||||
|
endif
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = JuliaMatch(a:lnum, line, '}', s)
|
||||||
|
if i >= 0 && i == fe
|
||||||
|
let s = i+1
|
||||||
|
if len(brackets_stack) > 0 && brackets_stack[-1][0] == 'curbra'
|
||||||
|
call remove(brackets_stack, -1)
|
||||||
|
else
|
||||||
|
let last_closed_bracket = i + 1
|
||||||
|
endif
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Note: it should be impossible to get here
|
||||||
|
break
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Note: it should be impossible to get here
|
||||||
|
break
|
||||||
|
endwhile
|
||||||
|
let first_open_bracket = -1
|
||||||
|
let last_open_bracket = -1
|
||||||
|
if len(brackets_stack) > 0
|
||||||
|
let first_open_bracket = brackets_stack[0][1]
|
||||||
|
let last_open_bracket = brackets_stack[-1][1]
|
||||||
|
endif
|
||||||
|
return [first_open_bracket, last_open_bracket, last_closed_bracket]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:bracketBlocks = '\<julia\%(\%(\%(Printf\)\?Par\|SqBra\|CurBra\)Block\|ParBlockInRange\|StringVars\%(Par\|SqBra\|CurBra\)\|Dollar\%(Par\|SqBra\)\|QuotedParBlockS\?\)\>'
|
||||||
|
|
||||||
|
function IsInBrackets(lnum, c)
|
||||||
|
let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
|
||||||
|
call filter(stack, 'v:val =~# s:bracketBlocks')
|
||||||
|
return len(stack) > 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Auxiliary function to find a line which does not start in the middle of a
|
||||||
|
" multiline bracketed expression, to be used as reference for block
|
||||||
|
" indentation.
|
||||||
|
function LastBlockIndent(lnum)
|
||||||
|
let lnum = a:lnum
|
||||||
|
let ind = 0
|
||||||
|
while lnum > 0
|
||||||
|
let ind = indent(lnum)
|
||||||
|
if ind == 0
|
||||||
|
return [lnum, 0]
|
||||||
|
endif
|
||||||
|
if !IsInBrackets(lnum, 1)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return [max([lnum,1]), ind]
|
||||||
|
endfunction
|
||||||
|
|
||||||
function GetJuliaIndent()
|
function GetJuliaIndent()
|
||||||
let s:save_ignorecase = &ignorecase
|
let s:save_ignorecase = &ignorecase
|
||||||
set noignorecase
|
set noignorecase
|
||||||
@@ -172,19 +303,81 @@ function GetJuliaIndent()
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let ind = indent(lnum)
|
let ind = -1
|
||||||
|
let st = -1
|
||||||
|
let lim = -1
|
||||||
|
|
||||||
" Analyse previous line
|
" Multiline bracketed expressions take precedence
|
||||||
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum)
|
let c = len(getline(lnum)) + 1
|
||||||
|
while IsInBrackets(lnum, c)
|
||||||
|
let [first_open_bracket, last_open_bracket, last_closed_bracket] = GetJuliaNestingBrackets(lnum, c)
|
||||||
|
|
||||||
|
" First scenario: the previous line has a hanging open bracket:
|
||||||
|
" set the indentation to match the opening bracket (plus an extra space)
|
||||||
|
if last_open_bracket != -1
|
||||||
|
let st = last_open_bracket
|
||||||
|
let ind = virtcol([lnum, st + 1])
|
||||||
|
|
||||||
|
" Second scenario: some multiline bracketed expression was closed in the
|
||||||
|
" previous line. But since we know we are still in a bracketed expression,
|
||||||
|
" we need to find the line where the bracket was open
|
||||||
|
elseif last_closed_bracket != -1 " && exists("loaded_matchit")
|
||||||
|
" we use the % command to skip back (this is buggy without matchit, and
|
||||||
|
" is potentially a disaster if % got remapped)
|
||||||
|
call cursor(lnum, last_closed_bracket)
|
||||||
|
normal %
|
||||||
|
if line(".") == lnum
|
||||||
|
" something wrong here, give up
|
||||||
|
let ind = indent(lnum)
|
||||||
|
else
|
||||||
|
let lnum = line(".")
|
||||||
|
let c = col(".") - 1
|
||||||
|
if c == 0
|
||||||
|
" uhm, give up
|
||||||
|
let ind = 0
|
||||||
|
else
|
||||||
|
" we skipped a bracket set, keep searching for an opening bracket
|
||||||
|
let lim = c
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Third scenario: nothing special, or matchit not available: keep the indentation
|
||||||
|
else
|
||||||
|
let ind = indent(lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" In case the current line starts with a closing bracket, we align it with
|
||||||
|
" the opening one.
|
||||||
|
if JuliaMatch(v:lnum, getline(v:lnum), '[])}]', indent(v:lnum)) == indent(v:lnum) && ind > 0
|
||||||
|
return ind - 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
break
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if ind == -1
|
||||||
|
" We are not in a multiline bracketed expression. Thus we look for a
|
||||||
|
" previous line to use as a reference
|
||||||
|
let [lnum,ind] = LastBlockIndent(lnum)
|
||||||
|
let c = len(getline(lnum)) + 1
|
||||||
|
if IsInBrackets(lnum, c)
|
||||||
|
let [first_open_bracket, last_open_bracket, last_closed_bracket] = GetJuliaNestingBrackets(lnum, c)
|
||||||
|
let lim = first_open_bracket
|
||||||
|
endif
|
||||||
|
end
|
||||||
|
|
||||||
|
" Analyse the reference line
|
||||||
|
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim)
|
||||||
|
|
||||||
" Increase indentation for each newly opened block
|
" Increase indentation for each newly opened block
|
||||||
" in the previous line
|
" in the reference line
|
||||||
while num_open_blocks > 0
|
while num_open_blocks > 0
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
let num_open_blocks -= 1
|
let num_open_blocks -= 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" Analyse current line
|
" Analyse the current line
|
||||||
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
|
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
|
||||||
|
|
||||||
" Decrease indentation for each closed block
|
" Decrease indentation for each closed block
|
||||||
|
|||||||
@@ -74,48 +74,42 @@ function GetLuaIndent()
|
|||||||
|
|
||||||
let original_cursor_pos = getpos(".")
|
let original_cursor_pos = getpos(".")
|
||||||
|
|
||||||
let i = 0
|
" count how many blocks the previous line opens
|
||||||
|
|
||||||
" check if the previous line opens blocks
|
|
||||||
call cursor(v:lnum, 1)
|
call cursor(v:lnum, 1)
|
||||||
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
let num_prev_opens = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
\ 'mrb', s:skip_expr, prev_line)
|
\ 'mrb', s:skip_expr, prev_line)
|
||||||
if num_pairs > 0
|
|
||||||
let i += num_pairs
|
|
||||||
endif
|
|
||||||
|
|
||||||
" special case: call(with, {anon = function() -- should indent only once
|
" count how many blocks the current line closes
|
||||||
if num_pairs > 1 && contents_prev =~# s:anon_func_start
|
|
||||||
let i = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" check if current line closes blocks
|
|
||||||
call cursor(prev_line, col([prev_line,'$']))
|
call cursor(prev_line, col([prev_line,'$']))
|
||||||
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
let num_cur_closes = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
\ 'mr', s:skip_expr, v:lnum)
|
\ 'mr', s:skip_expr, v:lnum)
|
||||||
if num_pairs > 0
|
|
||||||
let i -= num_pairs
|
|
||||||
endif
|
|
||||||
|
|
||||||
" special case: end}) -- end of call with anon func should unindent once
|
let i = num_prev_opens - num_cur_closes
|
||||||
if num_pairs > 1 && contents_cur =~# s:anon_func_end
|
|
||||||
let i = -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" if the previous line closed a paren, unindent (except with anon funcs)
|
" if the previous line closed a paren, outdent (except with anon funcs)
|
||||||
call cursor(prev_line - 1, col([prev_line - 1, '$']))
|
call cursor(prev_line - 1, col([prev_line - 1, '$']))
|
||||||
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
let num_prev_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
||||||
if num_pairs > 0 && contents_prev !~ s:anon_func_end
|
if num_prev_closed_parens > 0 && contents_prev !~# s:anon_func_end
|
||||||
let i -= 1
|
let i -= 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" if this line closed a paren, indent (except with anon funcs)
|
" if this line closed a paren, indent (except with anon funcs)
|
||||||
call cursor(prev_line, col([prev_line, '$']))
|
call cursor(prev_line, col([prev_line, '$']))
|
||||||
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
let num_cur_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
||||||
if num_pairs > 0 && contents_cur !~ s:anon_func_end
|
if num_cur_closed_parens > 0 && contents_cur !~# s:anon_func_end
|
||||||
let i += 1
|
let i += 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" special case: call(with, {anon = function() -- should indent only once
|
||||||
|
if i > 1 && contents_prev =~# s:anon_func_start
|
||||||
|
let i = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" special case: end}) -- end of call w/ anon func should outdent only once
|
||||||
|
if i < -1 && contents_cur =~# s:anon_func_end
|
||||||
|
let i = -1
|
||||||
|
endif
|
||||||
|
|
||||||
" restore cursor
|
" restore cursor
|
||||||
call setpos(".", original_cursor_pos)
|
call setpos(".", original_cursor_pos)
|
||||||
|
|
||||||
|
|||||||
79
indent/markdown.vim
Normal file
79
indent/markdown.vim
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
||||||
|
|
||||||
|
if exists("b:did_indent") | finish | endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetMarkdownIndent()
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent
|
||||||
|
|
||||||
|
" Automatically insert bullets
|
||||||
|
setlocal formatoptions+=r
|
||||||
|
" Do not automatically insert bullets when auto-wrapping with text-width
|
||||||
|
setlocal formatoptions-=c
|
||||||
|
" Accept various markers as bullets
|
||||||
|
setlocal comments=b:*,b:+,b:-
|
||||||
|
|
||||||
|
" Automatically continue blockquote on line break
|
||||||
|
setlocal comments+=b:>
|
||||||
|
|
||||||
|
" Only define the function once
|
||||||
|
if exists("*GetMarkdownIndent") | finish | endif
|
||||||
|
|
||||||
|
function! s:IsMkdCode(lnum)
|
||||||
|
let name = synIDattr(synID(a:lnum, 1, 0), 'name')
|
||||||
|
return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:IsLiStart(line)
|
||||||
|
return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
|
||||||
|
\ a:line =~ '^\s*[*+-] \+'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:IsHeaderLine(line)
|
||||||
|
return a:line =~ '^\s*#'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:IsBlankLine(line)
|
||||||
|
return a:line =~ '^$'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:PrevNonBlank(lnum)
|
||||||
|
let i = a:lnum
|
||||||
|
while i > 1 && s:IsBlankLine(getline(i))
|
||||||
|
let i -= 1
|
||||||
|
endwhile
|
||||||
|
return i
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function GetMarkdownIndent()
|
||||||
|
if v:lnum > 2 && s:IsBlankLine(getline(v:lnum - 1)) && s:IsBlankLine(getline(v:lnum - 2))
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let list_ind = get(g:, "vim_markdown_new_list_item_indent", 4)
|
||||||
|
" Find a non-blank line above the current line.
|
||||||
|
let lnum = s:PrevNonBlank(v:lnum - 1)
|
||||||
|
" At the start of the file use zero indent.
|
||||||
|
if lnum == 0 | return 0 | endif
|
||||||
|
let ind = indent(lnum)
|
||||||
|
let line = getline(lnum) " Last line
|
||||||
|
let cline = getline(v:lnum) " Current line
|
||||||
|
if s:IsLiStart(cline)
|
||||||
|
" Current line is the first line of a list item, do not change indent
|
||||||
|
return indent(v:lnum)
|
||||||
|
elseif s:IsHeaderLine(cline) && !s:IsMkdCode(v:lnum)
|
||||||
|
" Current line is the header, do not indent
|
||||||
|
return 0
|
||||||
|
elseif s:IsLiStart(line)
|
||||||
|
if s:IsMkdCode(lnum)
|
||||||
|
return ind
|
||||||
|
else
|
||||||
|
" Last line is the first line of a list item, increase indent
|
||||||
|
return ind + list_ind
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return ind
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
86
indent/nix.vim
Normal file
86
indent/nix.vim
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Nix
|
||||||
|
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||||
|
" URL: https://github.com/LnL7/vim-nix
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetNixIndent()
|
||||||
|
setlocal indentkeys+=0=then,0=else,0=inherit,*<Return>
|
||||||
|
|
||||||
|
if exists("*GetNixIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||||
|
let s:block_open = '\%({\|[\)'
|
||||||
|
let s:block_close = '\%(}\|]\)'
|
||||||
|
|
||||||
|
function! GetNixIndent()
|
||||||
|
let lnum = prevnonblank(v:lnum - 1)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
|
||||||
|
" At the start of the file use zero indent.
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
|
||||||
|
let current_line = getline(v:lnum)
|
||||||
|
let last_line = getline(lnum)
|
||||||
|
|
||||||
|
if last_line =~ s:block_open . '\s*$'
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
if current_line =~ '^\s*' . s:block_close
|
||||||
|
let ind -= &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
if last_line =~ '\<let\s*$'
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
if getline(v:lnum - 1) =~ '^\<in\s*$'
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
if current_line =~ '^\s*in\>'
|
||||||
|
let ind -= &sw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if synIDattr(synID(v:lnum, 1, 1), "name") =~ '^nixString'
|
||||||
|
let current_line = getline(v:lnum)
|
||||||
|
|
||||||
|
let ind = indent(v:lnum)
|
||||||
|
let bslnum = searchpair('''''', '', '''''', 'bnW',
|
||||||
|
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "InterpolationSpecial$"')
|
||||||
|
|
||||||
|
if ind <= indent(bslnum)
|
||||||
|
let ind = indent(bslnum) + &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
if current_line =~ '^\s*''''[^''\$]'
|
||||||
|
let ind = indent(bslnum)
|
||||||
|
endif
|
||||||
|
if current_line =~ '^\s*''''$'
|
||||||
|
let ind = indent(bslnum)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -136,9 +136,9 @@ function! GetPerlIndent()
|
|||||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
let brace = strpart(line, bracepos, 1)
|
let brace = strpart(line, bracepos, 1)
|
||||||
if brace == '(' || brace == '{' || brace == '['
|
if brace == '(' || brace == '{' || brace == '['
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
else
|
else
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let bracepos = match(line, braceclass, bracepos + 1)
|
let bracepos = match(line, braceclass, bracepos + 1)
|
||||||
@@ -151,25 +151,25 @@ function! GetPerlIndent()
|
|||||||
\ || synid == "perlBraces"
|
\ || synid == "perlBraces"
|
||||||
\ || synid == "perlStatementIndirObj"
|
\ || synid == "perlStatementIndirObj"
|
||||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
if cline =~ '^\s*[])}]'
|
if cline =~ '^\s*[])}]'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent lines that begin with 'or' or 'and'
|
" Indent lines that begin with 'or' or 'and'
|
||||||
if cline =~ '^\s*\(or\|and\)\>'
|
if cline =~ '^\s*\(or\|and\)\>'
|
||||||
if line !~ '^\s*\(or\|and\)\>'
|
if line !~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(or\|and\)\>'
|
elseif line =~ '^\s*\(or\|and\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let b:did_indent = 1
|
|||||||
" smartindent is good enough for powershell
|
" smartindent is good enough for powershell
|
||||||
setlocal smartindent
|
setlocal smartindent
|
||||||
" disable the indent removal for # marks
|
" disable the indent removal for # marks
|
||||||
inoremap # X#
|
inoremap <buffer> # X#
|
||||||
|
|
||||||
let b:undo_indent = "setl si<"
|
let b:undo_indent = "setl si<"
|
||||||
|
|
||||||
|
|||||||
@@ -1,217 +1,433 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-ident') == -1
|
||||||
|
|
||||||
" PEP8 compatible Python indent file
|
" PEP8 compatible Python indent file
|
||||||
|
" Language: Python
|
||||||
|
" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
|
||||||
|
" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
|
||||||
|
" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
|
||||||
|
" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
|
||||||
|
" License: CC0
|
||||||
|
"
|
||||||
|
" vim-python-pep8-indent - A nicer Python indentation style for vim.
|
||||||
|
" Written in 2004 by David Bustos <bustos@caltech.edu>
|
||||||
|
" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
|
||||||
|
" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
|
||||||
|
" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
|
||||||
|
"
|
||||||
|
" To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
" and related and neighboring rights to this software to the public domain
|
||||||
|
" worldwide. This software is distributed without any warranty.
|
||||||
|
" You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
" with this software. If not, see
|
||||||
|
" <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
|
||||||
" 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
|
||||||
|
|
||||||
setlocal expandtab
|
|
||||||
setlocal nolisp
|
setlocal nolisp
|
||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
|
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
|
||||||
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
||||||
|
|
||||||
let s:maxoff = 50
|
if !exists('g:python_pep8_indent_multiline_string')
|
||||||
|
let g:python_pep8_indent_multiline_string = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:block_rules = {
|
||||||
|
\ '^\s*elif\>': ['if', 'elif'],
|
||||||
|
\ '^\s*except\>': ['try', 'except'],
|
||||||
|
\ '^\s*finally\>': ['try', 'except', 'else']
|
||||||
|
\ }
|
||||||
|
let s:block_rules_multiple = {
|
||||||
|
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
|
||||||
|
\ }
|
||||||
|
" Pairs to look for when searching for opening parenthesis.
|
||||||
|
" The value is the maximum offset in lines.
|
||||||
|
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
|
||||||
|
|
||||||
|
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
|
||||||
|
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
|
||||||
|
else
|
||||||
|
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
|
||||||
|
endif
|
||||||
|
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||||
|
|
||||||
|
" Skip strings and comments. Return 1 for chars to skip.
|
||||||
|
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||||
|
" are inserted temporarily into the buffer.
|
||||||
|
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "\\vstring|comment|jedi\\S"'
|
||||||
|
|
||||||
|
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "\\vcomment|jedi\\S"'
|
||||||
|
|
||||||
|
" Also ignore anything concealed.
|
||||||
|
" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
|
||||||
|
function! s:is_concealed(line, col)
|
||||||
|
let concealed = synconcealed(a:line, a:col)
|
||||||
|
return len(concealed) && concealed[0]
|
||||||
|
endfunction
|
||||||
|
if has('conceal')
|
||||||
|
let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||||
|
\ '=~? "comment"'
|
||||||
|
|
||||||
|
" Use 'shiftwidth()' instead of '&sw'.
|
||||||
|
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
function! s:sw()
|
||||||
|
return shiftwidth()
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:sw()
|
||||||
|
return &shiftwidth
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:pair_sort(x, y)
|
||||||
|
if a:x[0] == a:y[0]
|
||||||
|
return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1
|
||||||
|
else
|
||||||
|
return a:x[0] > a:y[0] ? 1 : -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Find backwards the closest open parenthesis/bracket/brace.
|
" Find backwards the closest open parenthesis/bracket/brace.
|
||||||
function! s:SearchParensPair()
|
function! s:find_opening_paren(...)
|
||||||
let line = line('.')
|
" optional arguments: line and column (defaults to 1) to search around
|
||||||
let col = col('.')
|
if a:0 > 0
|
||||||
|
let view = winsaveview()
|
||||||
|
call cursor(a:1, a:0 > 1 ? a:2 : 1)
|
||||||
|
let ret = s:find_opening_paren()
|
||||||
|
call winrestview(view)
|
||||||
|
return ret
|
||||||
|
endif
|
||||||
|
|
||||||
" Skip strings and comments and don't look too far
|
" Return if cursor is in a comment.
|
||||||
let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
|
exe 'if' s:skip_search '| return [0, 0] | endif'
|
||||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
|
|
||||||
\ '"string\\|comment"'
|
|
||||||
|
|
||||||
" Search for parentheses
|
let nearest = [0, 0]
|
||||||
call cursor(line, col)
|
for [p, maxoff] in items(s:paren_pairs)
|
||||||
let parlnum = searchpair('(', '', ')', 'bW', skip)
|
let stopline = max([0, line('.') - maxoff, nearest[0]])
|
||||||
let parcol = col('.')
|
let next = searchpairpos(
|
||||||
|
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
|
||||||
" Search for brackets
|
if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
|
||||||
call cursor(line, col)
|
let nearest = next
|
||||||
let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
|
endif
|
||||||
let par2col = col('.')
|
endfor
|
||||||
|
return nearest
|
||||||
" Search for braces
|
|
||||||
call cursor(line, col)
|
|
||||||
let par3lnum = searchpair('{', '', '}', 'bW', skip)
|
|
||||||
let par3col = col('.')
|
|
||||||
|
|
||||||
" Get the closest match
|
|
||||||
if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
|
|
||||||
let parlnum = par2lnum
|
|
||||||
let parcol = par2col
|
|
||||||
endif
|
|
||||||
if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
|
|
||||||
let parlnum = par3lnum
|
|
||||||
let parcol = par3col
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Put the cursor on the match
|
|
||||||
if parlnum > 0
|
|
||||||
call cursor(parlnum, parcol)
|
|
||||||
endif
|
|
||||||
return parlnum
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find the start of a multi-line statement
|
" Find the start of a multi-line statement
|
||||||
function! s:StatementStart(lnum)
|
function! s:find_start_of_multiline_statement(lnum)
|
||||||
let lnum = a:lnum
|
let lnum = a:lnum
|
||||||
while 1
|
while lnum > 0
|
||||||
if getline(lnum - 1) =~ '\\$'
|
if getline(lnum - 1) =~# '\\$'
|
||||||
let lnum = lnum - 1
|
let lnum = prevnonblank(lnum - 1)
|
||||||
else
|
else
|
||||||
call cursor(lnum, 1)
|
let [paren_lnum, _] = s:find_opening_paren(lnum)
|
||||||
let maybe_lnum = s:SearchParensPair()
|
if paren_lnum < 1
|
||||||
if maybe_lnum < 1
|
return lnum
|
||||||
return lnum
|
else
|
||||||
else
|
let lnum = paren_lnum
|
||||||
let lnum = maybe_lnum
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endwhile
|
||||||
endwhile
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find the block starter that matches the current line
|
" Find possible indent(s) of the block starter that matches the current line.
|
||||||
function! s:BlockStarter(lnum, block_start_re)
|
function! s:find_start_of_block(lnum, types, multiple)
|
||||||
let lnum = a:lnum
|
let r = []
|
||||||
let maxindent = 10000 " whatever
|
let types = copy(a:types)
|
||||||
while lnum > 1
|
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = a:lnum
|
||||||
if indent(lnum) < maxindent
|
let last_indent = indent(lnum) + 1
|
||||||
if getline(lnum) =~ a:block_start_re
|
while lnum > 0 && last_indent > 0
|
||||||
return lnum
|
let indent = indent(lnum)
|
||||||
else
|
if indent < last_indent
|
||||||
let maxindent = indent(lnum)
|
for type in types
|
||||||
" It's not worth going further if we reached the top level
|
let re = '\v^\s*'.type.'>'
|
||||||
if maxindent == 0
|
if getline(lnum) =~# re
|
||||||
return -1
|
if !a:multiple
|
||||||
|
return [indent]
|
||||||
|
endif
|
||||||
|
if index(r, indent) == -1
|
||||||
|
let r += [indent]
|
||||||
|
endif
|
||||||
|
" Remove any handled type, e.g. 'if'.
|
||||||
|
call remove(types, index(types, type))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let last_indent = indent(lnum)
|
||||||
endif
|
endif
|
||||||
endif
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return r
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Is "expr" true for every position in "lnum", beginning at "start"?
|
||||||
|
" (optionally up to a:1 / 4th argument)
|
||||||
|
function! s:match_expr_on_line(expr, lnum, start, ...)
|
||||||
|
let text = getline(a:lnum)
|
||||||
|
let end = a:0 ? a:1 : len(text)
|
||||||
|
if a:start > end
|
||||||
|
return 1
|
||||||
endif
|
endif
|
||||||
endwhile
|
let save_pos = getpos('.')
|
||||||
return -1
|
let r = 1
|
||||||
|
for i in range(a:start, end)
|
||||||
|
call cursor(a:lnum, i)
|
||||||
|
if !(eval(a:expr) || text[i-1] =~# '\s')
|
||||||
|
let r = 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call setpos('.', save_pos)
|
||||||
|
return r
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Line up with open parenthesis/bracket/brace.
|
||||||
|
function! s:indent_like_opening_paren(lnum)
|
||||||
|
let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum)
|
||||||
|
if paren_lnum <= 0
|
||||||
|
return -2
|
||||||
|
endif
|
||||||
|
let text = getline(paren_lnum)
|
||||||
|
let base = indent(paren_lnum)
|
||||||
|
|
||||||
|
let nothing_after_opening_paren = s:match_expr_on_line(
|
||||||
|
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
||||||
|
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
||||||
|
|
||||||
|
if nothing_after_opening_paren
|
||||||
|
if starts_with_closing_paren
|
||||||
|
let res = base
|
||||||
|
else
|
||||||
|
let res = base + s:sw()
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Indent to match position of opening paren.
|
||||||
|
let res = paren_col
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line is the continuation of a control statement
|
||||||
|
" indent further to distinguish the continuation line
|
||||||
|
" from the next logical line.
|
||||||
|
if text =~# b:control_statement && res == base + s:sw()
|
||||||
|
return base + s:sw() * 2
|
||||||
|
else
|
||||||
|
return res
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Match indent of first block of this type.
|
||||||
|
function! s:indent_like_block(lnum)
|
||||||
|
let text = getline(a:lnum)
|
||||||
|
for [multiple, block_rules] in [
|
||||||
|
\ [0, s:block_rules],
|
||||||
|
\ [1, s:block_rules_multiple]]
|
||||||
|
for [line_re, blocks] in items(block_rules)
|
||||||
|
if text !~# line_re
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
|
||||||
|
if !len(indents)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
if len(indents) == 1
|
||||||
|
return indents[0]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Multiple valid indents, e.g. for 'else' with both try and if.
|
||||||
|
let indent = indent(a:lnum)
|
||||||
|
if index(indents, indent) != -1
|
||||||
|
" The indent is valid, keep it.
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
" Fallback to the first/nearest one.
|
||||||
|
return indents[0]
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
return -2
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:indent_like_previous_line(lnum)
|
||||||
|
let lnum = prevnonblank(a:lnum - 1)
|
||||||
|
|
||||||
|
" No previous line, keep current indent.
|
||||||
|
if lnum < 1
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let text = getline(lnum)
|
||||||
|
let start = s:find_start_of_multiline_statement(lnum)
|
||||||
|
let base = indent(start)
|
||||||
|
let current = indent(a:lnum)
|
||||||
|
|
||||||
|
" Jump to last character in previous line.
|
||||||
|
call cursor(lnum, len(text))
|
||||||
|
let ignore_last_char = eval(s:skip_special_chars)
|
||||||
|
|
||||||
|
" Search for final colon that is not inside something to be ignored.
|
||||||
|
while 1
|
||||||
|
let curpos = getpos('.')[2]
|
||||||
|
if curpos == 1 | break | endif
|
||||||
|
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
|
||||||
|
normal! h
|
||||||
|
continue
|
||||||
|
elseif text[curpos-1] ==# ':'
|
||||||
|
return base + s:sw()
|
||||||
|
endif
|
||||||
|
break
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if text =~# '\\$' && !ignore_last_char
|
||||||
|
" If this line is the continuation of a control statement
|
||||||
|
" indent further to distinguish the continuation line
|
||||||
|
" from the next logical line.
|
||||||
|
if getline(start) =~# b:control_statement
|
||||||
|
return base + s:sw() * 2
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Nest (other) explicit continuations only one level deeper.
|
||||||
|
return base + s:sw()
|
||||||
|
endif
|
||||||
|
|
||||||
|
let empty = getline(a:lnum) =~# '^\s*$'
|
||||||
|
|
||||||
|
" Current and prev line are empty, next is not -> indent like next.
|
||||||
|
if empty && a:lnum > 1 &&
|
||||||
|
\ (getline(a:lnum - 1) =~# '^\s*$') &&
|
||||||
|
\ !(getline(a:lnum + 1) =~# '^\s*$')
|
||||||
|
return indent(a:lnum + 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous statement was a stop-execution statement or a pass
|
||||||
|
if getline(start) =~# s:stop_statement
|
||||||
|
" Remove one level of indentation if the user hasn't already dedented
|
||||||
|
if empty || current > base - s:sw()
|
||||||
|
return base - s:sw()
|
||||||
|
endif
|
||||||
|
" Otherwise, trust the user
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty && s:is_dedented_already(current, base)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" In all other cases, line up with the start of the previous statement.
|
||||||
|
return base
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" If this line is dedented and the number of indent spaces is valid
|
||||||
|
" (multiple of the indentation size), trust the user.
|
||||||
|
function! s:is_dedented_already(current, base)
|
||||||
|
let dedent_size = a:current - a:base
|
||||||
|
return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Is the syntax at lnum (and optionally cnum) a python string?
|
||||||
|
function! s:is_python_string(lnum, ...)
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let linelen = len(line)
|
||||||
|
if linelen < 1
|
||||||
|
let linelen = 1
|
||||||
|
endif
|
||||||
|
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
|
||||||
|
for cnum in cols
|
||||||
|
if match(map(synstack(a:lnum, cnum),
|
||||||
|
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
endfor
|
||||||
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetPythonPEPIndent(lnum)
|
function! GetPythonPEPIndent(lnum)
|
||||||
let scol = col('.')
|
" First line has indent 0
|
||||||
|
if a:lnum == 1
|
||||||
" First line has indent 0
|
return 0
|
||||||
if a:lnum == 1
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If we can find an open parenthesis/bracket/brace, line up with it.
|
|
||||||
call cursor(a:lnum, 1)
|
|
||||||
let parlnum = s:SearchParensPair()
|
|
||||||
if parlnum > 0
|
|
||||||
let parcol = col('.')
|
|
||||||
let matches = matchlist(getline(a:lnum), '^\(\s*\)[])}]')
|
|
||||||
if len(matches) == 0
|
|
||||||
let closing_paren = 0
|
|
||||||
let closing_paren_pos = 0
|
|
||||||
else
|
|
||||||
let closing_paren = 1
|
|
||||||
let closing_paren_pos = len(matches[1])
|
|
||||||
endif
|
endif
|
||||||
if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
|
|
||||||
if closing_paren
|
let line = getline(a:lnum)
|
||||||
return indent(parlnum)
|
let prevline = getline(a:lnum-1)
|
||||||
else
|
|
||||||
return indent(parlnum) + &shiftwidth
|
" Multilinestrings: continous, docstring or starting.
|
||||||
endif
|
if s:is_python_string(a:lnum-1, len(prevline))
|
||||||
elseif a:lnum - 1 != parlnum
|
\ && (s:is_python_string(a:lnum, 1)
|
||||||
if closing_paren && closing_paren_pos > scol
|
\ || match(line, '^\%("""\|''''''\)') != -1)
|
||||||
return indent(parlnum)
|
|
||||||
else
|
" Indent closing quotes as the line with the opening ones.
|
||||||
let lastindent = match(getline(a:lnum - 1), '\S')
|
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
|
||||||
if lastindent != -1 && lastindent < parcol
|
if match_quotes != -1
|
||||||
return lastindent
|
" closing multiline string
|
||||||
|
let quotes = line[match_quotes:(match_quotes+2)]
|
||||||
|
let pairpos = searchpairpos(quotes, '', quotes, 'b')
|
||||||
|
if pairpos[0] != 0
|
||||||
|
return indent(pairpos[0])
|
||||||
|
else
|
||||||
|
" TODO: test to cover this!
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
if s:is_python_string(a:lnum-1)
|
||||||
|
" Previous line is (completely) a string.
|
||||||
|
return indent(a:lnum-1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
||||||
|
" docstring.
|
||||||
|
return indent(a:lnum-1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
|
||||||
|
\ get(g:, 'python_pep8_indent_multiline_string', 0))
|
||||||
|
if match(prevline, '\v%("""|'''''')$') != -1
|
||||||
|
" Opening multiline string, started in previous line.
|
||||||
|
if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
|
||||||
|
\ || match(line, '\v^\s+$') != -1
|
||||||
|
" <CR> with empty line or to split up 'foo("""bar' into
|
||||||
|
" 'foo("""' and 'bar'.
|
||||||
|
if indent_multi == -2
|
||||||
|
return indent(a:lnum-1) + s:sw()
|
||||||
|
endif
|
||||||
|
return indent_multi
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keep existing indent.
|
||||||
|
if match(line, '\v^\s*\S') != -1
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if indent_multi != -2
|
||||||
|
return indent_multi
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:indent_like_opening_paren(a:lnum)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If we line up with an opening column there is a special case
|
" Parens: If we can find an open parenthesis/bracket/brace, line up with it.
|
||||||
" we want to handle: a docstring as argument. In that case we
|
let indent = s:indent_like_opening_paren(a:lnum)
|
||||||
" don't want to line up with the paren but with the statement
|
if indent >= -1
|
||||||
" imagine foo(doc=""" as example
|
return indent
|
||||||
echo getline(parlnum)
|
|
||||||
if match(getline(parlnum), '\("""\|' . "'''" . '\)\s*$') != -1
|
|
||||||
return indent(parlnum)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return parcol
|
" Blocks: Match indent of first block of this type.
|
||||||
endif
|
let indent = s:indent_like_block(a:lnum)
|
||||||
|
if indent >= -1
|
||||||
" Examine this line
|
return indent
|
||||||
let thisline = getline(a:lnum)
|
|
||||||
let thisindent = indent(a:lnum)
|
|
||||||
|
|
||||||
" If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
|
|
||||||
if thisline =~ '^\s*\(elif\|else\)\>'
|
|
||||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
|
|
||||||
if bslnum > 0
|
|
||||||
return indent(bslnum)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
" If the line starts with 'except' or 'finally', line up with 'try'
|
return s:indent_like_previous_line(a:lnum)
|
||||||
" or 'except'
|
|
||||||
if thisline =~ '^\s*\(except\|finally\)\>'
|
|
||||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
|
|
||||||
if bslnum > 0
|
|
||||||
return indent(bslnum)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Examine previous line
|
|
||||||
let plnum = a:lnum - 1
|
|
||||||
let pline = getline(plnum)
|
|
||||||
let sslnum = s:StatementStart(plnum)
|
|
||||||
|
|
||||||
" If the previous line is blank, keep the same indentation
|
|
||||||
if pline =~ '^\s*$'
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If this line is explicitly joined, try to find an indentation that looks
|
|
||||||
" good.
|
|
||||||
if pline =~ '\\$'
|
|
||||||
let compound_statement = '^\s*\(if\|while\|from\|import\|for\s.*\sin\|except\)\s*'
|
|
||||||
let maybe_indent = matchend(getline(sslnum), compound_statement)
|
|
||||||
if maybe_indent != -1
|
|
||||||
return maybe_indent
|
|
||||||
else
|
|
||||||
return indent(sslnum) + &sw * 2
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the previous line ended with a colon and is not a comment, indent
|
|
||||||
" relative to statement start.
|
|
||||||
if pline =~ '^[^#]*:\s*\(#.*\)\?$'
|
|
||||||
return indent(sslnum) + &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the previous line was a stop-execution statement or a pass
|
|
||||||
if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
|
||||||
" See if the user has already dedented
|
|
||||||
if indent(a:lnum) > indent(sslnum) - &sw
|
|
||||||
" If not, recommend one dedent
|
|
||||||
return indent(sslnum) - &sw
|
|
||||||
endif
|
|
||||||
" Otherwise, trust the user
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" In all other cases, line up with the start of the previous statement.
|
|
||||||
return indent(sslnum)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
|||||||
" Language: QML
|
" Language: QML
|
||||||
" Author: Robert Kieffer
|
" Author: Robert Kieffer
|
||||||
" URL:
|
" URL:
|
||||||
" Last Change: 2010-03-27 (Happy Birthday, Dash!)
|
" Last Change: 2017-10-27
|
||||||
"
|
"
|
||||||
" Improved JavaScript indent script.
|
" Improved JavaScript indent script.
|
||||||
|
|
||||||
@@ -22,10 +22,10 @@ if exists("*GetJsIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Clean up a line of code by removing trailing '//' comments, and trimming
|
" Clean up a line of code by removing trailing '//' and '/* */' comments, and trimming
|
||||||
" whitespace
|
" whitespace
|
||||||
function! Trim(line)
|
function! Trim(line)
|
||||||
return substitute(substitute(a:line, '// .*', '', ''), '^\s*\|\s*$', '', 'g')
|
return substitute(substitute(substitute(a:line, '// .*', '', ''), '/\* .* \*/', '', ''), '^\s*\|\s*$', '', 'g')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetJsIndent()
|
function! GetJsIndent()
|
||||||
|
|||||||
79
indent/slime.vim
Normal file
79
indent/slime.vim
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slime') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Slime
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
runtime! indent/ruby.vim
|
||||||
|
unlet! b:did_indent
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent sw=2 et
|
||||||
|
setlocal indentexpr=GetSlimeIndent()
|
||||||
|
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetSlimeIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
|
||||||
|
let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
|
||||||
|
|
||||||
|
if !exists('g:haml_self_closing_tags')
|
||||||
|
let g:haml_self_closing_tags = 'meta|link|img|hr|br'
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GetSlimeIndent()
|
||||||
|
let lnum = prevnonblank(v:lnum-1)
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let line = substitute(getline(lnum),'\s\+$','','')
|
||||||
|
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||||
|
let lastcol = strlen(line)
|
||||||
|
let line = substitute(line,'^\s\+','','')
|
||||||
|
let indent = indent(lnum)
|
||||||
|
let cindent = indent(v:lnum)
|
||||||
|
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
||||||
|
let indent = cindent < indent ? cindent : indent - &sw
|
||||||
|
endif
|
||||||
|
let increase = indent + &sw
|
||||||
|
if indent == indent(lnum)
|
||||||
|
let indent = cindent <= indent ? -1 : increase
|
||||||
|
endif
|
||||||
|
|
||||||
|
let group = synIDattr(synID(lnum,lastcol,1),'name')
|
||||||
|
|
||||||
|
if line =~ '^doctype'
|
||||||
|
return indent
|
||||||
|
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
|
||||||
|
return increase
|
||||||
|
elseif line =~ '^[\.#]'
|
||||||
|
return increase
|
||||||
|
elseif line =~? '^div'
|
||||||
|
return increase
|
||||||
|
elseif group == 'hamlFilter'
|
||||||
|
return increase
|
||||||
|
elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
|
||||||
|
return increase
|
||||||
|
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
|
||||||
|
return increase
|
||||||
|
elseif line == '-#'
|
||||||
|
return increase
|
||||||
|
elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^\v('.g:haml_self_closing_tags.')>'
|
||||||
|
return indent
|
||||||
|
elseif group =~? '\v^(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$'
|
||||||
|
return increase
|
||||||
|
elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter'
|
||||||
|
return GetRubyIndent()
|
||||||
|
else
|
||||||
|
return indent
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim:set sw=2:
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
||||||
|
|
||||||
|
" Only load this file if no other indent file 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
|
||||||
|
|
||||||
setlocal nolisp
|
setlocal nolisp
|
||||||
setlocal autoindent
|
setlocal autoindent sw=2 ts=2
|
||||||
setlocal indentexpr=TerraformIndent(v:lnum)
|
setlocal indentexpr=TerraformIndent(v:lnum)
|
||||||
setlocal indentkeys+=<:>,0=},0=)
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
|
|
||||||
@@ -16,29 +16,30 @@ if exists("*TerraformIndent")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! TerraformIndent(lnum)
|
function! TerraformIndent(lnum)
|
||||||
" previous non-blank line
|
" Beginning of the file should have no indent
|
||||||
let prevlnum = prevnonblank(a:lnum-1)
|
if a:lnum == 0
|
||||||
|
|
||||||
" beginning of file?
|
|
||||||
if prevlnum == 0
|
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" previous line without comments
|
" Previous non-blank line should continue the indent level
|
||||||
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
|
|
||||||
|
" Previous line without comments should continue the indent level
|
||||||
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
|
let prevline = substitute(getline(prevlnum), '//.*$', '', '')
|
||||||
let previndent = indent(prevlnum)
|
let previndent = indent(prevlnum)
|
||||||
let thisindent = previndent
|
let thisindent = previndent
|
||||||
|
|
||||||
" block open?
|
" Config block starting with [ { ( should increase the indent level
|
||||||
if prevline =~ '[\[{\(]\s*$'
|
if prevline =~ '[\[{\(]\s*$'
|
||||||
let thisindent += &sw
|
let thisindent += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" current line without comments
|
" Current line without comments should continue the indent level
|
||||||
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
|
let thisline = substitute(getline(a:lnum), '//.*$', '', '')
|
||||||
|
|
||||||
" block close?
|
" Config block ending with ) } ] should get the indentation
|
||||||
if thisline =~ '^\s*[\)\]}]'
|
" level from the initial config block
|
||||||
|
if thisline =~ '^\s*[\)}\]]'
|
||||||
let thisindent -= &sw
|
let thisindent -= &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn match caddyDirective "^\s*\([a-z]\+\)" nextgroup=caddyDirectiveArgs skipwhite
|
syn match caddyDirective "^\s*\([a-zA-Z0-9_]\+\)" nextgroup=caddyDirectiveArgs skipwhite
|
||||||
syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite
|
syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite
|
||||||
syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment
|
syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment
|
||||||
|
|
||||||
|
|||||||
142
syntax/carp.vim
Normal file
142
syntax/carp.vim
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'carp') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Carp
|
||||||
|
" Maintainer: Veit Heller <veit@veitheller.de>
|
||||||
|
" URL: http://github.com/hellerve/carp-vim.git
|
||||||
|
" Description: Contains all of the keywords in #lang carp
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match carpError ,[]})],
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
set iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
|
||||||
|
else
|
||||||
|
setlocal iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn keyword carpSyntax def defn let do if while ref address set! the
|
||||||
|
syn keyword carpSyntax defmacro defdynamic quote cons list array
|
||||||
|
syn keyword carpSyntax expand deftype register system-include register-type
|
||||||
|
syn keyword carpSyntax defmodule copy use module defalias definterface eval
|
||||||
|
syn keyword carpSyntax expand instantiate type info help quit env build run
|
||||||
|
syn keyword carpSyntax cat use project-set! local-include system-include
|
||||||
|
syn keyword carpSyntax add-cflag add-lib project load reload let-do ignore
|
||||||
|
syn keyword carpSyntax fmt mac-only linux-only windows-only use-all when
|
||||||
|
syn keyword carpSyntax unless defn-do comment forever-do case and* or*
|
||||||
|
syn keyword carpSyntax str* println*
|
||||||
|
syn match carpSyntax "\vc(a|d){1,4}r"
|
||||||
|
|
||||||
|
syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long λ
|
||||||
|
syn keyword carpFunc not or and + - * / = /= >= <= > < inc dec
|
||||||
|
syn keyword carpFunc println print get-line from-string mod seed random
|
||||||
|
syn keyword carpFunc random-between str mask delete append count duplicate
|
||||||
|
syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos
|
||||||
|
syn keyword carpFunc atan2 exit time srand for cond floor abs sort-with
|
||||||
|
syn keyword carpFunc subarray prefix-array suffix-array reverse sum min max
|
||||||
|
syn keyword carpFunc first last reduce format zero read-file bit-shift-left
|
||||||
|
syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add
|
||||||
|
syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed
|
||||||
|
syn keyword carpFunc sanitize-addresses memory-balance reset-memory-balance!
|
||||||
|
syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace
|
||||||
|
syn keyword carpFunc pi e swaop! update! char-at tail head split-by words lines
|
||||||
|
syn keyword carpFunc pad-left pad-right count-char empty? random-sized substring
|
||||||
|
syn keyword carpFunc prefix-string suffix-string starts-with? ends-with?
|
||||||
|
syn keyword carpFunc string-join free sleep-seconds sleep-micros
|
||||||
|
syn keyword carpFunc atan2 exit time srand for cond floor abs neg to-float
|
||||||
|
syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp
|
||||||
|
syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach
|
||||||
|
syn keyword carpFunc => ==> repeat nth replicate range raw aset aset! count
|
||||||
|
syn keyword carpFunc push-back pop-back sort index-of element-count
|
||||||
|
|
||||||
|
|
||||||
|
syn match carpSymbol ,\k+, contained
|
||||||
|
syn match carpTodo /\v<(FIXME|NOTE|TODO|OPTIMIZE)/ containedin=carpComment,carpString
|
||||||
|
|
||||||
|
syn cluster carpNormal contains=carpSyntax,carpFunc,carpDelimiter
|
||||||
|
syn cluster carpQuotedStuff contains=carpSymbol
|
||||||
|
syn cluster carpQuotedOrNormal contains=carpDelimiter
|
||||||
|
|
||||||
|
syn region carpQuotedStruc start="@("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
syn region carpQuotedStruc start="&("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
syn region carpQuotedStruc start="("rs=s+1 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
syn region carpQuotedStruc start="\["rs=s+1 end="\]"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
||||||
|
|
||||||
|
syn cluster carpQuotedStuff add=carpQuotedStruc
|
||||||
|
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="@("rs=s+2 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="&("rs=s+2 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="&"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="@"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="("rs=s+1 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
||||||
|
syn region carpStruc matchgroup=Delimiter start="\["rs=s+1 matchgroup=Delimiter end="\]"re=e-1 contains=@carpNormal
|
||||||
|
|
||||||
|
syn region carpString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/
|
||||||
|
|
||||||
|
syn cluster carpNormal add=carpError,carpStruc,carpString
|
||||||
|
syn cluster carpQuotedOrNormal add=carpString
|
||||||
|
|
||||||
|
syn match carpNumber "\<[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?[lf]\?\>" contains=carpContainedNumberError
|
||||||
|
syn match carpNumber "\<[-+]\?\d\+/\d\+[lf]\?\>" contains=carpContainedNumberError
|
||||||
|
|
||||||
|
|
||||||
|
syn keyword carpBoolean true false
|
||||||
|
|
||||||
|
syn match carpChar "\<\\.\w\@!"
|
||||||
|
|
||||||
|
syn region carpQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
||||||
|
syn region carpQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=@carpQuotedStuff,@carpQuotedOrNormal
|
||||||
|
|
||||||
|
syn cluster carpNormal add=carpNumber,carpBoolean,carpChar
|
||||||
|
syn cluster carpQuotedOrNormal add=carpNumber,carpBoolean
|
||||||
|
|
||||||
|
syn match carpComment /;.*$/ contains=@Spell
|
||||||
|
|
||||||
|
syn region carpQuoted matchgroup=Delimiter start="#['`]"rs=s+2 end=![ \t()\[\]";]!re=e-1,me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
||||||
|
syn region carpQuoted matchgroup=Delimiter start="#['`]("rs=s+3 matchgroup=Delimiter end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
||||||
|
|
||||||
|
syn cluster carpNormal add=carpQuoted,carpComment
|
||||||
|
syn cluster carpQuotedOrNormal add=carpComment
|
||||||
|
|
||||||
|
syn sync match matchPlace grouphere NONE "^[^ \t]"
|
||||||
|
|
||||||
|
if version >= 508 || !exists("carp_syntax_init")
|
||||||
|
if version < 508
|
||||||
|
let carp_syntax_init = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink carpSyntax Statement
|
||||||
|
HiLink carpFunc Function
|
||||||
|
HiLink carpCopy Function
|
||||||
|
|
||||||
|
HiLink carpString String
|
||||||
|
HiLink carpChar Character
|
||||||
|
HiLink carpBoolean Boolean
|
||||||
|
|
||||||
|
HiLink carpNumber Number
|
||||||
|
HiLink carpNumberError Error
|
||||||
|
HiLink carpContainedNumberError Error
|
||||||
|
|
||||||
|
HiLink carpQuoted Structure
|
||||||
|
HiLink carpQuotedStruc Structure
|
||||||
|
HiLink carpSymbol Structure
|
||||||
|
HiLink carpAtom Structure
|
||||||
|
|
||||||
|
HiLink carpDelimiter Delimiter
|
||||||
|
HiLink carpConstant Constant
|
||||||
|
|
||||||
|
HiLink carpTodo Todo
|
||||||
|
HiLink carpComment Comment
|
||||||
|
HiLink carpError Error
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "carp"
|
||||||
|
|
||||||
|
endif
|
||||||
481
syntax/cmake.vim
Normal file
481
syntax/cmake.vim
Normal file
File diff suppressed because one or more lines are too long
@@ -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\|debugger\|import\|export\|await\)\>/
|
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|default\|await\)\>/
|
||||||
\ 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
|
||||||
@@ -109,7 +109,7 @@ hi def link coffeeFloat Float
|
|||||||
|
|
||||||
" An error for reserved keywords, taken from the RESERVED array:
|
" An error for reserved keywords, taken from the RESERVED array:
|
||||||
" http://coffeescript.org/documentation/docs/lexer.html#section-67
|
" http://coffeescript.org/documentation/docs/lexer.html#section-67
|
||||||
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
|
syn match coffeeReservedError /\<\%(case\|function\|var\|void\|with\|const\|let\|enum\|native\|implements\|interface\|package\|private\|protected\|public\|static\)\>/
|
||||||
\ display
|
\ display
|
||||||
hi def link coffeeReservedError Error
|
hi def link coffeeReservedError Error
|
||||||
|
|
||||||
|
|||||||
@@ -11,17 +11,17 @@ endif
|
|||||||
|
|
||||||
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr
|
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr
|
||||||
|
|
||||||
if exists('crystal_space_errors')
|
if exists('g:crystal_space_errors')
|
||||||
if !exists('crystal_no_trail_space_error')
|
if !exists('g:crystal_no_trail_space_error')
|
||||||
syn match crystalSpaceError display excludenl "\s\+$"
|
syn match crystalSpaceError display excludenl "\s\+$"
|
||||||
endif
|
endif
|
||||||
if !exists('crystal_no_tab_space_error')
|
if !exists('g:crystal_no_tab_space_error')
|
||||||
syn match crystalSpaceError display " \+\t"me=e-1
|
syn match crystalSpaceError display " \+\t"me=e-1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Operators
|
" Operators
|
||||||
if exists('crystal_operators')
|
if exists('g:crystal_operators')
|
||||||
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||||
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
||||||
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
|
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
|
||||||
@@ -170,39 +170,39 @@ syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<
|
|||||||
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart fold keepend
|
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart fold keepend
|
||||||
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend
|
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend
|
||||||
|
|
||||||
if exists('main_syntax') && g:main_syntax ==# 'ecrystal'
|
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
|
||||||
let b:crystal_no_expensive = 1
|
let b:crystal_no_expensive = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
|
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
|
||||||
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
|
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
|
||||||
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
|
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
|
||||||
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
|
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
|
||||||
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
||||||
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||||
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||||
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||||
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||||
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
|
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
|
||||||
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
|
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
|
||||||
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
|
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
|
||||||
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
|
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
|
||||||
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
|
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
|
||||||
|
|
||||||
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
|
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
|
||||||
|
|
||||||
" Keywords
|
" Keywords
|
||||||
" Note: the following keywords have already been defined:
|
" Note: the following keywords have already been defined:
|
||||||
" begin case class def do end for if module unless until while
|
" begin case class def do end for if module unless until while
|
||||||
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
|
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
|
||||||
syn match crystalOperator "\<defined?" display
|
syn match crystalOperator "\<defined?" display
|
||||||
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|as\|of\|with\)\>[?!]\@!"
|
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!"
|
||||||
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
|
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
|
||||||
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\)\>[?!]\@!" " TODO: reorganise
|
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
|
||||||
|
|
||||||
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
|
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
|
||||||
" based folding and special highlighting of module/class/method definitions
|
" based folding and special highlighting of module/class/method definitions
|
||||||
if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
|
if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
|
||||||
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
|
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
|
||||||
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
||||||
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
|
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
|
||||||
@@ -246,10 +246,10 @@ if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
|
|||||||
syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop
|
syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop
|
||||||
syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine fold
|
syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine fold
|
||||||
|
|
||||||
if !exists('crystal_minlines')
|
if !exists('g:crystal_minlines')
|
||||||
let crystal_minlines = 500
|
let g:crystal_minlines = 500
|
||||||
endif
|
endif
|
||||||
exec 'syn sync minlines=' . crystal_minlines
|
exec 'syn sync minlines=' . g:crystal_minlines
|
||||||
|
|
||||||
else
|
else
|
||||||
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
||||||
@@ -271,7 +271,7 @@ syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion disp
|
|||||||
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
|
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
|
||||||
|
|
||||||
" Special Methods
|
" Special Methods
|
||||||
if !exists('crystal_no_special_methods')
|
if !exists('g:crystal_no_special_methods')
|
||||||
syn keyword crystalAccess protected private
|
syn keyword crystalAccess protected private
|
||||||
" attr is a common variable name
|
" attr is a common variable name
|
||||||
syn keyword crystalAttribute getter setter property abstract
|
syn keyword crystalAttribute getter setter property abstract
|
||||||
@@ -293,7 +293,7 @@ syn match crystalMacro "\%({%\|%}\|{{\|}}\)" nextgroup=crystalMacroRegion skipwh
|
|||||||
syn match crystalSharpBang "\%^#!.*" display
|
syn match crystalSharpBang "\%^#!.*" display
|
||||||
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
|
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
|
||||||
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
|
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
|
||||||
if !exists('crystal_no_comment_fold')
|
if !exists('g:crystal_no_comment_fold')
|
||||||
syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent fold keepend
|
syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent fold keepend
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)
|
|||||||
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
||||||
|
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
|
||||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
|
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
|
||||||
@@ -335,7 +335,7 @@ hi def link crystalASCIICode Character
|
|||||||
hi def link crystalFloat Float
|
hi def link crystalFloat Float
|
||||||
hi def link crystalBoolean Boolean
|
hi def link crystalBoolean Boolean
|
||||||
hi def link crystalException Exception
|
hi def link crystalException Exception
|
||||||
if !exists('crystal_no_identifiers')
|
if !exists('g:crystal_no_identifiers')
|
||||||
hi def link crystalIdentifier Identifier
|
hi def link crystalIdentifier Identifier
|
||||||
else
|
else
|
||||||
hi def link crystalIdentifier NONE
|
hi def link crystalIdentifier NONE
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ syntax keyword dartTodo contained TODO FIXME XXX
|
|||||||
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
|
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
|
||||||
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
||||||
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
||||||
|
syntax match dartShebangLine /^\%1l#!.*/
|
||||||
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
||||||
|
|
||||||
" Strings
|
" Strings
|
||||||
@@ -83,8 +84,8 @@ endif
|
|||||||
syntax cluster dartStringContains contains=@dartRawStringContains,dartInterpolation,dartSpecialChar
|
syntax cluster dartStringContains contains=@dartRawStringContains,dartInterpolation,dartSpecialChar
|
||||||
syntax region dartString oneline start=+\z(["']\)+ end=+\z1+ contains=@dartStringContains keepend
|
syntax region dartString oneline start=+\z(["']\)+ end=+\z1+ contains=@dartStringContains keepend
|
||||||
syntax region dartRawString oneline start=+r\z(["']\)+ end=+\z1+ contains=@dartRawStringContains keepend
|
syntax region dartRawString oneline start=+r\z(["']\)+ end=+\z1+ contains=@dartRawStringContains keepend
|
||||||
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartStringContains
|
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartStringContains keepend
|
||||||
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartSRawtringContains
|
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartSRawtringContains keepend
|
||||||
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" extend
|
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" extend
|
||||||
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" extend
|
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" extend
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ highlight default link dartOperator Operator
|
|||||||
highlight default link dartComment Comment
|
highlight default link dartComment Comment
|
||||||
highlight default link dartLineComment Comment
|
highlight default link dartLineComment Comment
|
||||||
highlight default link dartLineDocComment Comment
|
highlight default link dartLineDocComment Comment
|
||||||
|
highlight default link dartShebangLine Comment
|
||||||
highlight default link dartConstant Constant
|
highlight default link dartConstant Constant
|
||||||
highlight default link dartTypedef Typedef
|
highlight default link dartTypedef Typedef
|
||||||
highlight default link dartTodo Todo
|
highlight default link dartTodo Todo
|
||||||
|
|||||||
@@ -64,9 +64,10 @@ syn match elixirVariable '&\d\+'
|
|||||||
|
|
||||||
syn keyword elixirPseudoVariable __FILE__ __DIR__ __MODULE__ __ENV__ __CALLER__
|
syn keyword elixirPseudoVariable __FILE__ __DIR__ __MODULE__ __ENV__ __CALLER__
|
||||||
|
|
||||||
syn match elixirNumber '\<\d\(_\?\d\)*\(\.[^[:space:][:digit:]]\@!\(_\?\d\)*\)\?\([eE][-+]\?\d\(_\?\d\)*\)\?\>'
|
syn match elixirNumber '\<-\?\d\(_\?\d\)*\(\.[^[:space:][:digit:]]\@!\(_\?\d\)*\)\?\([eE][-+]\?\d\(_\?\d\)*\)\?\>'
|
||||||
syn match elixirNumber '\<0[xX][0-9A-Fa-f]\+\>'
|
syn match elixirNumber '\<-\?0[xX][0-9A-Fa-f]\+\>'
|
||||||
syn match elixirNumber '\<0[bB][01]\+\>'
|
syn match elixirNumber '\<-\?0[oO][0-7]\+\>'
|
||||||
|
syn match elixirNumber '\<-\?0[bB][01]\+\>'
|
||||||
|
|
||||||
syn match elixirRegexEscape "\\\\\|\\[aAbBcdDefGhHnrsStvVwW]\|\\\d\{3}\|\\x[0-9a-fA-F]\{2}" contained
|
syn match elixirRegexEscape "\\\\\|\\[aAbBcdDefGhHnrsStvVwW]\|\\\d\{3}\|\\x[0-9a-fA-F]\{2}" contained
|
||||||
syn match elixirRegexEscapePunctuation "?\|\\.\|*\|\\\[\|\\\]\|+\|\\^\|\\\$\|\\|\|\\(\|\\)\|\\{\|\\}" contained
|
syn match elixirRegexEscapePunctuation "?\|\\.\|*\|\\\[\|\\\]\|+\|\\^\|\\\$\|\\|\|\\(\|\\)\|\\{\|\\}" contained
|
||||||
@@ -120,10 +121,10 @@ syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z('''\)+ end=
|
|||||||
" Documentation
|
" Documentation
|
||||||
if exists('g:elixir_use_markdown_for_docs') && g:elixir_use_markdown_for_docs
|
if exists('g:elixir_use_markdown_for_docs') && g:elixir_use_markdown_for_docs
|
||||||
syn include @markdown syntax/markdown.vim
|
syn include @markdown syntax/markdown.vim
|
||||||
syn cluster elixirDocStringContained contains=@markdown,@Spell
|
syn cluster elixirDocStringContained contains=@markdown,@Spell,elixirInterpolation
|
||||||
else
|
else
|
||||||
let g:elixir_use_markdown_for_docs = 0
|
let g:elixir_use_markdown_for_docs = 0
|
||||||
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell
|
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell,elixirInterpolation
|
||||||
|
|
||||||
" doctests
|
" doctests
|
||||||
syn region elixirDocTest start="^\s*\%(iex\|\.\.\.\)\%((\d*)\)\?>\s" end="^\s*$" contained
|
syn region elixirDocTest start="^\s*\%(iex\|\.\.\.\)\%((\d*)\)\?>\s" end="^\s*$" contained
|
||||||
@@ -142,6 +143,8 @@ syn region elixirDocString matchgroup=elixirSigilDelimiter start=+\%(@\w*doc\s\
|
|||||||
" Defines
|
" Defines
|
||||||
syn match elixirDefine '\<def\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
syn match elixirDefine '\<def\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
||||||
syn match elixirPrivateDefine '\<defp\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
syn match elixirPrivateDefine '\<defp\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
||||||
|
syn match elixirGuard '\<defguard\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
||||||
|
syn match elixirPrivateGuard '\<defguardp\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
|
||||||
syn match elixirModuleDefine '\<defmodule\>\(:\)\@!' nextgroup=elixirModuleDeclaration skipwhite skipnl
|
syn match elixirModuleDefine '\<defmodule\>\(:\)\@!' nextgroup=elixirModuleDeclaration skipwhite skipnl
|
||||||
syn match elixirProtocolDefine '\<defprotocol\>\(:\)\@!' nextgroup=elixirProtocolDeclaration skipwhite skipnl
|
syn match elixirProtocolDefine '\<defprotocol\>\(:\)\@!' nextgroup=elixirProtocolDeclaration skipwhite skipnl
|
||||||
syn match elixirImplDefine '\<defimpl\>\(:\)\@!' nextgroup=elixirImplDeclaration skipwhite skipnl
|
syn match elixirImplDefine '\<defimpl\>\(:\)\@!' nextgroup=elixirImplDeclaration skipwhite skipnl
|
||||||
@@ -176,6 +179,8 @@ syn match elixirExUnitAssert "\(^\s*\)\@<=\<\(catch_exit\|catch_throw\|flunk\|r
|
|||||||
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
|
||||||
|
hi def link elixirGuard Define
|
||||||
|
hi def link elixirPrivateGuard Define
|
||||||
hi def link elixirModuleDefine Define
|
hi def link elixirModuleDefine Define
|
||||||
hi def link elixirProtocolDefine Define
|
hi def link elixirProtocolDefine Define
|
||||||
hi def link elixirImplDefine Define
|
hi def link elixirImplDefine Define
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ syntax match fishCommandSub /\v\(\s*\zs\k+>/
|
|||||||
|
|
||||||
syntax region fishLineContinuation matchgroup=fishStatement
|
syntax region fishLineContinuation matchgroup=fishStatement
|
||||||
\ start='\v^\s*\zs\k+>' skip='\\$' end='$'
|
\ start='\v^\s*\zs\k+>' skip='\\$' end='$'
|
||||||
\ contains=fishSpecial,fishIdentifier,fishString,fishCharacter,fishStatement,fishCommandSub
|
\ contains=fishSpecial,fishIdentifier,fishString,fishCharacter,fishStatement,fishCommandSub,fishComment
|
||||||
|
|
||||||
highlight default link fishKeyword Keyword
|
highlight default link fishKeyword Keyword
|
||||||
highlight default link fishConditional Conditional
|
highlight default link fishConditional Conditional
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ syn sync minlines=50
|
|||||||
syn include @gitDiff syntax/diff.vim
|
syn include @gitDiff syntax/diff.vim
|
||||||
|
|
||||||
syn region gitHead start=/\%^/ end=/^$/
|
syn region gitHead start=/\%^/ end=/^$/
|
||||||
syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
||||||
|
|
||||||
" For git reflog and git show ...^{tree}, avoid sync issues
|
" For git reflog and git show ...^{tree}, avoid sync issues
|
||||||
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ if !exists("g:go_highlight_functions")
|
|||||||
let g:go_highlight_functions = 0
|
let g:go_highlight_functions = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:go_highlight_methods")
|
if !exists("g:go_highlight_function_arguments")
|
||||||
let g:go_highlight_methods = 0
|
let g:go_highlight_function_arguments = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("g:go_highlight_function_calls")
|
||||||
|
let g:go_highlight_function_calls = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:go_highlight_fields")
|
if !exists("g:go_highlight_fields")
|
||||||
@@ -96,7 +100,7 @@ if exists("g:go_fold_enable")
|
|||||||
if index(g:go_fold_enable, 'package_comment') == -1
|
if index(g:go_fold_enable, 'package_comment') == -1
|
||||||
let s:fold_package_comment = 0
|
let s:fold_package_comment = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Disabled by default.
|
" Disabled by default.
|
||||||
if index(g:go_fold_enable, 'comment') > -1
|
if index(g:go_fold_enable, 'comment') > -1
|
||||||
let s:fold_comment = 1
|
let s:fold_comment = 1
|
||||||
@@ -200,7 +204,19 @@ 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
|
" [n] notation is valid for specifying explicit argument indexes
|
||||||
|
" 1. Match a literal % not preceded by a %.
|
||||||
|
" 2. Match any number of -, #, 0, space, or +
|
||||||
|
" 3. Match * or [n]* or any number or nothing before a .
|
||||||
|
" 4. Match * or [n]* or any number or nothing after a .
|
||||||
|
" 5. Match [n] or nothing before a verb
|
||||||
|
" 6. Match a formatting verb
|
||||||
|
syn match goFormatSpecifier /\
|
||||||
|
\([^%]\(%%\)*\)\
|
||||||
|
\@<=%[-#0 +]*\
|
||||||
|
\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\
|
||||||
|
\%(\.\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\)\=\
|
||||||
|
\%(\[\d\+\]\)\=[vTtbcdoqxXUeEfFgGsp]/ contained containedin=goString,goRawString
|
||||||
hi def link goFormatSpecifier goSpecialString
|
hi def link goFormatSpecifier goSpecialString
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -231,14 +247,14 @@ endif
|
|||||||
" var, const
|
" var, const
|
||||||
if s:fold_varconst
|
if s:fold_varconst
|
||||||
syn region goVar start='var (' end='^\s*)$' transparent fold
|
syn region goVar start='var (' end='^\s*)$' transparent fold
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
||||||
syn region goConst start='const (' end='^\s*)$' transparent fold
|
syn region goConst start='const (' end='^\s*)$' transparent fold
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
||||||
else
|
else
|
||||||
syn region goVar start='var (' end='^\s*)$' transparent
|
syn region goVar start='var (' end='^\s*)$' transparent
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
||||||
syn region goConst start='const (' end='^\s*)$' transparent
|
syn region goConst start='const (' end='^\s*)$' transparent
|
||||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar
|
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Single-line var, const, and import.
|
" Single-line var, const, and import.
|
||||||
@@ -345,25 +361,31 @@ endif
|
|||||||
hi def link goOperator Operator
|
hi def link goOperator Operator
|
||||||
|
|
||||||
" Functions;
|
" Functions;
|
||||||
if g:go_highlight_functions != 0
|
if g:go_highlight_functions isnot 0 || g:go_highlight_function_arguments isnot 0
|
||||||
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction skipwhite skipnl
|
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl
|
||||||
syn match goReceiver /(\(\w\|[ *]\)\+)/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
|
syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
|
||||||
syn match goReceiverVar /\w\+/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
|
|
||||||
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
|
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
|
||||||
|
syn match goFunction /\w\+/ nextgroup=goSimpleArguments contained skipwhite skipnl
|
||||||
syn match goReceiverType /\w\+/ contained
|
syn match goReceiverType /\w\+/ contained
|
||||||
syn match goFunction /\w\+/ contained
|
if g:go_highlight_function_arguments isnot 0
|
||||||
syn match goFunctionCall /\w\+\ze(/ contains=GoBuiltins,goDeclaration
|
syn match goSimpleArguments /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goArgumentName nextgroup=goSimpleArguments skipwhite skipnl
|
||||||
|
syn match goArgumentName /\w\+\(\s*,\s*\w\+\)*\ze\s\+\(\w\|\.\|\*\|\[\)/ contained nextgroup=goArgumentType skipwhite skipnl
|
||||||
|
syn match goArgumentType /\([^,)]\|\_s\)\+,\?/ contained nextgroup=goArgumentName skipwhite skipnl
|
||||||
|
\ contains=goVarArgs,goType,goSignedInts,goUnsignedInts,goFloats,goComplexes,goDeclType,goBlock
|
||||||
|
hi def link goReceiverVar goArgumentName
|
||||||
|
hi def link goArgumentName Identifier
|
||||||
|
endif
|
||||||
|
syn match goReceiver /(\s*\w\+\(\s\+\*\?\s*\w\+\)\?\s*)\ze\s*\w/ contained nextgroup=goFunction contains=goReceiverVar skipwhite skipnl
|
||||||
else
|
else
|
||||||
syn keyword goDeclaration func
|
syn keyword goDeclaration func
|
||||||
endif
|
endif
|
||||||
hi def link goFunction Function
|
hi def link goFunction Function
|
||||||
hi def link goFunctionCall Type
|
|
||||||
|
|
||||||
" Methods;
|
" Function calls;
|
||||||
if g:go_highlight_methods != 0
|
if g:go_highlight_function_calls != 0
|
||||||
syn match goMethodCall /\.\w\+\ze(/hs=s+1
|
syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
|
||||||
endif
|
endif
|
||||||
hi def link goMethodCall Type
|
hi def link goFunctionCall Type
|
||||||
|
|
||||||
" Fields;
|
" Fields;
|
||||||
if g:go_highlight_fields != 0
|
if g:go_highlight_fields != 0
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ if exists("b:current_syntax")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("main_syntax")
|
if !exists("g:main_syntax")
|
||||||
let main_syntax = 'html'
|
let g:main_syntax = 'html'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! syntax/gotexttmpl.vim
|
runtime! syntax/gotexttmpl.vim
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ syn region haskellBlockComment start="{-" end="-}"
|
|||||||
\ haskellTodo,
|
\ haskellTodo,
|
||||||
\ @Spell
|
\ @Spell
|
||||||
syn region haskellPragma start="{-#" end="#-}"
|
syn region haskellPragma start="{-#" end="#-}"
|
||||||
|
syn region haskellLiquid start="{-@" end="@-}"
|
||||||
syn match haskellPreProc "^#.*$"
|
syn match haskellPreProc "^#.*$"
|
||||||
syn keyword haskellTodo TODO FIXME contained
|
syn keyword haskellTodo TODO FIXME contained
|
||||||
" Treat a shebang line at the start of the file as a comment
|
" Treat a shebang line at the start of the file as a comment
|
||||||
@@ -147,6 +148,7 @@ highlight def link haskellShebang Comment
|
|||||||
highlight def link haskellLineComment Comment
|
highlight def link haskellLineComment Comment
|
||||||
highlight def link haskellBlockComment Comment
|
highlight def link haskellBlockComment Comment
|
||||||
highlight def link haskellPragma SpecialComment
|
highlight def link haskellPragma SpecialComment
|
||||||
|
highlight def link haskellLiquid SpecialComment
|
||||||
highlight def link haskellString String
|
highlight def link haskellString String
|
||||||
highlight def link haskellChar String
|
highlight def link haskellChar String
|
||||||
highlight def link haskellBacktick Operator
|
highlight def link haskellBacktick Operator
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ syn keyword htmlArg contained async
|
|||||||
" <content>
|
" <content>
|
||||||
syn keyword htmlArg contained select
|
syn keyword htmlArg contained select
|
||||||
" <iframe>
|
" <iframe>
|
||||||
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest
|
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest allowpresentation
|
||||||
" <picture>
|
" <picture>
|
||||||
syn keyword htmlArg contained srcset sizes
|
syn keyword htmlArg contained srcset sizes
|
||||||
" <a>
|
" <a>
|
||||||
@@ -126,6 +126,8 @@ syn keyword htmlArg contained integrity crossorigin
|
|||||||
" <link>
|
" <link>
|
||||||
syn keyword htmlArg contained prefetch
|
syn keyword htmlArg contained prefetch
|
||||||
" syn keyword htmlArg contained preload
|
" syn keyword htmlArg contained preload
|
||||||
|
" <img>
|
||||||
|
syn keyword htmlArg contained decoding
|
||||||
|
|
||||||
" Custom Data Attributes
|
" Custom Data Attributes
|
||||||
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ syn match i3NoStartupId '--no-startup-id' contained
|
|||||||
syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
|
syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
|
||||||
syn keyword i3BordersSpecialParam none vertical horizontal both
|
syn keyword i3BordersSpecialParam none vertical horizontal both
|
||||||
syn keyword i3ModeParam dock hide invisible skipwhite
|
syn keyword i3ModeParam dock hide invisible skipwhite
|
||||||
|
syn keyword i3GapsCommand gaps smart_gaps smart_borders
|
||||||
|
syn keyword i3GapsParam inner outer current all set plus minus no_gaps
|
||||||
|
|
||||||
" these are not keywords but we add them for consistency
|
" these are not keywords but we add them for consistency
|
||||||
syn keyword i3PseudoParam no false inactive
|
syn keyword i3PseudoParam no false inactive
|
||||||
@@ -99,6 +101,7 @@ highlight link i3ColorLast Constant
|
|||||||
highlight link i3WsSpecialParam Constant
|
highlight link i3WsSpecialParam Constant
|
||||||
highlight link i3BordersSpecialParam Constant
|
highlight link i3BordersSpecialParam Constant
|
||||||
highlight link i3ModeParam Constant
|
highlight link i3ModeParam Constant
|
||||||
|
highlight link i3GapsParam Constant
|
||||||
|
|
||||||
highlight link i3Var Identifier
|
highlight link i3Var Identifier
|
||||||
highlight link i3SetVar Identifier
|
highlight link i3SetVar Identifier
|
||||||
@@ -115,6 +118,7 @@ highlight link i3Font String
|
|||||||
highlight link i3ExecKeyword Keyword
|
highlight link i3ExecKeyword Keyword
|
||||||
highlight link i3Command Keyword
|
highlight link i3Command Keyword
|
||||||
highlight link i3WsKeyword Keyword
|
highlight link i3WsKeyword Keyword
|
||||||
|
highlight link i3GapsCommand Keyword
|
||||||
|
|
||||||
highlight link i3ColorDef1 Define
|
highlight link i3ColorDef1 Define
|
||||||
highlight link i3ColorDef3 Define
|
highlight link i3ColorDef3 Define
|
||||||
|
|||||||
@@ -26,17 +26,17 @@ syntax sync fromstart
|
|||||||
" syntax case ignore
|
" syntax case ignore
|
||||||
syntax case match
|
syntax case match
|
||||||
|
|
||||||
syntax match jsNoise /[:,\;]\{1}/
|
syntax match jsNoise /[:,;]/
|
||||||
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
|
syntax match jsNoise /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
|
||||||
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/
|
syntax match jsObjectProp contained /\<\K\k*/
|
||||||
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
|
syntax match jsFuncCall /\<\K\k*\ze\s*(/
|
||||||
syntax match jsParensError /[)}\]]/
|
syntax match jsParensError /[)}\]]/
|
||||||
|
|
||||||
" Program Keywords
|
" Program Keywords
|
||||||
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
|
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
|
||||||
syntax match jsVariableDef contained /\k\+/ skipwhite skipempty nextgroup=jsFlowDefinition
|
syntax match jsVariableDef contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFlowDefinition
|
||||||
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
|
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
|
||||||
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ skipwhite skipempty nextgroup=@jsExpression
|
syntax match jsOperator "[-!|&+<>=%/*~^]" skipwhite skipempty nextgroup=@jsExpression
|
||||||
syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression
|
syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression
|
||||||
syntax keyword jsBooleanTrue true
|
syntax keyword jsBooleanTrue true
|
||||||
syntax keyword jsBooleanFalse false
|
syntax keyword jsBooleanFalse false
|
||||||
@@ -44,7 +44,7 @@ syntax keyword jsBooleanFalse false
|
|||||||
" Modules
|
" Modules
|
||||||
syntax keyword jsImport import skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup,jsFlowImportType
|
syntax keyword jsImport import skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup,jsFlowImportType
|
||||||
syntax keyword jsExport export skipwhite skipempty nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword,jsFlowTypeStatement
|
syntax keyword jsExport export skipwhite skipempty nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword,jsFlowTypeStatement
|
||||||
syntax match jsModuleKeyword contained /\k\+/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
syntax match jsModuleKeyword contained /\<\K\k*/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
||||||
syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup=@jsExpression
|
syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup=@jsExpression
|
||||||
syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
||||||
syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAs,jsFrom
|
syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAs,jsFrom
|
||||||
@@ -53,44 +53,37 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
|
|||||||
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
||||||
|
|
||||||
" Strings, Templates, Numbers
|
" Strings, Templates, Numbers
|
||||||
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
|
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend
|
||||||
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend
|
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
||||||
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
||||||
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
|
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
||||||
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
|
|
||||||
syntax keyword jsNumber Infinity
|
syntax keyword jsNumber Infinity
|
||||||
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=\d\+\)\=\>/
|
||||||
|
|
||||||
" Regular Expressions
|
" Regular Expressions
|
||||||
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
|
syntax match jsSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)"
|
||||||
syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend
|
syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend
|
||||||
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+
|
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=jsSpecial
|
||||||
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
|
syntax match jsRegexpBoundary contained "\v\c[$^]|\\b"
|
||||||
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
|
syntax match jsRegexpBackRef contained "\v\\[1-9]\d*"
|
||||||
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
|
syntax match jsRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1
|
||||||
syntax match jsRegexpOr contained "\v\<@!\|"
|
syntax match jsRegexpOr contained "|"
|
||||||
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
|
syntax match jsRegexpMod contained "\v\(\?[:=!>]"lc=1
|
||||||
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
syntax region jsRegexpGroup contained start="[^\\]("lc=1 skip="\\.\|\[\(\\.\|[^]]\+\)\]" end=")" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
||||||
if v:version > 703 || v:version == 603 && has("patch1088")
|
syntax region jsRegexpString start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blank:][:alnum:]_$]\)\s*\)\@<=/\ze[^*/]+ skip=+\\.\|\[[^]]\{1,}\]+ end=+/[gimyus]\{,6}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
|
||||||
else
|
|
||||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
|
||||||
endif
|
|
||||||
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
||||||
|
|
||||||
" Objects
|
" Objects
|
||||||
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax match jsObjectColon contained /:/ skipwhite skipempty
|
syntax match jsObjectColon contained /:/ skipwhite skipempty
|
||||||
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
|
||||||
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
||||||
syntax match jsObjectSeparator contained /,/
|
syntax match jsObjectSeparator contained /,/
|
||||||
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend
|
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
|
||||||
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
|
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
|
||||||
syntax match jsObjectMethodType contained /\%(get\|set\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
|
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
|
||||||
syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
||||||
syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
|
||||||
|
|
||||||
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
||||||
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite skipempty nextgroup=@jsExpression'
|
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite skipempty nextgroup=@jsExpression'
|
||||||
@@ -101,8 +94,8 @@ exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal
|
|||||||
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
|
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
|
||||||
|
|
||||||
" Statement Keywords
|
" Statement Keywords
|
||||||
syntax match jsBlockLabel /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
|
syntax match jsBlockLabel /\<\K\k*\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
|
||||||
syntax match jsBlockLabelKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*\%(;\|\n\)\)\@=/
|
syntax match jsBlockLabelKey contained /\<\K\k*\ze\s*\_[;]/
|
||||||
syntax keyword jsStatement contained with yield debugger
|
syntax keyword jsStatement contained with yield debugger
|
||||||
syntax keyword jsStatement contained break continue skipwhite skipempty nextgroup=jsBlockLabelKey
|
syntax keyword jsStatement contained break continue skipwhite skipempty nextgroup=jsBlockLabelKey
|
||||||
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
|
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
|
||||||
@@ -119,7 +112,7 @@ syntax keyword jsAsyncKeyword async await
|
|||||||
syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock
|
syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock
|
||||||
|
|
||||||
" Keywords
|
" Keywords
|
||||||
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
|
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set WeakSet RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
|
||||||
syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename
|
syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename
|
||||||
syntax match jsGlobalNodeObjects /\<require\>/ containedin=jsFuncCall
|
syntax match jsGlobalNodeObjects /\<require\>/ containedin=jsFuncCall
|
||||||
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
|
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
|
||||||
@@ -164,68 +157,68 @@ syntax region jsBlock matchgroup=jsBraces s
|
|||||||
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
|
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
|
||||||
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
|
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
|
||||||
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
|
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
|
||||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
|
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|}\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
|
||||||
|
syntax match jsOperator /?\.\ze\_D/
|
||||||
|
|
||||||
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs,jsFlowFunctionGroup
|
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs,jsFlowFunctionGroup
|
||||||
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
|
syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
|
||||||
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
|
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
|
||||||
syntax match jsFuncArgCommas contained ','
|
syntax match jsFuncArgCommas contained ','
|
||||||
syntax keyword jsArguments contained arguments
|
syntax keyword jsArguments contained arguments
|
||||||
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat
|
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat
|
||||||
|
|
||||||
" Matches a single keyword argument with no parens
|
" Matches a single keyword argument with no parens
|
||||||
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
|
syntax match jsArrowFuncArgs /\<\K\k*\ze\s*=>/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
|
||||||
" Matches a series of arguments surrounded in parens
|
" Matches a series of arguments surrounded in parens
|
||||||
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
|
syntax match jsArrowFuncArgs /([^()]*)\ze\s*=>/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
|
||||||
|
|
||||||
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs,jsFlowFunctionGroup skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs,jsFlowFunctionGroup skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
||||||
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
||||||
exe 'syntax match jsArrowFunction /()\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '').(' contains=jsArrowFuncArgs')
|
exe 'syntax match jsArrowFunction /()\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '')
|
||||||
exe 'syntax match jsArrowFunction /_\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
|
exe 'syntax match jsArrowFunction /_\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
|
||||||
|
|
||||||
" Classes
|
" Classes
|
||||||
syntax keyword jsClassKeyword contained class
|
syntax keyword jsClassKeyword contained class
|
||||||
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
|
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
|
||||||
syntax match jsClassNoise contained /\./
|
syntax match jsClassNoise contained /\./
|
||||||
syntax match jsClassMethodType contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
|
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
|
||||||
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
|
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
|
||||||
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*[=:]\)\@=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
||||||
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
|
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
|
||||||
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
||||||
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
syntax match jsClassFuncName contained /\<\K\k*\ze\s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
|
||||||
|
|
||||||
" Destructuring
|
" Destructuring
|
||||||
syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/
|
syntax match jsDestructuringPropertyValue contained /\k\+/
|
||||||
syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue
|
syntax match jsDestructuringProperty contained /\k\+\ze\s*=/ skipwhite skipempty nextgroup=jsDestructuringValue
|
||||||
syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
|
syntax match jsDestructuringAssignment contained /\k\+\ze\s*:/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
|
||||||
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
|
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
|
||||||
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
|
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
|
||||||
syntax match jsDestructuringNoise contained /[,\[\]]/
|
syntax match jsDestructuringNoise contained /[,[\]]/
|
||||||
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold
|
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD
|
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD
|
||||||
syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend
|
syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend
|
||||||
syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend
|
syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend
|
||||||
syntax region jsEnvComment start=/\%^#!/ end=/$/ display
|
syntax region jsEnvComment start=/\%^#!/ end=/$/ display
|
||||||
|
|
||||||
" Specialized Comments - These are special comment regexes that are used in
|
" Specialized Comments - These are special comment regexes that are used in
|
||||||
" odd places that maintain the proper nextgroup functionality. It sucks we
|
" odd places that maintain the proper nextgroup functionality. It sucks we
|
||||||
" can't make jsComment a skippable type of group for nextgroup
|
" can't make jsComment a skippable type of group for nextgroup
|
||||||
syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
|
syntax region jsCommentFunction contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
|
||||||
syntax region jsCommentFunction contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
|
syntax region jsCommentFunction contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
|
||||||
syntax region jsCommentClass contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
|
syntax region jsCommentClass contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
|
||||||
syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
|
syntax region jsCommentClass contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
|
||||||
syntax region jsCommentIfElse contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
|
syntax region jsCommentIfElse contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
|
||||||
syntax region jsCommentIfElse contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
|
syntax region jsCommentIfElse contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
|
||||||
syntax region jsCommentRepeat contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
|
syntax region jsCommentRepeat contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
|
||||||
syntax region jsCommentRepeat contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
|
syntax region jsCommentRepeat contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
|
||||||
|
|
||||||
" Decorators
|
" Decorators
|
||||||
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
|
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
|
||||||
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
|
syntax match jsDecoratorFunction contained /\h[a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
|
||||||
|
|
||||||
if exists("javascript_plugin_jsdoc")
|
if exists("javascript_plugin_jsdoc")
|
||||||
runtime extras/jsdoc.vim
|
runtime extras/jsdoc.vim
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
|
|||||||
syn match jsonTrailingCommaError ",\_s*[}\]]"
|
syn match jsonTrailingCommaError ",\_s*[}\]]"
|
||||||
|
|
||||||
" Syntax: Watch out for missing commas between elements
|
" Syntax: Watch out for missing commas between elements
|
||||||
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
|
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
|
||||||
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
|
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
|
||||||
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
|
if (expand('%:e') !=? 'jsonl')
|
||||||
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
|
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
|
||||||
|
endif
|
||||||
|
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ********************************************** END OF ERROR WARNINGS
|
" ********************************************** END OF ERROR WARNINGS
|
||||||
@@ -103,10 +105,10 @@ if version >= 508 || !exists("did_json_syn_inits")
|
|||||||
hi def link jsonString String
|
hi def link jsonString String
|
||||||
hi def link jsonTest Label
|
hi def link jsonTest Label
|
||||||
hi def link jsonEscape Special
|
hi def link jsonEscape Special
|
||||||
hi def link jsonNumber Delimiter
|
hi def link jsonNumber Number
|
||||||
hi def link jsonBraces Delimiter
|
hi def link jsonBraces Delimiter
|
||||||
hi def link jsonNull Function
|
hi def link jsonNull Function
|
||||||
hi def link jsonBoolean Delimiter
|
hi def link jsonBoolean Boolean
|
||||||
hi def link jsonKeyword Label
|
hi def link jsonKeyword Label
|
||||||
|
|
||||||
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
|
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
|
||||||
|
|||||||
56
syntax/json5.vim
Normal file
56
syntax/json5.vim
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json5') == -1
|
||||||
|
|
||||||
|
" Syntax setup {{{1
|
||||||
|
if exists('b:current_syntax') && b:current_syntax == 'json5'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Syntax: Strings {{{1
|
||||||
|
syn region json5String start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=json5Escape
|
||||||
|
syn region json5String start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=json5Escape
|
||||||
|
|
||||||
|
" Syntax: Escape sequences
|
||||||
|
syn match json5Escape "\\["\\/bfnrt]" contained
|
||||||
|
syn match json5Escape "\\u\x\{4}" contained
|
||||||
|
|
||||||
|
" Syntax: Numbers {{{1
|
||||||
|
syn match json5Number "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>"
|
||||||
|
syn keyword json5Number Infinity -Infinity
|
||||||
|
|
||||||
|
" Syntax: An integer part of 0 followed by other digits is not allowed.
|
||||||
|
syn match json5NumError "-\=\<0\d\.\d*\>"
|
||||||
|
|
||||||
|
" Syntax: Boolean {{{1
|
||||||
|
syn keyword json5Boolean true false
|
||||||
|
|
||||||
|
" Syntax: Null {{{1
|
||||||
|
syn keyword json5Null null
|
||||||
|
|
||||||
|
" Syntax: Braces {{{1
|
||||||
|
syn match json5Braces "[{}\[\]]"
|
||||||
|
syn match json5ObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/
|
||||||
|
|
||||||
|
" Syntax: Comment {{{1
|
||||||
|
syn region json5LineComment start=+\/\/+ end=+$+ keepend
|
||||||
|
syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold
|
||||||
|
syn region json5Comment start="/\*" end="\*/" fold
|
||||||
|
|
||||||
|
" Define the default highlighting. {{{1
|
||||||
|
hi def link json5String String
|
||||||
|
hi def link json5ObjAssign Identifier
|
||||||
|
hi def link json5Escape Special
|
||||||
|
hi def link json5Number Number
|
||||||
|
hi def link json5Braces Operator
|
||||||
|
hi def link json5Null Function
|
||||||
|
hi def link json5Boolean Boolean
|
||||||
|
hi def link json5LineComment Comment
|
||||||
|
hi def link json5Comment Comment
|
||||||
|
hi def link json5NumError Error
|
||||||
|
|
||||||
|
if !exists('b:current_syntax')
|
||||||
|
let b:current_syntax = 'json5'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: fdm=marker
|
||||||
|
|
||||||
|
endif
|
||||||
635
syntax/julia.vim
635
syntax/julia.vim
@@ -1,153 +1,564 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: julia
|
||||||
|
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
|
||||||
|
" Last Change: 2013 feb 11
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if version < 704
|
||||||
|
" this is used to disable regex syntax like `\@3<='
|
||||||
|
" on older vim versions
|
||||||
|
function! s:d(x)
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:d(x)
|
||||||
|
return string(a:x)
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
if !exists("b:julia_syntax_version")
|
||||||
|
let b:julia_syntax_version = get(g:, "default_julia_version", "current")
|
||||||
|
endif
|
||||||
|
if !exists("b:julia_syntax_highlight_deprecated")
|
||||||
|
let b:julia_syntax_highlight_deprecated = get(g:, "julia_syntax_highlight_deprecated", 0)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if b:julia_syntax_version =~? '\<\%(curr\%(ent\)\?\|release\|6\|0\.6\)\>'
|
||||||
|
let b:julia_syntax_version = 6
|
||||||
|
elseif b:julia_syntax_version =~? '\<\%(next\|devel\|7\|0\.7\)\>'
|
||||||
|
let b:julia_syntax_version = 7
|
||||||
|
elseif b:julia_syntax_version =~? '\<\%(prev\%(ious\)\?\|legacy\|5\|0\.5\)\>'
|
||||||
|
let b:julia_syntax_version = 5
|
||||||
|
else
|
||||||
|
echohl WarningMsg | echomsg "Unrecognized or unsupported julia syntax version: " . b:julia_syntax_version | echohl None
|
||||||
|
let b:julia_syntax_version = 6
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:julia_spellcheck_strings = get(g:, "julia_spellcheck_strings", 0)
|
||||||
|
let s:julia_spellcheck_docstrings = get(g:, "julia_spellcheck_docstrings", 1)
|
||||||
|
let s:julia_spellcheck_comments = get(g:, "julia_spellcheck_comments", 1)
|
||||||
|
|
||||||
|
let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1)
|
||||||
|
|
||||||
|
" characters which cannot be used in identifiers. This list is very incomplete:
|
||||||
|
" 1) it only cares about charactes below 256
|
||||||
|
" 2) it doesn't distinguish between what's allowed as the 1st char vs in the
|
||||||
|
" rest of an identifier (e.g. digits, `!` and `?`)
|
||||||
|
" Despite these shortcomings, it seems to do a decent job.
|
||||||
|
" note: \U5B and \U5D are '[' and ']'
|
||||||
|
let s:nonid_chars = "\U01-\U07" . "\U0E-\U1F" .
|
||||||
|
\ "\"#$'(,.:;=@`\\U5B{" .
|
||||||
|
\ "\U80-\UA1" . "\UA7\UA8\UAB\UAD\UAF\UB4" . "\UB6-\UB8" . "\UBB\UBF"
|
||||||
|
|
||||||
|
let s:nonidS_chars = "[:space:])\\U5D}" . s:nonid_chars
|
||||||
|
|
||||||
|
" the following excludes '!' since it can be used as an identifier,
|
||||||
|
" and '$' since it can be used in interpolations
|
||||||
|
" note that \U2D is '-'
|
||||||
|
let s:uniop_chars = "+\\U2D~¬√∛∜"
|
||||||
|
|
||||||
|
let s:binop_chars = "=+\\U2D*/\\%÷^&|⊻<>≤≥≡≠≢∈∉⋅×∪∩⊆⊈⊂⊄⊊←→∋∌⊕⊖⊞⊟∘∧⊗⊘↑↓∨⊠±"
|
||||||
|
|
||||||
|
" the following is a list of all remainig valid operator chars,
|
||||||
|
" but it's more efficient when expressed with ranges (see below)
|
||||||
|
" let s:binop_chars_extra = "↔↚↛↠↣↦↮⇎⇏⇒⇔⇴⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⟵⟶⟷⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤌⤍⤎⤏⤐⤑⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥊⥋⥎⥐⥒⥓⥖⥗⥚⥛⥞⥟⥢⥤⥦⥧⥨⥩⥪⥫⥬⥭⥰⧴⬱⬰⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←→" .
|
||||||
|
" \ "∝∊∍∥∦∷∺∻∽∾≁≃≄≅≆≇≈≉≊≋≌≍≎≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≣≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊃⊅⊇⊉⊋⊏⊐⊑⊒⊜⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⋍⋐⋑⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⟈⟉⟒⦷⧀⧁⧡⧣⧤⧥⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫷⫸⫹⫺⊢⊣" .
|
||||||
|
" \ "⊔∓∔∸≂≏⊎⊽⋎⋓⧺⧻⨈⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨹⨺⩁⩂⩅⩊⩌⩏⩐⩒⩔⩖⩗⩛⩝⩡⩢⩣" .
|
||||||
|
" \ "⊙⊚⊛⊡⊓∗∙∤⅋≀⊼⋄⋆⋇⋉⋊⋋⋌⋏⋒⟑⦸⦼⦾⦿⧶⧷⨇⨰⨱⨲⨳⨴⨵⨶⨷⨸⨻⨼⨽⩀⩃⩄⩋⩍⩎⩑⩓⩕⩘⩚⩜⩞⩟⩠⫛⊍▷⨝⟕⟖⟗" .
|
||||||
|
" \ "⇵⟰⟱⤈⤉⤊⤋⤒⤓⥉⥌⥍⥏⥑⥔⥕⥘⥙⥜⥝⥠⥡⥣⥥⥮⥯↑↓"
|
||||||
|
|
||||||
|
" same as above, but with character ranges, for performance
|
||||||
|
let s:binop_chars_extra = "\\U214B\\U2190-\\U2194\\U219A\\U219B\\U21A0\\U21A3\\U21A6\\U21AE\\U21CE\\U21CF\\U21D2\\U21D4\\U21F4-\\U21FF\\U2208-\\U220D\\U2213\\U2214\\U2217-\\U2219\\U221D\\U2224-\\U222A\\U2237\\U2238\\U223A\\U223B\\U223D\\U223E\\U2240-\\U228B\\U228D-\\U229C\\U229E-\\U22A3\\U22A9\\U22AC\\U22AE\\U22B0-\\U22B7\\U22BB-\\U22BD\\U22C4-\\U22C7\\U22C9-\\U22D3\\U22D5-\\U22ED\\U22F2-\\U22FF\\U25B7\\U27C8\\U27C9\\U27D1\\U27D2\\U27D5-\\U27D7\\U27F0\\U27F1\\U27F5-\\U27F7\\U27F7\\U27F9-\\U27FF\\U2900-\\U2918\\U291D-\\U2920\\U2944-\\U2970\\U29B7\\U29B8\\U29BC\\U29BE-\\U29C1\\U29E1\\U29E3-\\U29E5\\U29F4\\U29F6\\U29F7\\U29FA\\U29FB\\U2A07\\U2A08\\U2A1D\\U2A22-\\U2A2E\\U2A30-\\U2A3D\\U2A40-\\U2A45\\U2A4A-\\U2A58\\U2A5A-\\U2A63\\U2A66\\U2A67\\U2A6A-\\U2AD9\\U2ADB\\U2AF7-\\U2AFA\\U2B30-\\U2B44\\U2B47-\\U2B4C\\UFFE9-\\UFFEC"
|
||||||
|
|
||||||
|
" a Julia identifier, sort of (TODO: the special case of a lone `?` should be
|
||||||
|
" removed as soon as the Julia parser is fixed)
|
||||||
|
let s:idregex = '\%([^' . s:nonidS_chars . '0-9!?' . s:uniop_chars . s:binop_chars . '][^' . s:nonidS_chars . s:uniop_chars . s:binop_chars . s:binop_chars_extra . ']*\|\<?\>\)'
|
||||||
|
|
||||||
|
let s:operators = '\%(' . '\.\%([-+*/^÷%|&!]\|//\|\\\|<<\|>>>\?\)\?=' .
|
||||||
|
\ '\|' . '[:$<>]=\|||\|&&\||>\|<|\|<:\|:>\|::\|<<\|>>>\?\|//\|[-=]>\|\.\{3\}' .
|
||||||
|
\ '\|' . '[' . s:uniop_chars . '!$]' .
|
||||||
|
\ '\|' . '\.\?[' . s:binop_chars . s:binop_chars_extra . ']' .
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
|
|
||||||
|
syntax cluster juliaExpressions contains=@juliaParItems,@juliaStringItems,@juliaKeywordItems,@juliaBlocksItems,@juliaTypesItems,@juliaConstItems,@juliaMacroItems,@juliaSymbolItems,@juliaOperatorItems,@juliaNumberItems,@juliaCommentItems,@juliaErrorItems
|
||||||
|
syntax cluster juliaExprsPrintf contains=@juliaExpressions,@juliaPrintfItems
|
||||||
|
|
||||||
syn keyword juliaDirective import importall export using require include
|
syntax cluster juliaParItems contains=juliaParBlock,juliaSqBraBlock,juliaCurBraBlock,juliaQuotedParBlock,juliaQuotedQMarkPar
|
||||||
|
syntax cluster juliaKeywordItems contains=juliaKeyword,juliaInfixKeyword,juliaRepKeyword,juliaTypedef
|
||||||
|
if b:julia_syntax_version == 5
|
||||||
|
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll
|
||||||
|
else
|
||||||
|
syntax cluster juliaBlocksItems contains=@juliaBlocksItemsAll,@juliaBlocksItems0607
|
||||||
|
endif
|
||||||
|
syntax cluster juliaBlocksItemsAll contains=juliaConditionalBlock,juliaWhileBlock,juliaForBlock,juliaBeginBlock,juliaFunctionBlock,juliaMacroBlock,juliaQuoteBlock,juliaTypeBlock,juliaImmutableBlock,juliaExceptionBlock,juliaLetBlock,juliaDoBlock,juliaModuleBlock
|
||||||
|
syntax cluster juliaBlocksItems0607 contains=juliaStructBlock,juliaMutableStructBlock,juliaAbstractBlock,juliaPrimitiveBlock
|
||||||
|
if b:julia_syntax_version == 5
|
||||||
|
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506
|
||||||
|
elseif b:julia_syntax_version == 6
|
||||||
|
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506,@juliaTypesItems0607
|
||||||
|
else
|
||||||
|
syntax cluster juliaTypesItems contains=@juliaTypesItemsAll,@juliaTypesItems05,@juliaTypesItems0506,@juliaTypesItems0607,@juliaTypesItems07
|
||||||
|
endif
|
||||||
|
syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
|
||||||
|
syntax cluster juliaTypesItems05 contains=juliaBaseTypeIter05,juliaBaseTypeRange05
|
||||||
|
syntax cluster juliaTypesItems0506 contains=juliaBaseTypeNum0506,juliaBaseTypeRange0506,juliaBaseTypeSet0506
|
||||||
|
syntax cluster juliaTypesItems0607 contains=juliaBaseTypeBasic0607,juliaBaseTypeArray0607,juliaBaseTypeSet0607,juliaBaseTypeProcess0607,juliaBaseTypeRange0607,juliaBaseTypeTime0607
|
||||||
|
syntax cluster juliaTypesItems07 contains=juliaBaseTypeBasic07,juliaBaseTypeNum07,juliaBaseTypeError07,juliaBaseTypeIter07,juliaBaseTypeRange07,juliaBaseTypeArray07,juliaBaseTypeSet07,juliaBaseTypeC07,juliaBaseTypeDisplay07,juliaBaseTypeIO07
|
||||||
|
|
||||||
hi def link juliaDirective Include
|
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstIO,juliaConstMMap,juliaConstC,juliaConstGeneric
|
||||||
|
syntax cluster juliaConstItems0506 contains=juliaConstNum0506
|
||||||
|
syntax cluster juliaConstItems07 contains=juliaConstGeneric07,juliaPossibleEuler
|
||||||
|
if b:julia_syntax_version <= 6
|
||||||
|
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506
|
||||||
|
else
|
||||||
|
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506,@juliaConstItems07
|
||||||
|
endif
|
||||||
|
|
||||||
syn region juliaDeclTypeBlock transparent matchgroup=juliaDeclType start="\<\%(type\|immutable\)\>" end="\<end\>" contains=ALL
|
syntax cluster juliaMacroItems contains=juliaPossibleMacro,juliaDollarVar,juliaDollarPar,juliaDollarSqBra
|
||||||
syn keyword juliaTypeAlias typealias
|
syntax cluster juliaSymbolItems contains=juliaPossibleSymbol
|
||||||
syn keyword juliaDeclAbstract abstract
|
syntax cluster juliaNumberItems contains=juliaNumbers
|
||||||
|
syntax cluster juliaStringItems contains=juliaChar,juliaString,juliabString,juliasString,juliavString,juliaipString,juliabigString,juliaMIMEString,juliaShellString,juliaDocString,juliaRegEx
|
||||||
|
syntax cluster juliaPrintfItems contains=juliaPrintfParBlock,juliaPrintfString
|
||||||
|
syntax cluster juliaOperatorItems contains=juliaOperator,juliaRangeOperator,juliaCTransOperator,juliaTernaryRegion,juliaColon,juliaSemicolon,juliaComma
|
||||||
|
syntax cluster juliaCommentItems contains=juliaCommentL,juliaCommentM
|
||||||
|
syntax cluster juliaErrorItems contains=juliaErrorPar,juliaErrorEnd,juliaErrorElse,juliaErrorCatch,juliaErrorFinally
|
||||||
|
|
||||||
hi def link juliaDeclType Structure
|
syntax cluster juliaSpellcheckStrings contains=@spell
|
||||||
hi def link juliaTypeAlias Typedef
|
syntax cluster juliaSpellcheckDocStrings contains=@spell
|
||||||
hi def link juliaDeclAbstract Structure
|
syntax cluster juliaSpellcheckComments contains=@spell
|
||||||
|
|
||||||
" Module
|
if !s:julia_spellcheck_docstrings
|
||||||
syn region juliaModuleBlock transparent matchgroup=juliaModule start="\<module\>" end="\<end\>" contains=ALL
|
syntax cluster juliaSpellcheckDocStrings remove=@spell
|
||||||
|
endif
|
||||||
|
if !s:julia_spellcheck_strings
|
||||||
|
syntax cluster juliaSpellcheckStrings remove=@spell
|
||||||
|
endif
|
||||||
|
if !s:julia_spellcheck_comments
|
||||||
|
syntax cluster juliaSpellcheckComments remove=@spell
|
||||||
|
endif
|
||||||
|
|
||||||
hi def link juliaModule Structure
|
syntax match juliaSemicolon display ";"
|
||||||
|
syntax match juliaComma display ","
|
||||||
|
syntax match juliaColon display ":"
|
||||||
|
|
||||||
|
syntax match juliaErrorPar display "[])}]"
|
||||||
|
syntax match juliaErrorEnd display "\<end\>"
|
||||||
|
syntax match juliaErrorElse display "\<\%(else\|elseif\)\>"
|
||||||
|
syntax match juliaErrorCatch display "\<catch\>"
|
||||||
|
syntax match juliaErrorFinally display "\<finally\>"
|
||||||
|
syntax match juliaErrorSemicol display contained ";"
|
||||||
|
|
||||||
|
syntax match juliaRangeEnd display contained "\<end\>"
|
||||||
|
|
||||||
|
syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor
|
||||||
|
syntax region juliaParBlockInRange matchgroup=juliaParDelim contained start="(" end=")" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor
|
||||||
|
syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\[" end="\]" contains=@juliaExpressions,juliaParBlockInRange,juliaRangeEnd,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
||||||
|
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
|
||||||
|
|
||||||
|
if b:julia_syntax_version >= 6
|
||||||
|
let s:keywords = '\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>'
|
||||||
|
let s:infixkeywords = '\<\%(in\|isa\)\>'
|
||||||
|
else
|
||||||
|
let s:keywords = '\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\)\>'
|
||||||
|
let s:infixkeywords = '\<\%(in\)\>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec 'syntax match juliaKeyword display "' . s:keywords . '"'
|
||||||
|
exec 'syntax match juliaInfixKeyword display "\%(=\s*\)\@<!' . s:infixkeywords . '\S\@!\%(\s*=\)\@!"'
|
||||||
|
syntax match juliaRepKeyword display "\<\%(break\|continue\)\>"
|
||||||
|
syntax region juliaConditionalBlock matchgroup=juliaConditional start="\<if\>" end="\<end\>" contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock fold
|
||||||
|
syntax region juliaConditionalEIBlock matchgroup=juliaConditional transparent contained start="\<elseif\>" end="\<\%(end\|else\|elseif\)\>"me=s-1 contains=@juliaExpressions,juliaConditionalEIBlock,juliaConditionalEBlock
|
||||||
|
syntax region juliaConditionalEBlock matchgroup=juliaConditional transparent contained start="\<else\>" end="\<end\>"me=s-1 contains=@juliaExpressions
|
||||||
|
syntax region juliaWhileBlock matchgroup=juliaRepeat start="\<while\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaForBlock matchgroup=juliaRepeat start="\<for\>" end="\<end\>" contains=@juliaExpressions,juliaOuter fold
|
||||||
|
syntax region juliaBeginBlock matchgroup=juliaBlKeyword start="\<begin\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaFunctionBlock matchgroup=juliaBlKeyword start="\<function\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaMacroBlock matchgroup=juliaBlKeyword start="\<macro\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaQuoteBlock matchgroup=juliaBlKeyword start="\<quote\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaTypeBlock matchgroup=juliaBlKeyword start="\<type\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaImmutableBlock matchgroup=juliaBlKeyword start="\<immutable\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaStructBlock matchgroup=juliaBlKeyword start="\<struct\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaMutableStructBlock matchgroup=juliaBlKeyword start="\<mutable struct\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\<let\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
syntax region juliaDoBlock matchgroup=juliaBlKeyword start="\<do\>" end="\<end\>" contains=@juliaExpressions fold
|
||||||
|
exec 'syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\%(\%(\.\s*\)\@'.s:d(6).'<!\|\%(@\s*\.\s*\)\@'.s:d(6).'<=\)\<\%(bare\)\?module\>" end="\<end\>" contains=@juliaExpressions fold'
|
||||||
|
syntax region juliaExceptionBlock matchgroup=juliaException start="\<try\>" end="\<end\>" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold
|
||||||
|
syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="\<catch\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaFinallyBlock
|
||||||
|
syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="\<finally\>" end="\<end\>"me=s-1 contains=@juliaExpressions
|
||||||
|
syntax match juliaTypedef "\<\%(abstract\|typealias\|bitstype\)\>"
|
||||||
|
" AbstractBlock needs to come after to take precedence
|
||||||
|
syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="\<abstract type\>" end="\<end\>" fold contains=@juliaExpressions
|
||||||
|
syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="\<primitive type\>" end="\<end\>" fold contains=@juliaExpressions
|
||||||
|
|
||||||
|
exec 'syntax region juliaComprehensionFor matchgroup=juliaComprehensionFor transparent contained start="\%([^[:space:],;:({[]\_s*\)\@'.s:d(80).'<=\<for\>" end="\ze[]);]" contains=@juliaExpressions,juliaComprehensionIf,juliaComprehensionFor'
|
||||||
|
syntax match juliaComprehensionIf contained "\<if\>"
|
||||||
|
|
||||||
|
exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"'
|
||||||
|
|
||||||
|
syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|\%(Intrinsic\)\?Function\|Union\|Type\%(Name\|Constructor\|Var\)\?\|Any\|ANY\|Vararg\|Top\|None\|Nothing\|Ptr\|Void\|Exception\|Module\|Box\|Expr\|LambdaStaticData\|\%(Data\|Union\)Type\|\%(LineNumber\|Label\|Goto\|Quote\|Top\|Symbol\|Getfield\)Node\|\%(Weak\|Global\)\?Ref\|Associative\|Method\(Table\)\?\|GetfieldNode\|Nullable\|Pair\|Val\|TypeMap\%(Level\|Entry\)\)\>"
|
||||||
|
syntax match juliaBaseTypeBasic0607 display "\<\%(UnionAll\|CodeInfo\)\>"
|
||||||
|
syntax match juliaBaseTypeBasic07 display "\<\%(Some\|Missing\)\>"
|
||||||
|
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>"
|
||||||
|
syntax match juliaBaseTypeNum0506 display "\<Complex\%(32\|64\|128\)\>"
|
||||||
|
syntax match juliaBaseTypeNum07 display "\<\%(AbstractIrrational\|ComplexF\%(16\|32\|64\)\)\>"
|
||||||
|
syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>"
|
||||||
|
syntax match juliaBaseTypeC07 display "\<Cvoid\>"
|
||||||
|
syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>"
|
||||||
|
syntax match juliaBaseTypeError07 display "\<\%(StringIndexError\|MissingException\)\>"
|
||||||
|
syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
|
||||||
|
syntax match juliaBaseTypeIter05 display "\<\%(Zip\|Filter\)\>"
|
||||||
|
syntax match juliaBaseTypeIter07 display "\<CartesianIndices\>"
|
||||||
|
syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>"
|
||||||
|
syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\)\>"
|
||||||
|
syntax match juliaBaseTypeArray0607 display "\<\%(Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
|
||||||
|
syntax match juliaBaseTypeArray07 display "\<\%(BroadcastStyle\|Adjoint\|Transpose\|LinearIndices\)\>"
|
||||||
|
syntax match juliaBaseTypeDict display "\<\%(WeakKey\|ObjectId\)\?Dict\>"
|
||||||
|
syntax match juliaBaseTypeSet display "\<Set\>"
|
||||||
|
syntax match juliaBaseTypeSet0506 display "\<IntSet\>"
|
||||||
|
syntax match juliaBaseTypeSet0607 display "\<AbstractSet\>"
|
||||||
|
syntax match juliaBaseTypeSet07 display "\<\%(\%(Bit\|Key\)Set\|AbstractDict\)\>"
|
||||||
|
syntax match juliaBaseTypeIO display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"
|
||||||
|
syntax match juliaBaseTypeIO07 display "\<GenericIOBuffer\>"
|
||||||
|
syntax match juliaBaseTypeProcess display "\<\%(ProcessGroup\|Pipe\|Cmd\)\>"
|
||||||
|
syntax match juliaBaseTypeProcess0607 display "\<PipeBuffer\>"
|
||||||
|
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\)\>"
|
||||||
|
syntax match juliaBaseTypeRange05 display "\<FloatRange\>"
|
||||||
|
syntax match juliaBaseTypeRange0506 display "\<Range\>"
|
||||||
|
syntax match juliaBaseTypeRange0607 display "\<\%(ExponentialBackOff\|StepRangeLen\)\>"
|
||||||
|
syntax match juliaBaseTypeRange07 display "\<AbstractRange\>"
|
||||||
|
syntax match juliaBaseTypeRegex display "\<Regex\%(Match\)\?\>"
|
||||||
|
syntax match juliaBaseTypeFact display "\<Factorization\>"
|
||||||
|
syntax match juliaBaseTypeSort display "\<\%(Insertion\|\(Partial\)\?Quick\|Merge\)Sort\>"
|
||||||
|
syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Nearest\%(Ties\%(Away\|Up\)\)\?\|ToZero\|Up\)\>"
|
||||||
|
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
|
||||||
|
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
|
||||||
|
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>"
|
||||||
|
syntax match juliaBaseTypeDisplay07 display "\<AbstractDisplay\>"
|
||||||
|
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\)\>"
|
||||||
|
syntax match juliaBaseTypeTime0607 display "\<DateFormat\>"
|
||||||
|
syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>"
|
||||||
|
|
||||||
|
syntax match juliaConstNum display "\%(\<\%(\%(NaN\|Inf\)\%(16\|32\|64\)\?\|pi\|π\)\>\)"
|
||||||
|
syntax match juliaConstNum0506 display "\%(\<\%(eu\?\|eulergamma\|γ\|catalan\|φ\|golden\)\>\)"
|
||||||
|
" Note: recognition of ℯ, which Vim does not consider a valid identifier, is
|
||||||
|
" complicated. We detect possible uses by just looking for the character (for
|
||||||
|
" performance) and then check that it's actually used by its own.
|
||||||
|
" (This also tries to detect preceding number constants; it does so in a crude
|
||||||
|
" way.)
|
||||||
|
syntax match juliaPossibleEuler "ℯ" contains=juliaEuler
|
||||||
|
exec 'syntax match juliaEuler contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=ℯ\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"'
|
||||||
|
syntax match juliaConstBool display "\<\%(true\|false\)\>"
|
||||||
|
syntax match juliaConstEnv display "\<\%(ARGS\|ENV\|CPU_CORES\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>"
|
||||||
|
syntax match juliaConstIO display "\<\%(STD\%(OUT\|IN\|ERR\)\|DevNull\)\>"
|
||||||
|
syntax match juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
|
||||||
|
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
|
||||||
|
syntax match juliaConstGeneric07 display "\<missing\>"
|
||||||
|
|
||||||
|
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
|
||||||
|
|
||||||
|
exec 'syntax match juliaMacro contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"'
|
||||||
|
syntax match juliaMacro contained "@\.\ze[^0-9]"
|
||||||
|
exec 'syntax region juliaMacroCallP contained transparent start="@' . s:idregex . '\%(\.' . s:idregex . '\)*(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock'
|
||||||
|
exec 'syntax region juliaMacroCallP contained transparent start="@.(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock'
|
||||||
|
exec 'syntax region juliaMacroCall contained transparent start="\(@' . s:idregex . '\%(\.' . s:idregex . '\)*\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
|
||||||
|
exec 'syntax region juliaMacroCall contained transparent start="\(@.\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
|
||||||
|
|
||||||
|
syntax match juliaNumbers transparent "\<\d\|\.\d\|\<im\>" contains=juliaNumber,juliaFloat,juliaComplexUnit
|
||||||
|
|
||||||
|
"integer regexes
|
||||||
|
let s:dec_regex = '\d\%(_\?\d\)*\%(\>\|im\>\|\ze\D\)'
|
||||||
|
let s:hex_regex = '0x\x\%(_\?\x\)*\%(\>\|im\>\|\ze\X\)'
|
||||||
|
let s:bin_regex = '0b[01]\%(_\?[01]\)*\%(\>\|im\>\|\ze[^01]\)'
|
||||||
|
let s:oct_regex = '0o\o\%(_\?\o\)*\%(\>\|im\>\|\ze\O\)'
|
||||||
|
|
||||||
|
let s:int_regex = '\%(' . s:hex_regex .
|
||||||
|
\ '\|' . s:bin_regex .
|
||||||
|
\ '\|' . s:oct_regex .
|
||||||
|
\ '\|' . s:dec_regex .
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
|
"floating point regexes
|
||||||
|
" starting with a dot, optional exponent
|
||||||
|
let s:float_regex1 = '\.\d\%(_\?\d\)*\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)'
|
||||||
|
" with dot, optional exponent
|
||||||
|
let s:float_regex2 = '\d\%(_\?\d\)*\.\%(\d\%(_\?\d\)*\)\?\%([eEf][-+]\?\d\+\)\?\%(\>\|im\>\|\ze\D\)'
|
||||||
|
" without dot, with exponent
|
||||||
|
let s:float_regex3 = '\d\%(_\?\d\)*[eEf][-+]\?\d\+\%(\>\|im\>\|\ze\D\)'
|
||||||
|
|
||||||
|
"hex floating point numbers
|
||||||
|
" starting with a dot
|
||||||
|
let s:hexfloat_regex1 = '0x\.\%\(\x\%(_\?\x\)*\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)'
|
||||||
|
" starting with a digit
|
||||||
|
let s:hexfloat_regex2 = '0x\x\%(_\?\x\)*\%\(\.\%\(\x\%(_\?\x\)*\)\?\)\?[pP][-+]\?\d\+\%(\>\|im\>\|\ze\X\)'
|
||||||
|
|
||||||
|
let s:float_regex = '\%(' . s:float_regex3 .
|
||||||
|
\ '\|' . s:float_regex2 .
|
||||||
|
\ '\|' . s:float_regex1 .
|
||||||
|
\ '\|' . s:hexfloat_regex2 .
|
||||||
|
\ '\|' . s:hexfloat_regex1 .
|
||||||
|
\ '\)'
|
||||||
|
|
||||||
|
exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaComplexUnit'
|
||||||
|
exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit'
|
||||||
|
syntax match juliaComplexUnit display contained "\<im\>"
|
||||||
|
|
||||||
|
exec 'syntax match juliaOperator "' . s:operators . '"'
|
||||||
|
syntax match juliaRangeOperator display ":"
|
||||||
|
exec 'syntax region juliaTernaryRegion matchgroup=juliaTernaryOperator start="\s\zs?\ze\s" skip="\%(:\(:\|[^:[:space:]'."'".'"({[]\+\s*\ze:\)\|^\s*:\|\%(?\s*\)\@'.s:d(6).'<=:(\)" end=":" contains=@juliaExpressions,juliaErrorSemicol'
|
||||||
|
|
||||||
|
let s:interp_dollar = '\([' . s:nonidS_chars . s:uniop_chars . s:binop_chars . '!?]\|^\)\@'.s:d(1).'<=\$'
|
||||||
|
|
||||||
|
exec 'syntax match juliaDollarVar display contained "' . s:interp_dollar . s:idregex . '"'
|
||||||
|
exec 'syntax region juliaDollarPar matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '(" end=")" contains=@juliaExpressions'
|
||||||
|
exec 'syntax region juliaDollarSqBra matchgroup=juliaDollarVar contained start="' .s:interp_dollar . '\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
|
||||||
|
|
||||||
|
syntax match juliaChar "'\\\?.'" contains=juliaSpecialChar
|
||||||
|
syntax match juliaChar display "'\\\o\{3\}'" contains=juliaOctalEscapeChar
|
||||||
|
syntax match juliaChar display "'\\x\x\{2\}'" contains=juliaHexEscapeChar
|
||||||
|
syntax match juliaChar display "'\\u\x\{1,4\}'" contains=juliaUniCharSmall
|
||||||
|
syntax match juliaChar display "'\\U\x\{1,8\}'" contains=juliaUniCharLarge
|
||||||
|
|
||||||
|
exec 'syntax match juliaCTransOperator "[[:space:]}' . s:nonid_chars . s:uniop_chars . s:binop_chars . '!?]\@'.s:d(1).'<!\.\?' . "'" . '"'
|
||||||
|
|
||||||
|
syntax region juliaString matchgroup=juliaStringDelim start=+\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckStrings
|
||||||
|
syntax region juliabString matchgroup=juliaStringDelim start=+\<b\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
|
syntax region juliasString matchgroup=juliaStringDelim start=+\<s\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
|
syntax region juliavString matchgroup=juliaStringDelim start=+\<v\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
||||||
|
syntax region juliaipString matchgroup=juliaStringDelim start=+\<ip\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
||||||
|
syntax region juliabigString matchgroup=juliaStringDelim start=+\<big\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+
|
||||||
|
syntax region juliaMIMEString matchgroup=juliaStringDelim start=+\<MIME\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1+ contains=@juliaSpecialChars
|
||||||
|
|
||||||
|
syntax region juliaDocString matchgroup=juliaStringDelim start=+^"""+ skip=+\%(\\\\\)*\\"+ end=+"""+ contains=@juliaStringVars,@juliaSpecialChars,@juliaSpellcheckDocStrings
|
||||||
|
|
||||||
|
exec 'syntax region juliaPrintfMacro contained transparent start="@s\?printf(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaPrintfParBlock'
|
||||||
|
syntax region juliaPrintfMacro contained transparent start="@s\?printf\s\+" end="\ze\%([])};#]\|$\|\<for\>\)" contains=@juliaExprsPrintf,juliaMacro,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
||||||
|
syntax region juliaPrintfParBlock contained matchgroup=juliaParDelim start="(" end=")" contains=@juliaExprsPrintf
|
||||||
|
syntax region juliaPrintfString contained matchgroup=juliaStringDelim start=+"+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=@juliaSpecialChars,@juliaPrintfChars
|
||||||
|
|
||||||
|
syntax region juliaShellString matchgroup=juliaStringDelim start=+`+ skip=+\%(\\\\\)*\\`+ end=+`+ contains=@juliaStringVars,juliaSpecialChar
|
||||||
|
|
||||||
|
syntax cluster juliaStringVars contains=juliaStringVarsPar,juliaStringVarsSqBra,juliaStringVarsCurBra,juliaStringVarsPla
|
||||||
|
syntax region juliaStringVarsPar contained matchgroup=juliaStringVarDelim start="$(" end=")" contains=@juliaExpressions
|
||||||
|
syntax region juliaStringVarsSqBra contained matchgroup=juliaStringVarDelim start="$\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS
|
||||||
|
syntax region juliaStringVarsCurBra contained matchgroup=juliaStringVarDelim start="${" end="}" contains=@juliaExpressions
|
||||||
|
exec 'syntax match juliaStringVarsPla contained "\$' . s:idregex . '"'
|
||||||
|
|
||||||
|
" TODO improve RegEx
|
||||||
|
syntax region juliaRegEx matchgroup=juliaStringDelim start=+\<r\z("\(""\)\?\)+ skip=+\%(\\\\\)*\\"+ end=+\z1[imsx]*+
|
||||||
|
|
||||||
|
syntax cluster juliaSpecialChars contains=juliaSpecialChar,juliaOctalEscapeChar,juliaHexEscapeChar,juliaUniCharSmall,juliaUniCharLarge
|
||||||
|
syntax match juliaSpecialChar display contained "\\."
|
||||||
|
syntax match juliaOctalEscapeChar display contained "\\\o\{3\}"
|
||||||
|
syntax match juliaHexEscapeChar display contained "\\x\x\{2\}"
|
||||||
|
syntax match juliaUniCharSmall display contained "\\u\x\{1,4\}"
|
||||||
|
syntax match juliaUniCharLarge display contained "\\U\x\{1,8\}"
|
||||||
|
|
||||||
|
syntax cluster juliaPrintfChars contains=juliaErrorPrintfFmt,juliaPrintfFmt
|
||||||
|
syntax match juliaErrorPrintfFmt display contained "\\\?%."
|
||||||
|
syntax match juliaPrintfFmt display contained "%\%(\d\+\$\)\=[-+' #0]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjqzt]\|ll\|hh\)\=[aAbdiuoxXDOUfFeEgGcCsSpn]"
|
||||||
|
syntax match juliaPrintfFmt display contained "%%"
|
||||||
|
syntax match juliaPrintfFmt display contained "\\%\%(\d\+\$\)\=[-+' #0]*\%(\d*\|\*\|\*\d\+\$\)\%(\.\%(\d*\|\*\|\*\d\+\$\)\)\=\%([hlLjqzt]\|ll\|hh\)\=[aAbdiuoxXDOUfFeEgGcCsSpn]"hs=s+1
|
||||||
|
syntax match juliaPrintfFmt display contained "\\%%"hs=s+1
|
||||||
|
|
||||||
|
" this is used to restrict the search for Symbols to when colons appear at all
|
||||||
|
" (for performance reasons)
|
||||||
|
syntax match juliaPossibleSymbol transparent ":\ze[^:]" contains=juliaSymbol,juliaQuotedParBlock,juliaQuotedQMarkPar,juliaColon
|
||||||
|
|
||||||
|
let s:quotable = '\%(' . s:idregex . '\|?\|' . s:operators . '\|' . s:float_regex . '\|' . s:int_regex . '\)'
|
||||||
|
let s:quoting_colon = '\%(\%(^\s*\|\s\{6,\}\|[' . s:nonid_chars . s:uniop_chars . s:binop_chars . '?]\s*\)\@'.s:d(6).'<=\|\%(\<\%(return\|if\|else\%(if\)\?\|while\|try\|begin\)\s*\)\@'.s:d(9).'<=\)\zs:'
|
||||||
|
let s:quoting_colonS = '\s\@'.s:d(1).'<=:'
|
||||||
|
|
||||||
|
" note: juliaSymbolS only works within whitespace-sensitive contexts,
|
||||||
|
" such as in macro calls without parentheses, or within square brackets.
|
||||||
|
" It is used to override the recognition of expressions like `a :b` as
|
||||||
|
" ranges rather than symbols in those contexts.
|
||||||
|
" (Note that such `a :b` expressions only allows at most 5 spaces between
|
||||||
|
" the identifier and the colon anyway.)
|
||||||
|
|
||||||
|
exec 'syntax match juliaSymbol contained "' .s:quoting_colon . s:quotable . '"'
|
||||||
|
exec 'syntax match juliaSymbolS contained "' . s:quoting_colonS . s:quotable . '"'
|
||||||
|
|
||||||
|
" same as above for quoted expressions such as :(expr)
|
||||||
|
" (includes :(?) as a special case, although it really shouldn't work...)
|
||||||
|
exec 'syntax region juliaQuotedParBlock matchgroup=juliaQParDelim start="' . s:quoting_colon . '(" end=")" contains=@juliaExpressions'
|
||||||
|
exec 'syntax match juliaQuotedQMarkPar "' . s:quoting_colon . '(\s*?\s*)" contains=juliaQuotedQMark'
|
||||||
|
exec 'syntax region juliaQuotedParBlockS matchgroup=juliaQParDelim contained start="' . s:quoting_colonS . '(" end=")" contains=@juliaExpressions'
|
||||||
|
exec 'syntax match juliaQuotedQMarkParS contained "' . s:quoting_colonS . '(\s*?\s*)" contains=juliaQuotedQMark'
|
||||||
|
|
||||||
|
" force precedence over Symbols
|
||||||
|
syntax match juliaOperator display "::"
|
||||||
|
|
||||||
|
syntax region juliaCommentL matchgroup=juliaCommentDelim start="#\ze\%([^=]\|$\)" end="$" keepend contains=juliaTodo,@juliaSpellcheckComments
|
||||||
|
syntax region juliaCommentM matchgroup=juliaCommentDelim start="#=\ze\%([^#]\|$\)" end="=#" contains=juliaTodo,juliaCommentM,@juliaSpellcheckComments
|
||||||
|
syntax keyword juliaTodo contained TODO FIXME XXX
|
||||||
|
|
||||||
|
|
||||||
" Misc. blocks
|
" the following are disabled by default, but
|
||||||
syn region juliaMiscBlockBlock transparent matchgroup=juliaMiscBlock start="\<\%(quote\|do\|begin\|let\)\>" end="\<end\>" contains=ALL
|
" can be enabled by entering e.g.
|
||||||
|
" :hi link juliaParDelim Delimiter
|
||||||
|
hi def link juliaParDelim juliaNone
|
||||||
|
hi def link juliaSemicolon juliaNone
|
||||||
|
hi def link juliaComma juliaNone
|
||||||
|
|
||||||
hi def link juliaMiscBlock Repeat
|
hi def link juliaColon juliaOperator
|
||||||
|
|
||||||
" Braces and Brackets
|
|
||||||
syn region juliaBracketsBlock matchgroup=juliaBrackets start='\[' end='\]' contains=ALLBUT,juliaRepeatBlock contained
|
|
||||||
syn region juliaBracesBlock matchgroup=juliaBraces start='{' end='}' contains=ALLBUT,juliaRepeatBlock contained
|
|
||||||
|
|
||||||
" Repeat
|
|
||||||
syn region juliaRepeatBlock transparent matchgroup=juliaRepeat start="\<\%(while\|for\)\>" end="\<end\>" contains=@juliaTop
|
|
||||||
|
|
||||||
hi def link juliaRepeat Repeat
|
|
||||||
|
|
||||||
" Conditional
|
|
||||||
syn keyword juliaElse else elseif
|
|
||||||
syn region juliaIfBlock transparent matchgroup=juliaIf start="\<if\>" end="\<end\>" contains=@juliaTop
|
|
||||||
|
|
||||||
hi def link juliaElse Conditional
|
|
||||||
hi def link juliaIf Conditional
|
|
||||||
|
|
||||||
|
|
||||||
" try catch end
|
hi def link juliaKeyword Keyword
|
||||||
syn keyword juliaCatch catch contained
|
hi def link juliaInfixKeyword Keyword
|
||||||
syn region juliaTryBlock transparent matchgroup=juliaTry start="\<try\>" end="\<end\>" contains=@juliaTop
|
hi def link juliaRepKeyword Keyword
|
||||||
|
hi def link juliaBlKeyword Keyword
|
||||||
|
hi def link juliaConditional Conditional
|
||||||
|
hi def link juliaRepeat Repeat
|
||||||
|
hi def link juliaException Exception
|
||||||
|
hi def link juliaTypedef Keyword
|
||||||
|
exec 'hi! def link juliaOuter ' . (b:julia_syntax_version >= 7 ? 'Keyword' : 'NONE')
|
||||||
|
hi def link juliaBaseTypeBasic Type
|
||||||
|
hi def link juliaBaseTypeNum Type
|
||||||
|
hi def link juliaBaseTypeC Type
|
||||||
|
hi def link juliaBaseTypeError Type
|
||||||
|
hi def link juliaBaseTypeIter Type
|
||||||
|
hi def link juliaBaseTypeString Type
|
||||||
|
hi def link juliaBaseTypeArray Type
|
||||||
|
hi def link juliaBaseTypeDict Type
|
||||||
|
hi def link juliaBaseTypeSet Type
|
||||||
|
hi def link juliaBaseTypeIO Type
|
||||||
|
hi def link juliaBaseTypeProcess Type
|
||||||
|
hi def link juliaBaseTypeRange Type
|
||||||
|
hi def link juliaBaseTypeRegex Type
|
||||||
|
hi def link juliaBaseTypeFact Type
|
||||||
|
hi def link juliaBaseTypeSort Type
|
||||||
|
hi def link juliaBaseTypeRound Type
|
||||||
|
hi def link juliaBaseTypeSpecial Type
|
||||||
|
hi def link juliaBaseTypeRandom Type
|
||||||
|
hi def link juliaBaseTypeDisplay Type
|
||||||
|
hi def link juliaBaseTypeTime Type
|
||||||
|
hi def link juliaBaseTypeOther Type
|
||||||
|
for t in ["Basic", "Array", "Set", "Range", "Time", "Process"]
|
||||||
|
let h = b:julia_syntax_version >= 6 ? "Type" : "NONE"
|
||||||
|
exec "hi! def link juliaBaseType" . t . "0607 " . h
|
||||||
|
endfor
|
||||||
|
for t in ["Iter", "Range"]
|
||||||
|
let h = b:julia_syntax_version == 5 ? "Type" : b:julia_syntax_version == 6 ? "juliaDeprecated" : "NONE"
|
||||||
|
exec "hi! def link juliaBaseType" . t . "05 " . h
|
||||||
|
endfor
|
||||||
|
for t in ["Num", "Range", "Set"]
|
||||||
|
let h = b:julia_syntax_version <= 6 ? "Type" : "juliaDeprecated"
|
||||||
|
exec "hi! def link juliaBaseType" . t . "0506 " . h
|
||||||
|
endfor
|
||||||
|
for t in ["Range", "Set", "Basic", "C", "Array", "Iter", "Display", "IO", "Num", "Error"]
|
||||||
|
let h = b:julia_syntax_version >= 7 ? "Type" : "NONE"
|
||||||
|
exec "hi! def link juliaBaseType" . t . "07 " . h
|
||||||
|
endfor
|
||||||
|
|
||||||
hi def link juliaTry Exception
|
" NOTE: deprecated constants are not highlighted as such. For once,
|
||||||
hi def link juliaCatch Exception
|
" one can still legitimately use them by importing Base.MathConstants.
|
||||||
|
" Plus, one-letter variables like `e` and `γ` can be used with other
|
||||||
|
" meanings.
|
||||||
|
hi def link juliaConstNum Constant
|
||||||
|
let h = b:julia_syntax_version <= 6 ? "Constant" : "NONE"
|
||||||
|
exec "hi! def link juliaConstNum0506 " . h
|
||||||
|
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
|
||||||
|
exec "hi! def link juliaEuler " . h
|
||||||
|
|
||||||
|
hi def link juliaConstEnv Constant
|
||||||
|
hi def link juliaConstIO Constant
|
||||||
|
hi def link juliaConstC Constant
|
||||||
|
hi def link juliaConstLimits Constant
|
||||||
|
hi def link juliaConstGeneric Constant
|
||||||
|
hi def link juliaRangeEnd Constant
|
||||||
|
hi def link juliaConstBool Boolean
|
||||||
|
|
||||||
" one word statements
|
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
|
||||||
syn keyword juliaStatement return continue break
|
exec "hi! def link juliaConstGeneric07 " . h
|
||||||
|
|
||||||
hi def link juliaStatement Statement
|
hi def link juliaComprehensionFor Keyword
|
||||||
|
hi def link juliaComprehensionIf Keyword
|
||||||
|
|
||||||
" misc
|
hi def link juliaDollarVar Identifier
|
||||||
syn keyword juliaDeclaration const global local
|
|
||||||
syn keyword juliaComprehensionFor for
|
|
||||||
|
|
||||||
hi def link juliaDeclaration Keyword
|
hi def link juliaMacro Macro
|
||||||
hi def link juliaComprehensionFor Keyword
|
hi def link juliaSymbol Identifier
|
||||||
|
hi def link juliaSymbolS Identifier
|
||||||
|
hi def link juliaQParDelim Identifier
|
||||||
|
hi def link juliaQuotedQMarkPar Identifier
|
||||||
|
hi def link juliaQuotedQMarkParS Identifier
|
||||||
|
hi def link juliaQuotedQMark juliaOperatorHL
|
||||||
|
|
||||||
" Built in types
|
hi def link juliaNumber Number
|
||||||
syn keyword juliaType Uint Uint8 Uint16 Uint32 Uint64 Uint128
|
hi def link juliaFloat Float
|
||||||
syn keyword juliaType Int Int8 Int16 Int32 Int64 Int128
|
hi def link juliaComplexUnit Constant
|
||||||
syn keyword juliaType Float Float16 Float32 Float64
|
|
||||||
syn keyword juliaType AbstractArray AbstractMatrix AbstractVector Array Vector Matrix
|
|
||||||
syn keyword juliaType String ByteString UTF8String SubString
|
|
||||||
syn keyword juliaType Bool Nothing Union Type
|
|
||||||
|
|
||||||
|
hi def link juliaChar Character
|
||||||
|
|
||||||
hi def link juliaType Type
|
hi def link juliaString String
|
||||||
|
hi def link juliabString String
|
||||||
|
hi def link juliasString String
|
||||||
|
hi def link juliavString String
|
||||||
|
hi def link juliarString String
|
||||||
|
hi def link juliaipString String
|
||||||
|
hi def link juliabigString String
|
||||||
|
hi def link juliaMIMEString String
|
||||||
|
hi def link juliaPrintfString String
|
||||||
|
hi def link juliaShellString String
|
||||||
|
hi def link juliaDocString String
|
||||||
|
hi def link juliaStringDelim String
|
||||||
|
hi def link juliaStringVarsPla Identifier
|
||||||
|
hi def link juliaStringVarDelim Identifier
|
||||||
|
|
||||||
|
hi def link juliaRegEx String
|
||||||
|
|
||||||
" Comments
|
hi def link juliaSpecialChar SpecialChar
|
||||||
syn keyword juliaTodo contained TODO FIXME XXX
|
hi def link juliaOctalEscapeChar SpecialChar
|
||||||
syn cluster juliaCommentGroup contains=juliaTodo
|
hi def link juliaHexEscapeChar SpecialChar
|
||||||
syn region juliaComment start="#" end="$" contains=@juliaCommentGroup,@Spell
|
hi def link juliaUniCharSmall SpecialChar
|
||||||
|
hi def link juliaUniCharLarge SpecialChar
|
||||||
|
|
||||||
hi def link juliaComment Comment
|
hi def link juliaPrintfFmt SpecialChar
|
||||||
hi def link juliaTodo Todo
|
|
||||||
|
|
||||||
|
if s:julia_highlight_operators
|
||||||
|
hi! def link juliaOperatorHL Operator
|
||||||
|
else
|
||||||
|
hi! def link juliaOperatorHL juliaNone
|
||||||
|
endif
|
||||||
|
hi def link juliaOperator juliaOperatorHL
|
||||||
|
hi def link juliaRangeOperator juliaOperatorHL
|
||||||
|
hi def link juliaCTransOperator juliaOperatorHL
|
||||||
|
hi def link juliaTernaryOperator juliaOperatorHL
|
||||||
|
|
||||||
" Strings
|
hi def link juliaCommentL Comment
|
||||||
syn region juliaString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@juliaStringGroup,@Spell
|
hi def link juliaCommentM Comment
|
||||||
syn region juliaTripleString start=+"""+ end=+"""+
|
hi def link juliaCommentDelim Comment
|
||||||
syn region juliaCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@juliaCharacterGroup
|
hi def link juliaTodo Todo
|
||||||
|
|
||||||
hi def link juliaString String
|
hi def link juliaErrorPar juliaError
|
||||||
hi def link juliaTripleString String
|
hi def link juliaErrorEnd juliaError
|
||||||
hi def link juliaCharacter Character
|
hi def link juliaErrorElse juliaError
|
||||||
|
hi def link juliaErrorCatch juliaError
|
||||||
|
hi def link juliaErrorFinally juliaError
|
||||||
|
hi def link juliaErrorSemicol juliaError
|
||||||
|
hi def link juliaErrorPrintfFmt juliaError
|
||||||
|
|
||||||
|
hi def link juliaError Error
|
||||||
|
|
||||||
" Functions
|
if b:julia_syntax_highlight_deprecated == 1
|
||||||
syn region juliaFunctionBlock transparent matchgroup=juliaFunction start="\<\%\(function\|macro\)\>" end="\<end\>" contains=@juliaTop
|
hi! def link juliaDeprecated Todo
|
||||||
hi def link juliaFunction Function
|
else
|
||||||
|
hi! def link juliaDeprecated NONE
|
||||||
|
end
|
||||||
" Numbers
|
|
||||||
syn match juliaNumber "\<\d\+\([Ee]\d\+\)\?\>"
|
|
||||||
syn match juliaNumber "\<0x\x\+\>"
|
|
||||||
syn match juliaNumber "\<0\o\+\>"
|
|
||||||
|
|
||||||
syn match juliaFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
|
|
||||||
syn match juliaFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
|
|
||||||
syn match juliaFloat "\<\d\+[Ee][-+]\d\+\>"
|
|
||||||
syn keyword juliaFloatSpecial NaN Inf
|
|
||||||
|
|
||||||
hi def link juliaNumber Number
|
|
||||||
hi def link juliaFloat Float
|
|
||||||
hi def link juliaFloatSpecial Float
|
|
||||||
|
|
||||||
|
|
||||||
" Operators
|
|
||||||
syn keyword juliaIn in
|
|
||||||
hi def link juliaIn Operator
|
|
||||||
|
|
||||||
|
|
||||||
" Constants
|
|
||||||
syn keyword juliaBool true false nothing
|
|
||||||
hi def link juliaBool Boolean
|
|
||||||
|
|
||||||
syn keyword juliaIdentifierSpecial STDOUT, STDIN, STDERR
|
|
||||||
|
|
||||||
hi def link juliaIdentifierSpecial Identifier
|
|
||||||
|
|
||||||
|
|
||||||
" Macros
|
|
||||||
syn match juliaMacro display "@[_[:alpha:]][_[:alnum:]!]*\%(\.[_[:alpha:]][_[:alnum:]!]*\)*"
|
|
||||||
|
|
||||||
hi def link juliaMacro Macro
|
|
||||||
|
|
||||||
|
|
||||||
syn cluster juliaTop contains=ALLBUT,juliaComprehensionFor
|
|
||||||
|
|
||||||
" Ragel
|
|
||||||
syn include @ragel syntax/ragel.vim
|
|
||||||
syn region ragelLine start="%%" end="$" contains=@ragel
|
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
|
|
||||||
let b:current_syntax = "julia"
|
let b:current_syntax = "julia"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: Kotlin
|
" Language: Kotlin
|
||||||
" Maintainer: Alexander Udalov
|
" Maintainer: Alexander Udalov
|
||||||
" Latest Revision: 18 September 2017
|
" Latest Revision: 23 November 2017
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@@ -39,7 +39,7 @@ syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contai
|
|||||||
syn match ktSpecialCharError "\v\\." contained
|
syn match ktSpecialCharError "\v\\." contained
|
||||||
syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
|
syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
|
||||||
syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
||||||
syn region ktString start='"""' end='"""' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
||||||
syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
|
syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
|
||||||
syn match ktCharacter "\v'\\''" contains=ktSpecialChar
|
syn match ktCharacter "\v'\\''" contains=ktSpecialChar
|
||||||
syn match ktCharacter "\v'[^\\]'"
|
syn match ktCharacter "\v'[^\\]'"
|
||||||
|
|||||||
@@ -110,11 +110,9 @@ syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ containe
|
|||||||
syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained
|
syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained
|
||||||
syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
|
syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
|
||||||
syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
|
syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
|
||||||
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
|
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*\(\*\|\s\)*$/
|
||||||
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
|
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-\(-\|\s\)*$/
|
||||||
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
|
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_\(_\|\s\)*$/
|
||||||
syn match mkdRule /^\s*-\{3,}$/
|
|
||||||
syn match mkdRule /^\s*\*\{3,5}$/
|
|
||||||
|
|
||||||
" YAML frontmatter
|
" YAML frontmatter
|
||||||
if get(g:, 'vim_markdown_frontmatter', 0)
|
if get(g:, 'vim_markdown_frontmatter', 0)
|
||||||
|
|||||||
@@ -13,12 +13,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|||||||
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
|
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
|
||||||
"
|
"
|
||||||
|
|
||||||
" Clear previous syntax settings unless this is v6 or above, in which case just
|
" quit when a syntax file was already loaded
|
||||||
" exit without doing anything.
|
if exists("b:current_syntax")
|
||||||
"
|
|
||||||
if version < 600
|
|
||||||
syn clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -30,26 +26,16 @@ endif
|
|||||||
|
|
||||||
" First pull in the HTML syntax.
|
" First pull in the HTML syntax.
|
||||||
"
|
"
|
||||||
if version < 600
|
runtime! syntax/html.vim
|
||||||
so <sfile>:p:h/html.vim
|
unlet b:current_syntax
|
||||||
else
|
|
||||||
runtime! syntax/html.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn cluster htmlPreproc add=@masonTop
|
syn cluster htmlPreproc add=@masonTop
|
||||||
|
|
||||||
" Now pull in the Perl syntax.
|
" Now pull in the Perl syntax.
|
||||||
"
|
"
|
||||||
if version < 600
|
syn include @perlTop syntax/perl.vim
|
||||||
syn include @perlTop <sfile>:p:h/perl.vim
|
unlet b:current_syntax
|
||||||
unlet b:current_syntax
|
syn include @podTop syntax/pod.vim
|
||||||
syn include @podTop <sfile>:p:h/pod.vim
|
|
||||||
else
|
|
||||||
syn include @perlTop syntax/perl.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
syn include @podTop syntax/pod.vim
|
|
||||||
endif
|
|
||||||
|
|
||||||
" It's hard to reduce down to the correct sub-set of Perl to highlight in some
|
" It's hard to reduce down to the correct sub-set of Perl to highlight in some
|
||||||
" of these cases so I've taken the safe option of just using perlTop in all of
|
" of these cases so I've taken the safe option of just using perlTop in all of
|
||||||
@@ -88,21 +74,9 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,
|
|||||||
|
|
||||||
" Set up default highlighting. Almost all of this is done in the included
|
" Set up default highlighting. Almost all of this is done in the included
|
||||||
" syntax files.
|
" syntax files.
|
||||||
"
|
hi def link masonDoc Comment
|
||||||
if version >= 508 || !exists("did_mason_syn_inits")
|
hi def link masonPod Comment
|
||||||
if version < 508
|
hi def link masonPerlComment perlComment
|
||||||
let did_mason_syn_inits = 1
|
|
||||||
com -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
com -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
HiLink masonDoc Comment
|
|
||||||
HiLink masonPod Comment
|
|
||||||
HiLink masonPerlComment perlComment
|
|
||||||
|
|
||||||
delc HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:current_syntax = "mason"
|
let b:current_syntax = "mason"
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ syn keyword nimKeyword ptr
|
|||||||
syn keyword nimKeyword raise ref return
|
syn keyword nimKeyword raise ref return
|
||||||
syn keyword nimKeyword shared shl shr static
|
syn keyword nimKeyword shared shl shr static
|
||||||
syn keyword nimKeyword try tuple type
|
syn keyword nimKeyword try tuple type
|
||||||
syn keyword nimKeyword var
|
syn keyword nimKeyword var vtref vtptr
|
||||||
syn keyword nimKeyword when while with without
|
syn keyword nimKeyword when while with without
|
||||||
syn keyword nimKeyword xor
|
syn keyword nimKeyword xor
|
||||||
syn keyword nimKeyword yield
|
syn keyword nimKeyword yield
|
||||||
@@ -92,32 +92,33 @@ endif
|
|||||||
|
|
||||||
if nim_highlight_builtins == 1
|
if nim_highlight_builtins == 1
|
||||||
" builtin functions, types and objects, not really part of the syntax
|
" builtin functions, types and objects, not really part of the syntax
|
||||||
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool
|
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64
|
||||||
syn keyword nimBuiltin char string cstring pointer range array openarray seq
|
syn keyword nimBuiltin bool void chr char string cstring pointer range array openarray openArray seq varargs varArgs
|
||||||
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
||||||
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
||||||
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
||||||
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
|
syn keyword nimBuiltin CompileDate CompileTime nimversion nimVersion nimmajor nimMajor
|
||||||
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
|
syn keyword nimBuiltin nimminor nimMinor nimpatch nimPatch cpuendian cpuEndian hostos hostOS hostcpu hostCPU inf
|
||||||
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
|
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbglinehook dbgLineHook stdin
|
||||||
syn keyword nimBuiltin stdout stderr defined new high low sizeof succ pred
|
syn keyword nimBuiltin stdout stderr defined new high low sizeof succ pred
|
||||||
syn keyword nimBuiltin inc dec newSeq len incl excl card ord chr ze ze64
|
syn keyword nimBuiltin inc dec newseq newSeq len incl excl card ord chr ze ze64
|
||||||
syn keyword nimBuiltin toU8 toU16 toU32 abs min max add repr
|
syn keyword nimBuiltin tou8 toU8 tou16 toU16 tou32 toU32 abs min max add repr
|
||||||
syn match nimBuiltin "\<contains\>"
|
syn match nimBuiltin "\<contains\>"
|
||||||
syn keyword nimBuiltin toFloat toBiggestFloat toInt toBiggestInt addQuitProc
|
syn keyword nimBuiltin tofloat toFloat tobiggestfloat toBiggestFloat toint toInt tobiggestint toBiggestInt
|
||||||
syn keyword nimBuiltin copy setLen newString zeroMem copyMem moveMem
|
syn keyword nimBuiltin addquitproc addQuitProc
|
||||||
syn keyword nimBuiltin equalMem alloc alloc0 realloc dealloc setLen assert
|
syn keyword nimBuiltin copy setlen setLen newstring newString zeromem zeroMem copymem copyMem movemem moveMem
|
||||||
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
|
syn keyword nimBuiltin equalmem equalMem alloc alloc0 realloc dealloc assert
|
||||||
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
|
syn keyword nimBuiltin echo swap getrefcount getRefcount getcurrentexception getCurrentException Msg
|
||||||
|
syn keyword nimBuiltin getoccupiedmem getOccupiedMem getfreemem getFreeMem gettotalmem getTotalMem isnil isNil seqtoptr seqToPtr
|
||||||
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
||||||
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
|
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
|
||||||
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
|
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
|
||||||
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
|
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
|
||||||
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
||||||
syn keyword nimBuiltin FlushFile readFile write readLine writeln writeln
|
syn keyword nimBuiltin FlushFile readfile readFile readline readLine write writeln writeLn writeline writeLine
|
||||||
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
|
syn keyword nimBuiltin getfilesize getFileSize ReadBytes ReadChars readbuffer readBuffer writebytes writeBytes
|
||||||
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
|
syn keyword nimBuiltin writechars writeChars writebuffer writeBuffer setfilepos setFilePos getfilepos getFilePos
|
||||||
syn keyword nimBuiltin fileHandle countdown countup items lines
|
syn keyword nimBuiltin filehandle fileHandle countdown countup items lines
|
||||||
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
|
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
260
syntax/nix.vim
260
syntax/nix.vim
@@ -1,131 +1,187 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||||
|
|
||||||
"
|
" Vim syntax file
|
||||||
" Syntax file for Nix
|
" Language: Nix
|
||||||
"
|
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||||
" TODO:
|
" URL: https://github.com/LnL7/vim-nix
|
||||||
" Emphasize :
|
|
||||||
" Deemphasize ;
|
|
||||||
" Consistent ()
|
|
||||||
" rec (red?)
|
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Operators
|
syn keyword nixBoolean true false
|
||||||
syn match nixOperator "\V++"
|
syn keyword nixNull null
|
||||||
syn match nixOperator "\V+"
|
syn keyword nixRecKeyword rec
|
||||||
syn match nixOperator "\V!"
|
|
||||||
syn match nixOperator "\V=="
|
|
||||||
syn match nixOperator "\V!="
|
|
||||||
syn match nixOperator "\V&&"
|
|
||||||
syn match nixOperator "\V||"
|
|
||||||
syn match nixOperator "\V->"
|
|
||||||
|
|
||||||
syn match nixOperator "\V-"
|
syn keyword nixOperator or
|
||||||
syn match nixOperator "\V*"
|
syn match nixOperator '!=\|!'
|
||||||
syn match nixOperator "\V/"
|
syn match nixOperator '<=\?'
|
||||||
syn match nixOperator "\V>"
|
syn match nixOperator '>=\?'
|
||||||
syn match nixOperator "\V<"
|
syn match nixOperator '&&'
|
||||||
|
syn match nixOperator '//\='
|
||||||
|
syn match nixOperator '=='
|
||||||
|
syn match nixOperator '?'
|
||||||
|
syn match nixOperator '||'
|
||||||
|
syn match nixOperator '++\='
|
||||||
|
syn match nixOperator '-'
|
||||||
|
syn match nixOperator '\*'
|
||||||
|
syn match nixOperator '->'
|
||||||
|
|
||||||
" Keywords
|
syn match nixParen '[()]'
|
||||||
syn keyword nixKeyword let in or assert inherit null with rec
|
syn match nixInteger '\d\+'
|
||||||
syn keyword nixConditional if else then
|
|
||||||
syn keyword nixBoolean true false
|
|
||||||
|
|
||||||
" Builtins
|
syn keyword nixTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||||
syn keyword nixBuiltin builtins abort add attrNames attrValues
|
syn match nixComment '#.*' contains=nixTodo,@Spell
|
||||||
\ baseNameOf compareVersions concatLists currentSystem deepSeq
|
syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell
|
||||||
\ derivation dirOf div elem elemAt filter filterSource fromJSON
|
|
||||||
\ getAttr getEnv hasAttr hashString head import intersectAttrs
|
|
||||||
\ isAttrs isList isFunction isString isInt isBool isNull length
|
|
||||||
\ lessThan listToAttrs map mul parseDrvNames pathExists readDir
|
|
||||||
\ readFile removeAttrs seq stringLength sub substring tail throw
|
|
||||||
\ toFile toJSON toPath toString toXML trace typeOf tryEval
|
|
||||||
|
|
||||||
syn match nixpkgs "<nixpkgs>"
|
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
|
||||||
syn match nixSpecialOper "\V@\|;\|,\|?\|..."
|
|
||||||
|
|
||||||
" Attribute Lists
|
syn match nixSimpleStringSpecial /\\["nrt\\$]/ contained
|
||||||
"syn match nixBrace "\v[(){}\[\]]|rec\s*\{"
|
syn match nixInterpolationSpecial /''['$]/ contained
|
||||||
syn region nixSet matchgroup=nixBraces start="{" end="}" contains=ALL
|
|
||||||
syn region nixRecSet matchgroup=nixBraces start="rec\s*{" end="}" contains=ALL
|
|
||||||
syn region nixList matchgroup=nixBraces start="\[" end="\]" contains=ALLBUT,nixAttr
|
|
||||||
syn match nixAttr "\v[0-9A-Za-z\-\_]+\ze\s*\=" contained
|
|
||||||
|
|
||||||
syn match nixInteger "\v<\d+>"
|
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial
|
||||||
|
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$]+ end=+''+ contains=nixInterpolation,nixInterpolationSpecial
|
||||||
|
|
||||||
" Functions
|
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
|
||||||
syn match nixFuncArg "\v\zs\w+\ze\s*:"
|
|
||||||
|
|
||||||
" TODO: Exclude ; and other illegal characters
|
syn match nixPath "[a-zA-Z0-9._+-]*\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||||
syn match nixPath "\v\S*/\S+|\S+/\S*"
|
syn match nixHomePath "\~\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||||
|
syn match nixSearchPath "[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*" contained
|
||||||
|
syn match nixPathDelimiter "[<>]" contained
|
||||||
|
syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contains=nixSearchPath,nixPathDelimiter
|
||||||
|
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
|
||||||
|
|
||||||
" This operator is placed after nixPath to override nixPath's highlighting
|
syn match nixAttributeDot "\." contained
|
||||||
syn match nixOperator "\V//"
|
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'-.]\|$\)" contained
|
||||||
|
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
|
||||||
|
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
|
||||||
|
|
||||||
" Strings
|
syn region nixInheritAttributeScope start="(" end=")" contained contains=nixComment,nixAttributeDot
|
||||||
syn match nixStringIndentedEscapes +'''\|''\${\|''\\n\|''\\r\|''\\t+
|
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
|
||||||
syn match nixStringEscapes +\\"\|\\\${\|\\n\|\\r\|\\t\|\\\\+
|
|
||||||
syn region nixStringIndented
|
|
||||||
\ start=+''+
|
|
||||||
\ skip=+'''+
|
|
||||||
\ end=+''+
|
|
||||||
\ contains=nixAntiquotation,nixStringIndentedEscapes
|
|
||||||
syn region nixString
|
|
||||||
\ start=+"+
|
|
||||||
\ skip=+\\"+
|
|
||||||
\ end=+"+
|
|
||||||
\ contains=nixAntiquotation,nixStringEscapes
|
|
||||||
|
|
||||||
" If this contains nixBrace, it ignores its own closing brace and syntax gets
|
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition
|
||||||
" thrown way off contains=ALLBUT,nixBrace
|
|
||||||
syn region nixAntiquotation start=+\${+ end=+}+ contains=nixAntiQuotation
|
|
||||||
|
|
||||||
" Comments
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+ contains=nixTodos
|
syn region nixArgumentDefinitionWithDefault matchgroup=nixArgumentDefinition start="[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*?\@=" matchgroup=NONE end="[,}]\@=" transparent contained contains=@nixExpr
|
||||||
syn match nixEndOfLineComment "#.*$" contains=nixTodos
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
syntax keyword nixTodos TODO XXX FIXME NOTE TODOS contained
|
syn match nixArgumentDefinition "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,}]\@=" contained
|
||||||
|
syn match nixArgumentEllipsis "\.\.\." contained
|
||||||
|
syn match nixArgumentSeparator "," contained
|
||||||
|
|
||||||
" Special (Delimiter
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
hi def link nixBraces Delimiter
|
syn match nixArgOperator '@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:'he=s+1 contained contains=nixAttribute
|
||||||
hi def link nixpkgs Special
|
|
||||||
hi def link nixSpecialOper Special
|
|
||||||
hi def link nixStringIndentedEscapes SpecialChar
|
|
||||||
hi def link nixStringEscapes SpecialChar
|
|
||||||
hi def link nixBuiltin Special
|
|
||||||
hi def link nixOperator Operator
|
|
||||||
|
|
||||||
" Constants
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
hi def link nixBoolean Boolean
|
syn match nixArgOperator '[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@'hs=e-1 contains=nixAttribute nextgroup=nixFunctionArgument
|
||||||
hi def link nixInteger Number
|
|
||||||
hi def link nixString String
|
|
||||||
hi def link nixStringIndented String
|
|
||||||
|
|
||||||
" Comments
|
" This is a bit more complicated, because function arguments can be passed in a
|
||||||
hi def link nixMultiLineComment Comment
|
" very similar form on how attribute sets are defined and two regions with the
|
||||||
hi def link nixEndOfLineComment Comment
|
" same start patterns will shadow each other. Instead of a region we could use a
|
||||||
|
" match on {\_.\{-\}}, which unfortunately doesn't take nesting into account.
|
||||||
|
"
|
||||||
|
" So what we do instead is that we look forward until we are sure that it's a
|
||||||
|
" function argument. Unfortunately, we need to catch comments and both vertical
|
||||||
|
" and horizontal white space, which the following regex should hopefully do:
|
||||||
|
"
|
||||||
|
" "\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*"
|
||||||
|
"
|
||||||
|
" It is also used throught the whole file and is marked with 'v's as well.
|
||||||
|
"
|
||||||
|
" Fortunately the matching rules for function arguments are much simpler than
|
||||||
|
" for real attribute sets, because we can stop when we hit the first ellipsis or
|
||||||
|
" default value operator, but we also need to paste the "whitespace & comments
|
||||||
|
" eating" regex all over the place (marked with 'v's):
|
||||||
|
"
|
||||||
|
" Region match 1: { foo ? ... } or { foo, ... } or { ... } (ellipsis)
|
||||||
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv {----- identifier -----}vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
|
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*\%([a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,?}]\|\.\.\.\)" end="}" contains=nixComment,nixArgumentDefinitionWithDefault,nixArgumentDefinition,nixArgumentEllipsis,nixArgumentSeparator nextgroup=nixArgOperator
|
||||||
|
|
||||||
" Identifiers
|
" Now it gets more tricky, because we need to look forward for the colon, but
|
||||||
hi def link nixConditional Conditional
|
" there could be something like "{}@foo:", even though it's highly unlikely.
|
||||||
hi def link nixKeyword Keyword
|
"
|
||||||
hi def link nixOperator Operator
|
" Region match 2: {}
|
||||||
hi def link nixException Exception
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv@vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv{----- identifier -----} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
hi def link nixAttr Identifier
|
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator
|
||||||
hi def link nixFuncArg Identifier
|
|
||||||
|
|
||||||
" PreProc
|
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
hi def link nixAntiquotation Macro
|
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:/\@!"
|
||||||
|
|
||||||
" Underlined (html links)
|
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr
|
||||||
hi def link nixPath Underlined
|
|
||||||
|
|
||||||
" Error
|
syn region nixLetExpr matchgroup=nixLetExprKeyword start="\<let\>" end="\<in\>" contains=nixComment,nixAttributeDefinition
|
||||||
|
|
||||||
syn sync maxlines=20000
|
syn keyword nixIfExprKeyword then contained
|
||||||
syn sync minlines=50000
|
syn region nixIfExpr matchgroup=nixIfExprKeyword start="\<if\>" end="\<else\>" contains=@nixExpr,nixIfExprKeyword
|
||||||
|
|
||||||
let b:current_syntax = 'nix'
|
syn region nixWithExpr matchgroup=nixWithExprKeyword start="\<with\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||||
|
|
||||||
|
syn region nixAssertExpr matchgroup=nixAssertKeyword start="\<assert\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||||
|
|
||||||
|
syn cluster nixExpr contains=nixBoolean,nixNull,nixOperator,nixParen,nixInteger,nixRecKeyword,nixConditional,nixBuiltin,nixSimpleBuiltin,nixComment,nixFunctionCall,nixFunctionArgument,nixSimpleFunctionArgument,nixPath,nixHomePath,nixSearchPathRef,nixURI,nixAttributeSet,nixList,nixSimpleString,nixString,nixLetExpr,nixIfExpr,nixWithExpr,nixAssertExpr
|
||||||
|
|
||||||
|
" These definitions override @nixExpr and have to come afterwards:
|
||||||
|
|
||||||
|
syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-9_'-]*\)*" contained
|
||||||
|
|
||||||
|
" Non-namespaced Nix builtins as of version 1.10:
|
||||||
|
syn keyword nixSimpleBuiltin
|
||||||
|
\ abort baseNameOf derivation dirOf fetchTarball import map removeAttrs
|
||||||
|
\ throw toString
|
||||||
|
|
||||||
|
" Namespaced and non-namespaced Nix builtins as of version 1.10:
|
||||||
|
syn keyword nixNamespacedBuiltin contained
|
||||||
|
\ abort add all any attrNames attrValues baseNameOf compareVersions
|
||||||
|
\ concatLists currentSystem deepSeq derivation dirOf div elem elemAt
|
||||||
|
\ fetchTarball fetchurl filter filterSource foldl' fromJSON genList
|
||||||
|
\ getAttr getEnv hasAttr hashString head import intersectAttrs isAttrs
|
||||||
|
\ isBool isFunction isInt isList isString length lessThan listToAttrs map
|
||||||
|
\ mul parseDrvName pathExists readDir readFile removeAttrs replaceStrings
|
||||||
|
\ seq sort stringLength sub substring tail throw toFile toJSON toPath
|
||||||
|
\ toString toXML trace typeOf
|
||||||
|
|
||||||
|
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
|
||||||
|
|
||||||
|
hi def link nixArgOperator Operator
|
||||||
|
hi def link nixArgumentDefinition Identifier
|
||||||
|
hi def link nixArgumentEllipsis Operator
|
||||||
|
hi def link nixAssertKeyword Keyword
|
||||||
|
hi def link nixAttribute Identifier
|
||||||
|
hi def link nixAttributeDot Operator
|
||||||
|
hi def link nixBoolean Boolean
|
||||||
|
hi def link nixBuiltin Special
|
||||||
|
hi def link nixComment Comment
|
||||||
|
hi def link nixConditional Conditional
|
||||||
|
hi def link nixHomePath Include
|
||||||
|
hi def link nixIfExprKeyword Keyword
|
||||||
|
hi def link nixInherit Keyword
|
||||||
|
hi def link nixInteger Integer
|
||||||
|
hi def link nixInterpolation Macro
|
||||||
|
hi def link nixInterpolationDelimiter Delimiter
|
||||||
|
hi def link nixInterpolationParam Macro
|
||||||
|
hi def link nixInterpolationSpecial Special
|
||||||
|
hi def link nixLetExprKeyword Keyword
|
||||||
|
hi def link nixNamespacedBuiltin Special
|
||||||
|
hi def link nixNull Constant
|
||||||
|
hi def link nixOperator Operator
|
||||||
|
hi def link nixPath Include
|
||||||
|
hi def link nixPathDelimiter Delimiter
|
||||||
|
hi def link nixRecKeyword Keyword
|
||||||
|
hi def link nixSearchPath Include
|
||||||
|
hi def link nixSimpleBuiltin Keyword
|
||||||
|
hi def link nixSimpleFunctionArgument Identifier
|
||||||
|
hi def link nixSimpleString String
|
||||||
|
hi def link nixSimpleStringSpecial SpecialChar
|
||||||
|
hi def link nixString String
|
||||||
|
hi def link nixStringDelimiter Delimiter
|
||||||
|
hi def link nixTodo Todo
|
||||||
|
hi def link nixURI Include
|
||||||
|
hi def link nixWithExprKeyword Keyword
|
||||||
|
|
||||||
|
" This could lead up to slow syntax highlighting for large files, but usually
|
||||||
|
" large files such as all-packages.nix are one large attribute set, so if we'd
|
||||||
|
" use sync patterns we'd have to go back to the start of the file anyway
|
||||||
|
syn sync fromstart
|
||||||
|
|
||||||
|
let b:current_syntax = "nix"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
|
|
||||||
|
|
||||||
" Vim syntax file
|
|
||||||
" Language: OpenSCAD
|
|
||||||
" Maintainer: Sirtaj Singh Kang <sirtaj-vim@sirtaj.net>
|
|
||||||
" Last Changed: 2013 March 05
|
|
||||||
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
"syn keyword openscadFunctionDef function
|
|
||||||
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
|
|
||||||
syn match openscadFunction /\<\h\w*\>/ contained display
|
|
||||||
|
|
||||||
"syn keyword openscadModuleDef module
|
|
||||||
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
|
|
||||||
syn match openscadModule /\<\h\w*\>/ contained display
|
|
||||||
|
|
||||||
syn keyword openscadStatement echo assign let
|
|
||||||
syn keyword openscadConditional if else
|
|
||||||
syn keyword openscadRepeat for intersection_for
|
|
||||||
syn keyword openscadInclude include use
|
|
||||||
syn keyword openscadCsgKeyword union difference intersection render intersection_for
|
|
||||||
syn keyword openscadTransform scale rotate translate mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
|
|
||||||
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
|
|
||||||
syn keyword openscadPrimitive2D square circle polygon import_dxf text
|
|
||||||
syn keyword openscadPrimitiveImport import child children
|
|
||||||
|
|
||||||
syn match openscadSpecialVariable "\$[a-zA-Z]\+\>" display
|
|
||||||
syn match openscadModifier "^\s*[\*\!\#\%]" display
|
|
||||||
|
|
||||||
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
|
|
||||||
syn match openscadNumber "\d\+" display contained
|
|
||||||
syn match openscadNumber "\.\d\+" display contained
|
|
||||||
|
|
||||||
syn region openscadString start=/"/ skip=/\\"/ end=/"/
|
|
||||||
|
|
||||||
syn keyword openscadBoolean true false
|
|
||||||
|
|
||||||
syn keyword openscadCommentTodo TODO FIXME XXX contained display
|
|
||||||
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
|
|
||||||
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
|
|
||||||
|
|
||||||
syn region openscadBlock start="{" end="}" transparent fold
|
|
||||||
syn region openscadVector start="\[" end="\]" transparent fold
|
|
||||||
|
|
||||||
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
|
|
||||||
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
|
|
||||||
syn keyword openscadBuiltin str len search version version_num concat chr
|
|
||||||
syn keyword openscadBuiltin dxf_cross dxf_dim
|
|
||||||
|
|
||||||
hi def link openscadFunctionDef Structure
|
|
||||||
hi def link openscadFunction Function
|
|
||||||
hi def link openscadModuleDef Structure
|
|
||||||
hi def link openscadModule Function
|
|
||||||
hi def link openscadBlockComment Comment
|
|
||||||
hi def link openscadBoolean Boolean
|
|
||||||
hi def link openscadBuiltin Function
|
|
||||||
hi def link openscadConditional Conditional
|
|
||||||
hi def link openscadCsgKeyword Structure
|
|
||||||
hi def link openscadInclude Include
|
|
||||||
hi def link openscadInlineComment Comment
|
|
||||||
hi def link openscadModifier Special
|
|
||||||
hi def link openscadStatement Statement
|
|
||||||
hi def link openscadNumbers Number
|
|
||||||
hi def link openscadNumber Number
|
|
||||||
hi def link openscadPrimitiveSolid Keyword
|
|
||||||
hi def link openscadPrimitive2D Keyword
|
|
||||||
hi def link openscadPrimitiveImport Keyword
|
|
||||||
hi def link openscadRepeat Repeat
|
|
||||||
hi def link openscadSpecialVariable Special
|
|
||||||
hi def link openscadString String
|
|
||||||
hi def link openscadTransform Statement
|
|
||||||
hi def link openscadCommentTodo Todo
|
|
||||||
|
|
||||||
" Blatantly stolen from vim74\syntax\c.vim
|
|
||||||
"when wanted, highlight trailing white space
|
|
||||||
if exists("openscad_space_errors")
|
|
||||||
if !exists("openscad_no_trail_space_error")
|
|
||||||
syn match openscadSpaceError display excludenl "\s\+$"
|
|
||||||
endif
|
|
||||||
if !exists("openscad_no_tab_space_error")
|
|
||||||
syn match openscadSpaceError display " \+\t"me=e-1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:current_syntax = "openscad"
|
|
||||||
|
|
||||||
endif
|
|
||||||
198
syntax/perl.vim
198
syntax/perl.vim
@@ -435,125 +435,121 @@ else
|
|||||||
syn sync minlines=0
|
syn sync minlines=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
|
|
||||||
" NOTE: If you're linking new highlight groups to perlString, please also put
|
" NOTE: If you're linking new highlight groups to perlString, please also put
|
||||||
" them into b:match_skip in ftplugin/perl.vim.
|
" them into b:match_skip in ftplugin/perl.vim.
|
||||||
|
|
||||||
" The default highlighting.
|
" The default highlighting.
|
||||||
HiLink perlSharpBang PreProc
|
hi def link perlSharpBang PreProc
|
||||||
HiLink perlControl PreProc
|
hi def link perlControl PreProc
|
||||||
HiLink perlInclude Include
|
hi def link perlInclude Include
|
||||||
HiLink perlSpecial Special
|
hi def link perlSpecial Special
|
||||||
HiLink perlString String
|
hi def link perlString String
|
||||||
HiLink perlCharacter Character
|
hi def link perlCharacter Character
|
||||||
HiLink perlNumber Number
|
hi def link perlNumber Number
|
||||||
HiLink perlFloat Float
|
hi def link perlFloat Float
|
||||||
HiLink perlType Type
|
hi def link perlType Type
|
||||||
HiLink perlIdentifier Identifier
|
hi def link perlIdentifier Identifier
|
||||||
HiLink perlLabel Label
|
hi def link perlLabel Label
|
||||||
HiLink perlStatement Statement
|
hi def link perlStatement Statement
|
||||||
HiLink perlConditional Conditional
|
hi def link perlConditional Conditional
|
||||||
HiLink perlRepeat Repeat
|
hi def link perlRepeat Repeat
|
||||||
HiLink perlOperator Operator
|
hi def link perlOperator Operator
|
||||||
HiLink perlFunction Keyword
|
hi def link perlFunction Keyword
|
||||||
HiLink perlSubName Function
|
hi def link perlSubName Function
|
||||||
HiLink perlSubPrototype Type
|
hi def link perlSubPrototype Type
|
||||||
HiLink perlSignature Type
|
hi def link perlSignature Type
|
||||||
HiLink perlSubAttributes PreProc
|
hi def link perlSubAttributes PreProc
|
||||||
HiLink perlSubAttributesCont perlSubAttributes
|
hi def link perlSubAttributesCont perlSubAttributes
|
||||||
HiLink perlComment Comment
|
hi def link perlComment Comment
|
||||||
HiLink perlTodo Todo
|
hi def link perlTodo Todo
|
||||||
if exists("perl_string_as_statement")
|
if exists("perl_string_as_statement")
|
||||||
HiLink perlStringStartEnd perlStatement
|
hi def link perlStringStartEnd perlStatement
|
||||||
else
|
else
|
||||||
HiLink perlStringStartEnd perlString
|
hi def link perlStringStartEnd perlString
|
||||||
endif
|
endif
|
||||||
HiLink perlVStringV perlStringStartEnd
|
hi def link perlVStringV perlStringStartEnd
|
||||||
HiLink perlList perlStatement
|
hi def link perlList perlStatement
|
||||||
HiLink perlMisc perlStatement
|
hi def link perlMisc perlStatement
|
||||||
HiLink perlVarPlain perlIdentifier
|
hi def link perlVarPlain perlIdentifier
|
||||||
HiLink perlVarPlain2 perlIdentifier
|
hi def link perlVarPlain2 perlIdentifier
|
||||||
HiLink perlArrow perlIdentifier
|
hi def link perlArrow perlIdentifier
|
||||||
HiLink perlFiledescRead perlIdentifier
|
hi def link perlFiledescRead perlIdentifier
|
||||||
HiLink perlFiledescStatement perlIdentifier
|
hi def link perlFiledescStatement perlIdentifier
|
||||||
HiLink perlVarSimpleMember perlIdentifier
|
hi def link perlVarSimpleMember perlIdentifier
|
||||||
HiLink perlVarSimpleMemberName perlString
|
hi def link perlVarSimpleMemberName perlString
|
||||||
HiLink perlVarNotInMatches perlIdentifier
|
hi def link perlVarNotInMatches perlIdentifier
|
||||||
HiLink perlVarSlash perlIdentifier
|
hi def link perlVarSlash perlIdentifier
|
||||||
HiLink perlQQ perlString
|
hi def link perlQQ perlString
|
||||||
HiLink perlHereDoc perlString
|
hi def link perlHereDoc perlString
|
||||||
HiLink perlStringUnexpanded perlString
|
hi def link perlStringUnexpanded perlString
|
||||||
HiLink perlSubstitutionSQ perlString
|
hi def link perlSubstitutionSQ perlString
|
||||||
HiLink perlSubstitutionGQQ perlString
|
hi def link perlSubstitutionGQQ perlString
|
||||||
HiLink perlTranslationGQ perlString
|
hi def link perlTranslationGQ perlString
|
||||||
HiLink perlMatch perlString
|
hi def link perlMatch perlString
|
||||||
HiLink perlMatchStartEnd perlStatement
|
hi def link perlMatchStartEnd perlStatement
|
||||||
HiLink perlFormatName perlIdentifier
|
hi def link perlFormatName perlIdentifier
|
||||||
HiLink perlFormatField perlString
|
hi def link perlFormatField perlString
|
||||||
HiLink perlPackageDecl perlType
|
hi def link perlPackageDecl perlType
|
||||||
HiLink perlStorageClass perlType
|
hi def link perlStorageClass perlType
|
||||||
HiLink perlPackageRef perlType
|
hi def link perlPackageRef perlType
|
||||||
HiLink perlStatementPackage perlStatement
|
hi def link perlStatementPackage perlStatement
|
||||||
HiLink perlStatementStorage perlStatement
|
hi def link perlStatementStorage perlStatement
|
||||||
HiLink perlStatementControl perlStatement
|
hi def link perlStatementControl perlStatement
|
||||||
HiLink perlStatementScalar perlStatement
|
hi def link perlStatementScalar perlStatement
|
||||||
HiLink perlStatementRegexp perlStatement
|
hi def link perlStatementRegexp perlStatement
|
||||||
HiLink perlStatementNumeric perlStatement
|
hi def link perlStatementNumeric perlStatement
|
||||||
HiLink perlStatementList perlStatement
|
hi def link perlStatementList perlStatement
|
||||||
HiLink perlStatementHash perlStatement
|
hi def link perlStatementHash perlStatement
|
||||||
HiLink perlStatementIOfunc perlStatement
|
hi def link perlStatementIOfunc perlStatement
|
||||||
HiLink perlStatementFiledesc perlStatement
|
hi def link perlStatementFiledesc perlStatement
|
||||||
HiLink perlStatementVector perlStatement
|
hi def link perlStatementVector perlStatement
|
||||||
HiLink perlStatementFiles perlStatement
|
hi def link perlStatementFiles perlStatement
|
||||||
HiLink perlStatementFlow perlStatement
|
hi def link perlStatementFlow perlStatement
|
||||||
HiLink perlStatementInclude perlStatement
|
hi def link perlStatementInclude perlStatement
|
||||||
HiLink perlStatementProc perlStatement
|
hi def link perlStatementProc perlStatement
|
||||||
HiLink perlStatementSocket perlStatement
|
hi def link perlStatementSocket perlStatement
|
||||||
HiLink perlStatementIPC perlStatement
|
hi def link perlStatementIPC perlStatement
|
||||||
HiLink perlStatementNetwork perlStatement
|
hi def link perlStatementNetwork perlStatement
|
||||||
HiLink perlStatementPword perlStatement
|
hi def link perlStatementPword perlStatement
|
||||||
HiLink perlStatementTime perlStatement
|
hi def link perlStatementTime perlStatement
|
||||||
HiLink perlStatementMisc perlStatement
|
hi def link perlStatementMisc perlStatement
|
||||||
HiLink perlStatementIndirObj perlStatement
|
hi def link perlStatementIndirObj perlStatement
|
||||||
HiLink perlFunctionName perlIdentifier
|
hi def link perlFunctionName perlIdentifier
|
||||||
HiLink perlMethod perlIdentifier
|
hi def link perlMethod perlIdentifier
|
||||||
HiLink perlPostDeref perlIdentifier
|
hi def link perlPostDeref perlIdentifier
|
||||||
HiLink perlFunctionPRef perlType
|
hi def link perlFunctionPRef perlType
|
||||||
if !get(g:, 'perl_include_pod', 1)
|
if !get(g:, 'perl_include_pod', 1)
|
||||||
HiLink perlPOD perlComment
|
hi def link perlPOD perlComment
|
||||||
endif
|
endif
|
||||||
HiLink perlShellCommand perlString
|
hi def link perlShellCommand perlString
|
||||||
HiLink perlSpecialAscii perlSpecial
|
hi def link perlSpecialAscii perlSpecial
|
||||||
HiLink perlSpecialDollar perlSpecial
|
hi def link perlSpecialDollar perlSpecial
|
||||||
HiLink perlSpecialString perlSpecial
|
hi def link perlSpecialString perlSpecial
|
||||||
HiLink perlSpecialStringU perlSpecial
|
hi def link perlSpecialStringU perlSpecial
|
||||||
HiLink perlSpecialMatch perlSpecial
|
hi def link perlSpecialMatch perlSpecial
|
||||||
HiLink perlDATA perlComment
|
hi def link perlDATA perlComment
|
||||||
|
|
||||||
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
|
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
|
||||||
" I had to remove the transparent property from the following regions
|
" I had to remove the transparent property from the following regions
|
||||||
" in order to get them to highlight correctly. Feel free to remove
|
" in order to get them to highlight correctly. Feel free to remove
|
||||||
" these and reinstate the transparent property if you know how.
|
" these and reinstate the transparent property if you know how.
|
||||||
HiLink perlParensSQ perlString
|
hi def link perlParensSQ perlString
|
||||||
HiLink perlBracketsSQ perlString
|
hi def link perlBracketsSQ perlString
|
||||||
HiLink perlBracesSQ perlString
|
hi def link perlBracesSQ perlString
|
||||||
HiLink perlAnglesSQ perlString
|
hi def link perlAnglesSQ perlString
|
||||||
|
|
||||||
HiLink perlParensDQ perlString
|
hi def link perlParensDQ perlString
|
||||||
HiLink perlBracketsDQ perlString
|
hi def link perlBracketsDQ perlString
|
||||||
HiLink perlBracesDQ perlString
|
hi def link perlBracesDQ perlString
|
||||||
HiLink perlAnglesDQ perlString
|
hi def link perlAnglesDQ perlString
|
||||||
|
|
||||||
HiLink perlSpecialStringU2 perlString
|
hi def link perlSpecialStringU2 perlString
|
||||||
|
|
||||||
" Possible errors
|
" Possible errors
|
||||||
HiLink perlNotEmptyLine Error
|
hi def link perlNotEmptyLine Error
|
||||||
HiLink perlElseIfError Error
|
hi def link perlElseIfError Error
|
||||||
HiLink perlSubPrototypeError Error
|
hi def link perlSubPrototypeError Error
|
||||||
HiLink perlSubError Error
|
hi def link perlSubError Error
|
||||||
|
|
||||||
delcommand HiLink
|
|
||||||
|
|
||||||
" Syncing to speed up processing
|
" Syncing to speed up processing
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -621,8 +621,9 @@ if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc
|
|||||||
|
|
||||||
syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment
|
syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment
|
||||||
syn match phpDocTags "@\%(abstract\|access\|api\|author\|brief\|bug\|category\|class\|copyright\|created\|date\|deprecated\|details\|example\|exception\|file\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|struct\|subpackage\|throws\|toc\|todo\|tutorial\|type\|uses\|var\|version\|warning\)" containedin=phpDocComment nextgroup=phpDocParam,phpDocIdentifier skipwhite contained
|
syn match phpDocTags "@\%(abstract\|access\|api\|author\|brief\|bug\|category\|class\|copyright\|created\|date\|deprecated\|details\|example\|exception\|file\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|struct\|subpackage\|throws\|toc\|todo\|tutorial\|type\|uses\|var\|version\|warning\)" containedin=phpDocComment nextgroup=phpDocParam,phpDocIdentifier skipwhite contained
|
||||||
syn match phpDocParam "\s\+\zs\%(\h\w*|\?\)\+" nextgroup=phpDocIdentifier skipwhite contained
|
syn match phpDocParam "\s\+\zs\(|\|\\\|\h\w*\)*\h\w*" nextgroup=phpDocIdentifier skipwhite contained contains=phpDocNamespaceSeparator
|
||||||
syn match phpDocIdentifier "\s\+\zs$\h\w*" contained
|
syn match phpDocIdentifier "\s\+\zs$\h\w*" contained
|
||||||
|
syn match phpDocNamespaceSeparator "\\" contained display
|
||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
endif
|
endif
|
||||||
@@ -651,26 +652,26 @@ endif
|
|||||||
" HereDoc
|
" HereDoc
|
||||||
syn case match
|
syn case match
|
||||||
|
|
||||||
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@3<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
" including HTML,JavaScript,SQL if enabled via options
|
" including HTML,JavaScript,SQL if enabled via options
|
||||||
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
|
if (exists("php_html_in_heredoc") && php_html_in_heredoc)
|
||||||
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
endif
|
endif
|
||||||
if (exists("php_sql_heredoc") && php_sql_heredoc)
|
if (exists("php_sql_heredoc") && php_sql_heredoc)
|
||||||
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@3<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" NowDoc
|
" NowDoc
|
||||||
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
|
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend
|
||||||
|
|
||||||
if (exists("php_sql_nowdoc") && php_sql_nowdoc)
|
if (exists("php_sql_nowdoc") && php_sql_nowdoc)
|
||||||
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
endif
|
endif
|
||||||
if (exists("php_html_in_nowdoc") && php_html_in_nowdoc)
|
if (exists("php_html_in_nowdoc") && php_html_in_nowdoc)
|
||||||
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@3<='\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)'$+ end="^\z1\(;\=$\)\@=" contained contains=@htmlJavascript,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn case ignore
|
syn case ignore
|
||||||
@@ -695,25 +696,28 @@ syn keyword phpKeyword class contained
|
|||||||
\ nextgroup=phpClass skipwhite skipempty
|
\ nextgroup=phpClass skipwhite skipempty
|
||||||
syn match phpClass /\h\w*/ contained
|
syn match phpClass /\h\w*/ contained
|
||||||
|
|
||||||
|
syn match phpClassNamespaceSeparator "\\" contained display
|
||||||
|
|
||||||
" Class extends
|
" Class extends
|
||||||
syn keyword phpKeyword extends contained
|
syn keyword phpKeyword extends contained
|
||||||
\ nextgroup=phpClassExtends skipwhite skipempty
|
\ nextgroup=phpClassExtends skipwhite skipempty
|
||||||
syn match phpClassExtends /\(\\\|\h\w*\)*\h\w*/ contained
|
syn match phpClassExtends /\(\\\|\h\w*\)*\h\w*/ contained contains=phpClassNamespaceSeparator
|
||||||
|
|
||||||
" Class implements
|
" Class implements
|
||||||
syntax keyword phpKeyword implements contained
|
syntax keyword phpKeyword implements contained
|
||||||
\ nextgroup=phpClassImplements skipwhite skipempty
|
\ nextgroup=phpClassImplements skipwhite skipempty
|
||||||
syntax match phpClassImplements contained
|
syntax match phpClassImplements contained contains=phpClassNamespaceSeparator
|
||||||
\ nextgroup=phpClassDelimiter skipwhite skipempty /\(\\\|\h\w*\)*\h\w*/
|
\ nextgroup=phpClassDelimiter skipwhite skipempty /\(\\\|\h\w*\)*\h\w*/
|
||||||
syntax match phpClassDelimiter contained
|
syntax match phpClassDelimiter contained
|
||||||
\ nextgroup=phpClassImplements skipwhite skipempty /,/
|
\ nextgroup=phpClassImplements skipwhite skipempty /,/
|
||||||
|
|
||||||
" use statement
|
" use statement
|
||||||
|
syn match phpUseNamespaceSeparator "\\" contained display
|
||||||
syn keyword phpInclude use contained
|
syn keyword phpInclude use contained
|
||||||
\ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty
|
\ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty
|
||||||
syn match phpUseFunction /function\_s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword
|
syn match phpUseFunction /function\_s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword
|
||||||
\ nextgroup=phpUseAlias skipwhite skipempty
|
\ nextgroup=phpUseAlias skipwhite skipempty
|
||||||
syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained
|
syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseNamespaceSeparator
|
||||||
\ nextgroup=phpUseAlias skipwhite skipempty
|
\ nextgroup=phpUseAlias skipwhite skipempty
|
||||||
syn match phpUseAlias /as\_s\+\h\w*/ contained contains=phpUseKeyword
|
syn match phpUseAlias /as\_s\+\h\w*/ contained contains=phpUseKeyword
|
||||||
syn match phpUseKeyword /\(function\|as\)\_s\+/ contained contains=phpKeyword
|
syn match phpUseKeyword /\(function\|as\)\_s\+/ contained contains=phpKeyword
|
||||||
@@ -865,6 +869,10 @@ if !exists("did_php_syn_inits")
|
|||||||
hi def link phpClassImplements phpClass
|
hi def link phpClassImplements phpClass
|
||||||
hi def link phpClassDelimiter phpRegion
|
hi def link phpClassDelimiter phpRegion
|
||||||
|
|
||||||
|
hi def link phpDocNamespaceSeparator phpComment
|
||||||
|
hi def link phpClassNamespaceSeparator phpClass
|
||||||
|
hi def link phpUseNamespaceSeparator phpRegion
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Cleanup: {{{
|
" Cleanup: {{{
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ syntax match plantumlHorizontalArrow /\%([-\.]\%(|>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\
|
|||||||
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||||
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
|
||||||
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
|
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
|
||||||
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained
|
syntax match plantumlText /\%([0-9A-Za-z\0xc0-\0xff]\|\s\|[\.,;_-]\)\+/ contained
|
||||||
|
|
||||||
" Note
|
" Note
|
||||||
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart
|
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart
|
||||||
|
|||||||
@@ -21,11 +21,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|||||||
|
|
||||||
" Remove any old syntax stuff hanging around (this is suppressed
|
" Remove any old syntax stuff hanging around (this is suppressed
|
||||||
" automatically by ":syn include" if necessary).
|
" automatically by ":syn include" if necessary).
|
||||||
" For version 5.x: Clear all syntax items
|
" quit when a syntax file was already loaded
|
||||||
" For version 6.x: Quit when a syntax file was already loaded
|
if exists("b:current_syntax")
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -69,28 +66,17 @@ syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
|
|||||||
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
|
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
|
||||||
|
|
||||||
" Define the default highlighting.
|
" Define the default highlighting.
|
||||||
" For version 5.7 and earlier: only when not done already
|
" Only when an item doesn't have highlighting yet
|
||||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
||||||
if version >= 508 || !exists("did_pod_syntax_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_pod_syntax_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
HiLink podCommand Statement
|
hi def link podCommand Statement
|
||||||
HiLink podCmdText String
|
hi def link podCmdText String
|
||||||
HiLink podOverIndent Number
|
hi def link podOverIndent Number
|
||||||
HiLink podForKeywd Identifier
|
hi def link podForKeywd Identifier
|
||||||
HiLink podFormat Identifier
|
hi def link podFormat Identifier
|
||||||
HiLink podVerbatimLine PreProc
|
hi def link podVerbatimLine PreProc
|
||||||
HiLink podSpecial Identifier
|
hi def link podSpecial Identifier
|
||||||
HiLink podEscape String
|
hi def link podEscape String
|
||||||
HiLink podEscape2 Number
|
hi def link podEscape2 Number
|
||||||
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists("perl_pod_spellcheck_headings")
|
if exists("perl_pod_spellcheck_headings")
|
||||||
" Spell-check headings
|
" Spell-check headings
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ syn keyword pbRepeat optional required repeated
|
|||||||
syn keyword pbDefault default
|
syn keyword pbDefault default
|
||||||
syn keyword pbExtend extend extensions to max reserved
|
syn keyword pbExtend extend extensions to max reserved
|
||||||
syn keyword pbRPC service rpc returns
|
syn keyword pbRPC service rpc returns
|
||||||
|
syn keyword pbStream stream
|
||||||
|
|
||||||
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
|
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
|
||||||
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
|
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
|
||||||
@@ -92,6 +93,7 @@ if version >= 508 || !exists("did_proto_syn_inits")
|
|||||||
HiLink pbDefault Keyword
|
HiLink pbDefault Keyword
|
||||||
HiLink pbExtend Keyword
|
HiLink pbExtend Keyword
|
||||||
HiLink pbRPC Keyword
|
HiLink pbRPC Keyword
|
||||||
|
HiLink pbStream Keyword
|
||||||
HiLink pbType Type
|
HiLink pbType Type
|
||||||
HiLink pbTypedef Typedef
|
HiLink pbTypedef Typedef
|
||||||
HiLink pbBool Boolean
|
HiLink pbBool Boolean
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ syn keyword purescriptBoolean true false
|
|||||||
syn match purescriptDelimiter "[,;|.()[\]{}]"
|
syn match purescriptDelimiter "[,;|.()[\]{}]"
|
||||||
|
|
||||||
" Constructor
|
" Constructor
|
||||||
syn match purescriptConstructor "\<[A-Z]\w*\>"
|
syn match purescriptConstructor "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>"
|
||||||
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
|
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
|
||||||
\ containedin=purescriptData,purescriptNewtype
|
\ containedin=purescriptData,purescriptNewtype
|
||||||
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
|
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
|
||||||
|
|
||||||
" Type
|
" Type
|
||||||
syn match purescriptType "\<[A-Z]\w*\>" contained
|
syn match purescriptType "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>" contained
|
||||||
\ containedin=purescriptTypeAlias
|
\ containedin=purescriptTypeAlias
|
||||||
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
|
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
|
||||||
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
|
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||||
@@ -36,9 +36,20 @@ syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^
|
|||||||
\ contains=purescriptConstructor,purescriptDelimiter
|
\ contains=purescriptConstructor,purescriptDelimiter
|
||||||
|
|
||||||
" Function
|
" Function
|
||||||
syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
|
syn match purescriptFunction "\%(\<instance\s\+\|\<class\s\+\)\@18<!\<[_a-z]\(\w\|\'\)*\>" contained
|
||||||
syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend
|
" syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||||
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`"
|
syn match purescriptFunction "(\%(\<class\s\+\)\@18<!\(\W\&[^(),\"]\)\+)" contained extend
|
||||||
|
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_\.]*`"
|
||||||
|
|
||||||
|
" Class
|
||||||
|
syn region purescriptClassDecl start="^\%(\s*\)class\>"ms=e-5 end="\<where\>\|$"
|
||||||
|
\ contains=purescriptClass,purescriptClassName,purescriptOperatorType,purescriptOperator,purescriptType,purescriptWhere
|
||||||
|
\ nextgroup=purescriptClass
|
||||||
|
\ skipnl
|
||||||
|
syn match purescriptClass "\<class\>" containedin=purescriptClassDecl contained
|
||||||
|
\ nextgroup=purescriptClassName
|
||||||
|
\ skipnl
|
||||||
|
syn match purescriptClassName "\<[A-Z]\w*\>" containedin=purescriptClassDecl contained
|
||||||
|
|
||||||
" Module
|
" Module
|
||||||
syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl
|
syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl
|
||||||
@@ -46,8 +57,8 @@ syn match purescriptModuleKeyword "\<module\>"
|
|||||||
syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>"
|
syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>"
|
||||||
\ contains=purescriptModuleKeyword,purescriptModuleName
|
\ contains=purescriptModuleKeyword,purescriptModuleName
|
||||||
\ nextgroup=purescriptModuleParams skipwhite skipnl skipempty
|
\ nextgroup=purescriptModuleParams skipwhite skipnl skipempty
|
||||||
syn region purescriptModuleParams start="(" end=")" fold contained keepend
|
syn region purescriptModuleParams start="(" skip="([^)]\{-})" end=")" fold contained keepend
|
||||||
\ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
|
\ contains=purescriptClassDecl,purescriptClass,purescriptClassName,purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
|
||||||
\ nextgroup=purescriptImportParams skipwhite
|
\ nextgroup=purescriptImportParams skipwhite
|
||||||
|
|
||||||
" Import
|
" Import
|
||||||
@@ -86,8 +97,9 @@ syn match purescriptForall "∀"
|
|||||||
syn keyword purescriptConditional if then else
|
syn keyword purescriptConditional if then else
|
||||||
syn keyword purescriptStatement do case of in
|
syn keyword purescriptStatement do case of in
|
||||||
syn keyword purescriptLet let
|
syn keyword purescriptLet let
|
||||||
|
" syn keyword purescriptClass class
|
||||||
syn keyword purescriptWhere where
|
syn keyword purescriptWhere where
|
||||||
syn match purescriptStructure "\<\(data\|newtype\|type\|class\|kind\)\>"
|
syn match purescriptStructure "\<\(data\|newtype\|type\|kind\)\>"
|
||||||
\ nextgroup=purescriptType skipwhite
|
\ nextgroup=purescriptType skipwhite
|
||||||
syn keyword purescriptStructure derive
|
syn keyword purescriptStructure derive
|
||||||
syn keyword purescriptStructure instance
|
syn keyword purescriptStructure instance
|
||||||
@@ -101,7 +113,7 @@ syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type
|
|||||||
|
|
||||||
" Operators
|
" Operators
|
||||||
syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
|
syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
|
||||||
syn match purescriptOperatorType "\(::\|∷\)"
|
syn match purescriptOperatorType "\%(\<instance\>.*\)\@40<!\(::\|∷\)"
|
||||||
\ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty
|
\ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty
|
||||||
syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)"
|
syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)"
|
||||||
syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained
|
syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained
|
||||||
@@ -176,6 +188,8 @@ highlight def link purescriptLineComment purescriptComment
|
|||||||
highlight def link purescriptBlockComment purescriptComment
|
highlight def link purescriptBlockComment purescriptComment
|
||||||
|
|
||||||
" purescript general highlights
|
" purescript general highlights
|
||||||
|
highlight def link purescriptClass purescriptKeyword
|
||||||
|
highlight def link purescriptClassName Type
|
||||||
highlight def link purescriptStructure purescriptKeyword
|
highlight def link purescriptStructure purescriptKeyword
|
||||||
highlight def link purescriptKeyword Keyword
|
highlight def link purescriptKeyword Keyword
|
||||||
highlight def link purescriptStatement Statement
|
highlight def link purescriptStatement Statement
|
||||||
|
|||||||
@@ -1,326 +1,487 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python') == -1
|
||||||
|
|
||||||
" Vim syntax file
|
|
||||||
"
|
|
||||||
" Based on python.vim (from Vim 6.1 distribution)
|
|
||||||
" by Neil Schemenauer <nas@python.ca>
|
|
||||||
"
|
|
||||||
" Notes Armin:
|
|
||||||
"
|
|
||||||
" This version of the syntax file works better for 2.x and 3.x without
|
|
||||||
" having to switch modes.
|
|
||||||
"
|
|
||||||
" Thanks:
|
|
||||||
"
|
|
||||||
" Jeroen Ruigrok van der Werven
|
|
||||||
" for the idea of highlighting for erroneous operators
|
|
||||||
" Pedro Algarvio
|
|
||||||
" for the patch to enable spell checking only for the right spots
|
|
||||||
" (strings and comments)
|
|
||||||
|
|
||||||
"
|
|
||||||
" Options:
|
|
||||||
"
|
|
||||||
" For set option do: let OPTION_NAME = 1
|
|
||||||
" For clear option do: let OPTION_NAME = 0
|
|
||||||
"
|
|
||||||
" Option names:
|
|
||||||
"
|
|
||||||
" For highlight builtin functions:
|
|
||||||
" python_highlight_builtins
|
|
||||||
"
|
|
||||||
" For highlight standard exceptions:
|
|
||||||
" python_highlight_exceptions
|
|
||||||
"
|
|
||||||
" For highlight string formatting:
|
|
||||||
" python_highlight_string_formatting
|
|
||||||
"
|
|
||||||
" For highlight indentation errors:
|
|
||||||
" python_highlight_indent_errors
|
|
||||||
"
|
|
||||||
" For highlight trailing spaces:
|
|
||||||
" python_highlight_space_errors
|
|
||||||
"
|
|
||||||
" For highlight doc-tests:
|
|
||||||
" python_highlight_doctests
|
|
||||||
"
|
|
||||||
" If you want all possible Python highlighting:
|
|
||||||
" (This option not override previously set options)
|
|
||||||
" python_highlight_all
|
|
||||||
"
|
|
||||||
" For fast machines:
|
|
||||||
" python_slow_sync
|
|
||||||
"
|
|
||||||
|
|
||||||
" For version 5.x: Clear all syntax items
|
" For version 5.x: Clear all syntax items
|
||||||
" For version 6.x: Quit when a syntax file was already loaded
|
" For versions greater than 6.x: Quit when a syntax file was already loaded
|
||||||
if version < 600
|
if v:version < 600
|
||||||
syntax clear
|
syntax clear
|
||||||
elseif exists("b:current_syntax")
|
elseif exists('b:current_syntax')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("python_highlight_all") && python_highlight_all != 0
|
"
|
||||||
" Not override previously set options
|
" Commands
|
||||||
if !exists("python_highlight_builtins")
|
"
|
||||||
let python_highlight_builtins = 1
|
command! -buffer Python2Syntax let b:python_version_2 = 1 | let &syntax=&syntax
|
||||||
|
command! -buffer Python3Syntax let b:python_version_2 = 0 | let &syntax=&syntax
|
||||||
|
|
||||||
|
" Enable option if it's not defined
|
||||||
|
function! s:EnableByDefault(name)
|
||||||
|
if !exists(a:name)
|
||||||
|
let {a:name} = 1
|
||||||
endif
|
endif
|
||||||
if !exists("python_highlight_exceptions")
|
endfunction
|
||||||
let python_highlight_exceptions = 1
|
|
||||||
|
" Check if option is enabled
|
||||||
|
function! s:Enabled(name)
|
||||||
|
return exists(a:name) && {a:name}
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Is it Python 2 syntax?
|
||||||
|
function! s:Python2Syntax()
|
||||||
|
if exists('b:python_version_2')
|
||||||
|
return b:python_version_2
|
||||||
endif
|
endif
|
||||||
if !exists("python_highlight_string_formatting")
|
return s:Enabled('g:python_version_2')
|
||||||
let python_highlight_string_formatting = 1
|
endfunction
|
||||||
endif
|
|
||||||
if !exists("python_highlight_indent_errors")
|
"
|
||||||
let python_highlight_indent_errors = 1
|
" Default options
|
||||||
endif
|
"
|
||||||
if !exists("python_highlight_space_errors")
|
|
||||||
let python_highlight_space_errors = 1
|
call s:EnableByDefault('g:python_slow_sync')
|
||||||
endif
|
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
|
||||||
if !exists("python_highlight_doctests")
|
|
||||||
let python_highlight_doctests = 1
|
if s:Enabled('g:python_highlight_all')
|
||||||
|
call s:EnableByDefault('g:python_highlight_builtins')
|
||||||
|
if s:Enabled('g:python_highlight_builtins')
|
||||||
|
call s:EnableByDefault('g:python_highlight_builtin_objs')
|
||||||
|
call s:EnableByDefault('g:python_highlight_builtin_funcs')
|
||||||
endif
|
endif
|
||||||
|
call s:EnableByDefault('g:python_highlight_exceptions')
|
||||||
|
call s:EnableByDefault('g:python_highlight_string_formatting')
|
||||||
|
call s:EnableByDefault('g:python_highlight_string_format')
|
||||||
|
call s:EnableByDefault('g:python_highlight_string_templates')
|
||||||
|
call s:EnableByDefault('g:python_highlight_indent_errors')
|
||||||
|
call s:EnableByDefault('g:python_highlight_space_errors')
|
||||||
|
call s:EnableByDefault('g:python_highlight_doctests')
|
||||||
|
call s:EnableByDefault('g:python_print_as_function')
|
||||||
|
call s:EnableByDefault('g:python_highlight_class_vars')
|
||||||
|
call s:EnableByDefault('g:python_highlight_operators')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
" Keywords
|
" Keywords
|
||||||
syn keyword pythonStatement break continue del
|
"
|
||||||
syn keyword pythonStatement exec return
|
|
||||||
syn keyword pythonStatement pass raise
|
|
||||||
syn keyword pythonStatement global assert
|
|
||||||
syn keyword pythonStatement lambda yield
|
|
||||||
syn keyword pythonStatement async await
|
|
||||||
syn keyword pythonStatement with nonlocal True False None
|
|
||||||
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
|
||||||
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
|
|
||||||
syn keyword pythonRepeat for while
|
|
||||||
syn keyword pythonConditional if elif else
|
|
||||||
syn keyword pythonImport import from as
|
|
||||||
syn keyword pythonException try except finally
|
|
||||||
syn keyword pythonOperator and in is not or
|
|
||||||
|
|
||||||
" Print keyword but only if not used as function
|
syn keyword pythonStatement break continue del return pass yield global assert lambda with
|
||||||
syn match pythonStatement "\<print\>\((\|,\|*=\)\@!" display
|
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
|
||||||
|
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
||||||
|
if s:Enabled('g:python_highlight_class_vars')
|
||||||
|
syn keyword pythonClassVar self cls
|
||||||
|
endif
|
||||||
|
syn keyword pythonRepeat for while
|
||||||
|
syn keyword pythonConditional if elif else
|
||||||
|
syn keyword pythonException try except finally
|
||||||
|
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
|
||||||
|
" we provide a dummy group here to avoid crashing pyrex.vim.
|
||||||
|
syn keyword pythonInclude import
|
||||||
|
syn keyword pythonImport import
|
||||||
|
syn match pythonRaiseFromStatement '\<from\>'
|
||||||
|
syn match pythonImport '^\s*\zsfrom\>'
|
||||||
|
|
||||||
|
|
||||||
|
if s:Python2Syntax()
|
||||||
|
if !s:Enabled('g:python_print_as_function')
|
||||||
|
syn keyword pythonStatement print
|
||||||
|
endif
|
||||||
|
syn keyword pythonStatement exec
|
||||||
|
syn keyword pythonImport as
|
||||||
|
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
|
||||||
|
else
|
||||||
|
syn keyword pythonStatement as nonlocal
|
||||||
|
syn match pythonStatement '\v\.@<!<await>'
|
||||||
|
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
|
||||||
|
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
|
||||||
|
syn match pythonStatement '\<async\s\+with\>'
|
||||||
|
syn match pythonStatement '\<async\s\+for\>'
|
||||||
|
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonBuiltinObj,pythonBuiltinFunc
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
" Operators
|
||||||
|
"
|
||||||
|
syn keyword pythonOperator and in is not or
|
||||||
|
if s:Enabled('g:python_highlight_operators')
|
||||||
|
syn match pythonOperator '\V=\|-\|+\|*\|@\|/\|%\|&\||\|^\|~\|<\|>\|!='
|
||||||
|
endif
|
||||||
|
syn match pythonError '[$?]\|\([-+@%&|^~]\)\1\{1,}\|\([=*/<>]\)\2\{2,}\|\([+@/%&|^~<>]\)\3\@![-+*@/%&|^~<>]\|\*\*[*@/%&|^<>]\|=[*@/%&|^<>]\|-[+*@/%&|^~<]\|[<!>]\+=\{2,}\|!\{2,}=\+' display
|
||||||
|
|
||||||
|
"
|
||||||
" Decorators (new in Python 2.4)
|
" Decorators (new in Python 2.4)
|
||||||
syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
|
"
|
||||||
|
|
||||||
|
syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite
|
||||||
|
if s:Python2Syntax()
|
||||||
|
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained
|
||||||
|
else
|
||||||
|
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained
|
||||||
|
endif
|
||||||
|
syn match pythonDot '\.' display containedin=pythonDottedName
|
||||||
|
|
||||||
|
"
|
||||||
" Comments
|
" Comments
|
||||||
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
|
"
|
||||||
syn match pythonRun "\%^#!.*$"
|
|
||||||
syn match pythonCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
|
|
||||||
syn keyword pythonTodo TODO FIXME XXX contained
|
|
||||||
|
|
||||||
|
syn match pythonComment '#.*$' display contains=pythonTodo,@Spell
|
||||||
|
if !s:Enabled('g:python_highlight_file_headers_as_comments')
|
||||||
|
syn match pythonRun '\%^#!.*$'
|
||||||
|
syn match pythonCoding '\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$'
|
||||||
|
endif
|
||||||
|
syn keyword pythonTodo TODO FIXME XXX contained
|
||||||
|
|
||||||
|
"
|
||||||
" Errors
|
" Errors
|
||||||
syn match pythonError "\<\d\+\D\+\>" display
|
"
|
||||||
syn match pythonError "[$?]" display
|
|
||||||
syn match pythonError "[-+&|]\{2,}" display
|
|
||||||
syn match pythonError "[=]\{3,}" display
|
|
||||||
|
|
||||||
" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline
|
syn match pythonError '\<\d\+[^0-9[:space:]]\+\>' display
|
||||||
" statements. For now I don't know how to work around this.
|
|
||||||
if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0
|
" Mixing spaces and tabs also may be used for pretty formatting multiline
|
||||||
syn match pythonIndentError "^\s*\( \t\|\t \)\s*\S"me=e-1 display
|
" statements
|
||||||
|
if s:Enabled('g:python_highlight_indent_errors')
|
||||||
|
syn match pythonIndentError '^\s*\%( \t\|\t \)\s*\S'me=e-1 display
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Trailing space errors
|
" Trailing space errors
|
||||||
if exists("python_highlight_space_errors") && python_highlight_space_errors != 0
|
if s:Enabled('g:python_highlight_space_errors')
|
||||||
syn match pythonSpaceError "\s\+$" display
|
syn match pythonSpaceError '\s\+$' display
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
" Strings
|
" Strings
|
||||||
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
|
"
|
||||||
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
|
|
||||||
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
|
||||||
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
|
||||||
|
|
||||||
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
|
if s:Python2Syntax()
|
||||||
syn match pythonEscape "\\\o\o\=\o\=" display contained
|
" Python 2 strings
|
||||||
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
|
syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
syn match pythonEscape "\\x\x\{2}" display contained
|
syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
syn match pythonEscapeError "\\x\x\=\X" display contained
|
syn region pythonString start=+[bB]\="""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
syn match pythonEscape "\\$"
|
syn region pythonString start=+[bB]\='''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
else
|
||||||
|
" Python 3 byte strings
|
||||||
|
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||||
|
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||||
|
syn region pythonBytes start=+[bB]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonBytes start=+[bB]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
|
||||||
" Byte-Strings
|
syn match pythonBytesError '.\+' display contained
|
||||||
syn region pythonBString start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell
|
syn match pythonBytesContent '[\u0000-\u00ff]\+' display contained contains=pythonBytesEscape,pythonBytesEscapeError
|
||||||
syn region pythonBString start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBEscape,pythonBEscapeError,@Spell
|
|
||||||
syn region pythonBString start=+[bB]"""+ end=+"""+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
|
||||||
syn region pythonBString start=+[bB]'''+ end=+'''+ keepend contains=pythonBEscape,pythonBEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
|
||||||
|
|
||||||
syn match pythonBEscape +\\[abfnrtv'"\\]+ display contained
|
|
||||||
syn match pythonBEscape "\\\o\o\=\o\=" display contained
|
|
||||||
syn match pythonBEscapeError "\\\o\{,2}[89]" display contained
|
|
||||||
syn match pythonBEscape "\\x\x\{2}" display contained
|
|
||||||
syn match pythonBEscapeError "\\x\x\=\X" display contained
|
|
||||||
syn match pythonBEscape "\\$"
|
|
||||||
|
|
||||||
" Unicode strings
|
|
||||||
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell
|
|
||||||
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,@Spell
|
|
||||||
syn region pythonUniString start=+[uU]"""+ end=+"""+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
|
||||||
syn region pythonUniString start=+[uU]'''+ end=+'''+ keepend contains=pythonEscape,pythonUniEscape,pythonEscapeError,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
|
||||||
|
|
||||||
syn match pythonUniEscape "\\u\x\{4}" display contained
|
|
||||||
syn match pythonUniEscapeError "\\u\x\{,3}\X" display contained
|
|
||||||
syn match pythonUniEscape "\\U\x\{8}" display contained
|
|
||||||
syn match pythonUniEscapeError "\\U\x\{,7}\X" display contained
|
|
||||||
syn match pythonUniEscape "\\N{[A-Z ]\+}" display contained
|
|
||||||
syn match pythonUniEscapeError "\\N{[^A-Z ]\+}" display contained
|
|
||||||
|
|
||||||
" Raw strings
|
|
||||||
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
|
||||||
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
|
||||||
syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
|
||||||
syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
|
||||||
|
|
||||||
syn match pythonRawEscape +\\['"]+ display transparent contained
|
|
||||||
|
|
||||||
" Unicode raw strings
|
|
||||||
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
|
||||||
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
|
||||||
syn region pythonUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
|
||||||
syn region pythonUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
|
||||||
|
|
||||||
syn match pythonUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
|
|
||||||
syn match pythonUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained
|
|
||||||
|
|
||||||
if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0
|
|
||||||
" String formatting
|
|
||||||
syn match pythonStrFormat "%\(([^)]\+)\)\=[-#0 +]*\d*\(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString
|
|
||||||
syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonBString,pythonUniString,pythonRawString,pythonUniRawString
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("python_highlight_doctests") && python_highlight_doctests != 0
|
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
|
||||||
|
syn match pythonBytesEscape '\\\o\o\=\o\=' display contained
|
||||||
|
syn match pythonBytesEscapeError '\\\o\{,2}[89]' display contained
|
||||||
|
syn match pythonBytesEscape '\\x\x\{2}' display contained
|
||||||
|
syn match pythonBytesEscapeError '\\x\x\=\X' display contained
|
||||||
|
syn match pythonBytesEscape '\\$'
|
||||||
|
|
||||||
|
syn match pythonUniEscape '\\u\x\{4}' display contained
|
||||||
|
syn match pythonUniEscapeError '\\u\x\{,3}\X' display contained
|
||||||
|
syn match pythonUniEscape '\\U\x\{8}' display contained
|
||||||
|
syn match pythonUniEscapeError '\\U\x\{,7}\X' display contained
|
||||||
|
syn match pythonUniEscape '\\N{[A-Z ]\+}' display contained
|
||||||
|
syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
|
||||||
|
|
||||||
|
if s:Python2Syntax()
|
||||||
|
" Python 2 Unicode strings
|
||||||
|
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonUniString start=+[uU]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonUniString start=+[uU]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
else
|
||||||
|
" Python 3 strings
|
||||||
|
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonString start=+'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonString start=+"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
|
||||||
|
syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||||
|
syn region pythonFString start=+[fF]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonFString start=+[fF]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:Python2Syntax()
|
||||||
|
" Python 2 Unicode raw strings
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonUniRawString start=+[uU][rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
|
||||||
|
syn match pythonUniRawEscape '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{4}' display contained
|
||||||
|
syn match pythonUniRawEscapeError '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{,3}\X' display contained
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Python 2/3 raw strings
|
||||||
|
if s:Python2Syntax()
|
||||||
|
syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawString start=+[bB]\=[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonRawString start=+[bB]\=[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
else
|
||||||
|
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawString start=+[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonRawString start=+[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
|
||||||
|
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
|
||||||
|
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||||
|
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||||
|
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match pythonRawEscape +\\['"]+ display contained
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_string_formatting')
|
||||||
|
" % operator string formatting
|
||||||
|
if s:Python2Syntax()
|
||||||
|
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
|
||||||
|
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
|
||||||
|
else
|
||||||
|
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
|
||||||
|
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_string_format')
|
||||||
|
" str.format syntax
|
||||||
|
if s:Python2Syntax()
|
||||||
|
syn match pythonStrFormat '{{\|}}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||||
|
syn match pythonStrFormat '{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||||
|
else
|
||||||
|
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
|
||||||
|
syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString,pythonRawFString contains=pythonStrInterpRegion,@pythonExpression
|
||||||
|
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString,pythonRawFString
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_string_templates')
|
||||||
|
" string.Template format
|
||||||
|
if s:Python2Syntax()
|
||||||
|
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||||
|
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||||
|
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||||
|
else
|
||||||
|
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonRawString
|
||||||
|
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonRawString
|
||||||
|
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonRawString
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_doctests')
|
||||||
" DocTests
|
" DocTests
|
||||||
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
|
syn region pythonDocTest start='^\s*>>>' skip=+\\'+ end=+'''+he=s-1 end='^\s*$' contained
|
||||||
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
|
syn region pythonDocTest2 start='^\s*>>>' skip=+\\"+ end=+"""+he=s-1 end='^\s*$' contained
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
" Numbers (ints, longs, floats, complex)
|
" Numbers (ints, longs, floats, complex)
|
||||||
syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display
|
"
|
||||||
syn match pythonHexNumber "\<0[xX]\>" display
|
|
||||||
syn match pythonNumber "\<\d\+[lLjJ]\=\>" display
|
|
||||||
syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
|
|
||||||
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
|
|
||||||
syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
|
|
||||||
|
|
||||||
syn match pythonOctalError "\<0\o*[89]\d*[lL]\=\>" display
|
if s:Python2Syntax()
|
||||||
syn match pythonHexError "\<0[xX]\X\+[lL]\=\>" display
|
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>' display
|
||||||
|
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*[lL]\=\>' display
|
||||||
|
syn match pythonBinError '\<0[bB][01]*\D\+\d*[lL]\=\>' display
|
||||||
|
|
||||||
if exists("python_highlight_builtins") && python_highlight_builtins != 0
|
syn match pythonHexNumber '\<0[xX]\x\+[lL]\=\>' display
|
||||||
" Builtin functions, types and objects
|
syn match pythonOctNumber '\<0[oO]\o\+[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinObj Ellipsis NotImplemented
|
syn match pythonBinNumber '\<0[bB][01]\+[lL]\=\>' display
|
||||||
|
|
||||||
syn keyword pythonBuiltinFunc __import__ abs all any apply
|
syn match pythonNumberError '\<\d\+\D[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc basestring bool buffer bytearray bytes callable
|
syn match pythonNumber '\<\d[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc chr classmethod cmp coerce compile complex
|
syn match pythonNumber '\<[0-9]\d\+[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
|
syn match pythonNumber '\<\d\+[lLjJ]\>' display
|
||||||
syn keyword pythonBuiltinFunc execfile file filter float frozenset getattr
|
|
||||||
syn keyword pythonBuiltinfunc globals hasattr hash help hex id
|
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc input int intern isinstance
|
syn match pythonBinError '\<0[bB][01]*[2-9]\d*[lL]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc issubclass iter len list locals long map max
|
|
||||||
syn keyword pythonBuiltinFunc min object oct open ord pow property range
|
syn match pythonFloat '\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc raw_input reduce reload repr
|
syn match pythonFloat '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' display
|
||||||
syn keyword pythonBuiltinFunc reversed round set setattr
|
syn match pythonFloat '\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=' display
|
||||||
syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
|
else
|
||||||
syn keyword pythonBuiltinFunc type unichr unicode vars xrange zip
|
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*\>' display
|
||||||
|
" pythonHexError comes after pythonOctError so that 0xffffl is pythonHexError
|
||||||
|
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\x*\>' display
|
||||||
|
syn match pythonBinError '\<0[bB][01]*\D\+\d*\>' display
|
||||||
|
|
||||||
|
syn match pythonHexNumber '\<0[xX][_0-9a-fA-F]*\x\>' display
|
||||||
|
syn match pythonOctNumber '\<0[oO][_0-7]*\o\>' display
|
||||||
|
syn match pythonBinNumber '\<0[bB][_01]*[01]\>' display
|
||||||
|
|
||||||
|
syn match pythonNumberError '\<\d[_0-9]*\D\>' display
|
||||||
|
syn match pythonNumberError '\<0[_0-9]\+\>' display
|
||||||
|
syn match pythonNumberError '\<0_x\S*\>' display
|
||||||
|
syn match pythonNumberError '\<0[bBxXoO][_0-9a-fA-F]*_\>' display
|
||||||
|
syn match pythonNumberError '\<\d[_0-9]*_\>' display
|
||||||
|
syn match pythonNumber '\<\d\>' display
|
||||||
|
syn match pythonNumber '\<[1-9][_0-9]*\d\>' display
|
||||||
|
syn match pythonNumber '\<\d[jJ]\>' display
|
||||||
|
syn match pythonNumber '\<[1-9][_0-9]*\d[jJ]\>' display
|
||||||
|
|
||||||
|
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*\>' display
|
||||||
|
syn match pythonBinError '\<0[bB][01]*[2-9]\d*\>' display
|
||||||
|
|
||||||
|
syn match pythonFloat '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display
|
||||||
|
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display
|
||||||
|
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("python_highlight_exceptions") && python_highlight_exceptions != 0
|
"
|
||||||
" Builtin exceptions and warnings
|
" Builtin objects and types
|
||||||
syn keyword pythonExClass BaseException
|
"
|
||||||
syn keyword pythonExClass Exception StandardError ArithmeticError
|
|
||||||
syn keyword pythonExClass LookupError EnvironmentError
|
|
||||||
|
|
||||||
syn keyword pythonExClass AssertionError AttributeError EOFError
|
if s:Enabled('g:python_highlight_builtin_objs')
|
||||||
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
|
syn keyword pythonNone None
|
||||||
syn keyword pythonExClass ImportError IndexError KeyError
|
syn keyword pythonBoolean True False
|
||||||
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
|
syn keyword pythonBuiltinObj Ellipsis NotImplemented
|
||||||
syn keyword pythonExClass NotImplementedError OSError OverflowError
|
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
|
||||||
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
|
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
|
||||||
syn keyword pythonExClass SyntaxError IndentationError TabError
|
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
|
||||||
syn keyword pythonExClass SystemError SystemExit TypeError
|
|
||||||
syn keyword pythonExClass UnboundLocalError UnicodeError
|
|
||||||
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
|
|
||||||
syn keyword pythonExClass UnicodeTranslateError ValueError
|
|
||||||
syn keyword pythonExClass WindowsError ZeroDivisionError
|
|
||||||
|
|
||||||
syn keyword pythonExClass Warning UserWarning DeprecationWarning
|
|
||||||
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
|
|
||||||
syn keyword pythonExClass RuntimeWarning FutureWarning OverflowWarning
|
|
||||||
syn keyword pythonExClass ImportWarning UnicodeWarning
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists("python_slow_sync") && python_slow_sync != 0
|
"
|
||||||
|
" Builtin functions
|
||||||
|
"
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_builtin_funcs')
|
||||||
|
let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip'
|
||||||
|
|
||||||
|
if s:Python2Syntax()
|
||||||
|
let s:funcs_re .= '|apply|basestring|buffer|cmp|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange'
|
||||||
|
if s:Enabled('g:python_print_as_function')
|
||||||
|
let s:funcs_re .= '|print'
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let s:funcs_re .= '|ascii|exec|print'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
|
||||||
|
|
||||||
|
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
|
||||||
|
let s:funcs_re .= '\=@!'
|
||||||
|
endif
|
||||||
|
|
||||||
|
execute s:funcs_re . ''''
|
||||||
|
unlet s:funcs_re
|
||||||
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
|
" Builtin exceptions and warnings
|
||||||
|
"
|
||||||
|
|
||||||
|
if s:Enabled('g:python_highlight_exceptions')
|
||||||
|
let s:exs_re = 'BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDepricationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning'
|
||||||
|
|
||||||
|
if s:Python2Syntax()
|
||||||
|
let s:exs_re .= '|StandardError'
|
||||||
|
else
|
||||||
|
let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
|
||||||
|
endif
|
||||||
|
|
||||||
|
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'''
|
||||||
|
unlet s:exs_re
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:Enabled('g:python_slow_sync')
|
||||||
syn sync minlines=2000
|
syn sync minlines=2000
|
||||||
else
|
else
|
||||||
" This is fast but code inside triple quoted strings screws it up. It
|
" This is fast but code inside triple quoted strings screws it up. It
|
||||||
" is impossible to fix because the only way to know if you are inside a
|
" is impossible to fix because the only way to know if you are inside a
|
||||||
" triple quoted string is to start from the beginning of the file.
|
" triple quoted string is to start from the beginning of the file.
|
||||||
syn sync match pythonSync grouphere NONE "):$"
|
syn sync match pythonSync grouphere NONE '):$'
|
||||||
syn sync maxlines=200
|
syn sync maxlines=200
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if version >= 508 || !exists("did_python_syn_inits")
|
if v:version >= 508 || !exists('did_python_syn_inits')
|
||||||
if version <= 508
|
if v:version <= 508
|
||||||
let did_python_syn_inits = 1
|
let did_python_syn_inits = 1
|
||||||
command -nargs=+ HiLink hi link <args>
|
command -nargs=+ HiLink hi link <args>
|
||||||
else
|
else
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
HiLink pythonStatement Statement
|
HiLink pythonStatement Statement
|
||||||
HiLink pythonImport Statement
|
HiLink pythonRaiseFromStatement Statement
|
||||||
HiLink pythonFunction Function
|
HiLink pythonImport Include
|
||||||
HiLink pythonConditional Conditional
|
HiLink pythonFunction Function
|
||||||
HiLink pythonRepeat Repeat
|
HiLink pythonConditional Conditional
|
||||||
HiLink pythonException Exception
|
HiLink pythonRepeat Repeat
|
||||||
HiLink pythonOperator Operator
|
HiLink pythonException Exception
|
||||||
|
HiLink pythonOperator Operator
|
||||||
|
|
||||||
HiLink pythonDecorator Define
|
HiLink pythonDecorator Define
|
||||||
|
HiLink pythonDottedName Function
|
||||||
|
HiLink pythonDot Normal
|
||||||
|
|
||||||
HiLink pythonComment Comment
|
HiLink pythonComment Comment
|
||||||
HiLink pythonCoding Special
|
if !s:Enabled('g:python_highlight_file_headers_as_comments')
|
||||||
HiLink pythonRun Special
|
HiLink pythonCoding Special
|
||||||
HiLink pythonTodo Todo
|
HiLink pythonRun Special
|
||||||
|
endif
|
||||||
|
HiLink pythonTodo Todo
|
||||||
|
|
||||||
HiLink pythonError Error
|
HiLink pythonError Error
|
||||||
HiLink pythonIndentError Error
|
HiLink pythonIndentError Error
|
||||||
HiLink pythonSpaceError Error
|
HiLink pythonSpaceError Error
|
||||||
|
|
||||||
HiLink pythonString String
|
HiLink pythonString String
|
||||||
HiLink pythonBString String
|
HiLink pythonRawString String
|
||||||
HiLink pythonUniString String
|
HiLink pythonRawEscape Special
|
||||||
HiLink pythonRawString String
|
|
||||||
HiLink pythonUniRawString String
|
|
||||||
|
|
||||||
HiLink pythonEscape Special
|
HiLink pythonUniEscape Special
|
||||||
HiLink pythonBEscape Special
|
HiLink pythonUniEscapeError Error
|
||||||
HiLink pythonEscapeError Error
|
|
||||||
HiLink pythonBEscapeError Error
|
|
||||||
HiLink pythonUniEscape Special
|
|
||||||
HiLink pythonUniEscapeError Error
|
|
||||||
HiLink pythonUniRawEscape Special
|
|
||||||
HiLink pythonUniRawEscapeError Error
|
|
||||||
|
|
||||||
HiLink pythonStrFormat Special
|
if s:Python2Syntax()
|
||||||
|
HiLink pythonUniString String
|
||||||
|
HiLink pythonUniRawString String
|
||||||
|
HiLink pythonUniRawEscape Special
|
||||||
|
HiLink pythonUniRawEscapeError Error
|
||||||
|
else
|
||||||
|
HiLink pythonBytes String
|
||||||
|
HiLink pythonRawBytes String
|
||||||
|
HiLink pythonBytesContent String
|
||||||
|
HiLink pythonBytesError Error
|
||||||
|
HiLink pythonBytesEscape Special
|
||||||
|
HiLink pythonBytesEscapeError Error
|
||||||
|
HiLink pythonFString String
|
||||||
|
HiLink pythonRawFString String
|
||||||
|
HiLink pythonStrInterpRegion Special
|
||||||
|
endif
|
||||||
|
|
||||||
HiLink pythonDocTest Special
|
HiLink pythonStrFormatting Special
|
||||||
HiLink pythonDocTest2 Special
|
HiLink pythonStrFormat Special
|
||||||
|
HiLink pythonStrTemplate Special
|
||||||
|
|
||||||
HiLink pythonNumber Number
|
HiLink pythonDocTest Special
|
||||||
HiLink pythonHexNumber Number
|
HiLink pythonDocTest2 Special
|
||||||
HiLink pythonFloat Float
|
|
||||||
HiLink pythonOctalError Error
|
|
||||||
HiLink pythonHexError Error
|
|
||||||
|
|
||||||
HiLink pythonBuiltinObj Structure
|
HiLink pythonNumber Number
|
||||||
HiLink pythonBuiltinFunc Function
|
HiLink pythonHexNumber Number
|
||||||
|
HiLink pythonOctNumber Number
|
||||||
|
HiLink pythonBinNumber Number
|
||||||
|
HiLink pythonFloat Float
|
||||||
|
HiLink pythonNumberError Error
|
||||||
|
HiLink pythonOctError Error
|
||||||
|
HiLink pythonHexError Error
|
||||||
|
HiLink pythonBinError Error
|
||||||
|
|
||||||
HiLink pythonExClass Structure
|
HiLink pythonBoolean Boolean
|
||||||
|
HiLink pythonNone Constant
|
||||||
|
|
||||||
|
HiLink pythonBuiltinObj Structure
|
||||||
|
HiLink pythonBuiltinFunc Function
|
||||||
|
|
||||||
|
HiLink pythonExClass Structure
|
||||||
|
HiLink pythonClassVar Identifier
|
||||||
|
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:current_syntax = "python"
|
let b:current_syntax = 'python'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
|||||||
|
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: QML
|
" Language: QML
|
||||||
" Maintainer: Warwick Allison <warwick.allison@nokia.com>
|
" Maintainer: Peter Hoeg <peter@hoeg.com>
|
||||||
" Updaters:
|
" Updaters: Refer to CONTRIBUTORS.md
|
||||||
" URL:
|
" URL: https://github.com/peterhoeg/vim-qml
|
||||||
" Changes:
|
" Changes: `git log` is your friend
|
||||||
" Last Change: 2009 Apr 30
|
" Last Change: 2017-11-11
|
||||||
|
"
|
||||||
|
" This file is bassed on the original work done by Warwick Allison
|
||||||
|
" <warwick.allison@nokia.com> whose did about 99% of the work here.
|
||||||
|
|
||||||
" Based on javascript syntax (as is QML)
|
" Based on javascript syntax (as is QML)
|
||||||
|
|
||||||
@@ -26,20 +29,20 @@ endif
|
|||||||
|
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
|
||||||
|
syn cluster qmlExpr contains=qmlStringD,qmlString,SqmlCharacter,qmlNumber,qmlObjectLiteralType,qmlBoolean,qmlType,qmlJsType,qmlNull,qmlGlobal,qmlFunction
|
||||||
syn keyword qmlCommentTodo TODO FIXME XXX TBD contained
|
syn keyword qmlCommentTodo TODO FIXME XXX TBD contained
|
||||||
syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
|
syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
|
||||||
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||||
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
||||||
syn match qmlSpecial "\\\d\d\d\|\\."
|
syn match qmlSpecial "\\\d\d\d\|\\."
|
||||||
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc
|
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
||||||
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc
|
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
||||||
|
|
||||||
syn match qmlCharacter "'\\.'"
|
syn match qmlCharacter "'\\.'"
|
||||||
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||||
syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||||
syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@="
|
syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@="
|
||||||
syn match qmlNonBindingColon "?[^;]*:"
|
syn region qmlTernaryColon start="?" end=":" contains=@qmlExpr,qmlBraces,qmlParens
|
||||||
syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:"
|
syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:"
|
||||||
|
|
||||||
syn keyword qmlConditional if else switch
|
syn keyword qmlConditional if else switch
|
||||||
@@ -56,7 +59,7 @@ syn keyword qmlLabel case default
|
|||||||
syn keyword qmlException try catch finally throw
|
syn keyword qmlException try catch finally throw
|
||||||
syn keyword qmlMessage alert confirm prompt status
|
syn keyword qmlMessage alert confirm prompt status
|
||||||
syn keyword qmlGlobal self
|
syn keyword qmlGlobal self
|
||||||
syn keyword qmlDeclaration property signal
|
syn keyword qmlDeclaration property signal readonly
|
||||||
syn keyword qmlReserved abstract boolean byte char class const debugger enum export extends final float goto implements import interface long native package pragma private protected public short static super synchronized throws transient volatile
|
syn keyword qmlReserved abstract boolean byte char class const debugger enum export extends final float goto implements import interface long native package pragma private protected public short static super synchronized throws transient volatile
|
||||||
|
|
||||||
if get(g:, 'qml_fold', 0)
|
if get(g:, 'qml_fold', 0)
|
||||||
@@ -122,7 +125,6 @@ if version >= 508 || !exists("did_qml_syn_inits")
|
|||||||
HiLink qmlReserved Keyword
|
HiLink qmlReserved Keyword
|
||||||
HiLink qmlDebug Debug
|
HiLink qmlDebug Debug
|
||||||
HiLink qmlConstant Label
|
HiLink qmlConstant Label
|
||||||
HiLink qmlNonBindingColon NONE
|
|
||||||
HiLink qmlBindingProperty Label
|
HiLink qmlBindingProperty Label
|
||||||
HiLink qmlDeclaration Function
|
HiLink qmlDeclaration Function
|
||||||
|
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtensio
|
|||||||
syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite
|
syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite
|
||||||
syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite
|
syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite
|
||||||
syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
|
syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
|
||||||
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite
|
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypeDeclaration skipwhite
|
||||||
syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
|
syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
|
||||||
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
|
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypePostDeclaration skipwhite
|
||||||
hi link scalaTypeTypeDeclaration Type
|
hi link scalaTypeTypeDeclaration Type
|
||||||
hi link scalaTypeTypeExtension Keyword
|
hi link scalaTypeTypeExtension Keyword
|
||||||
hi link scalaTypeTypePostDeclaration Special
|
hi link scalaTypeTypePostDeclaration Special
|
||||||
@@ -113,7 +113,7 @@ hi link scalaTypeTypePostExtension Keyword
|
|||||||
syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
|
syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
|
||||||
syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
|
syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
|
||||||
syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
|
syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
|
||||||
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite
|
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeDeclaration skipwhite
|
||||||
hi link scalaTypeDeclaration Type
|
hi link scalaTypeDeclaration Type
|
||||||
hi link scalaTypeExtension Keyword
|
hi link scalaTypeExtension Keyword
|
||||||
hi link scalaTypePostExtension Keyword
|
hi link scalaTypePostExtension Keyword
|
||||||
@@ -122,12 +122,14 @@ syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/
|
|||||||
syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
|
syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
|
||||||
hi link scalaTypeAnnotation Normal
|
hi link scalaTypeAnnotation Normal
|
||||||
|
|
||||||
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained
|
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained contains=scalaCapitalWord
|
||||||
syn match scalaCaseFollowing /`[^`]\+`/ contained
|
syn match scalaCaseFollowing /`[^`]\+`/ contained contains=scalaCapitalWord
|
||||||
hi link scalaCaseFollowing Special
|
hi link scalaCaseFollowing Special
|
||||||
|
|
||||||
syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super
|
syn keyword scalaKeywordModifier abstract override final lazy implicit private protected sealed null super
|
||||||
|
syn keyword scalaSpecialFunction implicitly require
|
||||||
hi link scalaKeywordModifier Function
|
hi link scalaKeywordModifier Function
|
||||||
|
hi link scalaSpecialFunction Function
|
||||||
|
|
||||||
syn keyword scalaSpecial this true false ne eq
|
syn keyword scalaSpecial this true false ne eq
|
||||||
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
||||||
@@ -199,7 +201,6 @@ hi link scalaDocLinks Function
|
|||||||
hi link scalaParameterAnnotation Function
|
hi link scalaParameterAnnotation Function
|
||||||
hi link scalaParamAnnotationValue Keyword
|
hi link scalaParamAnnotationValue Keyword
|
||||||
hi link scalaCommentAnnotation Function
|
hi link scalaCommentAnnotation Function
|
||||||
hi link scalaCommentCodeBlockBrackets String
|
|
||||||
hi link scalaCommentCodeBlock String
|
hi link scalaCommentCodeBlock String
|
||||||
hi link scalaTodo Todo
|
hi link scalaTodo Todo
|
||||||
|
|
||||||
|
|||||||
106
syntax/slime.vim
Normal file
106
syntax/slime.vim
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slime') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: slime
|
||||||
|
" Maintainer: Andrew Stone <andy@stonean.com>
|
||||||
|
" Version: 1
|
||||||
|
" Last Change: 2010 Sep 25
|
||||||
|
" TODO: Feedback is welcomed.
|
||||||
|
|
||||||
|
" Quit when a syntax file is already loaded.
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
let main_syntax = 'slime'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Allows a per line syntax evaluation.
|
||||||
|
let b:elixir_no_expensive = 1
|
||||||
|
|
||||||
|
" Include Elixir syntax highlighting
|
||||||
|
syn include @slimeElixirTop syntax/elixir.vim
|
||||||
|
unlet! b:current_syntax
|
||||||
|
" Include Haml syntax highlighting
|
||||||
|
syn include @slimeHaml syntax/haml.vim
|
||||||
|
unlet! b:current_syntax
|
||||||
|
|
||||||
|
syn match slimeBegin "^\s*\(&[^= ]\)\@!" nextgroup=slimeTag,slimeClassChar,slimeIdChar,slimeElixir
|
||||||
|
|
||||||
|
syn region elixirCurlyBlock start="{" end="}" contains=@slimeElixirTop contained
|
||||||
|
syn cluster slimeElixirTop add=elixirCurlyBlock
|
||||||
|
|
||||||
|
syn cluster slimeComponent contains=slimeClassChar,slimeIdChar,slimeWrappedAttrs,slimeElixir,slimeAttr,slimeInlineTagChar
|
||||||
|
|
||||||
|
syn keyword slimeDocType contained html 5 1.1 strict frameset mobile basic transitional
|
||||||
|
syn match slimeDocTypeKeyword "^\s*\(doctype\)\s\+" nextgroup=slimeDocType
|
||||||
|
|
||||||
|
syn keyword slimeTodo FIXME TODO NOTE OPTIMIZE XXX contained
|
||||||
|
syn keyword htmlTagName contained script
|
||||||
|
|
||||||
|
syn match slimeTag "\w\+[><]*" contained contains=htmlTagName nextgroup=@slimeComponent
|
||||||
|
syn match slimeIdChar "#{\@!" contained nextgroup=slimeId
|
||||||
|
syn match slimeId "\%(\w\|-\)\+" contained nextgroup=@slimeComponent
|
||||||
|
syn match slimeClassChar "\." contained nextgroup=slimeClass
|
||||||
|
syn match slimeClass "\%(\w\|-\)\+" contained nextgroup=@slimeComponent
|
||||||
|
syn match slimeInlineTagChar "\s*:\s*" contained nextgroup=slimeTag,slimeClassChar,slimeIdChar
|
||||||
|
|
||||||
|
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*{\s*" skip="}\s*\"" end="\s*}\s*" contained contains=slimeAttr nextgroup=slimeElixir
|
||||||
|
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*\[\s*" end="\s*\]\s*" contained contains=slimeAttr nextgroup=slimeElixir
|
||||||
|
syn region slimeWrappedAttrs matchgroup=slimeWrappedAttrsDelimiter start="\s*(\s*" end="\s*)\s*" contained contains=slimeAttr nextgroup=slimeElixir
|
||||||
|
|
||||||
|
syn match slimeAttr /\s*\%(\w\|-\)\+\s*=/me=e-1 contained contains=htmlArg nextgroup=slimeAttrAssignment
|
||||||
|
syn match slimeAttrAssignment "\s*=\s*" contained nextgroup=slimeWrappedAttrValue,slimeAttrString
|
||||||
|
|
||||||
|
syn region slimeWrappedAttrValue start="[^"']" end="\s\|$" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="{" end="}" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="\[" end="\]" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
syn region slimeWrappedAttrValue matchgroup=slimeWrappedAttrValueDelimiter start="(" end=")" contained contains=slimeAttrString,@slimeElixirTop nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
|
||||||
|
syn region slimeAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
syn region slimeAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr,slimeElixir,slimeInlineTagChar
|
||||||
|
|
||||||
|
syn region slimeInnerAttrString start=+\s*"+ skip=+\%(\\\\\)*\\"+ end=+"\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr
|
||||||
|
syn region slimeInnerAttrString start=+\s*'+ skip=+\%(\\\\\)*\\"+ end=+'\s*+ contained contains=slimeInterpolation,slimeInterpolationEscape nextgroup=slimeAttr
|
||||||
|
|
||||||
|
syn region slimeInterpolation matchgroup=slimeInterpolationDelimiter start="#{" end="}" contains=@slimeElixirTop containedin=javascriptStringS,javascriptStringD,slimeWrappedAttrs
|
||||||
|
syn region slimeInterpolation matchgroup=slimeInterpolationDelimiter start="#{{" end="}}" contains=@slimeElixirTop containedin=javascriptStringS,javascriptStringD,slimeWrappedAttrs
|
||||||
|
syn match slimeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
||||||
|
|
||||||
|
syn region slimeElixir matchgroup=slimeElixirOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimeElixirTop keepend
|
||||||
|
syn region slimeElixir matchgroup=slimeElixirChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimeElixirTop keepend
|
||||||
|
|
||||||
|
syn match slimeComment /^\(\s*\)[/].*\(\n\1\s.*\)*/ contains=slimeTodo
|
||||||
|
syn match slimeText /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ contains=slimeInterpolation
|
||||||
|
|
||||||
|
syn match slimeFilter /\s*\w\+:\s*/ contained
|
||||||
|
syn match slimeHaml /^\(\s*\)\<haml:\>.*\(\n\1\s.*\)*/ contains=@slimeHaml,slimeFilter
|
||||||
|
|
||||||
|
syn match slimeIEConditional "\%(^\s*/\)\@<=\[\s*if\>[^]]*]" contained containedin=slimeComment
|
||||||
|
|
||||||
|
hi def link slimeAttrString String
|
||||||
|
hi def link slimeBegin String
|
||||||
|
hi def link slimeClass Type
|
||||||
|
hi def link slimeAttr Type
|
||||||
|
hi def link slimeClassChar Type
|
||||||
|
hi def link slimeComment Comment
|
||||||
|
hi def link slimeDocType Identifier
|
||||||
|
hi def link slimeDocTypeKeyword Keyword
|
||||||
|
hi def link slimeFilter Keyword
|
||||||
|
hi def link slimeIEConditional SpecialComment
|
||||||
|
hi def link slimeId Identifier
|
||||||
|
hi def link slimeIdChar Identifier
|
||||||
|
hi def link slimeInnerAttrString String
|
||||||
|
hi def link slimeInterpolationDelimiter Delimiter
|
||||||
|
hi def link slimeElixirChar Special
|
||||||
|
hi def link slimeElixirOutputChar Special
|
||||||
|
hi def link slimeText String
|
||||||
|
hi def link slimeTodo Todo
|
||||||
|
hi def link slimeWrappedAttrValueDelimiter Delimiter
|
||||||
|
hi def link slimeWrappedAttrsDelimiter Delimiter
|
||||||
|
hi def link slimeInlineTagChar Delimiter
|
||||||
|
|
||||||
|
let b:current_syntax = "slime"
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -3,7 +3,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
|
|||||||
" File: swift.vim
|
" File: swift.vim
|
||||||
" Author: Keith Smiley
|
" Author: Keith Smiley
|
||||||
" Description: Runtime files for Swift
|
" Description: Runtime files for Swift
|
||||||
" Last Modified: June 15, 2014
|
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@@ -55,9 +54,11 @@ delfunction s:CommentKeywordMatch
|
|||||||
|
|
||||||
" Literals
|
" Literals
|
||||||
" Strings
|
" Strings
|
||||||
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper oneline
|
syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftMultilineInterpolatedWrapper oneline
|
||||||
|
syntax region swiftMultilineString start=/"""/ end=/"""/ contains=swiftMultilineInterpolatedWrapper
|
||||||
|
syntax region swiftMultilineInterpolatedWrapper start="\v\\\(\s*" end="\v\s*\)" contained containedin=swiftMultilineString contains=swiftInterpolatedString oneline
|
||||||
syntax region swiftInterpolatedWrapper start="\v[^\\]\zs\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline
|
syntax region swiftInterpolatedWrapper start="\v[^\\]\zs\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString,swiftString oneline
|
||||||
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper oneline
|
syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper,swiftMultilineInterpolatedWrapper oneline
|
||||||
|
|
||||||
" Numbers
|
" Numbers
|
||||||
syntax match swiftNumber "\v<\d+>"
|
syntax match swiftNumber "\v<\d+>"
|
||||||
@@ -222,7 +223,7 @@ syntax keyword swiftDebugIdentifier
|
|||||||
|
|
||||||
syntax keyword swiftLineDirective #setline
|
syntax keyword swiftLineDirective #setline
|
||||||
|
|
||||||
syntax region swiftTypeWrapper start=":\s*\(\.\)\@!\<\u" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper transparent
|
syntax region swiftTypeWrapper start=":\s*\(\.\)\@!\<\u" skip="\s*,\s*$*\s*" end="$\|/"me=e-1 contains=ALLBUT,swiftInterpolatedWrapper,swiftMultilineInterpolatedWrapper transparent
|
||||||
syntax region swiftTypeCastWrapper start="\(as\|is\)\(!\|?\)\=\s\+" end="\v(\s|$|\{)" contains=swiftType,swiftCastKeyword keepend transparent oneline
|
syntax region swiftTypeCastWrapper start="\(as\|is\)\(!\|?\)\=\s\+" end="\v(\s|$|\{)" contains=swiftType,swiftCastKeyword keepend transparent oneline
|
||||||
syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
|
syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline
|
||||||
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
|
syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=ALL transparent oneline
|
||||||
@@ -240,6 +241,8 @@ syntax keyword swiftPreprocessor
|
|||||||
\ #else
|
\ #else
|
||||||
\ #endif
|
\ #endif
|
||||||
\ #selector
|
\ #selector
|
||||||
|
\ #warning
|
||||||
|
\ #error
|
||||||
|
|
||||||
|
|
||||||
" Comment patterns
|
" Comment patterns
|
||||||
@@ -257,7 +260,9 @@ highlight default link swiftComment Comment
|
|||||||
highlight default link swiftMarker Comment
|
highlight default link swiftMarker Comment
|
||||||
|
|
||||||
highlight default link swiftString String
|
highlight default link swiftString String
|
||||||
|
highlight default link swiftMultilineString String
|
||||||
highlight default link swiftInterpolatedWrapper Delimiter
|
highlight default link swiftInterpolatedWrapper Delimiter
|
||||||
|
highlight default link swiftMultilineInterpolatedWrapper Delimiter
|
||||||
highlight default link swiftTypeDeclaration Delimiter
|
highlight default link swiftTypeDeclaration Delimiter
|
||||||
highlight default link swiftNumber Number
|
highlight default link swiftNumber Number
|
||||||
highlight default link swiftBoolean Boolean
|
highlight default link swiftBoolean Boolean
|
||||||
|
|||||||
@@ -9,20 +9,34 @@ endif
|
|||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
|
|
||||||
syn keyword terraSection connection output provider variable data terraform
|
syn keyword terraSection connection output provider variable data terraform locals
|
||||||
syn keyword terraValueBool true false on off yes no
|
syn keyword terraValueBool true false on off yes no
|
||||||
|
|
||||||
""" data
|
""" data
|
||||||
syn keyword terraDataTypeBI
|
syn keyword terraDataTypeBI
|
||||||
|
\ alicloud_dns_domain_groups
|
||||||
|
\ alicloud_dns_domain_records
|
||||||
|
\ alicloud_dns_domains
|
||||||
|
\ alicloud_dns_groups
|
||||||
|
\ alicloud_dns_records
|
||||||
\ alicloud_images
|
\ alicloud_images
|
||||||
\ alicloud_instance_types
|
\ alicloud_instance_types
|
||||||
|
\ alicloud_key_pairs
|
||||||
|
\ alicloud_ram_account_alias
|
||||||
|
\ alicloud_ram_account_aliases
|
||||||
|
\ alicloud_ram_groups
|
||||||
|
\ alicloud_ram_policies
|
||||||
|
\ alicloud_ram_roles
|
||||||
|
\ alicloud_ram_users
|
||||||
\ alicloud_regions
|
\ alicloud_regions
|
||||||
|
\ alicloud_vpcs
|
||||||
\ alicloud_zones
|
\ alicloud_zones
|
||||||
\ archive_file
|
\ archive_file
|
||||||
\ atlas_artifact
|
\ atlas_artifact
|
||||||
\ aws_acm_certificate
|
\ aws_acm_certificate
|
||||||
\ aws_alb
|
\ aws_alb
|
||||||
\ aws_alb_listener
|
\ aws_alb_listener
|
||||||
|
\ aws_alb_target_group
|
||||||
\ aws_ami
|
\ aws_ami
|
||||||
\ aws_ami_ids
|
\ aws_ami_ids
|
||||||
\ aws_autoscaling_groups
|
\ aws_autoscaling_groups
|
||||||
@@ -32,36 +46,54 @@ syn keyword terraDataTypeBI
|
|||||||
\ aws_caller_identity
|
\ aws_caller_identity
|
||||||
\ aws_canonical_user_id
|
\ aws_canonical_user_id
|
||||||
\ aws_cloudformation_stack
|
\ aws_cloudformation_stack
|
||||||
|
\ aws_cloudtrail_service_account
|
||||||
\ aws_db_instance
|
\ aws_db_instance
|
||||||
\ aws_db_snapshot
|
\ aws_db_snapshot
|
||||||
|
\ aws_dynamodb_table
|
||||||
\ aws_ebs_snapshot
|
\ aws_ebs_snapshot
|
||||||
\ aws_ebs_snapshot_ids
|
\ aws_ebs_snapshot_ids
|
||||||
\ aws_ebs_volume
|
\ aws_ebs_volume
|
||||||
|
\ aws_ecr_repository
|
||||||
\ aws_ecs_cluster
|
\ aws_ecs_cluster
|
||||||
\ aws_ecs_container_definition
|
\ aws_ecs_container_definition
|
||||||
\ aws_ecs_task_definition
|
\ aws_ecs_task_definition
|
||||||
\ aws_efs_file_system
|
\ aws_efs_file_system
|
||||||
|
\ aws_efs_mount_target
|
||||||
\ aws_eip
|
\ aws_eip
|
||||||
\ aws_elastic_beanstalk_solution_stack
|
\ aws_elastic_beanstalk_solution_stack
|
||||||
\ aws_elasticache_cluster
|
\ aws_elasticache_cluster
|
||||||
|
\ aws_elasticache_replication_group
|
||||||
|
\ aws_elb
|
||||||
\ aws_elb_hosted_zone_id
|
\ aws_elb_hosted_zone_id
|
||||||
\ aws_elb_service_account
|
\ aws_elb_service_account
|
||||||
\ aws_iam_account_alias
|
\ aws_iam_account_alias
|
||||||
|
\ aws_iam_group
|
||||||
|
\ aws_iam_instance_profile
|
||||||
\ aws_iam_policy_document
|
\ aws_iam_policy_document
|
||||||
\ aws_iam_role
|
\ aws_iam_role
|
||||||
\ aws_iam_server_certificate
|
\ aws_iam_server_certificate
|
||||||
|
\ aws_iam_user
|
||||||
\ aws_instance
|
\ aws_instance
|
||||||
|
\ aws_instances
|
||||||
|
\ aws_internet_gateway
|
||||||
\ aws_ip_ranges
|
\ aws_ip_ranges
|
||||||
\ aws_kinesis_stream
|
\ aws_kinesis_stream
|
||||||
\ aws_kms_alias
|
\ aws_kms_alias
|
||||||
\ aws_kms_ciphertext
|
\ aws_kms_ciphertext
|
||||||
\ aws_kms_secret
|
\ aws_kms_secret
|
||||||
|
\ aws_lb
|
||||||
|
\ aws_lb_listener
|
||||||
|
\ aws_lb_target_group
|
||||||
|
\ aws_nat_gateway
|
||||||
|
\ aws_network_interface
|
||||||
\ aws_partition
|
\ aws_partition
|
||||||
\ aws_prefix_list
|
\ aws_prefix_list
|
||||||
|
\ aws_rds_cluster
|
||||||
\ aws_redshift_service_account
|
\ aws_redshift_service_account
|
||||||
\ aws_region
|
\ aws_region
|
||||||
\ aws_route53_zone
|
\ aws_route53_zone
|
||||||
\ aws_route_table
|
\ aws_route_table
|
||||||
|
\ aws_s3_bucket
|
||||||
\ aws_s3_bucket_object
|
\ aws_s3_bucket_object
|
||||||
\ aws_security_group
|
\ aws_security_group
|
||||||
\ aws_sns_topic
|
\ aws_sns_topic
|
||||||
@@ -73,10 +105,23 @@ syn keyword terraDataTypeBI
|
|||||||
\ aws_vpc_endpoint_service
|
\ aws_vpc_endpoint_service
|
||||||
\ aws_vpc_peering_connection
|
\ aws_vpc_peering_connection
|
||||||
\ aws_vpn_gateway
|
\ aws_vpn_gateway
|
||||||
|
\ azurerm_builtin_role_definition
|
||||||
\ azurerm_client_config
|
\ azurerm_client_config
|
||||||
|
\ azurerm_image
|
||||||
|
\ azurerm_key_vault_access_policy
|
||||||
|
\ azurerm_managed_disk
|
||||||
|
\ azurerm_network_security_group
|
||||||
|
\ azurerm_platform_image
|
||||||
\ azurerm_public_ip
|
\ azurerm_public_ip
|
||||||
|
\ azurerm_resource_group
|
||||||
|
\ azurerm_role_definition
|
||||||
|
\ azurerm_snapshot
|
||||||
|
\ azurerm_subnet
|
||||||
|
\ azurerm_subscription
|
||||||
|
\ azurerm_virtual_network
|
||||||
\ circonus_account
|
\ circonus_account
|
||||||
\ circonus_collector
|
\ circonus_collector
|
||||||
|
\ cloudstack_template
|
||||||
\ consul_agent_self
|
\ consul_agent_self
|
||||||
\ consul_catalog_nodes
|
\ consul_catalog_nodes
|
||||||
\ consul_catalog_service
|
\ consul_catalog_service
|
||||||
@@ -84,28 +129,61 @@ syn keyword terraDataTypeBI
|
|||||||
\ consul_keys
|
\ consul_keys
|
||||||
\ digitalocean_image
|
\ digitalocean_image
|
||||||
\ dns_a_record_set
|
\ dns_a_record_set
|
||||||
|
\ dns_aaaa_record_set
|
||||||
\ dns_cname_record_set
|
\ dns_cname_record_set
|
||||||
|
\ dns_ns_record_set
|
||||||
\ dns_txt_record_set
|
\ dns_txt_record_set
|
||||||
\ docker_registry_image
|
\ docker_registry_image
|
||||||
\ external
|
\ external
|
||||||
\ fastly_ip_ranges
|
\ fastly_ip_ranges
|
||||||
\ github_team
|
\ github_team
|
||||||
\ github_user
|
\ github_user
|
||||||
|
\ google_active_folder
|
||||||
|
\ google_billing_account
|
||||||
|
\ google_client_config
|
||||||
|
\ google_compute_address
|
||||||
|
\ google_compute_global_address
|
||||||
|
\ google_compute_image
|
||||||
|
\ google_compute_instance_group
|
||||||
|
\ google_compute_lb_ip_ranges
|
||||||
\ google_compute_network
|
\ google_compute_network
|
||||||
|
\ google_compute_region_instance_group
|
||||||
\ google_compute_subnetwork
|
\ google_compute_subnetwork
|
||||||
\ google_compute_zones
|
\ google_compute_zones
|
||||||
|
\ google_container_cluster
|
||||||
\ google_container_engine_versions
|
\ google_container_engine_versions
|
||||||
|
\ google_dns_managed_zone
|
||||||
\ google_iam_policy
|
\ google_iam_policy
|
||||||
|
\ google_kms_secret
|
||||||
|
\ google_organization
|
||||||
\ google_storage_object_signed_url
|
\ google_storage_object_signed_url
|
||||||
\ http
|
\ http
|
||||||
|
\ kubernetes_service
|
||||||
|
\ kubernetes_storage_class
|
||||||
|
\ local_file
|
||||||
|
\ logicmonitor_collectors
|
||||||
|
\ logicmonitor_device_group
|
||||||
\ newrelic_application
|
\ newrelic_application
|
||||||
\ ns1_datasource
|
\ ns1_datasource
|
||||||
\ null_data_source
|
\ null_data_source
|
||||||
|
\ oneandone_instance_size
|
||||||
|
\ opc_compute_image_list_entry
|
||||||
|
\ opc_compute_network_interface
|
||||||
|
\ opc_compute_storage_volume_snapshot
|
||||||
|
\ opc_compute_vnic
|
||||||
|
\ openstack_dns_zone_v2
|
||||||
\ openstack_images_image_v2
|
\ openstack_images_image_v2
|
||||||
\ openstack_networking_network_v2
|
\ openstack_networking_network_v2
|
||||||
|
\ openstack_networking_secgroup_v2
|
||||||
|
\ openstack_networking_subnet_v2
|
||||||
|
\ opentelekomcloud_images_image_v2
|
||||||
|
\ opentelekomcloud_networking_network_v2
|
||||||
|
\ opentelekomcloud_networking_secgroup_v2
|
||||||
|
\ opentelekomcloud_s3_bucket_object
|
||||||
\ opsgenie_user
|
\ opsgenie_user
|
||||||
\ ovh_publiccloud_region
|
\ ovh_publiccloud_region
|
||||||
\ ovh_publiccloud_regions
|
\ ovh_publiccloud_regions
|
||||||
|
\ packet_precreated_ip_block
|
||||||
\ pagerduty_escalation_policy
|
\ pagerduty_escalation_policy
|
||||||
\ pagerduty_schedule
|
\ pagerduty_schedule
|
||||||
\ pagerduty_user
|
\ pagerduty_user
|
||||||
@@ -113,18 +191,43 @@ syn keyword terraDataTypeBI
|
|||||||
\ profitbricks_datacenter
|
\ profitbricks_datacenter
|
||||||
\ profitbricks_image
|
\ profitbricks_image
|
||||||
\ profitbricks_location
|
\ profitbricks_location
|
||||||
|
\ profitbricks_resource
|
||||||
|
\ profitbricks_snapshot
|
||||||
|
\ rancher_certificate
|
||||||
|
\ rancher_environment
|
||||||
|
\ rancher_setting
|
||||||
\ scaleway_bootscript
|
\ scaleway_bootscript
|
||||||
\ scaleway_image
|
\ scaleway_image
|
||||||
\ template_cloudinit_config
|
\ template_cloudinit_config
|
||||||
\ template_file
|
\ template_file
|
||||||
\ terraform_remote_state
|
\ terraform_remote_state
|
||||||
|
\ triton_account
|
||||||
|
\ triton_datacenter
|
||||||
|
\ triton_image
|
||||||
|
\ triton_network
|
||||||
|
\ vsphere_custom_attribute
|
||||||
|
\ vsphere_datacenter
|
||||||
|
\ vsphere_datastore
|
||||||
|
\ vsphere_distributed_virtual_switch
|
||||||
|
\ vsphere_host
|
||||||
|
\ vsphere_network
|
||||||
|
\ vsphere_resource_pool
|
||||||
|
\ vsphere_tag
|
||||||
|
\ vsphere_tag_category
|
||||||
|
\ vsphere_virtual_machine
|
||||||
|
\ vsphere_vmfs_disks
|
||||||
""" end data sources
|
""" end data sources
|
||||||
|
|
||||||
""" resource
|
""" resource
|
||||||
syn keyword terraResourceTypeBI
|
syn keyword terraResourceTypeBI
|
||||||
|
\ alicloud_cdn_domain
|
||||||
|
\ alicloud_container_cluster
|
||||||
\ alicloud_db_instance
|
\ alicloud_db_instance
|
||||||
\ alicloud_disk
|
\ alicloud_disk
|
||||||
\ alicloud_disk_attachment
|
\ alicloud_disk_attachment
|
||||||
|
\ alicloud_dns
|
||||||
|
\ alicloud_dns_group
|
||||||
|
\ alicloud_dns_record
|
||||||
\ alicloud_eip
|
\ alicloud_eip
|
||||||
\ alicloud_eip_association
|
\ alicloud_eip_association
|
||||||
\ alicloud_ess_scaling_configuration
|
\ alicloud_ess_scaling_configuration
|
||||||
@@ -133,12 +236,31 @@ syn keyword terraResourceTypeBI
|
|||||||
\ alicloud_ess_schedule
|
\ alicloud_ess_schedule
|
||||||
\ alicloud_forward_entry
|
\ alicloud_forward_entry
|
||||||
\ alicloud_instance
|
\ alicloud_instance
|
||||||
|
\ alicloud_key_pair
|
||||||
|
\ alicloud_key_pair_attachment
|
||||||
\ alicloud_nat_gateway
|
\ alicloud_nat_gateway
|
||||||
|
\ alicloud_oss_bucket
|
||||||
|
\ alicloud_oss_bucket_object
|
||||||
|
\ alicloud_ram_access_key
|
||||||
|
\ alicloud_ram_account_alias
|
||||||
|
\ alicloud_ram_alias
|
||||||
|
\ alicloud_ram_group
|
||||||
|
\ alicloud_ram_group_membership
|
||||||
|
\ alicloud_ram_group_policy_attachment
|
||||||
|
\ alicloud_ram_login_profile
|
||||||
|
\ alicloud_ram_policy
|
||||||
|
\ alicloud_ram_role
|
||||||
|
\ alicloud_ram_role_attachment
|
||||||
|
\ alicloud_ram_role_policy_attachment
|
||||||
|
\ alicloud_ram_user
|
||||||
|
\ alicloud_ram_user_policy_attachment
|
||||||
\ alicloud_route_entry
|
\ alicloud_route_entry
|
||||||
|
\ alicloud_router_interface
|
||||||
\ alicloud_security_group
|
\ alicloud_security_group
|
||||||
\ alicloud_security_group_rule
|
\ alicloud_security_group_rule
|
||||||
\ alicloud_slb
|
\ alicloud_slb
|
||||||
\ alicloud_slb_attachment
|
\ alicloud_slb_attachment
|
||||||
|
\ alicloud_slb_listener
|
||||||
\ alicloud_snat_entry
|
\ alicloud_snat_entry
|
||||||
\ alicloud_subnet
|
\ alicloud_subnet
|
||||||
\ alicloud_vpc
|
\ alicloud_vpc
|
||||||
@@ -161,12 +283,14 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_api_gateway_client_certificate
|
\ aws_api_gateway_client_certificate
|
||||||
\ aws_api_gateway_deployment
|
\ aws_api_gateway_deployment
|
||||||
\ aws_api_gateway_domain_name
|
\ aws_api_gateway_domain_name
|
||||||
|
\ aws_api_gateway_gateway_response
|
||||||
\ aws_api_gateway_integration
|
\ aws_api_gateway_integration
|
||||||
\ aws_api_gateway_integration_response
|
\ aws_api_gateway_integration_response
|
||||||
\ aws_api_gateway_method
|
\ aws_api_gateway_method
|
||||||
\ aws_api_gateway_method_response
|
\ aws_api_gateway_method_response
|
||||||
\ aws_api_gateway_method_settings
|
\ aws_api_gateway_method_settings
|
||||||
\ aws_api_gateway_model
|
\ aws_api_gateway_model
|
||||||
|
\ aws_api_gateway_request_validator
|
||||||
\ aws_api_gateway_resource
|
\ aws_api_gateway_resource
|
||||||
\ aws_api_gateway_rest_api
|
\ aws_api_gateway_rest_api
|
||||||
\ aws_api_gateway_stage
|
\ aws_api_gateway_stage
|
||||||
@@ -174,23 +298,31 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_api_gateway_usage_plan_key
|
\ aws_api_gateway_usage_plan_key
|
||||||
\ aws_app_cookie_stickiness_policy
|
\ aws_app_cookie_stickiness_policy
|
||||||
\ aws_appautoscaling_policy
|
\ aws_appautoscaling_policy
|
||||||
|
\ aws_appautoscaling_scheduled_action
|
||||||
\ aws_appautoscaling_target
|
\ aws_appautoscaling_target
|
||||||
|
\ aws_athena_database
|
||||||
|
\ aws_athena_named_query
|
||||||
\ aws_autoscaling_attachment
|
\ aws_autoscaling_attachment
|
||||||
\ aws_autoscaling_group
|
\ aws_autoscaling_group
|
||||||
\ aws_autoscaling_lifecycle_hook
|
\ aws_autoscaling_lifecycle_hook
|
||||||
\ aws_autoscaling_notification
|
\ aws_autoscaling_notification
|
||||||
\ aws_autoscaling_policy
|
\ aws_autoscaling_policy
|
||||||
\ aws_autoscaling_schedule
|
\ aws_autoscaling_schedule
|
||||||
|
\ aws_batch_compute_environment
|
||||||
|
\ aws_batch_job_definition
|
||||||
|
\ aws_batch_job_queue
|
||||||
\ aws_cloudformation_stack
|
\ aws_cloudformation_stack
|
||||||
\ aws_cloudfront_distribution
|
\ aws_cloudfront_distribution
|
||||||
\ aws_cloudfront_origin_access_identity
|
\ aws_cloudfront_origin_access_identity
|
||||||
\ aws_cloudtrail
|
\ aws_cloudtrail
|
||||||
|
\ aws_cloudwatch_dashboard
|
||||||
\ aws_cloudwatch_event_rule
|
\ aws_cloudwatch_event_rule
|
||||||
\ aws_cloudwatch_event_target
|
\ aws_cloudwatch_event_target
|
||||||
\ aws_cloudwatch_log_destination
|
\ aws_cloudwatch_log_destination
|
||||||
\ aws_cloudwatch_log_destination_policy
|
\ aws_cloudwatch_log_destination_policy
|
||||||
\ aws_cloudwatch_log_group
|
\ aws_cloudwatch_log_group
|
||||||
\ aws_cloudwatch_log_metric_filter
|
\ aws_cloudwatch_log_metric_filter
|
||||||
|
\ aws_cloudwatch_log_resource_policy
|
||||||
\ aws_cloudwatch_log_stream
|
\ aws_cloudwatch_log_stream
|
||||||
\ aws_cloudwatch_log_subscription_filter
|
\ aws_cloudwatch_log_subscription_filter
|
||||||
\ aws_cloudwatch_metric_alarm
|
\ aws_cloudwatch_metric_alarm
|
||||||
@@ -202,6 +334,8 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_codedeploy_deployment_group
|
\ aws_codedeploy_deployment_group
|
||||||
\ aws_codepipeline
|
\ aws_codepipeline
|
||||||
\ aws_cognito_identity_pool
|
\ aws_cognito_identity_pool
|
||||||
|
\ aws_cognito_identity_pool_roles_attachment
|
||||||
|
\ aws_cognito_user_pool
|
||||||
\ aws_config_config_rule
|
\ aws_config_config_rule
|
||||||
\ aws_config_configuration_recorder
|
\ aws_config_configuration_recorder
|
||||||
\ aws_config_configuration_recorder_status
|
\ aws_config_configuration_recorder_status
|
||||||
@@ -227,9 +361,13 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_dms_replication_instance
|
\ aws_dms_replication_instance
|
||||||
\ aws_dms_replication_subnet_group
|
\ aws_dms_replication_subnet_group
|
||||||
\ aws_dms_replication_task
|
\ aws_dms_replication_task
|
||||||
|
\ aws_dx_connection
|
||||||
|
\ aws_dx_connection_association
|
||||||
|
\ aws_dx_lag
|
||||||
\ aws_dynamodb_table
|
\ aws_dynamodb_table
|
||||||
\ aws_ebs_snapshot
|
\ aws_ebs_snapshot
|
||||||
\ aws_ebs_volume
|
\ aws_ebs_volume
|
||||||
|
\ aws_ecr_lifecycle_policy
|
||||||
\ aws_ecr_repository
|
\ aws_ecr_repository
|
||||||
\ aws_ecr_repository_policy
|
\ aws_ecr_repository_policy
|
||||||
\ aws_ecs_cluster
|
\ aws_ecs_cluster
|
||||||
@@ -286,6 +424,8 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_inspector_resource_group
|
\ aws_inspector_resource_group
|
||||||
\ aws_instance
|
\ aws_instance
|
||||||
\ aws_internet_gateway
|
\ aws_internet_gateway
|
||||||
|
\ aws_iot_certificate
|
||||||
|
\ aws_iot_policy
|
||||||
\ aws_key_pair
|
\ aws_key_pair
|
||||||
\ aws_kinesis_firehose_delivery_stream
|
\ aws_kinesis_firehose_delivery_stream
|
||||||
\ aws_kinesis_stream
|
\ aws_kinesis_stream
|
||||||
@@ -296,8 +436,13 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_lambda_function
|
\ aws_lambda_function
|
||||||
\ aws_lambda_permission
|
\ aws_lambda_permission
|
||||||
\ aws_launch_configuration
|
\ aws_launch_configuration
|
||||||
|
\ aws_lb
|
||||||
\ aws_lb_cookie_stickiness_policy
|
\ aws_lb_cookie_stickiness_policy
|
||||||
|
\ aws_lb_listener
|
||||||
|
\ aws_lb_listener_rule
|
||||||
\ aws_lb_ssl_negotiation_policy
|
\ aws_lb_ssl_negotiation_policy
|
||||||
|
\ aws_lb_target_group
|
||||||
|
\ aws_lb_target_group_attachment
|
||||||
\ aws_lightsail_domain
|
\ aws_lightsail_domain
|
||||||
\ aws_lightsail_instance
|
\ aws_lightsail_instance
|
||||||
\ aws_lightsail_key_pair
|
\ aws_lightsail_key_pair
|
||||||
@@ -307,11 +452,15 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_load_balancer_listener_policy
|
\ aws_load_balancer_listener_policy
|
||||||
\ aws_load_balancer_policy
|
\ aws_load_balancer_policy
|
||||||
\ aws_main_route_table_association
|
\ aws_main_route_table_association
|
||||||
|
\ aws_media_store_container
|
||||||
|
\ aws_mq_broker
|
||||||
|
\ aws_mq_configuration
|
||||||
\ aws_nat_gateway
|
\ aws_nat_gateway
|
||||||
\ aws_network_acl
|
\ aws_network_acl
|
||||||
\ aws_network_acl_rule
|
\ aws_network_acl_rule
|
||||||
\ aws_network_interface
|
\ aws_network_interface
|
||||||
\ aws_network_interface_attachment
|
\ aws_network_interface_attachment
|
||||||
|
\ aws_network_interface_sg_attachment
|
||||||
\ aws_opsworks_application
|
\ aws_opsworks_application
|
||||||
\ aws_opsworks_custom_layer
|
\ aws_opsworks_custom_layer
|
||||||
\ aws_opsworks_ganglia_layer
|
\ aws_opsworks_ganglia_layer
|
||||||
@@ -351,13 +500,18 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_s3_bucket_policy
|
\ aws_s3_bucket_policy
|
||||||
\ aws_security_group
|
\ aws_security_group
|
||||||
\ aws_security_group_rule
|
\ aws_security_group_rule
|
||||||
|
\ aws_service_discovery_private_dns_namespace
|
||||||
|
\ aws_service_discovery_public_dns_namespace
|
||||||
|
\ aws_servicecatalog_portfolio
|
||||||
\ aws_ses_active_receipt_rule_set
|
\ aws_ses_active_receipt_rule_set
|
||||||
\ aws_ses_configuration_set
|
\ aws_ses_configuration_set
|
||||||
|
\ aws_ses_domain_dkim
|
||||||
\ aws_ses_domain_identity
|
\ aws_ses_domain_identity
|
||||||
\ aws_ses_event_destination
|
\ aws_ses_event_destination
|
||||||
\ aws_ses_receipt_filter
|
\ aws_ses_receipt_filter
|
||||||
\ aws_ses_receipt_rule
|
\ aws_ses_receipt_rule
|
||||||
\ aws_ses_receipt_rule_set
|
\ aws_ses_receipt_rule_set
|
||||||
|
\ aws_ses_template
|
||||||
\ aws_sfn_activity
|
\ aws_sfn_activity
|
||||||
\ aws_sfn_state_machine
|
\ aws_sfn_state_machine
|
||||||
\ aws_simpledb_domain
|
\ aws_simpledb_domain
|
||||||
@@ -379,6 +533,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_ssm_parameter
|
\ aws_ssm_parameter
|
||||||
\ aws_ssm_patch_baseline
|
\ aws_ssm_patch_baseline
|
||||||
\ aws_ssm_patch_group
|
\ aws_ssm_patch_group
|
||||||
|
\ aws_ssm_resource_data_sync
|
||||||
\ aws_subnet
|
\ aws_subnet
|
||||||
\ aws_volume_attachment
|
\ aws_volume_attachment
|
||||||
\ aws_vpc
|
\ aws_vpc
|
||||||
@@ -392,8 +547,10 @@ syn keyword terraResourceTypeBI
|
|||||||
\ aws_vpn_connection_route
|
\ aws_vpn_connection_route
|
||||||
\ aws_vpn_gateway
|
\ aws_vpn_gateway
|
||||||
\ aws_vpn_gateway_attachment
|
\ aws_vpn_gateway_attachment
|
||||||
|
\ aws_vpn_gateway_route_propagation
|
||||||
\ aws_waf_byte_match_set
|
\ aws_waf_byte_match_set
|
||||||
\ aws_waf_ipset
|
\ aws_waf_ipset
|
||||||
|
\ aws_waf_rate_based_rule
|
||||||
\ aws_waf_rule
|
\ aws_waf_rule
|
||||||
\ aws_waf_size_constraint_set
|
\ aws_waf_size_constraint_set
|
||||||
\ aws_waf_sql_injection_match_set
|
\ aws_waf_sql_injection_match_set
|
||||||
@@ -417,25 +574,41 @@ syn keyword terraResourceTypeBI
|
|||||||
\ azure_storage_queue
|
\ azure_storage_queue
|
||||||
\ azure_storage_service
|
\ azure_storage_service
|
||||||
\ azure_virtual_network
|
\ azure_virtual_network
|
||||||
|
\ azurerm_app_service
|
||||||
|
\ azurerm_app_service_plan
|
||||||
|
\ azurerm_application_gateway
|
||||||
|
\ azurerm_application_insights
|
||||||
|
\ azurerm_automation_account
|
||||||
|
\ azurerm_automation_credential
|
||||||
|
\ azurerm_automation_runbook
|
||||||
|
\ azurerm_automation_schedule
|
||||||
\ azurerm_availability_set
|
\ azurerm_availability_set
|
||||||
\ azurerm_cdn_endpoint
|
\ azurerm_cdn_endpoint
|
||||||
\ azurerm_cdn_profile
|
\ azurerm_cdn_profile
|
||||||
|
\ azurerm_container_group
|
||||||
\ azurerm_container_registry
|
\ azurerm_container_registry
|
||||||
\ azurerm_container_service
|
\ azurerm_container_service
|
||||||
|
\ azurerm_cosmosdb_account
|
||||||
\ azurerm_dns_a_record
|
\ azurerm_dns_a_record
|
||||||
\ azurerm_dns_aaaa_record
|
\ azurerm_dns_aaaa_record
|
||||||
\ azurerm_dns_cname_record
|
\ azurerm_dns_cname_record
|
||||||
\ azurerm_dns_mx_record
|
\ azurerm_dns_mx_record
|
||||||
\ azurerm_dns_ns_record
|
\ azurerm_dns_ns_record
|
||||||
|
\ azurerm_dns_ptr_record
|
||||||
\ azurerm_dns_srv_record
|
\ azurerm_dns_srv_record
|
||||||
\ azurerm_dns_txt_record
|
\ azurerm_dns_txt_record
|
||||||
\ azurerm_dns_zone
|
\ azurerm_dns_zone
|
||||||
|
\ azurerm_eventgrid_topic
|
||||||
\ azurerm_eventhub
|
\ azurerm_eventhub
|
||||||
\ azurerm_eventhub_authorization_rule
|
\ azurerm_eventhub_authorization_rule
|
||||||
\ azurerm_eventhub_consumer_group
|
\ azurerm_eventhub_consumer_group
|
||||||
\ azurerm_eventhub_namespace
|
\ azurerm_eventhub_namespace
|
||||||
\ azurerm_express_route_circuit
|
\ azurerm_express_route_circuit
|
||||||
|
\ azurerm_image
|
||||||
\ azurerm_key_vault
|
\ azurerm_key_vault
|
||||||
|
\ azurerm_key_vault_certificate
|
||||||
|
\ azurerm_key_vault_key
|
||||||
|
\ azurerm_key_vault_secret
|
||||||
\ azurerm_lb
|
\ azurerm_lb
|
||||||
\ azurerm_lb_backend_address_pool
|
\ azurerm_lb_backend_address_pool
|
||||||
\ azurerm_lb_nat_pool
|
\ azurerm_lb_nat_pool
|
||||||
@@ -443,19 +616,35 @@ syn keyword terraResourceTypeBI
|
|||||||
\ azurerm_lb_probe
|
\ azurerm_lb_probe
|
||||||
\ azurerm_lb_rule
|
\ azurerm_lb_rule
|
||||||
\ azurerm_local_network_gateway
|
\ azurerm_local_network_gateway
|
||||||
|
\ azurerm_log_analytics_workspace
|
||||||
\ azurerm_managed_disk
|
\ azurerm_managed_disk
|
||||||
|
\ azurerm_management_lock
|
||||||
|
\ azurerm_mysql_configuration
|
||||||
|
\ azurerm_mysql_database
|
||||||
|
\ azurerm_mysql_firewall_rule
|
||||||
|
\ azurerm_mysql_server
|
||||||
\ azurerm_network_interface
|
\ azurerm_network_interface
|
||||||
\ azurerm_network_security_group
|
\ azurerm_network_security_group
|
||||||
\ azurerm_network_security_rule
|
\ azurerm_network_security_rule
|
||||||
|
\ azurerm_network_watcher
|
||||||
|
\ azurerm_postgresql_configuration
|
||||||
|
\ azurerm_postgresql_database
|
||||||
|
\ azurerm_postgresql_firewall_rule
|
||||||
|
\ azurerm_postgresql_server
|
||||||
\ azurerm_public_ip
|
\ azurerm_public_ip
|
||||||
\ azurerm_redis_cache
|
\ azurerm_redis_cache
|
||||||
|
\ azurerm_redis_firewall_rule
|
||||||
\ azurerm_resource_group
|
\ azurerm_resource_group
|
||||||
|
\ azurerm_role_assignment
|
||||||
|
\ azurerm_role_definition
|
||||||
\ azurerm_route
|
\ azurerm_route
|
||||||
\ azurerm_route_table
|
\ azurerm_route_table
|
||||||
\ azurerm_search_service
|
\ azurerm_search_service
|
||||||
\ azurerm_servicebus_namespace
|
\ azurerm_servicebus_namespace
|
||||||
|
\ azurerm_servicebus_queue
|
||||||
\ azurerm_servicebus_subscription
|
\ azurerm_servicebus_subscription
|
||||||
\ azurerm_servicebus_topic
|
\ azurerm_servicebus_topic
|
||||||
|
\ azurerm_snapshot
|
||||||
\ azurerm_sql_database
|
\ azurerm_sql_database
|
||||||
\ azurerm_sql_elasticpool
|
\ azurerm_sql_elasticpool
|
||||||
\ azurerm_sql_firewall_rule
|
\ azurerm_sql_firewall_rule
|
||||||
@@ -498,6 +687,8 @@ syn keyword terraResourceTypeBI
|
|||||||
\ clc_public_ip
|
\ clc_public_ip
|
||||||
\ clc_server
|
\ clc_server
|
||||||
\ cloudflare_record
|
\ cloudflare_record
|
||||||
|
\ cloudscale_floating_ip
|
||||||
|
\ cloudscale_server
|
||||||
\ cloudstack_affinity_group
|
\ cloudstack_affinity_group
|
||||||
\ cloudstack_disk
|
\ cloudstack_disk
|
||||||
\ cloudstack_egress_firewall
|
\ cloudstack_egress_firewall
|
||||||
@@ -525,6 +716,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ cobbler_distro
|
\ cobbler_distro
|
||||||
\ cobbler_kickstart_file
|
\ cobbler_kickstart_file
|
||||||
\ cobbler_profile
|
\ cobbler_profile
|
||||||
|
\ cobbler_repo
|
||||||
\ cobbler_snippet
|
\ cobbler_snippet
|
||||||
\ cobbler_system
|
\ cobbler_system
|
||||||
\ consul_agent_service
|
\ consul_agent_service
|
||||||
@@ -535,12 +727,14 @@ syn keyword terraResourceTypeBI
|
|||||||
\ consul_prepared_query
|
\ consul_prepared_query
|
||||||
\ consul_service
|
\ consul_service
|
||||||
\ datadog_downtime
|
\ datadog_downtime
|
||||||
|
\ datadog_metric_metadata
|
||||||
\ datadog_monitor
|
\ datadog_monitor
|
||||||
\ datadog_timeboard
|
\ datadog_timeboard
|
||||||
\ datadog_user
|
\ datadog_user
|
||||||
\ digitalocean_certificate
|
\ digitalocean_certificate
|
||||||
\ digitalocean_domain
|
\ digitalocean_domain
|
||||||
\ digitalocean_droplet
|
\ digitalocean_droplet
|
||||||
|
\ digitalocean_firewall
|
||||||
\ digitalocean_floating_ip
|
\ digitalocean_floating_ip
|
||||||
\ digitalocean_loadbalancer
|
\ digitalocean_loadbalancer
|
||||||
\ digitalocean_record
|
\ digitalocean_record
|
||||||
@@ -551,6 +745,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ dns_a_record_set
|
\ dns_a_record_set
|
||||||
\ dns_aaaa_record_set
|
\ dns_aaaa_record_set
|
||||||
\ dns_cname_record
|
\ dns_cname_record
|
||||||
|
\ dns_ns_record_set
|
||||||
\ dns_ptr_record
|
\ dns_ptr_record
|
||||||
\ dnsimple_record
|
\ dnsimple_record
|
||||||
\ docker_container
|
\ docker_container
|
||||||
@@ -565,16 +760,21 @@ syn keyword terraResourceTypeBI
|
|||||||
\ github_organization_webhook
|
\ github_organization_webhook
|
||||||
\ github_repository
|
\ github_repository
|
||||||
\ github_repository_collaborator
|
\ github_repository_collaborator
|
||||||
|
\ github_repository_deploy_key
|
||||||
\ github_repository_webhook
|
\ github_repository_webhook
|
||||||
\ github_team
|
\ github_team
|
||||||
\ github_team_membership
|
\ github_team_membership
|
||||||
\ github_team_repository
|
\ github_team_repository
|
||||||
\ gitlab_deploy_key
|
\ gitlab_deploy_key
|
||||||
\ gitlab_group
|
\ gitlab_group
|
||||||
|
\ gitlab_label
|
||||||
\ gitlab_project
|
\ gitlab_project
|
||||||
\ gitlab_project_hook
|
\ gitlab_project_hook
|
||||||
|
\ gitlab_user
|
||||||
\ google_bigquery_dataset
|
\ google_bigquery_dataset
|
||||||
\ google_bigquery_table
|
\ google_bigquery_table
|
||||||
|
\ google_bigtable_instance
|
||||||
|
\ google_bigtable_table
|
||||||
\ google_compute_address
|
\ google_compute_address
|
||||||
\ google_compute_autoscaler
|
\ google_compute_autoscaler
|
||||||
\ google_compute_backend_bucket
|
\ google_compute_backend_bucket
|
||||||
@@ -593,31 +793,58 @@ syn keyword terraResourceTypeBI
|
|||||||
\ google_compute_instance_group_manager
|
\ google_compute_instance_group_manager
|
||||||
\ google_compute_instance_template
|
\ google_compute_instance_template
|
||||||
\ google_compute_network
|
\ google_compute_network
|
||||||
|
\ google_compute_network_peering
|
||||||
\ google_compute_project_metadata
|
\ google_compute_project_metadata
|
||||||
|
\ google_compute_project_metadata_item
|
||||||
|
\ google_compute_region_autoscaler
|
||||||
\ google_compute_region_backend_service
|
\ google_compute_region_backend_service
|
||||||
|
\ google_compute_region_instance_group_manager
|
||||||
\ google_compute_route
|
\ google_compute_route
|
||||||
\ google_compute_router
|
\ google_compute_router
|
||||||
\ google_compute_router_interface
|
\ google_compute_router_interface
|
||||||
\ google_compute_router_peer
|
\ google_compute_router_peer
|
||||||
|
\ google_compute_shared_vpc_host_project
|
||||||
|
\ google_compute_shared_vpc_service_project
|
||||||
\ google_compute_snapshot
|
\ google_compute_snapshot
|
||||||
\ google_compute_ssl_certificate
|
\ google_compute_ssl_certificate
|
||||||
\ google_compute_subnetwork
|
\ google_compute_subnetwork
|
||||||
\ google_compute_target_http_proxy
|
\ google_compute_target_http_proxy
|
||||||
\ google_compute_target_https_proxy
|
\ google_compute_target_https_proxy
|
||||||
\ google_compute_target_pool
|
\ google_compute_target_pool
|
||||||
|
\ google_compute_target_ssl_proxy
|
||||||
|
\ google_compute_target_tcp_proxy
|
||||||
\ google_compute_url_map
|
\ google_compute_url_map
|
||||||
\ google_compute_vpn_gateway
|
\ google_compute_vpn_gateway
|
||||||
\ google_compute_vpn_tunnel
|
\ google_compute_vpn_tunnel
|
||||||
\ google_container_cluster
|
\ google_container_cluster
|
||||||
\ google_container_node_pool
|
\ google_container_node_pool
|
||||||
|
\ google_dataproc_cluster
|
||||||
|
\ google_dataproc_job
|
||||||
\ google_dns_managed_zone
|
\ google_dns_managed_zone
|
||||||
\ google_dns_record_set
|
\ google_dns_record_set
|
||||||
|
\ google_folder
|
||||||
|
\ google_folder_organization_policy
|
||||||
|
\ google_kms_crypto_key
|
||||||
|
\ google_kms_key_ring
|
||||||
|
\ google_logging_billing_account_sink
|
||||||
|
\ google_logging_folder_sink
|
||||||
|
\ google_logging_project_sink
|
||||||
|
\ google_organization_iam_custom_role
|
||||||
|
\ google_organization_policy
|
||||||
\ google_project
|
\ google_project
|
||||||
|
\ google_project_iam_custom_role
|
||||||
\ google_project_iam_policy
|
\ google_project_iam_policy
|
||||||
|
\ google_project_service
|
||||||
\ google_project_services
|
\ google_project_services
|
||||||
\ google_pubsub_subscription
|
\ google_pubsub_subscription
|
||||||
\ google_pubsub_topic
|
\ google_pubsub_topic
|
||||||
|
\ google_runtimeconfig_config
|
||||||
|
\ google_runtimeconfig_variable
|
||||||
\ google_service_account
|
\ google_service_account
|
||||||
|
\ google_service_account_key
|
||||||
|
\ google_sourcerepo_repository
|
||||||
|
\ google_spanner_database
|
||||||
|
\ google_spanner_instance
|
||||||
\ google_sql_database
|
\ google_sql_database
|
||||||
\ google_sql_database_instance
|
\ google_sql_database_instance
|
||||||
\ google_sql_user
|
\ google_sql_user
|
||||||
@@ -626,6 +853,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ google_storage_bucket_object
|
\ google_storage_bucket_object
|
||||||
\ google_storage_object_acl
|
\ google_storage_object_acl
|
||||||
\ heroku_addon
|
\ heroku_addon
|
||||||
|
\ heroku_addon_attachment
|
||||||
\ heroku_app
|
\ heroku_app
|
||||||
\ heroku_app_feature
|
\ heroku_app_feature
|
||||||
\ heroku_cert
|
\ heroku_cert
|
||||||
@@ -639,10 +867,12 @@ syn keyword terraResourceTypeBI
|
|||||||
\ icinga2_hostgroup
|
\ icinga2_hostgroup
|
||||||
\ icinga2_service
|
\ icinga2_service
|
||||||
\ ignition_config
|
\ ignition_config
|
||||||
|
\ ignition_directory
|
||||||
\ ignition_disk
|
\ ignition_disk
|
||||||
\ ignition_file
|
\ ignition_file
|
||||||
\ ignition_filesystem
|
\ ignition_filesystem
|
||||||
\ ignition_group
|
\ ignition_group
|
||||||
|
\ ignition_link
|
||||||
\ ignition_networkd_unit
|
\ ignition_networkd_unit
|
||||||
\ ignition_raid
|
\ ignition_raid
|
||||||
\ ignition_systemd_unit
|
\ ignition_systemd_unit
|
||||||
@@ -656,9 +886,13 @@ syn keyword terraResourceTypeBI
|
|||||||
\ kubernetes_namespace
|
\ kubernetes_namespace
|
||||||
\ kubernetes_persistent_volume
|
\ kubernetes_persistent_volume
|
||||||
\ kubernetes_persistent_volume_claim
|
\ kubernetes_persistent_volume_claim
|
||||||
|
\ kubernetes_pod
|
||||||
|
\ kubernetes_replication_controller
|
||||||
\ kubernetes_resource_quota
|
\ kubernetes_resource_quota
|
||||||
\ kubernetes_secret
|
\ kubernetes_secret
|
||||||
\ kubernetes_service
|
\ kubernetes_service
|
||||||
|
\ kubernetes_service_account
|
||||||
|
\ kubernetes_storage_class
|
||||||
\ librato_alert
|
\ librato_alert
|
||||||
\ librato_metric
|
\ librato_metric
|
||||||
\ librato_service
|
\ librato_service
|
||||||
@@ -667,6 +901,9 @@ syn keyword terraResourceTypeBI
|
|||||||
\ local_file
|
\ local_file
|
||||||
\ logentries_log
|
\ logentries_log
|
||||||
\ logentries_logset
|
\ logentries_logset
|
||||||
|
\ logicmonitor_collector_group
|
||||||
|
\ logicmonitor_device
|
||||||
|
\ logicmonitor_device_group
|
||||||
\ mailgun_domain
|
\ mailgun_domain
|
||||||
\ mysql_database
|
\ mysql_database
|
||||||
\ mysql_grant
|
\ mysql_grant
|
||||||
@@ -675,6 +912,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ newrelic_alert_condition
|
\ newrelic_alert_condition
|
||||||
\ newrelic_alert_policy
|
\ newrelic_alert_policy
|
||||||
\ newrelic_alert_policy_channel
|
\ newrelic_alert_policy_channel
|
||||||
|
\ newrelic_nrql_alert_condition
|
||||||
\ nomad_job
|
\ nomad_job
|
||||||
\ null_resource
|
\ null_resource
|
||||||
\ oneandone_firewall_policy
|
\ oneandone_firewall_policy
|
||||||
@@ -685,9 +923,37 @@ syn keyword terraResourceTypeBI
|
|||||||
\ oneandone_server
|
\ oneandone_server
|
||||||
\ oneandone_shared_storage
|
\ oneandone_shared_storage
|
||||||
\ oneandone_vpn
|
\ oneandone_vpn
|
||||||
|
\ opc_compute_acl
|
||||||
|
\ opc_compute_image_list
|
||||||
|
\ opc_compute_image_list_entry
|
||||||
|
\ opc_compute_instance
|
||||||
|
\ opc_compute_ip_address_association
|
||||||
|
\ opc_compute_ip_address_prefix_set
|
||||||
|
\ opc_compute_ip_address_reservation
|
||||||
|
\ opc_compute_ip_association
|
||||||
|
\ opc_compute_ip_network
|
||||||
|
\ opc_compute_ip_network_exchange
|
||||||
|
\ opc_compute_ip_reservation
|
||||||
|
\ opc_compute_orchestrated_instance
|
||||||
|
\ opc_compute_route
|
||||||
|
\ opc_compute_sec_rule
|
||||||
|
\ opc_compute_security_application
|
||||||
|
\ opc_compute_security_association
|
||||||
|
\ opc_compute_security_ip_list
|
||||||
|
\ opc_compute_security_list
|
||||||
|
\ opc_compute_security_protocol
|
||||||
|
\ opc_compute_security_rule
|
||||||
|
\ opc_compute_snapshot
|
||||||
|
\ opc_compute_ssh_key
|
||||||
|
\ opc_compute_storage_volume
|
||||||
|
\ opc_compute_storage_volume_snapshot
|
||||||
|
\ opc_compute_vnic_set
|
||||||
|
\ opc_storage_container
|
||||||
|
\ opc_storage_object
|
||||||
\ openstack_blockstorage_volume_attach_v2
|
\ openstack_blockstorage_volume_attach_v2
|
||||||
\ openstack_blockstorage_volume_v1
|
\ openstack_blockstorage_volume_v1
|
||||||
\ openstack_blockstorage_volume_v2
|
\ openstack_blockstorage_volume_v2
|
||||||
|
\ openstack_compute_flavor_v2
|
||||||
\ openstack_compute_floatingip_associate_v2
|
\ openstack_compute_floatingip_associate_v2
|
||||||
\ openstack_compute_floatingip_v2
|
\ openstack_compute_floatingip_v2
|
||||||
\ openstack_compute_instance_v2
|
\ openstack_compute_instance_v2
|
||||||
@@ -695,11 +961,15 @@ syn keyword terraResourceTypeBI
|
|||||||
\ openstack_compute_secgroup_v2
|
\ openstack_compute_secgroup_v2
|
||||||
\ openstack_compute_servergroup_v2
|
\ openstack_compute_servergroup_v2
|
||||||
\ openstack_compute_volume_attach_v2
|
\ openstack_compute_volume_attach_v2
|
||||||
|
\ openstack_db_database_v1
|
||||||
|
\ openstack_db_instance_v1
|
||||||
\ openstack_dns_recordset_v2
|
\ openstack_dns_recordset_v2
|
||||||
\ openstack_dns_zone_v2
|
\ openstack_dns_zone_v2
|
||||||
\ openstack_fw_firewall_v1
|
\ openstack_fw_firewall_v1
|
||||||
\ openstack_fw_policy_v1
|
\ openstack_fw_policy_v1
|
||||||
\ openstack_fw_rule_v1
|
\ openstack_fw_rule_v1
|
||||||
|
\ openstack_identity_project_v3
|
||||||
|
\ openstack_identity_user_v3
|
||||||
\ openstack_images_image_v2
|
\ openstack_images_image_v2
|
||||||
\ openstack_lb_listener_v2
|
\ openstack_lb_listener_v2
|
||||||
\ openstack_lb_loadbalancer_v2
|
\ openstack_lb_loadbalancer_v2
|
||||||
@@ -720,22 +990,67 @@ syn keyword terraResourceTypeBI
|
|||||||
\ openstack_networking_secgroup_v2
|
\ openstack_networking_secgroup_v2
|
||||||
\ openstack_networking_subnet_v2
|
\ openstack_networking_subnet_v2
|
||||||
\ openstack_objectstorage_container_v1
|
\ openstack_objectstorage_container_v1
|
||||||
|
\ openstack_objectstorage_object_v1
|
||||||
|
\ opentelekomcloud_blockstorage_volume_v2
|
||||||
|
\ opentelekomcloud_ces_alarmrule
|
||||||
|
\ opentelekomcloud_compute_floatingip_associate_v2
|
||||||
|
\ opentelekomcloud_compute_floatingip_v2
|
||||||
|
\ opentelekomcloud_compute_instance_v2
|
||||||
|
\ opentelekomcloud_compute_keypair_v2
|
||||||
|
\ opentelekomcloud_compute_secgroup_v2
|
||||||
|
\ opentelekomcloud_compute_servergroup_v2
|
||||||
|
\ opentelekomcloud_compute_volume_attach_v2
|
||||||
|
\ opentelekomcloud_dns_recordset_v2
|
||||||
|
\ opentelekomcloud_dns_zone_v2
|
||||||
|
\ opentelekomcloud_elb_backend
|
||||||
|
\ opentelekomcloud_elb_health
|
||||||
|
\ opentelekomcloud_elb_listener
|
||||||
|
\ opentelekomcloud_elb_loadbalancer
|
||||||
|
\ opentelekomcloud_fw_firewall_group_v2
|
||||||
|
\ opentelekomcloud_fw_policy_v2
|
||||||
|
\ opentelekomcloud_fw_rule_v2
|
||||||
|
\ opentelekomcloud_images_image_v2
|
||||||
|
\ opentelekomcloud_lb_listener_v2
|
||||||
|
\ opentelekomcloud_lb_loadbalancer_v2
|
||||||
|
\ opentelekomcloud_lb_member_v2
|
||||||
|
\ opentelekomcloud_lb_monitor_v2
|
||||||
|
\ opentelekomcloud_lb_pool_v2
|
||||||
|
\ opentelekomcloud_networking_floatingip_v2
|
||||||
|
\ opentelekomcloud_networking_network_v2
|
||||||
|
\ opentelekomcloud_networking_port_v2
|
||||||
|
\ opentelekomcloud_networking_router_interface_v2
|
||||||
|
\ opentelekomcloud_networking_router_route_v2
|
||||||
|
\ opentelekomcloud_networking_router_v2
|
||||||
|
\ opentelekomcloud_networking_secgroup_rule_v2
|
||||||
|
\ opentelekomcloud_networking_secgroup_v2
|
||||||
|
\ opentelekomcloud_networking_subnet_v2
|
||||||
|
\ opentelekomcloud_s3_bucket
|
||||||
|
\ opentelekomcloud_s3_bucket_object
|
||||||
|
\ opentelekomcloud_s3_bucket_policy
|
||||||
|
\ opentelekomcloud_smn_subscription_v2
|
||||||
|
\ opentelekomcloud_smn_topic_v2
|
||||||
\ opsgenie_team
|
\ opsgenie_team
|
||||||
\ opsgenie_user
|
\ opsgenie_user
|
||||||
|
\ ovh_domain_zone_record
|
||||||
\ ovh_publiccloud_private_network
|
\ ovh_publiccloud_private_network
|
||||||
\ ovh_publiccloud_private_network_subnet
|
\ ovh_publiccloud_private_network_subnet
|
||||||
\ ovh_publiccloud_user
|
\ ovh_publiccloud_user
|
||||||
\ ovh_vrack_publiccloud_attachment
|
\ ovh_vrack_publiccloud_attachment
|
||||||
\ packet_device
|
\ packet_device
|
||||||
|
\ packet_ip_attachment
|
||||||
\ packet_project
|
\ packet_project
|
||||||
|
\ packet_reserved_ip_block
|
||||||
\ packet_ssh_key
|
\ packet_ssh_key
|
||||||
\ packet_volume
|
\ packet_volume
|
||||||
|
\ packet_volume_attachment
|
||||||
\ pagerduty_addon
|
\ pagerduty_addon
|
||||||
\ pagerduty_escalation_policy
|
\ pagerduty_escalation_policy
|
||||||
|
\ pagerduty_maintenance_window
|
||||||
\ pagerduty_schedule
|
\ pagerduty_schedule
|
||||||
\ pagerduty_service
|
\ pagerduty_service
|
||||||
\ pagerduty_service_integration
|
\ pagerduty_service_integration
|
||||||
\ pagerduty_team
|
\ pagerduty_team
|
||||||
|
\ pagerduty_team_membership
|
||||||
\ pagerduty_user
|
\ pagerduty_user
|
||||||
\ postgresql_database
|
\ postgresql_database
|
||||||
\ postgresql_extension
|
\ postgresql_extension
|
||||||
@@ -744,11 +1059,16 @@ syn keyword terraResourceTypeBI
|
|||||||
\ powerdns_record
|
\ powerdns_record
|
||||||
\ profitbricks_datacenter
|
\ profitbricks_datacenter
|
||||||
\ profitbricks_firewall
|
\ profitbricks_firewall
|
||||||
|
\ profitbricks_group
|
||||||
\ profitbricks_ipblock
|
\ profitbricks_ipblock
|
||||||
|
\ profitbricks_ipfailover
|
||||||
\ profitbricks_lan
|
\ profitbricks_lan
|
||||||
\ profitbricks_loadbalancer
|
\ profitbricks_loadbalancer
|
||||||
\ profitbricks_nic
|
\ profitbricks_nic
|
||||||
\ profitbricks_server
|
\ profitbricks_server
|
||||||
|
\ profitbricks_share
|
||||||
|
\ profitbricks_snapshot
|
||||||
|
\ profitbricks_user
|
||||||
\ profitbricks_volume
|
\ profitbricks_volume
|
||||||
\ rabbitmq_binding
|
\ rabbitmq_binding
|
||||||
\ rabbitmq_exchange
|
\ rabbitmq_exchange
|
||||||
@@ -763,10 +1083,14 @@ syn keyword terraResourceTypeBI
|
|||||||
\ rancher_registration_token
|
\ rancher_registration_token
|
||||||
\ rancher_registry
|
\ rancher_registry
|
||||||
\ rancher_registry_credential
|
\ rancher_registry_credential
|
||||||
|
\ rancher_secret
|
||||||
\ rancher_stack
|
\ rancher_stack
|
||||||
|
\ rancher_volume
|
||||||
\ random_id
|
\ random_id
|
||||||
|
\ random_integer
|
||||||
\ random_pet
|
\ random_pet
|
||||||
\ random_shuffle
|
\ random_shuffle
|
||||||
|
\ random_string
|
||||||
\ rundeck_job
|
\ rundeck_job
|
||||||
\ rundeck_private_key
|
\ rundeck_private_key
|
||||||
\ rundeck_project
|
\ rundeck_project
|
||||||
@@ -792,6 +1116,7 @@ syn keyword terraResourceTypeBI
|
|||||||
\ triton_firewall_rule
|
\ triton_firewall_rule
|
||||||
\ triton_key
|
\ triton_key
|
||||||
\ triton_machine
|
\ triton_machine
|
||||||
|
\ triton_snapshot
|
||||||
\ triton_vlan
|
\ triton_vlan
|
||||||
\ ultradns_dirpool
|
\ ultradns_dirpool
|
||||||
\ ultradns_probe_http
|
\ ultradns_probe_http
|
||||||
@@ -805,10 +1130,23 @@ syn keyword terraResourceTypeBI
|
|||||||
\ vcd_network
|
\ vcd_network
|
||||||
\ vcd_snat
|
\ vcd_snat
|
||||||
\ vcd_vapp
|
\ vcd_vapp
|
||||||
|
\ vcd_vapp_vm
|
||||||
|
\ vsphere_custom_attribute
|
||||||
|
\ vsphere_datacenter
|
||||||
|
\ vsphere_distributed_port_group
|
||||||
|
\ vsphere_distributed_virtual_switch
|
||||||
\ vsphere_file
|
\ vsphere_file
|
||||||
\ vsphere_folder
|
\ vsphere_folder
|
||||||
|
\ vsphere_host_port_group
|
||||||
|
\ vsphere_host_virtual_switch
|
||||||
|
\ vsphere_license
|
||||||
|
\ vsphere_nas_datastore
|
||||||
|
\ vsphere_tag
|
||||||
|
\ vsphere_tag_category
|
||||||
\ vsphere_virtual_disk
|
\ vsphere_virtual_disk
|
||||||
\ vsphere_virtual_machine
|
\ vsphere_virtual_machine
|
||||||
|
\ vsphere_virtual_machine_snapshot
|
||||||
|
\ vsphere_vmfs_datastore
|
||||||
""" end resources
|
""" end resources
|
||||||
|
|
||||||
syn keyword terraTodo contained TODO FIXME XXX BUG
|
syn keyword terraTodo contained TODO FIXME XXX BUG
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
|||||||
" - Switch on syntax highlighting by adding "syntax enable" to .vimrc.
|
" - Switch on syntax highlighting by adding "syntax enable" to .vimrc.
|
||||||
"
|
"
|
||||||
|
|
||||||
if version < 600
|
if v:version < 600
|
||||||
syntax clear
|
syntax clear
|
||||||
elseif exists("b:current_syntax")
|
elseif exists('b:current_syntax')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -52,6 +52,7 @@ syn keyword tmuxCmds
|
|||||||
\ confirm
|
\ confirm
|
||||||
\ confirm-before
|
\ confirm-before
|
||||||
\ copy-mode
|
\ copy-mode
|
||||||
|
\ copy-mode-vi
|
||||||
\ delete-buffer
|
\ delete-buffer
|
||||||
\ deleteb
|
\ deleteb
|
||||||
\ detach
|
\ detach
|
||||||
@@ -327,6 +328,6 @@ hi def link tmuxTodo Todo
|
|||||||
hi def link tmuxVariable Constant
|
hi def link tmuxVariable Constant
|
||||||
hi def link tmuxVariableExpansion Constant
|
hi def link tmuxVariableExpansion Constant
|
||||||
|
|
||||||
let b:current_syntax = "tmux"
|
let b:current_syntax = 'tmux'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -38,13 +38,21 @@ syn match tomlBoolean /\<\%(true\|false\)\>/ display
|
|||||||
hi def link tomlBoolean Boolean
|
hi def link tomlBoolean Boolean
|
||||||
|
|
||||||
" https://tools.ietf.org/html/rfc3339
|
" https://tools.ietf.org/html/rfc3339
|
||||||
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display
|
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}/ display
|
||||||
|
syn match tomlDate /\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?/ display
|
||||||
|
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}[T ]\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)\?/ display
|
||||||
hi def link tomlDate Constant
|
hi def link tomlDate Constant
|
||||||
|
|
||||||
syn match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment
|
syn region tomlKeyDq oneline start=/"/ end=/"/ contains=tomlEscape contained
|
||||||
|
hi def link tomlKeyDq Identifier
|
||||||
|
|
||||||
|
syn region tomlKeySq oneline start=/'/ end=/'/ contained
|
||||||
|
hi def link tomlKeySq Identifier
|
||||||
|
|
||||||
|
syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKeyDq,tomlKeySq
|
||||||
hi def link tomlTable Identifier
|
hi def link tomlTable Identifier
|
||||||
|
|
||||||
syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment
|
syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKeyDq,tomlKeySq
|
||||||
hi def link tomlTableArray Identifier
|
hi def link tomlTableArray Identifier
|
||||||
|
|
||||||
syn keyword tomlTodo TODO FIXME XXX BUG contained
|
syn keyword tomlTodo TODO FIXME XXX BUG contained
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
|
|||||||
" 2011 July 27: Changed all references of jinja tp twig
|
" 2011 July 27: Changed all references of jinja tp twig
|
||||||
" 2014 December 4: Do not assume that the base filetype is HTML.
|
" 2014 December 4: Do not assume that the base filetype is HTML.
|
||||||
|
|
||||||
if exists('b:main_syntax')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
let b:main_syntax = b:current_syntax
|
let b:main_syntax = b:current_syntax
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ if !exists("typescript_ignore_typescriptdoc")
|
|||||||
"unlet b:current_syntax
|
"unlet b:current_syntax
|
||||||
|
|
||||||
syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend
|
syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend
|
||||||
syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite
|
syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\|returns\=\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite
|
||||||
syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
|
syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
|
||||||
syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
|
syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
|
||||||
syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags
|
syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags
|
||||||
|
|
||||||
@@ -67,14 +67,16 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter
|
|||||||
\ start=/${/ end=/}/ contained
|
\ start=/${/ end=/}/ contained
|
||||||
\ contains=@typescriptExpression
|
\ contains=@typescriptExpression
|
||||||
|
|
||||||
syn match typescriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
syn match typescriptNumber "-\=\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>" display
|
||||||
|
syn match typescriptNumber "-\=\<0[bB][01][01_]*\>" display
|
||||||
|
syn match typescriptNumber "-\=\<0[oO]\o[0-7_]*\>" display
|
||||||
syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||||
" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
||||||
" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc
|
" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc
|
||||||
" syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc
|
" syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc
|
||||||
" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline
|
" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline
|
||||||
" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
|
" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
|
||||||
syntax match typescriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/
|
||||||
" syntax match typescriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
|
" syntax match typescriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
|
||||||
|
|
||||||
syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/
|
syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user