mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dd2e11698 | ||
|
|
9197c69900 | ||
|
|
c7dfe2f626 | ||
|
|
af87010071 | ||
|
|
ef369d45a5 | ||
|
|
64938393bd | ||
|
|
79fce146dd | ||
|
|
ef4435cffc | ||
|
|
c2a7f363c6 | ||
|
|
0134940f23 | ||
|
|
8bb259b1f6 | ||
|
|
466f20b12e | ||
|
|
461de4cc21 | ||
|
|
ba75890936 | ||
|
|
0801eac01a | ||
|
|
9f735b1fe7 | ||
|
|
fbeb019a85 | ||
|
|
6e9529be4e | ||
|
|
462bb76e06 | ||
|
|
8002795088 | ||
|
|
7404993f0c | ||
|
|
b7e2b0cad3 | ||
|
|
cc868aee51 | ||
|
|
39036a553f | ||
|
|
e685e4b431 | ||
|
|
e404a658b1 | ||
|
|
74652b465d | ||
|
|
7575da2064 | ||
|
|
9b23910103 | ||
|
|
98e021e969 | ||
|
|
b8d9939329 | ||
|
|
0244e228fa | ||
|
|
ab61d2ac8e | ||
|
|
f42e1f477c | ||
|
|
3019afa721 | ||
|
|
cb574b283f | ||
|
|
b9ce3df4cd | ||
|
|
f028cfae59 | ||
|
|
041ab2d237 | ||
|
|
acd25ccf95 | ||
|
|
7dd62806a0 | ||
|
|
6a823fb3af | ||
|
|
11f34624aa | ||
|
|
1422f7a75c | ||
|
|
b17b5d4d9f | ||
|
|
bd824d9407 | ||
|
|
c3233deb70 | ||
|
|
bf188c4a51 | ||
|
|
a5857b81c2 | ||
|
|
7a32eec6d1 | ||
|
|
c69562f864 | ||
|
|
40c54bc12b | ||
|
|
44b3d860cb |
181
README.md
181
README.md
@@ -1,4 +1,4 @@
|
|||||||
# vim-polyglot [![Build Status][travis-img-url]][travis-url] []()
|
# vim-polyglot [![Build Status][travis-img-url]][travis-url] []()
|
||||||
|
|
||||||
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
|
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
|
||||||
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
|
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
|
||||||
@@ -8,7 +8,7 @@ A collection of language packs for Vim.
|
|||||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
> 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 70+ times faster** than 70+ packages it consist of.
|
- It **installs and updates 100+ times faster** than 100+ packages it consist of.
|
||||||
- Solid syntax and indentation support. Only the best language packs.
|
- Solid syntax and indentation support. 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`).
|
||||||
@@ -23,98 +23,131 @@ A collection of language packs for Vim.
|
|||||||
|
|
||||||
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
||||||
|
|
||||||
|
You can also use Vim 8 built-in package manager:
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir -p ~/.vim/pack/default/start
|
||||||
|
git clone https://github.com/sheerun/vim-polyglot ~/.vim/pack/default/start/vim-polyglot
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: Not all features of listed language packs are available. We strip them from functionality slowing vim startup in general (for example we ignore `plugins` folder that is loaded regardless of file type, use `ftplugin` instead).
|
||||||
|
|
||||||
|
If you need full functionality of any plugin, please use it directly with your plugin manager.
|
||||||
|
|
||||||
## Language packs
|
## Language packs
|
||||||
|
|
||||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin, ftdetect)
|
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
||||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax)
|
||||||
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin, ftdetect)
|
- [applescript](https://github.com/vim-scripts/applescript.vim) (syntax)
|
||||||
|
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent)
|
||||||
|
- [asciidoc](https://github.com/asciidoc/vim-asciidoc) (syntax)
|
||||||
|
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin)
|
||||||
- [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)
|
||||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (ftdetect, syntax, ftplugin)
|
- [caddyfile](https://github.com/joshglendenning/vim-caddyfile) (syntax, indent, ftplugin)
|
||||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect)
|
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin, ftdetect)
|
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin, ftdetect)
|
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||||
- [cql](https://github.com/elubow/cql-vim) (syntax, ftdetect)
|
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
||||||
|
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin)
|
||||||
- [css](https://github.com/JulesWang/css.vim) (syntax)
|
- [css](https://github.com/JulesWang/css.vim) (syntax)
|
||||||
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
|
||||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin, ftdetect)
|
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
|
||||||
- [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect)
|
- [dockerfile](https://github.com/docker/docker) (syntax)
|
||||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin, ftdetect)
|
- [elm](https://github.com/lambdatoast/elm.vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [emberscript](https://github.com/heartsentwined/vim-ember-script) (syntax, indent, ftplugin, ftdetect)
|
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
|
||||||
- [emblem](https://github.com/heartsentwined/vim-emblem) (syntax, indent, ftplugin, ftdetect)
|
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
|
||||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent, ftdetect)
|
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
|
||||||
- [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
|
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
|
||||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent, ftdetect)
|
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
|
||||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent, ftdetect)
|
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
|
||||||
|
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
|
||||||
|
- [graphql](https://github.com/jparise/vim-graphql) (syntax, ftplugin)
|
||||||
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
||||||
- [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
|
||||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin, ftdetect)
|
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
|
||||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin, ftdetect)
|
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
|
||||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
|
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
|
||||||
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
|
- [i3](https://github.com/PotatoesMaster/i3-vim-syntax) (syntax, ftplugin)
|
||||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftplugin, ftdetect)
|
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
|
||||||
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
|
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
||||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
|
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
||||||
- [jsx](https://github.com/mxw/vim-jsx) (ftdetect, after)
|
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
||||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
- [jsx](https://github.com/mxw/vim-jsx) (after)
|
||||||
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftdetect)
|
- [julia](https://github.com/dcjones/julia-minimalist-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, ftdetect)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
||||||
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin)
|
||||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
||||||
- [markdown](https://github.com/tpope/vim-markdown) (syntax, ftplugin, ftdetect)
|
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
||||||
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
|
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax)
|
||||||
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
|
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
||||||
|
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||||
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||||
|
- [nix](https://github.com/spwhitt/vim-nix) (syntax, 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, ftdetect)
|
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
||||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect)
|
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||||
- [pgsql](https://github.com/exu/pgsql.vim) (syntax, ftdetect)
|
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
|
||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, ftplugin, ftdetect)
|
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin)
|
||||||
- [powershell](https://github.com/Persistent13/vim-ps1) (syntax, indent, ftplugin, ftdetect)
|
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin)
|
||||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
|
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
||||||
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin, ftdetect)
|
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin, ftdetect)
|
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
|
||||||
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftdetect)
|
- [purescript](https://github.com/raichoo/purescript-vim) (syntax, indent, ftplugin)
|
||||||
|
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||||
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
|
||||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin, ftdetect)
|
- [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)
|
||||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||||
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
|
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
||||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [rspec](https://github.com/sheerun/rspec.vim) (syntax)
|
||||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
|
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
||||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
|
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
|
||||||
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent, ftdetect)
|
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin)
|
||||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
|
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
||||||
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin, ftdetect)
|
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent)
|
||||||
- [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax, ftdetect)
|
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
||||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
|
||||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
|
||||||
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
|
- [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax)
|
||||||
|
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, ftplugin)
|
||||||
|
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
|
||||||
|
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
|
||||||
|
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin)
|
||||||
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
|
||||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
|
||||||
- [twig](https://github.com/evidens/vim-twig) (syntax, ftplugin)
|
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
|
||||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin)
|
||||||
- [vala](https://github.com/tkztmk/vim-vala) (syntax, indent, ftdetect)
|
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent)
|
||||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax, ftdetect)
|
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
|
||||||
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent, ftdetect)
|
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
|
||||||
|
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
|
||||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||||
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
|
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
|
||||||
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
||||||
|
|
||||||
## Disabling a language pack
|
## Updating
|
||||||
|
|
||||||
Individual language packs can be disabled by setting `g:polyglot_disabled`.
|
You can either wait for new patch release with updates or run the `./build` script by yourself.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
Please make sure you have `syntax on` in your `.vimrc`, otherwise syntax files are not loaded at all.
|
||||||
|
|
||||||
|
Individual language packs can be disabled by setting `g:polyglot_disabled` as follows:
|
||||||
|
|
||||||
```viml
|
```viml
|
||||||
" ~/.vimrc
|
" ~/.vimrc
|
||||||
@@ -123,10 +156,6 @@ let g:polyglot_disabled = ['css']
|
|||||||
|
|
||||||
Note that disabiling languages won't make in general your vim startup any faster / slower (only for specific file type). Vim-polyglot is selection of language plugins that are loaded only on demand.
|
Note that disabiling languages won't make in general your vim startup any faster / slower (only for specific file type). Vim-polyglot is selection of language plugins that are loaded only on demand.
|
||||||
|
|
||||||
## Updating
|
|
||||||
|
|
||||||
You can either wait for new patch release with updates or run the `./build` script by yourself.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Language packs are periodically updated using automated `build` script.
|
Language packs are periodically updated using automated `build` script.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
||||||
|
|
||||||
setlocal comments=s1fl:{-,mb:-,ex:-},:--
|
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
|
||||||
setlocal iskeyword+='
|
setlocal iskeyword+='
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
16
after/ftplugin/javascript.vim
Normal file
16
after/ftplugin/javascript.vim
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: JavaScript
|
||||||
|
" Maintainer: vim-javascript community
|
||||||
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
|
|
||||||
|
setlocal iskeyword+=$ suffixesadd+=.js
|
||||||
|
|
||||||
|
if exists('b:undo_ftplugin')
|
||||||
|
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
|
||||||
|
else
|
||||||
|
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -5,7 +5,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
|||||||
"
|
"
|
||||||
" Language: JSX (JavaScript)
|
" Language: JSX (JavaScript)
|
||||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||||
" Depends: pangloss/vim-javascript
|
|
||||||
"
|
"
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|||||||
61
after/ftplugin/terraform.vim
Normal file
61
after/ftplugin/terraform.vim
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
||||||
|
|
||||||
|
if !exists('g:terraform_align')
|
||||||
|
let g:terraform_align = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:terraform_align && exists(':Tabularize')
|
||||||
|
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
|
||||||
|
function! s:terraformalign()
|
||||||
|
let p = '^.*=[^>]*$'
|
||||||
|
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
|
||||||
|
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
|
||||||
|
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
|
||||||
|
Tabularize/=/l1
|
||||||
|
normal! 0
|
||||||
|
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
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"
|
||||||
|
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()
|
||||||
|
|
||||||
|
"inoremap <space> <C-O>za
|
||||||
|
nnoremap <space> za
|
||||||
|
onoremap <space> <C-C>za
|
||||||
|
vnoremap <space> zf
|
||||||
|
|
||||||
|
" Match the identation put in place by Hashicorp and :TerraformFmt, https://github.com/hashivim/vim-terraform/issues/21
|
||||||
|
if get(g:, "terraform_align", 1)
|
||||||
|
setlocal tabstop=2
|
||||||
|
setlocal softtabstop=2
|
||||||
|
setlocal shiftwidth=2
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -20,7 +20,7 @@ setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
|
|||||||
|
|
||||||
function! GetCoffeeHtmlIndent(curlinenum)
|
function! GetCoffeeHtmlIndent(curlinenum)
|
||||||
" See if we're inside a coffeescript block.
|
" See if we're inside a coffeescript block.
|
||||||
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
|
let scriptlnum = searchpair('<script [^>]*type=[''"]\?text/coffeescript[''"]\?[^>]*>', '',
|
||||||
\ '</script>', 'bWn')
|
\ '</script>', 'bWn')
|
||||||
let prevlnum = prevnonblank(a:curlinenum)
|
let prevlnum = prevnonblank(a:curlinenum)
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
|||||||
"
|
"
|
||||||
" Language: JSX (JavaScript)
|
" Language: JSX (JavaScript)
|
||||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||||
" Depends: pangloss/vim-javascript
|
|
||||||
"
|
"
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Save the current JavaScript indentexpr.
|
||||||
|
let b:jsx_js_indentexpr = &indentexpr
|
||||||
|
|
||||||
" Prologue; load in XML indentation.
|
" Prologue; load in XML indentation.
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
let s:did_indent=b:did_indent
|
let s:did_indent=b:did_indent
|
||||||
@@ -51,19 +53,31 @@ fu! SynXMLish(syns)
|
|||||||
return SynAttrXMLish(get(a:syns, -1))
|
return SynAttrXMLish(get(a:syns, -1))
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
" Check if a synstack has any XMLish attribute.
|
|
||||||
fu! SynXMLishAny(syns)
|
|
||||||
for synattr in a:syns
|
|
||||||
if SynAttrXMLish(synattr)
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
endfu
|
|
||||||
|
|
||||||
" Check if a synstack denotes the end of a JSX block.
|
" Check if a synstack denotes the end of a JSX block.
|
||||||
fu! SynJSXBlockEnd(syns)
|
fu! SynJSXBlockEnd(syns)
|
||||||
return get(a:syns, -1) == 'jsBraces' && SynAttrXMLish(get(a:syns, -2))
|
return get(a:syns, -1) =~ '\%(js\|javascript\)Braces' &&
|
||||||
|
\ SynAttrXMLish(get(a:syns, -2))
|
||||||
|
endfu
|
||||||
|
|
||||||
|
" Determine how many jsxRegions deep a synstack is.
|
||||||
|
fu! SynJSXDepth(syns)
|
||||||
|
return len(filter(copy(a:syns), 'v:val ==# "jsxRegion"'))
|
||||||
|
endfu
|
||||||
|
|
||||||
|
" Check whether `cursyn' continues the same jsxRegion as `prevsyn'.
|
||||||
|
fu! SynJSXContinues(cursyn, prevsyn)
|
||||||
|
let curdepth = SynJSXDepth(a:cursyn)
|
||||||
|
let prevdepth = SynJSXDepth(a:prevsyn)
|
||||||
|
|
||||||
|
" In most places, we expect the nesting depths to be the same between any
|
||||||
|
" two consecutive positions within a jsxRegion (e.g., between a parent and
|
||||||
|
" child node, between two JSX attributes, etc.). The exception is between
|
||||||
|
" sibling nodes, where after a completed element (with depth N), we return
|
||||||
|
" to the parent's nesting (depth N - 1). This case is easily detected,
|
||||||
|
" since it is the only time when the top syntax element in the synstack is
|
||||||
|
" jsxRegion---specifically, the jsxRegion corresponding to the parent.
|
||||||
|
return prevdepth == curdepth ||
|
||||||
|
\ (prevdepth == curdepth + 1 && get(a:cursyn, -1) ==# 'jsxRegion')
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
" Cleverly mix JS and XML indentation.
|
" Cleverly mix JS and XML indentation.
|
||||||
@@ -71,9 +85,12 @@ fu! GetJsxIndent()
|
|||||||
let cursyn = SynSOL(v:lnum)
|
let cursyn = SynSOL(v:lnum)
|
||||||
let prevsyn = SynEOL(v:lnum - 1)
|
let prevsyn = SynEOL(v:lnum - 1)
|
||||||
|
|
||||||
" Use XML indenting if the syntax at the end of the previous line was either
|
" Use XML indenting iff:
|
||||||
" JSX or was the closing brace of a jsBlock whose parent syntax was JSX.
|
" - the syntax at the end of the previous line was either JSX or was the
|
||||||
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) && SynXMLishAny(cursyn)
|
" closing brace of a jsBlock whose parent syntax was JSX; and
|
||||||
|
" - the current line continues the same jsxRegion as the previous line.
|
||||||
|
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) &&
|
||||||
|
\ SynJSXContinues(cursyn, prevsyn)
|
||||||
let ind = XmlIndentGet(v:lnum, 0)
|
let ind = XmlIndentGet(v:lnum, 0)
|
||||||
|
|
||||||
" Align '/>' and '>' with '<' for multiline tags.
|
" Align '/>' and '>' with '<' for multiline tags.
|
||||||
@@ -86,7 +103,13 @@ fu! GetJsxIndent()
|
|||||||
let ind = ind + &sw
|
let ind = ind + &sw
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let ind = GetJavascriptIndent()
|
if len(b:jsx_js_indentexpr)
|
||||||
|
" Invoke the base JS package's custom indenter. (For vim-javascript,
|
||||||
|
" e.g., this will be GetJavascriptIndent().)
|
||||||
|
let ind = eval(b:jsx_js_indentexpr)
|
||||||
|
else
|
||||||
|
let ind = cindent(v:lnum)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
|||||||
@@ -24,6 +24,16 @@ syn match cCustomParen "(" 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
|
||||||
|
|
||||||
|
" -----------------------------------------------------------------------------
|
||||||
|
" Highlight member variable names.
|
||||||
|
" -----------------------------------------------------------------------------
|
||||||
|
if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
||||||
|
syn match cCustomDot "\." contained
|
||||||
|
syn match cCustomPtr "->" contained
|
||||||
|
syn match cCustomMemVar "\(\.\|->\)\w\+" contains=cCustomDot,cCustomPtr
|
||||||
|
hi def link cCustomMemVar Function
|
||||||
|
endif
|
||||||
|
|
||||||
" -----------------------------------------------------------------------------
|
" -----------------------------------------------------------------------------
|
||||||
" Source: aftersyntaxc.vim
|
" Source: aftersyntaxc.vim
|
||||||
" -----------------------------------------------------------------------------
|
" -----------------------------------------------------------------------------
|
||||||
|
|||||||
1513
after/syntax/cpp.vim
1513
after/syntax/cpp.vim
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
|
|||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
" URL: http://github.com/kchmck/vim-coffee-script
|
||||||
" License: WTFPL
|
" License: WTFPL
|
||||||
|
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax_save = b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
||||||
" priority than hamlInterpolation.
|
" priority than hamlInterpolation.
|
||||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
||||||
@@ -14,4 +19,9 @@ syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
|||||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
\ contains=@hamlCoffeeScript,hamlInterpolation
|
||||||
\ keepend
|
\ keepend
|
||||||
|
|
||||||
|
if exists('s:current_syntax_save')
|
||||||
|
let b:current_syntax = s:current_syntax_save
|
||||||
|
unlet s:current_syntax_save
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,13 +5,22 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script')
|
|||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
" URL: http://github.com/kchmck/vim-coffee-script
|
||||||
" License: WTFPL
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax_save = b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" Syntax highlighting for text/coffeescript script tags
|
" Syntax highlighting for text/coffeescript script tags
|
||||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
syn include @htmlCoffeeScript syntax/coffee.vim
|
||||||
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
syn region coffeeScript start=#<script [^>]*type=['"]\?text/coffeescript['"]\?[^>]*>#
|
||||||
\ end=#</script>#me=s-1 keepend
|
\ end=#</script>#me=s-1 keepend
|
||||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
||||||
\ containedin=htmlHead
|
\ containedin=htmlHead
|
||||||
|
|
||||||
|
if exists('s:current_syntax_save')
|
||||||
|
let b:current_syntax = s:current_syntax_save
|
||||||
|
unlet s:current_syntax_save
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||||
|
|
||||||
@@ -25,6 +34,22 @@ syn region ShaderScript
|
|||||||
\ end="</script>"me=s-1
|
\ end="</script>"me=s-1
|
||||||
\ contains=@GLSL,htmlScriptTag,@htmlPreproc
|
\ contains=@GLSL,htmlScriptTag,@htmlPreproc
|
||||||
|
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: HTML (version 5.1)
|
||||||
|
" Last Change: 2017 Feb 15
|
||||||
|
" License: Public domain
|
||||||
|
" (but let me know if you like :) )
|
||||||
|
"
|
||||||
|
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||||
|
|
||||||
|
" Comment
|
||||||
|
" https://github.com/w3c/html/issues/694
|
||||||
|
syntax region htmlComment start=+<!--+ end=+-->+ contains=@Spell
|
||||||
|
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
|||||||
" preceding it, to avoid conflicts with, respectively, the left shift operator
|
" preceding it, to avoid conflicts with, respectively, the left shift operator
|
||||||
" and generic Flow type annotations (http://flowtype.org/).
|
" and generic Flow type annotations (http://flowtype.org/).
|
||||||
syn region jsxRegion
|
syn region jsxRegion
|
||||||
\ contains=@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
||||||
\ skip=+<!--\_.\{-}-->+
|
\ skip=+<!--\_.\{-}-->+
|
||||||
\ end=+</\z1\_\s\{-}>+
|
\ end=+</\z1\_\s\{-}>+
|
||||||
|
|||||||
107
after/syntax/mma.vim
Normal file
107
after/syntax/mma.vim
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
|
||||||
|
|
||||||
|
"Vim conceal file
|
||||||
|
" Language: Mathematica
|
||||||
|
" Maintainer: R. Menon <rsmenon@icloud.com>
|
||||||
|
" Last Change: Feb 25, 2013
|
||||||
|
|
||||||
|
if (exists('g:mma_candy') && g:mma_candy == 0) || !has('conceal') || &enc != 'utf-8'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
"These are fairly safe and straightforward conceals
|
||||||
|
if exists('g:mma_candy') && g:mma_candy > 0
|
||||||
|
"Rules
|
||||||
|
syntax match mmaOperator "->" conceal cchar=→ "Rule
|
||||||
|
syntax match mmaOperator ":>" conceal cchar=⧴ "RuleDelayed
|
||||||
|
|
||||||
|
"Logicals
|
||||||
|
syntax match mmaOperator "===" conceal cchar=≡ "SameQ
|
||||||
|
syntax match mmaOperator "=!=" conceal cchar=≢ "UnsameQ
|
||||||
|
syntax match mmaOperator "!=" conceal cchar=≠ "NotEqual
|
||||||
|
syntax match mmaOperator "<=" conceal cchar=≤ "LessEqual
|
||||||
|
syntax match mmaOperator ">=" conceal cchar=≥ "GreaterEqual
|
||||||
|
|
||||||
|
"Constants
|
||||||
|
syntax keyword mmaSystemSymbol Pi conceal cchar=π
|
||||||
|
syntax keyword mmaSystemSymbol Infinity conceal cchar=∞
|
||||||
|
syntax keyword mmaSystemSymbol Degree conceal cchar=°
|
||||||
|
|
||||||
|
"Domains
|
||||||
|
syntax keyword mmaSystemSymbol Reals conceal cchar=ℝ
|
||||||
|
syntax keyword mmaSystemSymbol Integers conceal cchar=ℤ
|
||||||
|
syntax keyword mmaSystemSymbol Complexes conceal cchar=ℂ
|
||||||
|
syntax keyword mmaSystemSymbol Rationals conceal cchar=ℚ
|
||||||
|
|
||||||
|
"Greek
|
||||||
|
syntax match mmaSymbol "\\\[CapitalAlpha\]" conceal cchar=Α
|
||||||
|
syntax match mmaSymbol "\\\[CapitalBeta\]" conceal cchar=Β
|
||||||
|
syntax match mmaSymbol "\\\[CapitalGamma\]" conceal cchar=Γ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalDelta\]" conceal cchar=Δ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalEpsilon\]" conceal cchar=Ε
|
||||||
|
syntax match mmaSymbol "\\\[CapitalZeta\]" conceal cchar=Ζ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalEta\]" conceal cchar=Η
|
||||||
|
syntax match mmaSymbol "\\\[CapitalTheta\]" conceal cchar=Θ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalIota\]" conceal cchar=Ι
|
||||||
|
syntax match mmaSymbol "\\\[CapitalKappa\]" conceal cchar=Κ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalLambda\]" conceal cchar=Λ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalMu\]" conceal cchar=Μ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalNu\]" conceal cchar=Ν
|
||||||
|
syntax match mmaSymbol "\\\[CapitalXi\]" conceal cchar=Ξ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalOmicron\]" conceal cchar=Ο
|
||||||
|
syntax match mmaSymbol "\\\[CapitalPi\]" conceal cchar=Π
|
||||||
|
syntax match mmaSymbol "\\\[CapitalRho\]" conceal cchar=Ρ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalSigma\]" conceal cchar=Σ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalTau\]" conceal cchar=Τ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalUpsilon\]" conceal cchar=Υ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalPhi\]" conceal cchar=Φ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalChi\]" conceal cchar=Χ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalPsi\]" conceal cchar=Ψ
|
||||||
|
syntax match mmaSymbol "\\\[CapitalOmega\]" conceal cchar=Ω
|
||||||
|
syntax match mmaSymbol "\\\[Alpha\]" conceal cchar=α
|
||||||
|
syntax match mmaSymbol "\\\[Beta\]" conceal cchar=β
|
||||||
|
syntax match mmaSymbol "\\\[Gamma\]" conceal cchar=γ
|
||||||
|
syntax match mmaSymbol "\\\[Delta\]" conceal cchar=δ
|
||||||
|
syntax match mmaSymbol "\\\[Epsilon\]" conceal cchar=ε
|
||||||
|
syntax match mmaSymbol "\\\[Zeta\]" conceal cchar=ζ
|
||||||
|
syntax match mmaSymbol "\\\[Eta\]" conceal cchar=η
|
||||||
|
syntax match mmaSymbol "\\\[Theta\]" conceal cchar=θ
|
||||||
|
syntax match mmaSymbol "\\\[Iota\]" conceal cchar=ι
|
||||||
|
syntax match mmaSymbol "\\\[Kappa\]" conceal cchar=κ
|
||||||
|
syntax match mmaSymbol "\\\[Lambda\]" conceal cchar=λ
|
||||||
|
syntax match mmaSymbol "\\\[Mu\]" conceal cchar=μ
|
||||||
|
syntax match mmaSymbol "\\\[Nu\]" conceal cchar=ν
|
||||||
|
syntax match mmaSymbol "\\\[Xi\]" conceal cchar=ξ
|
||||||
|
syntax match mmaSymbol "\\\[Omicron\]" conceal cchar=ο
|
||||||
|
syntax match mmaSymbol "\\\[Pi\]" conceal cchar=π
|
||||||
|
syntax match mmaSymbol "\\\[Rho\]" conceal cchar=ρ
|
||||||
|
syntax match mmaSymbol "\\\[Sigma\]" conceal cchar=σ
|
||||||
|
syntax match mmaSymbol "\\\[Tau\]" conceal cchar=τ
|
||||||
|
syntax match mmaSymbol "\\\[Upsilon\]" conceal cchar=υ
|
||||||
|
syntax match mmaSymbol "\\\[Phi\]" conceal cchar=φ
|
||||||
|
syntax match mmaSymbol "\\\[Chi\]" conceal cchar=χ
|
||||||
|
syntax match mmaSymbol "\\\[Psi\]" conceal cchar=ψ
|
||||||
|
syntax match mmaSymbol "\\\[Omega\]" conceal cchar=ω
|
||||||
|
endif
|
||||||
|
|
||||||
|
"These might be troublesome if the appropriate fonts are missing. Also, they don't
|
||||||
|
"look quite as good as the earlier ones, so enable only if the user chooses to
|
||||||
|
if exists('g:mma_candy') && g:mma_candy == 2
|
||||||
|
"Constants
|
||||||
|
syntax keyword mmaSystemSymbol I conceal cchar=ⅈ
|
||||||
|
syntax keyword mmaSystemSymbol E conceal cchar=ⅇ
|
||||||
|
|
||||||
|
"Functions
|
||||||
|
syntax keyword mmaSystemSymbol Sum conceal cchar=∑
|
||||||
|
syntax keyword mmaSystemSymbol Product conceal cchar=∏
|
||||||
|
syntax keyword mmaSystemSymbol Sqrt conceal cchar=√
|
||||||
|
|
||||||
|
"Misc
|
||||||
|
syntax match mmaOperator ">>" conceal cchar=» "Put
|
||||||
|
syntax match mmaOperator "<<" conceal cchar=« "Get
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi! link Conceal Normal
|
||||||
|
setlocal conceallevel=2
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -28,8 +28,11 @@ endif
|
|||||||
|
|
||||||
hi link rustNiceOperator Operator
|
hi link rustNiceOperator Operator
|
||||||
|
|
||||||
if !exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0
|
if !(exists('g:rust_conceal_mod_path') && g:rust_conceal_mod_path != 0)
|
||||||
hi! link Conceal Operator
|
hi! link Conceal Operator
|
||||||
|
|
||||||
|
" And keep it after a colorscheme change
|
||||||
|
au ColorScheme <buffer> hi! link Conceal Operator
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ if version < 600
|
|||||||
endif
|
endif
|
||||||
syntax clear
|
syntax clear
|
||||||
|
|
||||||
syn match yamlDelimiter "[:,-]"
|
|
||||||
syn match yamlBlock "[\[\]\{\}\|\>]"
|
syn match yamlBlock "[\[\]\{\}\|\>]"
|
||||||
syn match yamlOperator "[?^+-]\|=>"
|
|
||||||
|
|
||||||
syn region yamlComment start="\#" end="$"
|
syn region yamlComment start="\#" end="$"
|
||||||
syn match yamlIndicator "#YAML:\S\+"
|
syn match yamlIndicator "#YAML:\S\+"
|
||||||
@@ -40,11 +38,12 @@ syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil
|
|||||||
syn keyword yamlConstant TRUE True true YES Yes yes ON On on
|
syn keyword yamlConstant TRUE True true YES Yes yes ON On on
|
||||||
syn keyword yamlConstant FALSE False false NO No no OFF Off off
|
syn keyword yamlConstant FALSE False false NO No no OFF Off off
|
||||||
|
|
||||||
syn match yamlKey "\w\+\ze\s*:"
|
syn match yamlKey "^\s*\zs[^ \t\"]\+\ze\s*:"
|
||||||
|
syn match yamlKey "^\s*-\s*\zs[^ \t\"]\+\ze\s*:"
|
||||||
syn match yamlAnchor "&\S\+"
|
syn match yamlAnchor "&\S\+"
|
||||||
syn match yamlAlias "*\S\+"
|
syn match yamlAlias "*\S\+"
|
||||||
|
|
||||||
" Setupt the hilighting links
|
" Setup the highlighting links
|
||||||
|
|
||||||
hi link yamlConstant Keyword
|
hi link yamlConstant Keyword
|
||||||
hi link yamlIndicator PreCondit
|
hi link yamlIndicator PreCondit
|
||||||
@@ -55,10 +54,7 @@ hi link yamlType Type
|
|||||||
|
|
||||||
hi link yamlComment Comment
|
hi link yamlComment Comment
|
||||||
hi link yamlBlock Operator
|
hi link yamlBlock Operator
|
||||||
hi link yamlOperator Operator
|
|
||||||
hi link yamlDelimiter Delimiter
|
|
||||||
hi link yamlString String
|
hi link yamlString String
|
||||||
hi link yamlEscape Special
|
hi link yamlEscape Special
|
||||||
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -20,18 +20,20 @@ endfunction
|
|||||||
|
|
||||||
function! dart#fmt(q_args) abort
|
function! dart#fmt(q_args) abort
|
||||||
if executable('dartfmt')
|
if executable('dartfmt')
|
||||||
let path = expand('%:p:gs:\:/:')
|
let buffer_content = join(getline(1, '$'), "\n")
|
||||||
if filereadable(path)
|
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
|
||||||
let joined_lines = system(printf('dartfmt %s %s', a:q_args, shellescape(path)))
|
|
||||||
if 0 == v:shell_error
|
if 0 == v:shell_error
|
||||||
|
let win_view = winsaveview()
|
||||||
silent % delete _
|
silent % delete _
|
||||||
silent put=joined_lines
|
silent put=joined_lines
|
||||||
silent 1 delete _
|
silent 1 delete _
|
||||||
|
call winrestview(win_view)
|
||||||
else
|
else
|
||||||
call s:cexpr('line %l\, column %c of %f: %m', joined_lines)
|
let errors = split(joined_lines, "\n")[2:]
|
||||||
endif
|
let file_path = expand('%')
|
||||||
else
|
call map(errors, 'file_path.":".v:val')
|
||||||
call s:error(printf('cannot read a file: "%s"', path))
|
let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#'
|
||||||
|
call s:cexpr(error_format, join(errors, "\n"))
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call s:error('cannot execute binary file: dartfmt')
|
call s:error('cannot execute binary file: dartfmt')
|
||||||
@@ -66,5 +68,86 @@ function! dart#tojs(q_args) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Finds the path to `uri`.
|
||||||
|
"
|
||||||
|
" If the file is a package: uri, looks for a .packages file to resolve the path.
|
||||||
|
" If the path cannot be resolved, or is not a package: uri, returns the
|
||||||
|
" original.
|
||||||
|
function! dart#resolveUri(uri) abort
|
||||||
|
if a:uri !~ 'package:'
|
||||||
|
return a:uri
|
||||||
|
endif
|
||||||
|
let package_name = substitute(a:uri, 'package:\(\w\+\)\/.*', '\1', '')
|
||||||
|
let [found, package_map] = s:PackageMap()
|
||||||
|
if !found
|
||||||
|
call s:error('cannot find .packages file')
|
||||||
|
return a:uri
|
||||||
|
endif
|
||||||
|
if !has_key(package_map, package_name)
|
||||||
|
call s:error('no package mapping for '.package_name)
|
||||||
|
return a:uri
|
||||||
|
endif
|
||||||
|
let package_lib = package_map[package_name]
|
||||||
|
return substitute(a:uri,
|
||||||
|
\ 'package:'.package_name,
|
||||||
|
\ escape(package_map[package_name], '\'),
|
||||||
|
\ '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" A map from package name to lib directory parse from a '.packages' file.
|
||||||
|
"
|
||||||
|
" Returns [found, package_map]
|
||||||
|
function! s:PackageMap() abort
|
||||||
|
let [found, dot_packages] = s:DotPackagesFile()
|
||||||
|
if !found
|
||||||
|
return [v:false, {}]
|
||||||
|
endif
|
||||||
|
let dot_packages_dir = fnamemodify(dot_packages, ':p:h')
|
||||||
|
let lines = readfile(dot_packages)
|
||||||
|
let map = {}
|
||||||
|
for line in lines
|
||||||
|
if line =~ '\s*#'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
let package = substitute(line, ':.*$', '', '')
|
||||||
|
let lib_dir = substitute(line, '^[^:]*:', '', '')
|
||||||
|
if lib_dir =~ 'file:/'
|
||||||
|
let lib_dir = substitute(lib_dir, 'file://', '', '')
|
||||||
|
if lib_dir =~ '/[A-Z]:/'
|
||||||
|
let lib_dir = lib_dir[1:]
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let lib_dir = resolve(dot_packages_dir.'/'.lib_dir)
|
||||||
|
endif
|
||||||
|
if lib_dir =~ '/$'
|
||||||
|
let lib_dir = lib_dir[:len(lib_dir) - 2]
|
||||||
|
endif
|
||||||
|
let map[package] = lib_dir
|
||||||
|
endfor
|
||||||
|
return [v:true, map]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Finds a file name '.packages' in the cwd, or in any directory above the open
|
||||||
|
" file.
|
||||||
|
"
|
||||||
|
" Returns [found, file].
|
||||||
|
function! s:DotPackagesFile() abort
|
||||||
|
if filereadable('.packages')
|
||||||
|
return [v:true, '.packages']
|
||||||
|
endif
|
||||||
|
let dir_path = expand('%:p:h')
|
||||||
|
while v:true
|
||||||
|
let file_path = dir_path.'/.packages'
|
||||||
|
if filereadable(file_path)
|
||||||
|
return [v:true, file_path]
|
||||||
|
endif
|
||||||
|
let parent = fnamemodify(dir_path, ':h')
|
||||||
|
if dir_path == parent
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let dir_path = parent
|
||||||
|
endwhile
|
||||||
|
return [v:false, '']
|
||||||
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
347
autoload/elixir/indent.vim
Normal file
347
autoload/elixir/indent.vim
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
|
function! elixir#indent#debug(str)
|
||||||
|
if exists("g:elixir_indent_debug") && g:elixir_indent_debug
|
||||||
|
echom a:str
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns 0 or 1 based on whether or not the text starts with the given
|
||||||
|
" expression and is not a string or comment
|
||||||
|
function! elixir#indent#starts_with(text, expr, lnum)
|
||||||
|
let pos = match(a:text, '^\s*'.a:expr)
|
||||||
|
if pos == -1
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
" NOTE: @jbodah 2017-02-24: pos is the index of the match which is
|
||||||
|
" zero-indexed. Add one to make it the column number
|
||||||
|
if elixir#indent#is_string_or_comment(a:lnum, pos + 1)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns 0 or 1 based on whether or not the text ends with the given
|
||||||
|
" expression and is not a string or comment
|
||||||
|
function! elixir#indent#ends_with(text, expr, lnum)
|
||||||
|
let pos = match(a:text, a:expr.'\s*$')
|
||||||
|
if pos == -1
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
if elixir#indent#is_string_or_comment(a:lnum, pos)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns 0 or 1 based on whether or not the text matches the given expression
|
||||||
|
function! elixir#indent#contains(text, expr)
|
||||||
|
return a:text =~ a:expr
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Returns 0 or 1 based on whether or not the given line number and column
|
||||||
|
" number pair is a string or comment
|
||||||
|
function! elixir#indent#is_string_or_comment(line, col)
|
||||||
|
return synIDattr(synID(a:line, a:col, 1), "name") =~ '\%(String\|Comment\)'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Skip expression for searchpair. Returns 0 or 1 based on whether the value
|
||||||
|
" under the cursor is a string or comment
|
||||||
|
function! elixir#indent#searchpair_back_skip()
|
||||||
|
" NOTE: @jbodah 2017-02-27: for some reason this function gets called with
|
||||||
|
" and index that doesn't exist in the line sometimes. Detect and account for
|
||||||
|
" that situation
|
||||||
|
let curr_col = col('.')
|
||||||
|
if getline('.')[curr_col-1] == ''
|
||||||
|
let curr_col = curr_col-1
|
||||||
|
endif
|
||||||
|
return elixir#indent#is_string_or_comment(line('.'), curr_col)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DRY up searchpair calls
|
||||||
|
function! elixir#indent#searchpair_back(start, mid, end)
|
||||||
|
let line = line('.')
|
||||||
|
return searchpair(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DRY up searchpairpos calls
|
||||||
|
function! elixir#indent#searchpairpos_back(start, mid, end)
|
||||||
|
let line = line('.')
|
||||||
|
return searchpairpos(a:start, a:mid, a:end, 'bnW', "line('.') == " . line . " || elixir#indent#searchpair_back_skip()")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" DRY up regex for keywords that 1) makes sure we only look at complete words
|
||||||
|
" and 2) ignores atoms
|
||||||
|
function! elixir#indent#keyword(expr)
|
||||||
|
return ':\@<!\<\C\%('.a:expr.'\)\>:\@!'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#starts_with_comment(text)
|
||||||
|
return match(a:text, '^\s*#') != -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Start at the end of text and search backwards looking for a match. Also peek
|
||||||
|
" ahead if we get a match to make sure we get a complete match. This means
|
||||||
|
" that the result should be the position of the start of the right-most match
|
||||||
|
function! elixir#indent#find_last_pos(lnum, text, match)
|
||||||
|
let last = len(a:text) - 1
|
||||||
|
let c = last
|
||||||
|
|
||||||
|
while c >= 0
|
||||||
|
let substr = strpart(a:text, c, last)
|
||||||
|
let peek = strpart(a:text, c - 1, last)
|
||||||
|
let ss_match = match(substr, a:match)
|
||||||
|
if ss_match != -1
|
||||||
|
let peek_match = match(peek, a:match)
|
||||||
|
if peek_match == ss_match + 1
|
||||||
|
let syng = synIDattr(synID(a:lnum, c + ss_match, 1), 'name')
|
||||||
|
if syng !~ '\%(String\|Comment\)'
|
||||||
|
return c + ss_match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
let c -= 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_top_of_file(_lnum, _text, prev_nb_lnum, _prev_nb_text)
|
||||||
|
if a:prev_nb_lnum == 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" TODO: @jbodah 2017-03-31: remove
|
||||||
|
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if elixir#indent#ends_with(a:prev_nb_text, elixir#indent#keyword('do'), a:prev_nb_lnum)
|
||||||
|
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
else
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||||
|
|
||||||
|
if elixir#indent#ends_with(a:prev_nb_text, binary_operator, a:prev_nb_lnum)
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_pipe(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if elixir#indent#starts_with(a:text, '|>', a:lnum)
|
||||||
|
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||||
|
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
||||||
|
if pos == -1
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
else
|
||||||
|
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
||||||
|
if next_word_pos == -1
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
else
|
||||||
|
return pos + 1 + next_word_pos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_comment(_lnum, text, prev_nb_lnum, _prev_nb_text)
|
||||||
|
if elixir#indent#starts_with_comment(a:text)
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_end(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||||
|
if elixir#indent#starts_with(a:text, elixir#indent#keyword('end'), a:lnum)
|
||||||
|
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end').'\zs')
|
||||||
|
return indent(pair_lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_mid_or_end_block_keyword(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||||
|
if elixir#indent#starts_with(a:text, elixir#indent#keyword('catch\|rescue\|after\|else'), a:lnum)
|
||||||
|
let pair_lnum = elixir#indent#searchpair_back(elixir#indent#keyword('with\|receive\|try\|if\|fn'), elixir#indent#keyword('catch\|rescue\|after\|else').'\zs', elixir#indent#keyword('end'))
|
||||||
|
return indent(pair_lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_close_bracket(lnum, text, _prev_nb_lnum, _prev_nb_text)
|
||||||
|
if elixir#indent#starts_with(a:text, '\%(\]\|}\|)\)', a:lnum)
|
||||||
|
let pair_lnum = elixir#indent#searchpair_back('\%(\[\|{\|(\)', '', '\%(\]\|}\|)\)')
|
||||||
|
return indent(pair_lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'
|
||||||
|
|
||||||
|
if elixir#indent#starts_with(a:text, binary_operator, a:lnum)
|
||||||
|
let match_operator = '\%(!\|=\|<\|>\)\@<!=\%(=\|>\|\~\)\@!'
|
||||||
|
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, match_operator)
|
||||||
|
if pos == -1
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
else
|
||||||
|
let next_word_pos = match(strpart(a:prev_nb_text, pos+1, len(a:prev_nb_text)-1), '\S')
|
||||||
|
if next_word_pos == -1
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
else
|
||||||
|
return pos + 1 + next_word_pos
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" To handle nested structures properly we need to find the innermost
|
||||||
|
" nested structure. For example, we might be in a function in a map in a
|
||||||
|
" function, etc... so we need to first figure out what the innermost structure
|
||||||
|
" is then forward execution to the proper handler
|
||||||
|
function! elixir#indent#handle_inside_nested_construct(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
let start_pattern = '\C\%(\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
|
||||||
|
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
|
||||||
|
let pair_info = elixir#indent#searchpairpos_back(start_pattern, '', end_pattern)
|
||||||
|
let pair_lnum = pair_info[0]
|
||||||
|
let pair_col = pair_info[1]
|
||||||
|
if pair_lnum != 0 || pair_col != 0
|
||||||
|
let pair_text = getline(pair_lnum)
|
||||||
|
let pair_char = pair_text[pair_col - 1]
|
||||||
|
if pair_char == 'f'
|
||||||
|
call elixir#indent#debug("testing elixir#indent#do_handle_inside_fn")
|
||||||
|
return elixir#indent#do_handle_inside_fn(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||||
|
elseif pair_char == '['
|
||||||
|
call elixir#indent#debug("testing elixir#indent#do_handle_inside_square_brace")
|
||||||
|
return elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||||
|
elseif pair_char == '{'
|
||||||
|
call elixir#indent#debug("testing elixir#indent#do_handle_inside_curly_brace")
|
||||||
|
return elixir#indent#do_handle_inside_curly_brace(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||||
|
elseif pair_char == '('
|
||||||
|
call elixir#indent#debug("testing elixir#indent#do_handle_inside_parens")
|
||||||
|
return elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||||
|
else
|
||||||
|
call elixir#indent#debug("testing elixir#indent#do_handle_inside_keyword_block")
|
||||||
|
return elixir#indent#do_handle_inside_keyword_block(pair_lnum, pair_col, a:lnum, a:text, a:prev_nb_lnum, a:prev_nb_text)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#do_handle_inside_keyword_block(pair_lnum, _pair_col, _lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
let keyword_pattern = '\C\%(\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<after\>\|\<catch\>\|\<rescue\>\|\<else\>\)'
|
||||||
|
if a:pair_lnum
|
||||||
|
" last line is a "receive" or something
|
||||||
|
if elixir#indent#starts_with(a:prev_nb_text, keyword_pattern, a:prev_nb_lnum)
|
||||||
|
call elixir#indent#debug("prev nb line is keyword")
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
elseif elixir#indent#contains(a:text, '->')
|
||||||
|
call elixir#indent#debug("contains ->")
|
||||||
|
" TODO: @jbodah 2017-03-31: test contains ignores str + comments
|
||||||
|
return indent(a:pair_lnum) + &sw
|
||||||
|
elseif elixir#indent#contains(a:prev_nb_text, '->')
|
||||||
|
call elixir#indent#debug("prev nb line contains ->")
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
else
|
||||||
|
call elixir#indent#debug("doesnt start with comment or contain ->")
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#do_handle_inside_fn(pair_lnum, _pair_col, lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if a:pair_lnum && a:pair_lnum != a:lnum
|
||||||
|
if elixir#indent#contains(a:text, '->')
|
||||||
|
return indent(a:pair_lnum) + &sw
|
||||||
|
else
|
||||||
|
if elixir#indent#ends_with(a:prev_nb_text, '->', a:prev_nb_lnum)
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
else
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#do_handle_inside_square_brace(pair_lnum, pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
|
||||||
|
" If in list...
|
||||||
|
if a:pair_lnum != 0 || a:pair_col != 0
|
||||||
|
let pair_text = getline(a:pair_lnum)
|
||||||
|
let substr = strpart(pair_text, a:pair_col, len(pair_text)-1)
|
||||||
|
let indent_pos = match(substr, '\S')
|
||||||
|
if indent_pos != -1
|
||||||
|
return indent_pos + a:pair_col
|
||||||
|
else
|
||||||
|
return indent(a:pair_lnum) + &sw
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#do_handle_inside_curly_brace(pair_lnum, _pair_col, _lnum, _text, _prev_nb_lnum, _prev_nb_text)
|
||||||
|
return indent(a:pair_lnum) + &sw
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#do_handle_inside_parens(pair_lnum, pair_col, _lnum, _text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if a:pair_lnum
|
||||||
|
if elixir#indent#ends_with(a:prev_nb_text, '(', a:prev_nb_lnum)
|
||||||
|
return indent(a:prev_nb_lnum) + &sw
|
||||||
|
elseif a:pair_lnum == a:prev_nb_lnum
|
||||||
|
" Align indent (e.g. "def add(a,")
|
||||||
|
let pos = elixir#indent#find_last_pos(a:prev_nb_lnum, a:prev_nb_text, '[^(]\+,')
|
||||||
|
if pos == -1
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return pos
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return indent(a:prev_nb_lnum)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_inside_generic_block(lnum, _text, prev_nb_lnum, prev_nb_text)
|
||||||
|
let pair_lnum = searchpair(elixir#indent#keyword('do\|fn'), '', elixir#indent#keyword('end'), 'bW', "line('.') == ".a:lnum." || elixir#indent#is_string_or_comment(line('.'), col('.'))")
|
||||||
|
if pair_lnum
|
||||||
|
" TODO: @jbodah 2017-03-29: this should probably be the case in *all*
|
||||||
|
" blocks
|
||||||
|
if elixir#indent#ends_with(a:prev_nb_text, ',', a:prev_nb_lnum)
|
||||||
|
return indent(pair_lnum) + 2 * &sw
|
||||||
|
else
|
||||||
|
return indent(pair_lnum) + &sw
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
28
autoload/elixir/util.vim
Normal file
28
autoload/elixir/util.vim
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
|
function! elixir#util#get_filename(word) abort
|
||||||
|
let word = a:word
|
||||||
|
|
||||||
|
" get first thing that starts uppercase, until the first space or end of line
|
||||||
|
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
|
||||||
|
|
||||||
|
" remove any trailing characters that don't look like a nested module
|
||||||
|
let word = substitute(word,'\.\U.*$','','g')
|
||||||
|
|
||||||
|
" replace module dots with slash
|
||||||
|
let word = substitute(word,'\.','/','g')
|
||||||
|
|
||||||
|
" remove any special chars
|
||||||
|
let word = substitute(word,'[^A-z0-9-_/]','','g')
|
||||||
|
|
||||||
|
" convert to snake_case
|
||||||
|
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||||
|
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||||
|
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
|
||||||
|
let word = substitute(word,'-','_','g')
|
||||||
|
let word = tolower(word)
|
||||||
|
|
||||||
|
return word
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -6,7 +6,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
|||||||
" Last Change: 2006 Oct 19
|
" Last Change: 2006 Oct 19
|
||||||
" Modified: othree <othree@gmail.com>
|
" Modified: othree <othree@gmail.com>
|
||||||
" Changes: Add HTML5, WAI-ARIA support
|
" Changes: Add HTML5, WAI-ARIA support
|
||||||
" Last Change: 2010 Sep 25
|
" Last Change: 2016 Oct 11
|
||||||
|
|
||||||
if !exists('g:aria_attributes_complete')
|
if !exists('g:aria_attributes_complete')
|
||||||
let g:aria_attributes_complete = 1
|
let g:aria_attributes_complete = 1
|
||||||
@@ -276,7 +276,9 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
|||||||
" 1. Events attributes
|
" 1. Events attributes
|
||||||
if context =~ '\s'
|
if context =~ '\s'
|
||||||
" Sort out style, class, and on* cases
|
" Sort out style, class, and on* cases
|
||||||
if context =~? "\\s\\(on[a-z]+\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
|
if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
|
||||||
|
\ || context =~? "style\\s*=\\s*[\"'][^\"']*$"
|
||||||
|
\ || context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
|
||||||
" Id, class completion {{{
|
" Id, class completion {{{
|
||||||
if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
|
if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
|
||||||
if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
|
if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
|
||||||
|
|||||||
21
autoload/python/utils.vim
Normal file
21
autoload/python/utils.vim
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
|
" Sometimes Python issues debugging messages
|
||||||
|
" which don't belong to a call stack context
|
||||||
|
" this function filters these messages
|
||||||
|
function! python#utils#fix_qflist() " {{{
|
||||||
|
let l:traceback = []
|
||||||
|
let l:qflist = getqflist()
|
||||||
|
|
||||||
|
for l:item in l:qflist
|
||||||
|
if !empty(l:item.type)
|
||||||
|
call add(l:traceback, l:item)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !empty(l:traceback)
|
||||||
|
call setqflist(l:traceback)
|
||||||
|
endif
|
||||||
|
endfunction " }}}
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -198,7 +198,7 @@ function! rubycomplete#Complete(findstart, base)
|
|||||||
if c =~ '\w'
|
if c =~ '\w'
|
||||||
continue
|
continue
|
||||||
elseif ! c =~ '\.'
|
elseif ! c =~ '\.'
|
||||||
idx = -1
|
let idx = -1
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
@@ -589,13 +589,15 @@ class VimRubyCompletion
|
|||||||
# {{{ main completion code
|
# {{{ main completion code
|
||||||
def self.preload_rails
|
def self.preload_rails
|
||||||
a = VimRubyCompletion.new
|
a = VimRubyCompletion.new
|
||||||
require 'Thread'
|
if VIM::evaluate("has('nvim')") == 0
|
||||||
|
require 'thread'
|
||||||
Thread.new(a) do |b|
|
Thread.new(a) do |b|
|
||||||
begin
|
begin
|
||||||
b.load_rails
|
b.load_rails
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
a.load_rails
|
a.load_rails
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ function! s:RmDir(path)
|
|||||||
echoerr 'Attempted to delete protected path: ' . a:path
|
echoerr 'Attempted to delete protected path: ' . a:path
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
silent exe "!rm -rf " . shellescape(a:path)
|
return system("rm -rf " . shellescape(a:path))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
|
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
|
||||||
|
|||||||
@@ -22,21 +22,28 @@ endif
|
|||||||
|
|
||||||
let s:got_fmt_error = 0
|
let s:got_fmt_error = 0
|
||||||
|
|
||||||
function! rustfmt#Format()
|
function! s:RustfmtCommandRange(filename, line1, line2)
|
||||||
let l:curw = winsaveview()
|
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
|
||||||
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
|
return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg))
|
||||||
call writefile(getline(1, '$'), l:tmpname)
|
endfunction
|
||||||
|
|
||||||
let command = g:rustfmt_command . " --write-mode=overwrite "
|
function! s:RustfmtCommand(filename)
|
||||||
|
return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename)
|
||||||
|
endfunction
|
||||||
|
|
||||||
let out = systemlist(command . g:rustfmt_options . " " . shellescape(l:tmpname))
|
function! s:RunRustfmt(command, curw, tmpname)
|
||||||
|
if exists("*systemlist")
|
||||||
|
let out = systemlist(a:command)
|
||||||
|
else
|
||||||
|
let out = split(system(a:command), '\r\?\n')
|
||||||
|
endif
|
||||||
|
|
||||||
if v:shell_error == 0
|
if v:shell_error == 0 || v:shell_error == 3
|
||||||
" remove undo point caused via BufWritePre
|
" remove undo point caused via BufWritePre
|
||||||
try | silent undojoin | catch | endtry
|
try | silent undojoin | catch | endtry
|
||||||
|
|
||||||
" Replace current file with temp file, then reload buffer
|
" Replace current file with temp file, then reload buffer
|
||||||
call rename(l:tmpname, expand('%'))
|
call rename(a:tmpname, expand('%'))
|
||||||
silent edit!
|
silent edit!
|
||||||
let &syntax = &syntax
|
let &syntax = &syntax
|
||||||
|
|
||||||
@@ -74,10 +81,30 @@ function! rustfmt#Format()
|
|||||||
let s:got_fmt_error = 1
|
let s:got_fmt_error = 1
|
||||||
lwindow
|
lwindow
|
||||||
" We didn't use the temp file, so clean up
|
" We didn't use the temp file, so clean up
|
||||||
call delete(l:tmpname)
|
call delete(a:tmpname)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call winrestview(l:curw)
|
call winrestview(a:curw)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! rustfmt#FormatRange(line1, line2)
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
|
||||||
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
|
|
||||||
|
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
|
||||||
|
|
||||||
|
call s:RunRustfmt(command, l:curw, l:tmpname)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! rustfmt#Format()
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
|
||||||
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
|
|
||||||
|
let command = s:RustfmtCommand(l:tmpname)
|
||||||
|
|
||||||
|
call s:RunRustfmt(command, l:curw, l:tmpname)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
41
autoload/scss_indent.vim
Normal file
41
autoload/scss_indent.vim
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||||
|
|
||||||
|
" usage:
|
||||||
|
" set indentexpr=scss_indent#GetIndent(v:lnum)
|
||||||
|
fun! scss_indent#GetIndent(lnum)
|
||||||
|
" { -> increase indent
|
||||||
|
" } -> decrease indent
|
||||||
|
if a:lnum == 1
|
||||||
|
" start at 0 indentation
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" try to find last line ending with { or }
|
||||||
|
" ignoring // comments
|
||||||
|
let regex = '\([{}]\)\%(\/\/.*\)\?$'
|
||||||
|
let nr = search(regex, 'bnW')
|
||||||
|
if nr > 0
|
||||||
|
let last = indent(nr)
|
||||||
|
let m = matchlist(getline(nr), regex)
|
||||||
|
let m_curr = matchlist(getline(a:lnum), regex)
|
||||||
|
echoe string(m).string(m_curr)
|
||||||
|
if !empty(m_curr) && m_curr[1] == '}' && m[1] == '{'
|
||||||
|
" last was open, current is close, use same indent
|
||||||
|
return last
|
||||||
|
elseif !empty(m_curr) && m_curr[1] == '}' && m[1] == '}'
|
||||||
|
" } line and last line was }: decrease
|
||||||
|
return last - &sw
|
||||||
|
endif
|
||||||
|
if m[1] == '{'
|
||||||
|
" line after {: increase indent
|
||||||
|
return last + &sw
|
||||||
|
else
|
||||||
|
" line after } or { - same indent
|
||||||
|
return last
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -3,31 +3,220 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
|||||||
" Vim completion for WAI-ARIA data file
|
" Vim completion for WAI-ARIA data file
|
||||||
" Language: HTML + WAI-ARIA
|
" Language: HTML + WAI-ARIA
|
||||||
" Maintainer: othree <othree@gmail.com>
|
" Maintainer: othree <othree@gmail.com>
|
||||||
" Last Change: 2010 Sep 09
|
" Last Change: 2017 Mar 07
|
||||||
|
|
||||||
" WAI_ARIA: {{{
|
" WAI_ARIA: {{{
|
||||||
" Ref: http://www.w3.org/TR/wai-aria/
|
" Ref: https://www.w3.org/TR/wai-aria-1.1/
|
||||||
" Version: Draft 15 December 2009
|
" Version: W3C Candidate Recommendation 27 October 2016
|
||||||
|
|
||||||
let abstract_role = {}
|
let abstract_role = {}
|
||||||
let role_attributes = {}
|
let role_attributes = {}
|
||||||
let default_role = {}
|
let default_role = {}
|
||||||
|
|
||||||
" Ref: http://www.w3.org/TR/wai-aria/roles
|
" Ref: https://www.w3.org/TR/wai-aria-1.1/#roles_categorization
|
||||||
" Version: Draft 15 December 2009
|
" Version: W3C Candidate Recommendation 27 October 2016
|
||||||
let widget_role = ['alert', 'alertdialog', 'button', 'checkbox', 'combobox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'slider', 'spinbutton', 'status', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid']
|
let widget_role = [
|
||||||
let document_structure = ['article', 'columnheader', 'definition', 'directory', 'document', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'note', 'presentation', 'region', 'row', 'rowheader', 'separator']
|
\ 'alert',
|
||||||
let landmark_role = ['application', 'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'search']
|
\ 'alertdialog',
|
||||||
|
\ 'button',
|
||||||
|
\ 'checkbox',
|
||||||
|
\ 'combobox',
|
||||||
|
\ 'dialog',
|
||||||
|
\ 'gridcell',
|
||||||
|
\ 'link',
|
||||||
|
\ 'log',
|
||||||
|
\ 'marquee',
|
||||||
|
\ 'menuitem',
|
||||||
|
\ 'menuitemcheckbox',
|
||||||
|
\ 'menuitemradio',
|
||||||
|
\ 'option',
|
||||||
|
\ 'progressbar',
|
||||||
|
\ 'radio',
|
||||||
|
\ 'radiogroup',
|
||||||
|
\ 'scrollbar',
|
||||||
|
\ 'searchbox',
|
||||||
|
\ 'slider',
|
||||||
|
\ 'spinbutton',
|
||||||
|
\ 'status',
|
||||||
|
\ 'switch',
|
||||||
|
\ 'tab',
|
||||||
|
\ 'tabpanel',
|
||||||
|
\ 'textbox',
|
||||||
|
\ 'timer',
|
||||||
|
\ 'tooltip',
|
||||||
|
\ 'treeitem',
|
||||||
|
\ 'combobox',
|
||||||
|
\ 'grid',
|
||||||
|
\ 'listbox',
|
||||||
|
\ 'menu',
|
||||||
|
\ 'menubar',
|
||||||
|
\ 'radiogroup',
|
||||||
|
\ 'tablist',
|
||||||
|
\ 'tree',
|
||||||
|
\ 'treegrid'
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
let document_structure = [
|
||||||
|
\ 'article',
|
||||||
|
\ 'cell',
|
||||||
|
\ 'columnheader',
|
||||||
|
\ 'definition',
|
||||||
|
\ 'directory',
|
||||||
|
\ 'document',
|
||||||
|
\ 'feed',
|
||||||
|
\ 'figure',
|
||||||
|
\ 'group',
|
||||||
|
\ 'heading',
|
||||||
|
\ 'img',
|
||||||
|
\ 'list',
|
||||||
|
\ 'listitem',
|
||||||
|
\ 'math',
|
||||||
|
\ 'none',
|
||||||
|
\ 'note',
|
||||||
|
\ 'presentation',
|
||||||
|
\ 'region',
|
||||||
|
\ 'row',
|
||||||
|
\ 'rowheader',
|
||||||
|
\ 'separator',
|
||||||
|
\ 'table',
|
||||||
|
\ 'term'
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
let landmark_role = [
|
||||||
|
\ 'application',
|
||||||
|
\ 'banner',
|
||||||
|
\ 'complementary',
|
||||||
|
\ 'contentinfo',
|
||||||
|
\ 'form',
|
||||||
|
\ 'main',
|
||||||
|
\ 'navigation',
|
||||||
|
\ 'search'
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
" Ref: https://www.w3.org/TR/dpub-aria-1.0/
|
||||||
|
" Version: W3C Candidate Recommendation 15 December 2016
|
||||||
|
let dpub_role = [
|
||||||
|
\ 'dpub-abstract',
|
||||||
|
\ 'dpub-afterword',
|
||||||
|
\ 'dpub-appendix',
|
||||||
|
\ 'dpub-biblioentry',
|
||||||
|
\ 'dpub-bibliography',
|
||||||
|
\ 'dpub-biblioref',
|
||||||
|
\ 'dpub-chapter',
|
||||||
|
\ 'dpub-cover',
|
||||||
|
\ 'dpub-epilogue',
|
||||||
|
\ 'dpub-footnote',
|
||||||
|
\ 'dpub-footnotes',
|
||||||
|
\ 'dpub-foreword',
|
||||||
|
\ 'dpub-glossary',
|
||||||
|
\ 'dpub-glossdef',
|
||||||
|
\ 'dpub-glossref',
|
||||||
|
\ 'dpub-glossterm',
|
||||||
|
\ 'dpub-index',
|
||||||
|
\ 'dpub-locator',
|
||||||
|
\ 'dpub-noteref',
|
||||||
|
\ 'dpub-notice',
|
||||||
|
\ 'dpub-pagebreak',
|
||||||
|
\ 'dpub-pagelist',
|
||||||
|
\ 'dpub-part',
|
||||||
|
\ 'dpub-preface',
|
||||||
|
\ 'dpub-prologue',
|
||||||
|
\ 'dpub-pullquote',
|
||||||
|
\ 'dpub-qna',
|
||||||
|
\ 'dpub-subtitle',
|
||||||
|
\ 'dpub-tip',
|
||||||
|
\ 'dpub-title',
|
||||||
|
\ 'dpub-toc'
|
||||||
|
\ ]
|
||||||
|
|
||||||
let role = extend(widget_role, document_structure)
|
let role = extend(widget_role, document_structure)
|
||||||
let role = extend(role, landmark_role)
|
let role = extend(role, landmark_role)
|
||||||
|
let role = extend(role, dpub_role)
|
||||||
|
|
||||||
" http://www.w3.org/TR/wai-aria/states_and_properties#state_prop_taxonomy
|
" https://www.w3.org/TR/wai-aria-1.1/#states_and_properties
|
||||||
"let global_states_and_properties = {'aria-atomic': ['true', 'false'], 'aria-busy': ['true', 'false'], 'aria-controls': [], 'aria-describedby': [], 'aria-disabled': ['true', 'false'], 'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'], 'aria-flowto': [], 'aria-grabbed': ['true', 'false', 'undefined'], 'aria-haspopup': ['true', 'false'], 'aria-hidden': ['true', 'false'], 'aria-invalid': ['grammar', 'spelling', 'true', 'false'], 'aria-label': [], 'aria-labelledby': [], 'aria-live': ['off', 'polite', 'assertive'], 'aria-owns': [], 'aria-relevant': ['additions', 'removals', 'text', 'all']}
|
let global_states_and_properties = {
|
||||||
let widget_attributes = {'aria-autocomplete': ['inline', 'list', 'both', 'none'], 'aria-checked': ['true', 'false', 'mixed', 'undefined'], 'aria-disabled': ['true', 'false'], 'aria-expanded': ['true', 'false', 'undefined'], 'aria-haspopup': ['true', 'false'], 'aria-hidden': ['true', 'false'], 'aria-invalid': ['grammar', 'spelling', 'true', 'false'], 'aria-label': [], 'aria-level': [], 'aria-multiline': ['true', 'false'], 'aria-multiselectable': ['true', 'false'], 'aria-orientation': ['horizontal', 'vertical'], 'aria-pressed': ['true', 'false', 'mixed', 'undefined'], 'aria-readonly': ['true', 'false'], 'aria-required': ['true', 'false'], 'aria-selected': ['true', 'false', 'undefined'], 'aria-sort': ['ascending', 'descending', 'none', 'other'], 'aria-valuemax': [], 'aria-valuemin': [], 'aria-valuenow': [], 'aria-valuetext': []}
|
\ 'aria-atomic': ['true', 'false'],
|
||||||
let live_region_attributes = {'aria-atomic': ['true', 'false'], 'aria-busy': ['true', 'false'], 'aria-live': ['off', 'polite', 'assertive'], 'aria-relevant': ['additions', 'removals', 'text', 'all', 'additions text']}
|
\ 'aria-busy': ['true', 'false'],
|
||||||
let drag_and_drop_attributes = {'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'], 'aria-grabbed': ['true', 'false', 'undefined']}
|
\ 'aria-controls': [],
|
||||||
let relationship_attributes = {'aria-activedescendant': [], 'aria-controls': [], 'aria-describedby': [], 'aria-flowto': [], 'aria-labelledby': [], 'aria-owns': [], 'aria-posinset': [], 'aria-setsize': []}
|
\ 'aria-current': [],
|
||||||
let aria_attributes = widget_attributes
|
\ 'aria-describedby': [],
|
||||||
|
\ 'aria-disabled': ['true', 'false'],
|
||||||
|
\ 'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'],
|
||||||
|
\ 'aria-errormessage': [],
|
||||||
|
\ 'aria-flowto': [],
|
||||||
|
\ 'aria-grabbed': ['true', 'false', 'undefined'],
|
||||||
|
\ 'aria-haspopup': ['true', 'false'],
|
||||||
|
\ 'aria-hidden': ['true', 'false'],
|
||||||
|
\ 'aria-invalid': ['grammar', 'spelling', 'true', 'false'],
|
||||||
|
\ 'aria-keyshortcuts': [],
|
||||||
|
\ 'aria-label': [],
|
||||||
|
\ 'aria-labelledby': [],
|
||||||
|
\ 'aria-live': ['off', 'polite', 'assertive'],
|
||||||
|
\ 'aria-owns': [],
|
||||||
|
\ 'aria-relevant': ['additions', 'removals', 'text', 'all'],
|
||||||
|
\ 'aria-roledescription': [],
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let widget_attributes = {
|
||||||
|
\ 'aria-autocomplete': ['inline', 'list', 'both', 'none'],
|
||||||
|
\ 'aria-checked': ['true', 'false', 'mixed', 'undefined'],
|
||||||
|
\ 'aria-disabled': ['true', 'false'],
|
||||||
|
\ 'aria-errormessage': [],
|
||||||
|
\ 'aria-expanded': ['true', 'false', 'undefined'],
|
||||||
|
\ 'aria-haspopup': ['true', 'false'],
|
||||||
|
\ 'aria-hidden': ['true', 'false'],
|
||||||
|
\ 'aria-invalid': ['grammar', 'spelling', 'true', 'false'],
|
||||||
|
\ 'aria-label': [],
|
||||||
|
\ 'aria-level': [],
|
||||||
|
\ 'aria-modal': ['true', 'false'],
|
||||||
|
\ 'aria-multiline': ['true', 'false'],
|
||||||
|
\ 'aria-multiselectable': ['true', 'false'],
|
||||||
|
\ 'aria-orientation': ['horizontal', 'vertical'],
|
||||||
|
\ 'aria-placeholder': [],
|
||||||
|
\ 'aria-pressed': ['true', 'false', 'mixed', 'undefined'],
|
||||||
|
\ 'aria-readonly': ['true', 'false'],
|
||||||
|
\ 'aria-required': ['true', 'false'],
|
||||||
|
\ 'aria-selected': ['true', 'false', 'undefined'],
|
||||||
|
\ 'aria-sort': ['ascending', 'descending', 'none', 'other'],
|
||||||
|
\ 'aria-valuemax': [],
|
||||||
|
\ 'aria-valuemin': [],
|
||||||
|
\ 'aria-valuenow': [],
|
||||||
|
\ 'aria-valuetext': []
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let live_region_attributes = {
|
||||||
|
\ 'aria-atomic': ['true', 'false'],
|
||||||
|
\ 'aria-busy': ['true', 'false'],
|
||||||
|
\ 'aria-live': ['off', 'polite', 'assertive'],
|
||||||
|
\ 'aria-relevant': ['additions', 'removals', 'text', 'all', 'additions text']
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let drag_and_drop_attributes = {
|
||||||
|
\ 'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'],
|
||||||
|
\ 'aria-grabbed': ['true', 'false', 'undefined']
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let relationship_attributes = {
|
||||||
|
\ 'aria-activedescendant': [],
|
||||||
|
\ 'aria-colcount': [],
|
||||||
|
\ 'aria-colindex': [],
|
||||||
|
\ 'aria-colspan': [],
|
||||||
|
\ 'aria-controls': [],
|
||||||
|
\ 'aria-describedby': [],
|
||||||
|
\ 'aria-details': [],
|
||||||
|
\ 'aria-errormessage': [],
|
||||||
|
\ 'aria-flowto': [],
|
||||||
|
\ 'aria-labelledby': [],
|
||||||
|
\ 'aria-owns': [],
|
||||||
|
\ 'aria-posinset': [],
|
||||||
|
\ 'aria-rowcount': [],
|
||||||
|
\ 'aria-rowindex': [],
|
||||||
|
\ 'aria-rowspan': [],
|
||||||
|
\ 'aria-setsize': []
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let aria_attributes = global_states_and_properties
|
||||||
|
let aria_attributes = extend(aria_attributes, widget_attributes)
|
||||||
let aria_attributes = extend(aria_attributes, live_region_attributes)
|
let aria_attributes = extend(aria_attributes, live_region_attributes)
|
||||||
let aria_attributes = extend(aria_attributes, drag_and_drop_attributes)
|
let aria_attributes = extend(aria_attributes, drag_and_drop_attributes)
|
||||||
let aria_attributes = extend(aria_attributes, relationship_attributes)
|
let aria_attributes = extend(aria_attributes, relationship_attributes)
|
||||||
@@ -82,6 +271,8 @@ let role_attributes['status'] = abstract_role['composite'] + role_attributes['re
|
|||||||
let role_attributes['tab'] = abstract_role['sectionhead'] + abstract_role['widget'] + ['aria-selected']
|
let role_attributes['tab'] = abstract_role['sectionhead'] + abstract_role['widget'] + ['aria-selected']
|
||||||
let role_attributes['tabpanel'] = role_attributes['region']
|
let role_attributes['tabpanel'] = role_attributes['region']
|
||||||
let role_attributes['textbox'] = abstract_role['input'] + ['aria-autocomplete', 'aria-multiline', 'aria-readonly', 'aria-required']
|
let role_attributes['textbox'] = abstract_role['input'] + ['aria-autocomplete', 'aria-multiline', 'aria-readonly', 'aria-required']
|
||||||
|
let role_attributes['searchbox'] = role_attributes['textbox']
|
||||||
|
let role_attributes['switch'] = role_attributes['checkbox']
|
||||||
let role_attributes['timer'] = role_attributes['status']
|
let role_attributes['timer'] = role_attributes['status']
|
||||||
let role_attributes['tooltip'] = abstract_role['section']
|
let role_attributes['tooltip'] = abstract_role['section']
|
||||||
let role_attributes['treeitem'] = role_attributes['listitem'] + role_attributes['option']
|
let role_attributes['treeitem'] = role_attributes['listitem'] + role_attributes['option']
|
||||||
@@ -99,16 +290,22 @@ let role_attributes['treegrid'] = role_attributes['grid'] + role_attributes['tre
|
|||||||
let role_attributes['document'] = abstract_role['structure'] + ['aria-expanded']
|
let role_attributes['document'] = abstract_role['structure'] + ['aria-expanded']
|
||||||
|
|
||||||
let role_attributes['article'] = role_attributes['document'] + role_attributes['region']
|
let role_attributes['article'] = role_attributes['document'] + role_attributes['region']
|
||||||
|
let role_attributes['cell'] = abstract_role['section'] + ['aria-colindex', 'aria-colspan', 'aria-rowindex', 'aria-rowspan']
|
||||||
let role_attributes['columnheader'] = role_attributes['gridcell'] + abstract_role['sectionhead'] + ['aria-sort']
|
let role_attributes['columnheader'] = role_attributes['gridcell'] + abstract_role['sectionhead'] + ['aria-sort']
|
||||||
let role_attributes['definition'] = abstract_role['section']
|
let role_attributes['definition'] = abstract_role['section']
|
||||||
|
let role_attributes['feed'] = role_attributes['list']
|
||||||
|
let role_attributes['figure'] = abstract_role['section']
|
||||||
let role_attributes['heading'] = abstract_role['sectionhead'] + ['aria-level']
|
let role_attributes['heading'] = abstract_role['sectionhead'] + ['aria-level']
|
||||||
let role_attributes['img'] = abstract_role['section']
|
let role_attributes['img'] = abstract_role['section']
|
||||||
let role_attributes['math'] = abstract_role['section']
|
let role_attributes['math'] = abstract_role['section']
|
||||||
let role_attributes['note'] = abstract_role['section']
|
let role_attributes['note'] = abstract_role['section']
|
||||||
let role_attributes['presentation'] = abstract_role['structure']
|
let role_attributes['presentation'] = abstract_role['structure']
|
||||||
|
let role_attributes['none'] = role_attributes['presentation']
|
||||||
let role_attributes['row'] = role_attributes['group'] + ['aria-level', 'aria-selected']
|
let role_attributes['row'] = role_attributes['group'] + ['aria-level', 'aria-selected']
|
||||||
let role_attributes['rowheader'] = role_attributes['gridcell'] + abstract_role['sectionhead']
|
let role_attributes['rowheader'] = role_attributes['gridcell'] + abstract_role['sectionhead']
|
||||||
let role_attributes['separator'] = abstract_role['structure'] + ['aria-expanded']
|
let role_attributes['separator'] = abstract_role['structure'] + ['aria-expanded']
|
||||||
|
let role_attributes['table'] = abstract_role['section'] + ['aria-colcount', 'aria-rowcount']
|
||||||
|
let role_attributes['term'] = abstract_role['section']
|
||||||
|
|
||||||
" Landmark Roles
|
" Landmark Roles
|
||||||
let role_attributes['application'] = abstract_role['landmark']
|
let role_attributes['application'] = abstract_role['landmark']
|
||||||
@@ -124,19 +321,30 @@ let role_attributes['search'] = abstract_role['landmark']
|
|||||||
let aria_attributes_value = {
|
let aria_attributes_value = {
|
||||||
\ 'aria-autocomplete': ['ID', ''],
|
\ 'aria-autocomplete': ['ID', ''],
|
||||||
\ 'aria-checked': ['Token', ''],
|
\ 'aria-checked': ['Token', ''],
|
||||||
|
\ 'aria-colcount': ['Number', ''],
|
||||||
|
\ 'aria-colindex': ['Number', ''],
|
||||||
|
\ 'aria-colspan': ['Number', ''],
|
||||||
\ 'aria-disabled': ['true/false', ''],
|
\ 'aria-disabled': ['true/false', ''],
|
||||||
|
\ 'aria-errormessage': ['ID', ''],
|
||||||
\ 'aria-expanded': ['Token', ''],
|
\ 'aria-expanded': ['Token', ''],
|
||||||
\ 'aria-haspopup': ['true/false', ''],
|
\ 'aria-haspopup': ['Token', ''],
|
||||||
\ 'aria-hidden': ['true/false', ''],
|
\ 'aria-hidden': ['true/false', ''],
|
||||||
\ 'aria-invalid': ['Token', ''],
|
\ 'aria-invalid': ['Token', ''],
|
||||||
|
\ 'aria-keyshortcuts': ['String', ''],
|
||||||
\ 'aria-label': ['String', ''],
|
\ 'aria-label': ['String', ''],
|
||||||
\ 'aria-level': ['Int', ''],
|
\ 'aria-level': ['Int', ''],
|
||||||
|
\ 'aria-modal': ['true/false', ''],
|
||||||
\ 'aria-multiline': ['true/false', ''],
|
\ 'aria-multiline': ['true/false', ''],
|
||||||
\ 'aria-multiselectable': ['true/false', ''],
|
\ 'aria-multiselectable': ['true/false', ''],
|
||||||
\ 'aria-orientation': ['Token', ''],
|
\ 'aria-orientation': ['Token', ''],
|
||||||
|
\ 'aria-placeholder': ['String', ''],
|
||||||
\ 'aria-pressed': ['Token', ''],
|
\ 'aria-pressed': ['Token', ''],
|
||||||
\ 'aria-readonly': ['true/false', ''],
|
\ 'aria-readonly': ['true/false', ''],
|
||||||
\ 'aria-required': ['true/false', ''],
|
\ 'aria-required': ['true/false', ''],
|
||||||
|
\ 'aria-roledescription': ['String', ''],
|
||||||
|
\ 'aria-rowcount': ['Number', ''],
|
||||||
|
\ 'aria-rowindex': ['Number', ''],
|
||||||
|
\ 'aria-rowspan': ['Number', ''],
|
||||||
\ 'aria-selected': ['Token', ''],
|
\ 'aria-selected': ['Token', ''],
|
||||||
\ 'aria-sort': ['Token', ''],
|
\ 'aria-sort': ['Token', ''],
|
||||||
\ 'aria-valuemax': ['Number', ''],
|
\ 'aria-valuemax': ['Number', ''],
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ 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']
|
||||||
|
|
||||||
" 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': []}
|
||||||
let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': ['http://www.w3.org/1999/xhtml', 'http://www.w3.org/1998/Math/MathML', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink']}
|
let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': ['http://www.w3.org/1999/xhtml', 'http://www.w3.org/1998/Math/MathML', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink']}
|
||||||
@@ -78,9 +80,12 @@ let attributes_value = {
|
|||||||
\ 'accept-charset': ['Charset', ''],
|
\ 'accept-charset': ['Charset', ''],
|
||||||
\ 'accesskey': ['Character', ''],
|
\ 'accesskey': ['Character', ''],
|
||||||
\ 'action': ['URL', ''],
|
\ 'action': ['URL', ''],
|
||||||
|
\ 'allowfullscreen': ['Bool', ''],
|
||||||
|
\ 'allowpaymentrequest': ['Bool', ''],
|
||||||
|
\ 'allowusermedia': ['Bool', ''],
|
||||||
\ 'alt': ['Text', ''],
|
\ 'alt': ['Text', ''],
|
||||||
\ 'async': ['Bool', ''],
|
\ 'async': ['Bool', ''],
|
||||||
\ 'autocomplete': ['on/off', ''],
|
\ 'autocomplete': ['*Token', ''],
|
||||||
\ 'autofocus': ['Bool', ''],
|
\ 'autofocus': ['Bool', ''],
|
||||||
\ 'autoplay': ['Bool', ''],
|
\ 'autoplay': ['Bool', ''],
|
||||||
\ 'border': ['1', ''],
|
\ 'border': ['1', ''],
|
||||||
@@ -140,6 +145,7 @@ let attributes_value = {
|
|||||||
\ 'optimum': ['Number', ''],
|
\ 'optimum': ['Number', ''],
|
||||||
\ 'pattern': ['Pattern', ''],
|
\ 'pattern': ['Pattern', ''],
|
||||||
\ 'placeholder': ['Text', ''],
|
\ 'placeholder': ['Text', ''],
|
||||||
|
\ 'playsinline': ['Bool', ''],
|
||||||
\ 'poster': ['URL', ''],
|
\ 'poster': ['URL', ''],
|
||||||
\ 'preload': ['Token', ''],
|
\ 'preload': ['Token', ''],
|
||||||
\ 'pubdate': ['Bool', ''],
|
\ 'pubdate': ['Bool', ''],
|
||||||
@@ -313,13 +319,15 @@ if !exists('g:html5_aria_attributes_complete')
|
|||||||
let g:html5_aria_attributes_complete = 1
|
let g:html5_aria_attributes_complete = 1
|
||||||
endif
|
endif
|
||||||
if g:html5_aria_attributes_complete == 1
|
if g:html5_aria_attributes_complete == 1
|
||||||
" Ref: http://www.w3.org/TR/wai-aria/roles
|
" Ref: https://www.w3.org/TR/wai-aria-1.1/#role_definitions
|
||||||
" Version: Draft 15 December 2009
|
" Version: W3C Candidate Recommendation 27 October 2016
|
||||||
let widget_role = ['alert', 'alertdialog', 'button', 'checkbox', 'combobox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'slider', 'spinbutton', 'status', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid']
|
let widget_role = ['alert', 'alertdialog', 'button', 'checkbox', 'combobox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'searchbox', 'slider', 'spinbutton', 'status', 'switch', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid']
|
||||||
let document_structure = ['article', 'columnheader', 'definition', 'directory', 'document', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'note', 'presentation', 'region', 'row', 'rowheader', 'separator']
|
let document_structure = ['article', 'cell', 'columnheader', 'definition', 'directory', 'document', 'feed', 'figure', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'none', 'note', 'presentation', 'region', 'row', 'rowheader', 'separator', 'table', 'term']
|
||||||
let landmark_role = ['application', 'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'search']
|
let landmark_role = ['application', 'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'search']
|
||||||
|
let dpub_role = ['dpub-abstract', 'dpub-afterword', 'dpub-appendix', 'dpub-biblioentry', 'dpub-bibliography', 'dpub-biblioref', 'dpub-chapter', 'dpub-cover', 'dpub-epilogue', 'dpub-footnote', 'dpub-footnotes', 'dpub-foreword', 'dpub-glossary', 'dpub-glossdef', 'dpub-glossref', 'dpub-glossterm', 'dpub-index', 'dpub-locator', 'dpub-noteref', 'dpub-notice', 'dpub-pagebreak', 'dpub-pagelist', 'dpub-part', 'dpub-preface', 'dpub-prologue', 'dpub-pullquote', 'dpub-qna', 'dpub-subtitle', 'dpub-tip', 'dpub-title', 'dpub-toc']
|
||||||
let role = extend(widget_role, document_structure)
|
let role = extend(widget_role, document_structure)
|
||||||
let role = extend(role, landmark_role)
|
let role = extend(role, landmark_role)
|
||||||
|
let role = extend(role, dpub_role)
|
||||||
let global_attributes = extend(global_attributes, {'role': role})
|
let global_attributes = extend(global_attributes, {'role': role})
|
||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
@@ -332,14 +340,38 @@ let metadata_elements = ['link', 'style', 'meta', 'script', 'noscript', 'command
|
|||||||
|
|
||||||
let flow_elements = phrasing_elements + ['p', 'hr', 'pre', 'ul', 'ol', 'dl', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'address', 'blockquote', 'ins', 'del', 'element', 'object', 'main', 'map', 'noscript', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'video', 'audio', 'figure', 'table', 'template', 'form', 'fieldset', 'menu', 'canvas', 'details']
|
let flow_elements = phrasing_elements + ['p', 'hr', 'pre', 'ul', 'ol', 'dl', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'address', 'blockquote', 'ins', 'del', 'element', 'object', 'main', 'map', 'noscript', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'video', 'audio', 'figure', 'table', 'template', 'form', 'fieldset', 'menu', 'canvas', 'details']
|
||||||
|
|
||||||
" http://dev.w3.org/html5/spec/Overview.html#linkTypes
|
" https://html.spec.whatwg.org/#linkTypes
|
||||||
let linktypes = ['alternate', 'author', 'bookmark', 'external', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'pingback', 'prefetch', 'prev', 'search', 'stylesheet', 'sidebar', 'tag']
|
let linktypes = ['alternate', 'author', 'bookmark', 'dns-prefetch', 'external', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'noopener', 'pingback', 'preconnect', 'prefetch', 'preload', 'prerender', 'prev', 'search', 'stylesheet', 'tag']
|
||||||
|
" https://w3c.github.io/manifest/
|
||||||
|
let linkreltypes = linktypes
|
||||||
|
let linkreltypes = linkreltypes + ['manifest']
|
||||||
" http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
|
" http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
|
||||||
let linkreltypes = linktypes + ['canonical', 'import']
|
" http://www.ysearchblog.com/2009/02/12/fighting-duplication-adding-more-arrows-to-your-quiver/
|
||||||
|
" http://blogs.bing.com/webmaster/2009/02/12/partnering-to-help-solve-duplicate-content-issues
|
||||||
|
let linkreltypes = linkreltypes + ['canonical']
|
||||||
|
" http://w3c.github.io/webcomponents/spec/imports/
|
||||||
|
let linkreltypes = linkreltypes + ['import']
|
||||||
|
" https://www.w3.org/TR/webmention/#sender-discovers-receiver-webmention-endpoint
|
||||||
|
let linkreltypes = linkreltypes + ['webmention']
|
||||||
|
" http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML
|
||||||
|
let linkreltypes = linkreltypes + ['search']
|
||||||
|
" http://microformats.org/wiki/rel-sitemap
|
||||||
|
let linkreltypes = linkreltypes + ['sitemap']
|
||||||
|
" https://www.ampproject.org/docs/get_started/create/prepare_for_discovery
|
||||||
|
let linkreltypes = linkreltypes + ['amphtml']
|
||||||
|
" https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
|
||||||
|
let linkreltypes = linkreltypes + ['apple-touch-icon', 'apple-touch-icon-precomposed', 'apple-touch-startup-image']
|
||||||
|
" https://developer.chrome.com/webstore/inline_installation
|
||||||
|
let linkreltypes = linkreltypes + ['chrome-webstore-item']
|
||||||
|
" http://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html#rfc.section.4
|
||||||
|
let linkreltypes = linkreltypes + ['hub']
|
||||||
|
" https://golem.ph.utexas.edu/~distler/blog/archives/000320.html
|
||||||
|
let linkreltypes = linkreltypes + ['pgpkey']
|
||||||
|
|
||||||
" a and button are special elements for interactive, some element can't be its descendent
|
" a and button are special elements for interactive, some element can't be its descendent
|
||||||
let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|textarea'
|
let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|textarea'
|
||||||
|
|
||||||
|
let crossorigin = ['anonymous', 'use-credentials']
|
||||||
|
|
||||||
|
|
||||||
let g:xmldata_html5 = {
|
let g:xmldata_html5 = {
|
||||||
@@ -347,7 +379,7 @@ let g:xmldata_html5 = {
|
|||||||
\ 'vimxmlroot': ['html', 'head', 'body'] + flow_elements,
|
\ 'vimxmlroot': ['html', 'head', 'body'] + flow_elements,
|
||||||
\ 'a': [
|
\ 'a': [
|
||||||
\ filter(copy(flow_elements), "!(v:val =~ '". abutton_dec ."')"),
|
\ filter(copy(flow_elements), "!(v:val =~ '". abutton_dec ."')"),
|
||||||
\ extend(copy(global_attributes), {'name': [], 'href': [], 'target': [], 'rel': linktypes, 'hreflang': lang_tag, 'media': [], 'type': []})
|
\ extend(copy(global_attributes), {'name': [], 'href': [], 'target': [], 'rel': linktypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'abbr': [
|
\ 'abbr': [
|
||||||
\ phrasing_elements,
|
\ phrasing_elements,
|
||||||
@@ -359,7 +391,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'area': [
|
\ 'area': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': []})
|
\ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': [], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'article': [
|
\ 'article': [
|
||||||
\ flow_elements + ['style'],
|
\ flow_elements + ['style'],
|
||||||
@@ -495,7 +527,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'form': [
|
\ 'form': [
|
||||||
\ flow_elements,
|
\ flow_elements,
|
||||||
\ extend(copy(global_attributes), {'name': [], 'action': [], 'enctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'method': ['get', 'post', 'put', 'delete'], 'target': [], 'novalidate': ['novalidate', ''], 'accept-charset': charset, 'autocomplete': ['on', 'off']})
|
\ extend(copy(global_attributes), {'name': [], 'action': [], 'enctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'method': ['get', 'post', 'put', 'delete'], 'target': [], 'novalidate': ['novalidate', ''], 'accept-charset': charset, 'autocomplete': autofill_tokens})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'h1': [
|
\ 'h1': [
|
||||||
\ phrasing_elements,
|
\ phrasing_elements,
|
||||||
@@ -547,15 +579,15 @@ 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', '']})
|
\ 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': []})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'img': [
|
\ 'img': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', '']})
|
\ 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']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'input': [
|
\ 'input': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': ['on', 'off'], 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
|
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'color'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': autofill_tokens, 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'ins': [
|
\ 'ins': [
|
||||||
\ flow_elements,
|
\ flow_elements,
|
||||||
@@ -583,7 +615,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'link': [
|
\ 'link': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any']})
|
\ 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', '']})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'main': [
|
\ 'main': [
|
||||||
\ flow_elements + ['style'],
|
\ flow_elements + ['style'],
|
||||||
@@ -691,7 +723,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'script': [
|
\ 'script': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset})
|
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset, 'nonce': [], 'crossorigin': crossorigin})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'section': [
|
\ 'section': [
|
||||||
\ flow_elements + ['style'],
|
\ flow_elements + ['style'],
|
||||||
@@ -723,7 +755,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'style': [
|
\ 'style': [
|
||||||
\ [],
|
\ [],
|
||||||
\ extend(copy(global_attributes), {'type': [], 'media': [], 'scoped': ['scoped', '']})
|
\ extend(copy(global_attributes), {'type': [], 'media': [], 'scoped': ['scoped', ''], 'nonce': []})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'sub': [
|
\ 'sub': [
|
||||||
\ phrasing_elements,
|
\ phrasing_elements,
|
||||||
@@ -803,7 +835,7 @@ let g:xmldata_html5 = {
|
|||||||
\ ],
|
\ ],
|
||||||
\ 'video': [
|
\ 'video': [
|
||||||
\ flow_elements + ['source', 'track'],
|
\ flow_elements + ['source', 'track'],
|
||||||
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'poster': [], 'height': [], 'width': [], 'src': []})
|
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'playsinline': ['playsinline', ''], 'poster': [], 'height': [], 'width': [], 'src': [], 'crossorigin': crossorigin})
|
||||||
\ ],
|
\ ],
|
||||||
\ 'wbr': [
|
\ 'wbr': [
|
||||||
\ [],
|
\ [],
|
||||||
|
|||||||
76
build
76
build
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
set -E
|
set -E
|
||||||
|
|
||||||
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
|
DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin"
|
||||||
DIRS_BASIC="syntax compiler indent ftdetect after/syntax after/indent after/ftdetect"
|
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
|
||||||
DIRS_ALL="syntax indent compiler autoload ftplugin ftdetect after"
|
DIRS_ALL="syntax indent compiler autoload ftplugin after"
|
||||||
|
DIRS_SYNTAX="syntax after/syntax"
|
||||||
|
DIRS_JAVASCRIPT="${DIRS} extras"
|
||||||
|
DIRS_RM="$DIRS_JAVASCRIPT"
|
||||||
|
|
||||||
OUTPUT=""
|
OUTPUT=""
|
||||||
|
|
||||||
@@ -26,6 +29,9 @@ download() {
|
|||||||
|
|
||||||
extract() {
|
extract() {
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
|
cat config.vim >> tmp/polyglot.vim
|
||||||
|
|
||||||
for pack in $1; do
|
for pack in $1; do
|
||||||
name="$(printf "$pack" | cut -d ':' -f 1)"
|
name="$(printf "$pack" | cut -d ':' -f 1)"
|
||||||
path="$(printf "$pack" | cut -d ':' -f 2)"
|
path="$(printf "$pack" | cut -d ':' -f 2)"
|
||||||
@@ -46,10 +52,21 @@ extract() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for f in ${dir}/ftdetect/*; do
|
||||||
|
(
|
||||||
|
echo "augroup filetypedetect";
|
||||||
|
echo '" '"$pack";
|
||||||
|
cat "${f}";
|
||||||
|
echo "augroup END";
|
||||||
|
echo
|
||||||
|
) >> tmp/polyglot.vim;
|
||||||
|
done
|
||||||
|
|
||||||
output "${subdirs##, })\n"
|
output "${subdirs##, })\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
mv tmp/polyglot.vim ftdetect/
|
||||||
|
|
||||||
for pack in $1; do
|
for pack in $1; do
|
||||||
name="$(printf "$pack" | cut -d ':' -f 1)"
|
name="$(printf "$pack" | cut -d ':' -f 1)"
|
||||||
path="$(printf "$pack" | cut -d ':' -f 2)"
|
path="$(printf "$pack" | cut -d ':' -f 2)"
|
||||||
@@ -73,12 +90,6 @@ copy_dir() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
concat_ftdetect() {
|
|
||||||
cat ftdetect/* | grep -E '^[^"]' > tmp/polyglot.vim
|
|
||||||
rm -f ftdetect/*
|
|
||||||
mv tmp/polyglot.vim ftdetect/
|
|
||||||
}
|
|
||||||
|
|
||||||
update_readme() {
|
update_readme() {
|
||||||
OLD_README="$(cat README.md)"
|
OLD_README="$(cat README.md)"
|
||||||
|
|
||||||
@@ -87,7 +98,7 @@ update_readme() {
|
|||||||
+2kb
|
+2kb
|
||||||
/##
|
/##
|
||||||
'b,-2c
|
'b,-2c
|
||||||
$(printf -- "$OUTPUT")
|
$(printf -- "$OUTPUT" | sort)
|
||||||
.
|
.
|
||||||
w
|
w
|
||||||
q
|
q
|
||||||
@@ -96,11 +107,16 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
PACKS="
|
PACKS="
|
||||||
|
apiblueprint:sheerun/apiblueprint.vim
|
||||||
|
applescript:vim-scripts/applescript.vim
|
||||||
|
asciidoc:asciidoc/vim-asciidoc
|
||||||
|
yaml:stephpy/vim-yaml
|
||||||
ansible:pearofducks/ansible-vim
|
ansible:pearofducks/ansible-vim
|
||||||
arduino:sudar/vim-arduino-syntax
|
arduino:sudar/vim-arduino-syntax
|
||||||
blade:jwalton512/vim-blade
|
blade:jwalton512/vim-blade
|
||||||
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:joshglendenning/vim-caddyfile
|
||||||
cjsx:mtscout6/vim-cjsx
|
cjsx:mtscout6/vim-cjsx
|
||||||
clojure:guns/vim-clojure-static
|
clojure:guns/vim-clojure-static
|
||||||
coffee-script:kchmck/vim-coffee-script
|
coffee-script:kchmck/vim-coffee-script
|
||||||
@@ -110,25 +126,28 @@ PACKS="
|
|||||||
css:JulesWang/css.vim
|
css:JulesWang/css.vim
|
||||||
cucumber:tpope/vim-cucumber
|
cucumber:tpope/vim-cucumber
|
||||||
dart:dart-lang/dart-vim-plugin
|
dart:dart-lang/dart-vim-plugin
|
||||||
dockerfile:honza/dockerfile.vim
|
dockerfile:docker/docker::/contrib/syntax/vim/
|
||||||
elixir:elixir-lang/vim-elixir
|
elixir:elixir-lang/vim-elixir
|
||||||
elm:lambdatoast/elm.vim
|
elm:lambdatoast/elm.vim
|
||||||
emberscript:heartsentwined/vim-ember-script
|
emberscript:yalesov/vim-ember-script
|
||||||
emblem:heartsentwined/vim-emblem
|
emblem:yalesov/vim-emblem
|
||||||
erlang:vim-erlang/vim-erlang-runtime
|
erlang:vim-erlang/vim-erlang-runtime
|
||||||
fish:dag/vim-fish
|
fish:dag/vim-fish
|
||||||
git:tpope/vim-git
|
git:tpope/vim-git
|
||||||
glsl:tikhomirov/vim-glsl
|
glsl:tikhomirov/vim-glsl
|
||||||
|
gnuplot:vim-scripts/gnuplot-syntax-highlighting
|
||||||
go:fatih/vim-go:_BASIC
|
go:fatih/vim-go:_BASIC
|
||||||
|
graphql:jparise/vim-graphql
|
||||||
groovy:vim-scripts/groovy.vim
|
groovy:vim-scripts/groovy.vim
|
||||||
haml:tpope/vim-haml
|
haml:sheerun/vim-haml
|
||||||
handlebars:mustache/vim-mustache-handlebars
|
handlebars:mustache/vim-mustache-handlebars
|
||||||
haskell:neovimhaskell/haskell-vim
|
haskell:neovimhaskell/haskell-vim
|
||||||
haxe:yaymukund/vim-haxe
|
haxe:yaymukund/vim-haxe
|
||||||
html5:othree/html5.vim
|
html5:othree/html5.vim
|
||||||
|
i3:PotatoesMaster/i3-vim-syntax
|
||||||
jasmine:glanotte/vim-jasmine
|
jasmine:glanotte/vim-jasmine
|
||||||
javascript:pangloss/vim-javascript
|
javascript:pangloss/vim-javascript:_JAVASCRIPT
|
||||||
json:sheerun/vim-json
|
json:elzr/vim-json
|
||||||
jst:briancollins/vim-jst
|
jst:briancollins/vim-jst
|
||||||
jsx:mxw/vim-jsx:_ALL
|
jsx:mxw/vim-jsx:_ALL
|
||||||
julia:dcjones/julia-minimalist-vim
|
julia:dcjones/julia-minimalist-vim
|
||||||
@@ -136,9 +155,12 @@ PACKS="
|
|||||||
latex:LaTeX-Box-Team/LaTeX-Box
|
latex:LaTeX-Box-Team/LaTeX-Box
|
||||||
less:groenewege/vim-less
|
less:groenewege/vim-less
|
||||||
liquid:tpope/vim-liquid
|
liquid:tpope/vim-liquid
|
||||||
|
livescript:gkz/vim-ls
|
||||||
|
lua:tbastos/vim-lua
|
||||||
mako:sophacles/vim-bundle-mako
|
mako:sophacles/vim-bundle-mako
|
||||||
markdown:tpope/vim-markdown
|
markdown:plasticboy/vim-markdown:_SYNTAX
|
||||||
nginx:othree/nginx-contrib-vim
|
mathematica:rsmenon/vim-mathematica
|
||||||
|
nginx:chr4/nginx.vim
|
||||||
nim:zah/nim.vim:_BASIC
|
nim:zah/nim.vim:_BASIC
|
||||||
nix:spwhitt/vim-nix
|
nix:spwhitt/vim-nix
|
||||||
objc:b4winckler/vim-objc
|
objc:b4winckler/vim-objc
|
||||||
@@ -149,49 +171,53 @@ PACKS="
|
|||||||
pgsql:exu/pgsql.vim
|
pgsql:exu/pgsql.vim
|
||||||
php:StanAngeloff/php.vim
|
php:StanAngeloff/php.vim
|
||||||
plantuml:aklt/plantuml-syntax
|
plantuml:aklt/plantuml-syntax
|
||||||
powershell:Persistent13/vim-ps1
|
powershell:PProvost/vim-ps1
|
||||||
protobuf:uarun/vim-protobuf
|
protobuf:uarun/vim-protobuf
|
||||||
pug:digitaltoad/vim-pug
|
pug:digitaltoad/vim-pug
|
||||||
puppet:voxpupuli/vim-puppet
|
puppet:voxpupuli/vim-puppet
|
||||||
purescript:raichoo/purescript-vim
|
purescript:raichoo/purescript-vim
|
||||||
python:mitsuhiko/vim-python-combined
|
python:mitsuhiko/vim-python-combined
|
||||||
|
python-compiler:aliev/vim-compiler-python
|
||||||
qml:peterhoeg/vim-qml
|
qml:peterhoeg/vim-qml
|
||||||
r-lang:vim-scripts/R.vim
|
r-lang:vim-scripts/R.vim
|
||||||
|
raml:IN3D/vim-raml
|
||||||
ragel:jneen/ragel.vim
|
ragel:jneen/ragel.vim
|
||||||
rspec:sheerun/rspec.vim
|
rspec:sheerun/rspec.vim
|
||||||
ruby:vim-ruby/vim-ruby
|
ruby:vim-ruby/vim-ruby
|
||||||
rust:rust-lang/rust.vim
|
rust:rust-lang/rust.vim
|
||||||
sbt:derekwyatt/vim-sbt
|
sbt:derekwyatt/vim-sbt
|
||||||
scala:derekwyatt/vim-scala
|
scala:derekwyatt/vim-scala
|
||||||
|
scss:cakebaker/scss-syntax.vim
|
||||||
slim:slim-template/vim-slim
|
slim:slim-template/vim-slim
|
||||||
solidity:ethereum/vim-solidity
|
solidity:ethereum/vim-solidity
|
||||||
stylus:wavded/vim-stylus
|
stylus:wavded/vim-stylus
|
||||||
swift:keith/swift.vim
|
swift:keith/swift.vim
|
||||||
|
sxhkd:baskerville/vim-sxhkdrc
|
||||||
systemd:kurayama/systemd-vim-syntax
|
systemd:kurayama/systemd-vim-syntax
|
||||||
|
terraform:hashivim/vim-terraform
|
||||||
textile:timcharper/textile.vim
|
textile:timcharper/textile.vim
|
||||||
thrift:solarnz/thrift.vim
|
thrift:solarnz/thrift.vim
|
||||||
tmux:tejr/vim-tmux
|
tmux:keith/tmux.vim
|
||||||
tomdoc:wellbredgrapefruit/tomdoc.vim
|
tomdoc:wellbredgrapefruit/tomdoc.vim
|
||||||
toml:cespare/vim-toml
|
toml:cespare/vim-toml
|
||||||
twig:evidens/vim-twig
|
twig:lumiliet/vim-twig
|
||||||
typescript:leafgarland/typescript-vim
|
typescript:leafgarland/typescript-vim
|
||||||
vala:tkztmk/vim-vala
|
vala:arrufat/vala.vim
|
||||||
vbnet:vim-scripts/vbnet.vim
|
vbnet:vim-scripts/vbnet.vim
|
||||||
vcl:smerrill/vcl-vim-plugin
|
vcl:smerrill/vcl-vim-plugin
|
||||||
|
vue:posva/vim-vue
|
||||||
vm:lepture/vim-velocity
|
vm:lepture/vim-velocity
|
||||||
xls:vim-scripts/XSLT-syntax
|
xls:vim-scripts/XSLT-syntax
|
||||||
yaml:stephpy/vim-yaml
|
|
||||||
yard:sheerun/vim-yardoc
|
yard:sheerun/vim-yardoc
|
||||||
"
|
"
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
rm -rf $DIRS_ALL
|
rm -rf $DIRS_RM
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|
||||||
printf "Downloading packs..."
|
printf "Downloading packs..."
|
||||||
download "$PACKS"
|
download "$PACKS"
|
||||||
extract "$PACKS"
|
extract "$PACKS"
|
||||||
concat_ftdetect
|
|
||||||
update_readme
|
update_readme
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
|
|||||||
@@ -21,49 +21,12 @@ else
|
|||||||
CompilerSet makeprg=cargo\ $*
|
CompilerSet makeprg=cargo\ $*
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Allow a configurable global Cargo.toml name. This makes it easy to
|
" Ignore general cargo progress messages
|
||||||
" support variations like 'cargo.toml'.
|
CompilerSet errorformat+=
|
||||||
let s:cargo_manifest_name = get(g:, 'cargo_manifest_name', 'Cargo.toml')
|
\%-G%\\s%#Downloading%.%#,
|
||||||
|
\%-G%\\s%#Compiling%.%#,
|
||||||
function! s:is_absolute(path)
|
\%-G%\\s%#Finished%.%#,
|
||||||
return a:path[0] == '/' || a:path =~ '[A-Z]\+:'
|
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
|
||||||
endfunction
|
\%-G%\\s%#To\ learn\ more\\,%.%#
|
||||||
|
|
||||||
let s:local_manifest = findfile(s:cargo_manifest_name, '.;')
|
|
||||||
if s:local_manifest != ''
|
|
||||||
let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/'
|
|
||||||
augroup cargo
|
|
||||||
au!
|
|
||||||
au QuickfixCmdPost make call s:FixPaths()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" FixPaths() is run after Cargo, and is used to change the file paths
|
|
||||||
" to be relative to the current directory instead of Cargo.toml.
|
|
||||||
function! s:FixPaths()
|
|
||||||
let qflist = getqflist()
|
|
||||||
let manifest = s:local_manifest
|
|
||||||
for qf in qflist
|
|
||||||
if !qf.valid
|
|
||||||
let m = matchlist(qf.text, '(file://\(.*\))$')
|
|
||||||
if !empty(m)
|
|
||||||
let manifest = m[1].'/'
|
|
||||||
" Manually strip another slash if needed; usually just an
|
|
||||||
" issue on Windows.
|
|
||||||
if manifest =~ '^/[A-Z]\+:/'
|
|
||||||
let manifest = manifest[1:]
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
let filename = bufname(qf.bufnr)
|
|
||||||
if s:is_absolute(filename)
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
let qf.filename = simplify(manifest.filename)
|
|
||||||
call remove(qf, 'bufnr')
|
|
||||||
endfor
|
|
||||||
call setqflist(qflist, 'r')
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
20
compiler/eslint.vim
Normal file
20
compiler/eslint.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
" Vim compiler plugin
|
||||||
|
" Language: JavaScript
|
||||||
|
" Maintainer: vim-javascript community
|
||||||
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = "eslint"
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command! -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
CompilerSet makeprg=eslint\ -f\ compact\ %
|
||||||
|
CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -40,6 +40,6 @@ CompilerSet errorformat+=%-G%.%# " All lines not matching a
|
|||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
78
compiler/ls.vim
Normal file
78
compiler/ls.vim
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists('current_compiler')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let current_compiler = 'ls'
|
||||||
|
" Pattern to check if livescript is the compiler
|
||||||
|
let s:pat = '^' . current_compiler
|
||||||
|
|
||||||
|
" Path to LiveScript compiler
|
||||||
|
if !exists('livescript_compiler')
|
||||||
|
let livescript_compiler = 'lsc'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('livescript_make_options')
|
||||||
|
let livescript_make_options = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Get a `makeprg` for the current filename. This is needed to support filenames
|
||||||
|
" with spaces and quotes, but also not break generic `make`.
|
||||||
|
function! s:GetMakePrg()
|
||||||
|
return g:livescript_compiler . ' -c ' . g:livescript_make_options . ' $* '
|
||||||
|
\ . fnameescape(expand('%'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
||||||
|
function! s:SetMakePrg()
|
||||||
|
if &l:makeprg =~ s:pat
|
||||||
|
let &l:makeprg = s:GetMakePrg()
|
||||||
|
elseif &g:makeprg =~ s:pat
|
||||||
|
let &g:makeprg = s:GetMakePrg()
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set a dummy compiler so we can check whether to set locally or globally.
|
||||||
|
CompilerSet makeprg=ls
|
||||||
|
call s:SetMakePrg()
|
||||||
|
|
||||||
|
CompilerSet errorformat=%EFailed\ at:\ %f,
|
||||||
|
\%ECan't\ find:\ %f,
|
||||||
|
\%CSyntaxError:\ %m\ on\ line\ %l,
|
||||||
|
\%CError:\ Parse\ error\ on\ line\ %l:\ %m,
|
||||||
|
\%C,%C\ %.%#
|
||||||
|
|
||||||
|
" Compile the current file.
|
||||||
|
command! -bang -bar -nargs=* LiveScriptMake make<bang> <args>
|
||||||
|
|
||||||
|
" Set `makeprg` on rename since we embed the filename in the setting.
|
||||||
|
augroup LiveScriptUpdateMakePrg
|
||||||
|
autocmd!
|
||||||
|
|
||||||
|
" Update `makeprg` if livescript is still the compiler, else stop running this
|
||||||
|
" function.
|
||||||
|
function! s:UpdateMakePrg()
|
||||||
|
if !s:SetMakePrg()
|
||||||
|
autocmd! LiveScriptUpdateMakePrg
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Set autocmd locally if compiler was set locally.
|
||||||
|
if &l:makeprg =~ s:pat
|
||||||
|
autocmd BufFilePost,BufWritePost <buffer> call s:UpdateMakePrg()
|
||||||
|
else
|
||||||
|
autocmd BufFilePost,BufWritePost call s:UpdateMakePrg()
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -13,7 +13,7 @@ endif
|
|||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo-=C
|
set cpo-=C
|
||||||
|
|
||||||
CompilerSet makeprg=nim\ c\ $*
|
CompilerSet makeprg=nim\ c\ --verbosity:0\ $*\ %:p
|
||||||
|
|
||||||
CompilerSet errorformat=
|
CompilerSet errorformat=
|
||||||
\%-GHint:\ %m,
|
\%-GHint:\ %m,
|
||||||
|
|||||||
71
compiler/python.vim
Normal file
71
compiler/python.vim
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Unit testing tool for Python
|
||||||
|
" Maintainer: Ali Aliev <ali@aliev.me>
|
||||||
|
" Last Change: 2015 Nov 2
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let current_compiler = "python"
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Disable Python warnings
|
||||||
|
if !exists('$PYTHONWARNINGS')
|
||||||
|
let $PYTHONWARNINGS="ignore"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" For Flake8 first
|
||||||
|
CompilerSet efm =%E%f:%l:\ could\ not\ compile,
|
||||||
|
CompilerSet efm +=%-Z%p^,
|
||||||
|
CompilerSet efm +=%A%f:%l:%c:\ %t%n\ %m,
|
||||||
|
CompilerSet efm +=%A%f:%l:\ %t%n\ %m,
|
||||||
|
|
||||||
|
" Python errors are multi-lined. They often start with 'Traceback', so
|
||||||
|
" we want to capture that (with +G) and show it in the quickfix window
|
||||||
|
" because it explains the order of error messages.
|
||||||
|
|
||||||
|
CompilerSet efm +=%+GTraceback%.%#,
|
||||||
|
|
||||||
|
" The error message itself starts with a line with 'File' in it. There
|
||||||
|
" are a couple of variations, and we need to process a line beginning
|
||||||
|
" with whitespace followed by File, the filename in "", a line number,
|
||||||
|
" and optional further text. %E here indicates the start of a multi-line
|
||||||
|
" error message. The %\C at the end means that a case-sensitive search is
|
||||||
|
" required.
|
||||||
|
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l\\,%m%\\C,
|
||||||
|
CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l%\\C,
|
||||||
|
|
||||||
|
" The possible continutation lines are idenitifed to Vim by %C. We deal
|
||||||
|
" with these in order of most to least specific to ensure a proper
|
||||||
|
" match. A pointer (^) identifies the column in which the error occurs
|
||||||
|
" (but will not be entirely accurate due to indention of Python code).
|
||||||
|
CompilerSet efm +=%C%p^,
|
||||||
|
|
||||||
|
" Any text, indented by more than two spaces contain useful information.
|
||||||
|
" We want this to appear in the quickfix window, hence %+.
|
||||||
|
CompilerSet efm +=%+C\ \ \ \ %.%#,
|
||||||
|
CompilerSet efm +=%+C\ \ %.%#,
|
||||||
|
|
||||||
|
" The last line (%Z) does not begin with any whitespace. We use a zero
|
||||||
|
" width lookahead (\&) to check this. The line contains the error
|
||||||
|
" message itself (%m)
|
||||||
|
CompilerSet efm +=%Z%\\S%\\&%m,
|
||||||
|
|
||||||
|
" We can ignore any other lines (%-G)
|
||||||
|
CompilerSet efm +=%-G%.%#
|
||||||
|
|
||||||
|
if filereadable("Makefile")
|
||||||
|
CompilerSet makeprg=make
|
||||||
|
else
|
||||||
|
CompilerSet makeprg=python
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim:foldmethod=marker:foldlevel=0
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -24,10 +24,10 @@ CompilerSet errorformat=
|
|||||||
\%D(in\ %f),
|
\%D(in\ %f),
|
||||||
\%\\s%#from\ %f:%l:%m,
|
\%\\s%#from\ %f:%l:%m,
|
||||||
\%\\s%#from\ %f:%l:,
|
\%\\s%#from\ %f:%l:,
|
||||||
\%\\s%##\ %f:%l:%m,
|
\%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%.%#,
|
||||||
\%\\s%##\ %f:%l,
|
\%\\s%##\ %f:%l%\\&%.%#%\\D:%.%#,
|
||||||
\%\\s%#[%f:%l:\ %#%m,
|
\%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
|
||||||
\%\\s%#%f:%l:\ %#%m,
|
\%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%.%#,
|
||||||
\%\\s%#%f:%l:,
|
\%\\s%#%f:%l:,
|
||||||
\%m\ [%f:%l]:,
|
\%m\ [%f:%l]:,
|
||||||
\%+Erake\ aborted!,
|
\%+Erake\ aborted!,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ else
|
|||||||
CompilerSet makeprg=rustc\ \%
|
CompilerSet makeprg=rustc\ \%
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Old errorformat (before nightly 2016/08/10)
|
||||||
CompilerSet errorformat=
|
CompilerSet errorformat=
|
||||||
\%f:%l:%c:\ %t%*[^:]:\ %m,
|
\%f:%l:%c:\ %t%*[^:]:\ %m,
|
||||||
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
|
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
|
||||||
@@ -31,6 +32,17 @@ CompilerSet errorformat=
|
|||||||
\%-G%*[\ ]^%*[~],
|
\%-G%*[\ ]^%*[~],
|
||||||
\%-G%*[\ ]...
|
\%-G%*[\ ]...
|
||||||
|
|
||||||
|
" New errorformat (after nightly 2016/08/10)
|
||||||
|
CompilerSet errorformat+=
|
||||||
|
\%-G,
|
||||||
|
\%-Gerror:\ aborting\ %.%#,
|
||||||
|
\%-Gerror:\ Could\ not\ compile\ %.%#,
|
||||||
|
\%Eerror:\ %m,
|
||||||
|
\%Eerror[E%n]:\ %m,
|
||||||
|
\%Wwarning:\ %m,
|
||||||
|
\%Inote:\ %m,
|
||||||
|
\%C\ %#-->\ %f:%l:%c
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
|
||||||
|
|
||||||
" Vim compiler file
|
|
||||||
" Compiler: Sass
|
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
||||||
" Last Change: 2013 May 30
|
|
||||||
|
|
||||||
if exists("current_compiler")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let current_compiler = "sass"
|
|
||||||
|
|
||||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
|
||||||
command -nargs=* CompilerSet setlocal <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
CompilerSet makeprg=sass
|
|
||||||
|
|
||||||
CompilerSet errorformat=
|
|
||||||
\%f:%l:%m\ (Sass::Syntax%trror),
|
|
||||||
\%ESyntax\ %trror:%m,
|
|
||||||
\%C%\\s%\\+on\ line\ %l\ of\ %f,
|
|
||||||
\%Z%.%#,
|
|
||||||
\%-G%.%#
|
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
" vim:set sw=2 sts=2:
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -13,6 +13,10 @@ if !exists("g:typescript_compiler_options")
|
|||||||
let g:typescript_compiler_options = ""
|
let g:typescript_compiler_options = ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command! -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
|
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
|
||||||
|
|
||||||
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
||||||
|
|||||||
11
config.vim
Normal file
11
config.vim
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
" Enable jsx syntax by default
|
||||||
|
if !exists('g:jsx_ext_required')
|
||||||
|
let g:jsx_ext_required = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Disable json concealing by default
|
||||||
|
if !exists('g:vim_json_syntax_conceal')
|
||||||
|
let g:vim_json_syntax_conceal = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:filetype_euphoria = 'elixir'
|
||||||
96
extras/flow.vim
Normal file
96
extras/flow.vim
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax region jsFlowDefinition contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster containedin=jsParen
|
||||||
|
syntax region jsFlowArgumentDef contained start=/:/ end=/\%(\s*[,)]\|=>\@!\)\@=/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster
|
||||||
|
syntax match jsFlowNoise contained /[:;,<>]/
|
||||||
|
syntax keyword jsFlowType contained boolean number string null void any mixed JSON array Function object array bool class
|
||||||
|
syntax keyword jsFlowTypeof contained typeof skipempty skipempty nextgroup=jsFlowTypeCustom,jsFlowType
|
||||||
|
syntax match jsFlowTypeCustom contained /[0-9a-zA-Z_.]*/ skipwhite skipempty nextgroup=jsFlowGroup
|
||||||
|
syntax region jsFlowGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowArrowArguments contained matchgroup=jsFlowNoise start=/(/ end=/)\%(\s*=>\)\@=/ oneline skipwhite skipempty nextgroup=jsFlowArrow contains=@jsFlowCluster
|
||||||
|
syntax match jsFlowArrow contained /=>/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens
|
||||||
|
syntax match jsFlowMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowType,jsFlowTypeCustom,jsFlowParens,jsFlowArrowArguments,jsFlowObject,jsFlowReturnObject
|
||||||
|
syntax match jsFlowObjectKey contained /[0-9a-zA-Z_$?]*\(\s*:\)\@=/ contains=jsFunctionKey,jsFlowMaybe skipwhite skipempty nextgroup=jsObjectValue containedin=jsObject
|
||||||
|
syntax match jsFlowOrOperator contained /|/ skipwhite skipempty nextgroup=@jsFlowCluster
|
||||||
|
syntax keyword jsFlowImportType contained type skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup
|
||||||
|
syntax match jsFlowWildcard contained /*/
|
||||||
|
|
||||||
|
syntax match jsFlowReturn contained /:\s*/ contains=jsFlowNoise skipwhite skipempty nextgroup=@jsFlowReturnCluster
|
||||||
|
syntax region jsFlowReturnObject contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||||
|
syntax region jsFlowReturnArray contained matchgroup=jsFlowNoise start=/\[/ end=/\]/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||||
|
syntax region jsFlowReturnParens contained matchgroup=jsFlowNoise start=/(/ end=/)/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||||
|
syntax match jsFlowReturnKeyword contained /\k\+/ contains=jsFlowType,jsFlowTypeCustom skipwhite skipempty nextgroup=jsFlowReturnGroup,jsFuncBlock,jsFlowReturnOrOp
|
||||||
|
syntax match jsFlowReturnMaybe contained /?/ skipwhite skipempty nextgroup=jsFlowReturnKeyword
|
||||||
|
syntax region jsFlowReturnGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturnOrOp
|
||||||
|
syntax match jsFlowReturnOrOp contained /\s*|\s*/ skipwhite skipempty nextgroup=@jsFlowReturnCluster
|
||||||
|
syntax match jsFlowWildcardReturn contained /*/ skipwhite skipempty nextgroup=jsFuncBlock
|
||||||
|
|
||||||
|
syntax region jsFlowFunctionGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
|
syntax region jsFlowClassGroup contained matchgroup=jsFlowNoise start=/</ end=/>/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassBlock
|
||||||
|
|
||||||
|
syntax region jsFlowTypeStatement start=/type\%(\s\+\k\)\@=/ end=/=\@=/ contains=jsFlowTypeOperator oneline skipwhite skipempty nextgroup=jsFlowTypeValue keepend
|
||||||
|
syntax region jsFlowTypeValue contained start=/=/ end=/[;\n]/ contains=@jsExpression,jsFlowGroup,jsFlowMaybe
|
||||||
|
syntax match jsFlowTypeOperator contained /=/
|
||||||
|
syntax keyword jsFlowTypeKeyword contained type
|
||||||
|
|
||||||
|
syntax keyword jsFlowDeclare declare skipwhite skipempty nextgroup=jsFlowTypeStatement,jsClassDefinition,jsStorageClass,jsFlowModule,jsFlowInterface
|
||||||
|
syntax match jsFlowClassProperty contained /\<[0-9a-zA-Z_$]*\>:\@=/ skipwhite skipempty nextgroup=jsFlowClassDef containedin=jsClassBlock
|
||||||
|
syntax region jsFlowClassDef contained start=/:/ end=/\%(\s*[,=;)\n]\)\@=/ contains=@jsFlowCluster skipwhite skipempty nextgroup=jsClassValue
|
||||||
|
|
||||||
|
syntax region jsFlowModule contained start=/module/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowDeclareBlock contains=jsString
|
||||||
|
syntax region jsFlowInterface contained start=/interface/ end=/{\@=/ skipempty skipempty nextgroup=jsFlowInterfaceBlock contains=@jsFlowCluster
|
||||||
|
syntax region jsFlowDeclareBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsFlowDeclare,jsFlowNoise
|
||||||
|
|
||||||
|
syntax region jsFlowInterfaceBlock contained matchgroup=jsFlowNoise start=/{/ end=/}/ contains=jsObjectKey,jsObjectKeyString,jsObjectKeyComputed,jsObjectSeparator,jsObjectFuncName,jsObjectMethodType,jsGenerator,jsComment,jsObjectStringKey,jsSpreadExpression,jsFlowNoise keepend
|
||||||
|
|
||||||
|
syntax cluster jsFlowReturnCluster contains=jsFlowNoise,jsFlowReturnObject,jsFlowReturnArray,jsFlowReturnKeyword,jsFlowReturnGroup,jsFlowReturnMaybe,jsFlowReturnOrOp,jsFlowWildcardReturn
|
||||||
|
syntax cluster jsFlowCluster contains=jsFlowArray,jsFlowObject,jsFlowNoise,jsFlowTypeof,jsFlowType,jsFlowGroup,jsFlowArrowArguments,jsFlowMaybe,jsFlowParens,jsFlowOrOperator,jsFlowWildcard
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsFlowDefinition PreProc
|
||||||
|
HiLink jsFlowClassDef jsFlowDefinition
|
||||||
|
HiLink jsFlowArgumentDef jsFlowDefinition
|
||||||
|
HiLink jsFlowType Type
|
||||||
|
HiLink jsFlowTypeCustom PreProc
|
||||||
|
HiLink jsFlowTypeof PreProc
|
||||||
|
HiLink jsFlowArray PreProc
|
||||||
|
HiLink jsFlowObject PreProc
|
||||||
|
HiLink jsFlowParens PreProc
|
||||||
|
HiLink jsFlowGroup PreProc
|
||||||
|
HiLink jsFlowReturn PreProc
|
||||||
|
HiLink jsFlowReturnObject jsFlowReturn
|
||||||
|
HiLink jsFlowReturnArray jsFlowArray
|
||||||
|
HiLink jsFlowReturnParens jsFlowParens
|
||||||
|
HiLink jsFlowReturnGroup jsFlowGroup
|
||||||
|
HiLink jsFlowFunctionGroup PreProc
|
||||||
|
HiLink jsFlowClassGroup PreProc
|
||||||
|
HiLink jsFlowArrowArguments PreProc
|
||||||
|
HiLink jsFlowArrow PreProc
|
||||||
|
HiLink jsFlowTypeStatement PreProc
|
||||||
|
HiLink jsFlowTypeKeyword PreProc
|
||||||
|
HiLink jsFlowTypeOperator PreProc
|
||||||
|
HiLink jsFlowMaybe PreProc
|
||||||
|
HiLink jsFlowReturnMaybe PreProc
|
||||||
|
HiLink jsFlowClassProperty jsClassProperty
|
||||||
|
HiLink jsFlowDeclare PreProc
|
||||||
|
HiLink jsFlowModule PreProc
|
||||||
|
HiLink jsFlowInterface PreProc
|
||||||
|
HiLink jsFlowNoise Noise
|
||||||
|
HiLink jsFlowObjectKey jsObjectKey
|
||||||
|
HiLink jsFlowOrOperator PreProc
|
||||||
|
HiLink jsFlowReturnOrOp jsFlowOrOperator
|
||||||
|
HiLink jsFlowWildcard PreProc
|
||||||
|
HiLink jsFlowWildcardReturn PreProc
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
43
extras/jsdoc.vim
Normal file
43
extras/jsdoc.vim
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
"" syntax coloring for javadoc comments (HTML)
|
||||||
|
syntax region jsComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold
|
||||||
|
|
||||||
|
" tags containing a param
|
||||||
|
syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|fires\|kind\|link\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" skipwhite nextgroup=jsDocParam
|
||||||
|
" tags containing type and param
|
||||||
|
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\|typedef\)\>" skipwhite nextgroup=jsDocType
|
||||||
|
" tags containing type but no param
|
||||||
|
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||||
|
" tags containing references
|
||||||
|
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||||
|
" other tags (no extra syntax)
|
||||||
|
syntax match jsDocTags contained "@\(abstract\|access\|accessor\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|localdoc\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>"
|
||||||
|
|
||||||
|
syntax region jsDocType contained matchgroup=jsDocTypeBrackets start="{" end="}" contains=jsDocTypeRecord oneline skipwhite nextgroup=jsDocParam
|
||||||
|
syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" skipwhite nextgroup=jsDocParam
|
||||||
|
syntax region jsDocTypeRecord contained start=/{/ end=/}/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeRecord contained start=/\[/ end=/\]/ contains=jsDocTypeRecord extend
|
||||||
|
syntax region jsDocTypeNoParam contained start="{" end="}" oneline
|
||||||
|
syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|-\|'\|\"\|{.\{-}}\|\w\|\.\|:\|\/\|\[.\{-}]\|=\)\+"
|
||||||
|
syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags
|
||||||
|
|
||||||
|
if version >= 508 || !exists("did_javascript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_javascript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink jsDocTags Special
|
||||||
|
HiLink jsDocSeeTag Function
|
||||||
|
HiLink jsDocType Type
|
||||||
|
HiLink jsDocTypeBrackets jsDocType
|
||||||
|
HiLink jsDocTypeRecord jsDocType
|
||||||
|
HiLink jsDocTypeNoParam Type
|
||||||
|
HiLink jsDocParam Label
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
7
extras/ngdoc.vim
Normal file
7
extras/ngdoc.vim
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
|
syntax match jsDocTags contained /@\(link\|method[oO]f\|ngdoc\|ng[iI]nject\|restrict\)/ nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocType contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite
|
||||||
|
syntax match jsDocParam contained "\%(#\|\$\|\w\|\"\|-\|\.\|:\|{\|}\|\/\|\[\|]\|=\)\+"
|
||||||
|
|
||||||
|
endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -4,5 +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
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -11,6 +11,27 @@ endif
|
|||||||
runtime! ftplugin/html.vim
|
runtime! ftplugin/html.vim
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
setlocal iskeyword+=@-@
|
setlocal suffixesadd=.blade.php,.php
|
||||||
|
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||||
|
setlocal path+=resources/views;
|
||||||
|
setlocal include=\\w\\@<!@\\%(include\\\|extends\\)
|
||||||
|
setlocal define=\\w\\@<!@\\%(yield\\\|stack\\)
|
||||||
|
|
||||||
|
setlocal commentstring={{--%s--}}
|
||||||
|
setlocal comments+=s:{{--,m:\ \ \ \ ,e:--}}
|
||||||
|
|
||||||
|
if exists('loaded_matchit') && exists('b:match_words')
|
||||||
|
" Append to html matchit words
|
||||||
|
let b:match_words .= ',' .
|
||||||
|
\ '@\%(section\s*([^\,]*)\|if\|unless\|foreach\|forelse\|for\|while\|push\|can\|cannot\|hasSection\|' .
|
||||||
|
\ 'php\s*(\@!\|verbatim\|component\|slot\|prepend\)' .
|
||||||
|
\ ':' .
|
||||||
|
\ '@\%(else\|elseif\|empty\|break\|continue\|elsecan\|elsecannot\)\>' .
|
||||||
|
\ ':' .
|
||||||
|
\ '@\%(end\w\+\|stop\|show\|append\|overwrite\)' .
|
||||||
|
\ ',{:},\[:\],(:)'
|
||||||
|
let b:match_skip = 'synIDattr(synID(line("."), col("."), 0), "name") !=# "bladeKeyword"'
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
28
ftplugin/caddyfile.vim
Normal file
28
ftplugin/caddyfile.vim
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'caddyfile') == -1
|
||||||
|
|
||||||
|
" Language: Caddyfile
|
||||||
|
" Author: Josh Glendenning <josh@isobit.io>
|
||||||
|
|
||||||
|
if exists('b:did_ftplugin')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
" Add NERDCommenter delimiters
|
||||||
|
let s:delimiters = {'left': '#'}
|
||||||
|
if exists('g:NERDDelimiterMap')
|
||||||
|
if !has_key(g:NERDDelimiterMap, 'caddyfile')
|
||||||
|
let g:NERDDelimiterMap.caddyfile = s:delimiters
|
||||||
|
endif
|
||||||
|
elseif exists('g:NERDCustomDelimiters')
|
||||||
|
if !has_key(g:NERDCustomDelimiters, 'caddyfile')
|
||||||
|
let g:NERDDelimiterMap.caddyfile = s:delimiters
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:NERDCustomDelimiters = {'caddyfile': s:delimiters}
|
||||||
|
endif
|
||||||
|
unlet s:delimiters
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -15,7 +15,7 @@ call coffee#CoffeeSetUpVariables()
|
|||||||
setlocal formatoptions-=t formatoptions+=croql
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
setlocal comments=:# commentstring=#\ %s
|
setlocal comments=:# commentstring=#\ %s
|
||||||
setlocal omnifunc=javascriptcomplete#CompleteJS
|
setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||||
setlocal suffixesadd+=coffee
|
setlocal suffixesadd+=.coffee
|
||||||
|
|
||||||
" Create custom augroups.
|
" Create custom augroups.
|
||||||
augroup CoffeeBufUpdate | augroup END
|
augroup CoffeeBufUpdate | augroup END
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if exists('loaded_matchit') && !exists('b:match_words')
|
|||||||
let b:match_ignorecase = 0
|
let b:match_ignorecase = 0
|
||||||
|
|
||||||
let b:match_words =
|
let b:match_words =
|
||||||
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|struct\|lib\|macro\|ifdef\|def\|fun\|begin\)\>=\@!' .
|
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|struct\|lib\|macro\|ifdef\|def\|fun\|begin\|enum\)\>=\@!' .
|
||||||
\ ':' .
|
\ ':' .
|
||||||
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
|
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
|
||||||
\ ':' .
|
\ ':' .
|
||||||
@@ -40,6 +40,30 @@ setlocal errorformat=
|
|||||||
\%C%p^,
|
\%C%p^,
|
||||||
\%-C%.%#
|
\%-C%.%#
|
||||||
|
|
||||||
|
let g:crystal_compiler_command = get(g:, 'crystal_compiler_command', 'crystal')
|
||||||
|
let g:crystal_auto_format = get(g:, 'crystal_auto_format', 0)
|
||||||
|
|
||||||
|
command! -buffer -nargs=* CrystalImpl echo crystal_lang#impl(expand('%'), getpos('.'), <q-args>).output
|
||||||
|
command! -buffer -nargs=0 CrystalDef call crystal_lang#jump_to_definition(expand('%'), getpos('.'))
|
||||||
|
command! -buffer -nargs=* CrystalContext echo crystal_lang#context(expand('%'), getpos('.'), <q-args>).output
|
||||||
|
command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expand('%'), <q-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
||||||
|
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>)
|
||||||
|
|
||||||
|
nnoremap <Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
||||||
|
nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
|
||||||
|
nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR>
|
||||||
|
|
||||||
|
augroup plugin-ft-crystal
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
if get(g:, 'crystal_define_mappings', 1)
|
if get(g:, 'crystal_define_mappings', 1)
|
||||||
nmap <buffer>gd <Plug>(crystal-jump-to-definition)
|
nmap <buffer>gd <Plug>(crystal-jump-to-definition)
|
||||||
nmap <buffer>gc <Plug>(crystal-show-context)
|
nmap <buffer>gc <Plug>(crystal-show-context)
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ let &l:errorformat =
|
|||||||
\ '%m'
|
\ '%m'
|
||||||
\ ], ',')
|
\ ], ',')
|
||||||
|
|
||||||
|
setlocal includeexpr=dart#resolveUri(v:fname)
|
||||||
|
setlocal isfname+=:
|
||||||
|
|
||||||
let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms<'
|
let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms< inex< isf<'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ if !exists("g:eelixir_default_subtype")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("b:eelixir_subtype")
|
if !exists("b:eelixir_subtype")
|
||||||
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
let s:lines = join(getline(1, 5) + [getline('$')], "\n")
|
||||||
let b:eelixir_subtype = matchstr(s:lines,'eelixir_subtype=\zs\w\+')
|
let b:eelixir_subtype = matchstr(s:lines,'eelixir_subtype=\zs\w\+')
|
||||||
if b:eelixir_subtype == ''
|
if b:eelixir_subtype == ''
|
||||||
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
|
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
|
||||||
@@ -80,10 +80,27 @@ if exists("loaded_matchit")
|
|||||||
let b:match_words = s:match_words
|
let b:match_words = s:match_words
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('b:surround_45')
|
||||||
|
" When using surround `-` (ASCII 45) would provide `<% selection %>`
|
||||||
|
let b:surround_45 = "<% \r %>"
|
||||||
|
endif
|
||||||
|
if !exists('b:surround_61')
|
||||||
|
" When using surround `=` (ASCII 61) would provide `<%= selection %>`
|
||||||
|
let b:surround_61 = "<%= \r %>"
|
||||||
|
endif
|
||||||
|
if !exists('b:surround_35')
|
||||||
|
" When using surround `#` (ASCII 35) would provide `<%# selection %>`
|
||||||
|
let b:surround_35 = "<%# \r %>"
|
||||||
|
endif
|
||||||
|
if !exists('b:surround_5')
|
||||||
|
" When using surround `<C-e>` (ASCII 5 `ENQ`) would provide `<% selection %>\n<% end %>`
|
||||||
|
let b:surround_5 = "<% \r %>\n<% end %>"
|
||||||
|
endif
|
||||||
|
|
||||||
setlocal comments=:<%#
|
setlocal comments=:<%#
|
||||||
setlocal commentstring=<%#\ %s\ %>
|
setlocal commentstring=<%#\ %s\ %>
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl cms< "
|
let b:undo_ftplugin = "setl cms< " .
|
||||||
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
|||||||
@@ -17,45 +17,24 @@ if exists("loaded_matchit") && !exists("b:match_words")
|
|||||||
\ ',{:},\[:\],(:)'
|
\ ',{:},\[:\],(:)'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,?
|
||||||
setlocal comments=:#
|
setlocal comments=:#
|
||||||
setlocal commentstring=#\ %s
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
function! GetElixirFilename(word)
|
|
||||||
let word = a:word
|
|
||||||
|
|
||||||
" get first thing that starts uppercase, until the first space or end of line
|
|
||||||
let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g')
|
|
||||||
|
|
||||||
" remove any trailing characters that don't look like a nested module
|
|
||||||
let word = substitute(word,'\.\U.*$','','g')
|
|
||||||
|
|
||||||
" replace module dots with slash
|
|
||||||
let word = substitute(word,'\.','/','g')
|
|
||||||
|
|
||||||
" remove any special chars
|
|
||||||
let word = substitute(word,'[^A-z0-9-_/]','','g')
|
|
||||||
|
|
||||||
" convert to snake_case
|
|
||||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
|
||||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
|
||||||
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
|
|
||||||
let word = substitute(word,'-','_','g')
|
|
||||||
let word = tolower(word)
|
|
||||||
|
|
||||||
return word
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let &l:path =
|
let &l:path =
|
||||||
\ join([
|
\ join([
|
||||||
\ getcwd().'/lib',
|
\ 'lib',
|
||||||
\ getcwd().'/src',
|
\ 'src',
|
||||||
\ getcwd().'/deps/**/lib',
|
\ 'deps/**/lib',
|
||||||
\ getcwd().'/deps/**/src',
|
\ 'deps/**/src',
|
||||||
\ &g:path
|
\ &g:path
|
||||||
\ ], ',')
|
\ ], ',')
|
||||||
setlocal includeexpr=GetElixirFilename(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
|
||||||
|
|
||||||
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< '.
|
||||||
|
\ '| unlet! b:match_ignorecase b:match_words'
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
|
||||||
|
|
||||||
" Language: ember-script
|
" Language: ember-script
|
||||||
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
|
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
|
||||||
" URL: http://github.com/heartsentwined/vim-ember-script
|
" URL: http://github.com/yalesov/vim-ember-script
|
||||||
" Version: 1.0.1
|
" Version: 1.0.4
|
||||||
" Last Change: 2013 Apr 17
|
" Last Change: 2016 Jul 6
|
||||||
" License: GPL-3.0
|
" License: ISC
|
||||||
|
|
||||||
setlocal tabstop=2
|
setlocal tabstop=2
|
||||||
setlocal softtabstop=2
|
setlocal softtabstop=2
|
||||||
@@ -14,7 +14,11 @@ setlocal smarttab
|
|||||||
setlocal expandtab
|
setlocal expandtab
|
||||||
setlocal smartindent
|
setlocal smartindent
|
||||||
|
|
||||||
|
if v:version < 703
|
||||||
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
|
else
|
||||||
setlocal formatoptions-=t formatoptions+=croqlj
|
setlocal formatoptions-=t formatoptions+=croqlj
|
||||||
|
endif
|
||||||
setlocal comments=:#
|
setlocal comments=:#
|
||||||
setlocal commentstring=#\ %s
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
|
||||||
|
|
||||||
" Language: emblem
|
" Language: emblem
|
||||||
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
|
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
|
||||||
" URL: http://github.com/heartsentwined/vim-emblem
|
" URL: http://github.com/yalesov/vim-emblem
|
||||||
" Version: 1.2.0
|
" Version: 2.0.1
|
||||||
" Last Change: 2013 Apr 22
|
" Last Change: 2016 Jul 6
|
||||||
" License: GPL-3.0
|
" License: ISC
|
||||||
|
|
||||||
setlocal tabstop=2
|
setlocal tabstop=2
|
||||||
setlocal softtabstop=2
|
setlocal softtabstop=2
|
||||||
|
|||||||
17
ftplugin/graphql.vim
Normal file
17
ftplugin/graphql.vim
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin
|
||||||
|
" Language: GraphQL
|
||||||
|
" Maintainer: Jon Parise <jon@indelible.org>
|
||||||
|
|
||||||
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal formatoptions-=t
|
||||||
|
setlocal iskeyword+=$,@-@
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
|
||||||
|
|
||||||
setlocal suffixesadd+=.js
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
endif
|
endif
|
||||||
42
ftplugin/json.vim
Normal file
42
ftplugin/json.vim
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: JSON
|
||||||
|
" Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
||||||
|
" Last Change: 2014-05-20 added warning toggle
|
||||||
|
|
||||||
|
"uncomment to enable folding of `{...}` and `[...]` blocks
|
||||||
|
"setlocal foldmethod=syntax
|
||||||
|
|
||||||
|
"conceal by default
|
||||||
|
if !exists("g:vim_json_syntax_conceal")
|
||||||
|
let g:vim_json_syntax_conceal = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
"have warnings by default
|
||||||
|
if !exists("g:vim_json_warnings")
|
||||||
|
let g:vim_json_warnings = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
"set concealcursor blank by default
|
||||||
|
"this should turn off the concealing in the current line (where the cursor is at),
|
||||||
|
"on all modes (normal, visual, insert)
|
||||||
|
if !exists("g:vim_json_syntax_concealcursor")
|
||||||
|
let g:vim_json_syntax_concealcursor = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if has('conceal')
|
||||||
|
if (g:vim_json_syntax_conceal == 1)
|
||||||
|
"level 2 means concealed text gets completely hidden unless a
|
||||||
|
"replacement is defined (none is defined by us)
|
||||||
|
setlocal conceallevel=2
|
||||||
|
let &l:concealcursor = g:vim_json_syntax_concealcursor
|
||||||
|
else
|
||||||
|
"level 0 means text is shown normally = no concealing
|
||||||
|
setlocal conceallevel=0
|
||||||
|
endif
|
||||||
|
"maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
|
||||||
|
"directly to vim's conceallevels? unsure if anyone cares
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
5
ftplugin/litcoffee.vim
Normal file
5
ftplugin/litcoffee.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
||||||
|
|
||||||
|
runtime ftplugin/coffee.vim
|
||||||
|
|
||||||
|
endif
|
||||||
208
ftplugin/ls.vim
Normal file
208
ftplugin/ls.vim
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
"
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
setlocal omnifunc=javascriptcomplete#CompleteJS
|
||||||
|
|
||||||
|
" Enable LiveScriptMake if it won't overwrite any settings.
|
||||||
|
if !len(&l:makeprg)
|
||||||
|
compiler ls
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Check here too in case the compiler above isn't loaded.
|
||||||
|
if !exists('livescript_compiler')
|
||||||
|
let livescript_compiler = 'lsc'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Reset the LiveScriptCompile variables for the current buffer.
|
||||||
|
function! s:LiveScriptCompileResetVars()
|
||||||
|
" Compiled output buffer
|
||||||
|
let b:livescript_compile_buf = -1
|
||||||
|
let b:livescript_compile_pos = []
|
||||||
|
|
||||||
|
" If LiveScriptCompile is watching a buffer
|
||||||
|
let b:livescript_compile_watch = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Clean things up in the source buffer.
|
||||||
|
function! s:LiveScriptCompileClose()
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
|
||||||
|
call s:LiveScriptCompileResetVars()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Update the LiveScriptCompile buffer given some input lines.
|
||||||
|
function! s:LiveScriptCompileUpdate(startline, endline)
|
||||||
|
let input = join(getline(a:startline, a:endline), "\n")
|
||||||
|
|
||||||
|
" Move to the LiveScriptCompile buffer.
|
||||||
|
exec bufwinnr(b:livescript_compile_buf) 'wincmd w'
|
||||||
|
|
||||||
|
" LiveScript doesn't like empty input.
|
||||||
|
if !len(input)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Compile input.
|
||||||
|
let output = system(g:livescript_compiler . ' -scb 2>&1', input)
|
||||||
|
|
||||||
|
" Be sure we're in the LiveScriptCompile buffer before overwriting.
|
||||||
|
if exists('b:livescript_compile_buf')
|
||||||
|
echoerr 'LiveScriptCompile buffers are messed up'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Replace buffer contents with new output and delete the last empty line.
|
||||||
|
setlocal modifiable
|
||||||
|
exec '% delete _'
|
||||||
|
put! =output
|
||||||
|
exec '$ delete _'
|
||||||
|
setlocal nomodifiable
|
||||||
|
|
||||||
|
" Highlight as JavaScript if there is no compile error.
|
||||||
|
if v:shell_error
|
||||||
|
setlocal filetype=
|
||||||
|
else
|
||||||
|
setlocal filetype=javascript
|
||||||
|
endif
|
||||||
|
|
||||||
|
call setpos('.', b:livescript_compile_pos)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Update the LiveScriptCompile buffer with the whole source buffer.
|
||||||
|
function! s:LiveScriptCompileWatchUpdate()
|
||||||
|
call s:LiveScriptCompileUpdate(1, '$')
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Peek at compiled LiveScript in a scratch buffer. We handle ranges like this
|
||||||
|
" to prevent the cursor from being moved (and its position saved) before the
|
||||||
|
" function is called.
|
||||||
|
function! s:LiveScriptCompile(startline, endline, args)
|
||||||
|
if !executable(g:livescript_compiler)
|
||||||
|
echoerr "Can't find LiveScript compiler `" . g:livescript_compiler . "`"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If in the LiveScriptCompile buffer, switch back to the source buffer and
|
||||||
|
" continue.
|
||||||
|
if !exists('b:livescript_compile_buf')
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Parse arguments.
|
||||||
|
let watch = a:args =~ '\<watch\>'
|
||||||
|
let unwatch = a:args =~ '\<unwatch\>'
|
||||||
|
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
||||||
|
|
||||||
|
" Determine default split direction.
|
||||||
|
if exists('g:livescript_compile_vert')
|
||||||
|
let vert = 1
|
||||||
|
else
|
||||||
|
let vert = a:args =~ '\<vert\%[ical]\>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Remove any watch listeners.
|
||||||
|
silent! autocmd! LiveScriptCompileAuWatch * <buffer>
|
||||||
|
|
||||||
|
" If just unwatching, don't compile.
|
||||||
|
if unwatch
|
||||||
|
let b:livescript_compile_watch = 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if watch
|
||||||
|
let b:livescript_compile_watch = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Build the LiveScriptCompile buffer if it doesn't exist.
|
||||||
|
if bufwinnr(b:livescript_compile_buf) == -1
|
||||||
|
let src_buf = bufnr('%')
|
||||||
|
let src_win = bufwinnr(src_buf)
|
||||||
|
|
||||||
|
" Create the new window and resize it.
|
||||||
|
if vert
|
||||||
|
let width = size ? size : winwidth(src_win) / 2
|
||||||
|
|
||||||
|
belowright vertical new
|
||||||
|
exec 'vertical resize' width
|
||||||
|
else
|
||||||
|
" Try to guess the compiled output's height.
|
||||||
|
let height = size ? size : min([winheight(src_win) / 2,
|
||||||
|
\ a:endline - a:startline + 5])
|
||||||
|
|
||||||
|
belowright new
|
||||||
|
exec 'resize' height
|
||||||
|
endif
|
||||||
|
|
||||||
|
" We're now in the scratch buffer, so set it up.
|
||||||
|
setlocal bufhidden=wipe buftype=nofile
|
||||||
|
setlocal nobuflisted nomodifiable noswapfile nowrap
|
||||||
|
|
||||||
|
autocmd BufWipeout <buffer> call s:LiveScriptCompileClose()
|
||||||
|
" Save the cursor when leaving the LiveScriptCompile buffer.
|
||||||
|
autocmd BufLeave <buffer> let b:livescript_compile_pos = getpos('.')
|
||||||
|
|
||||||
|
nnoremap <buffer> <silent> q :hide<CR>
|
||||||
|
|
||||||
|
let b:livescript_compile_src_buf = src_buf
|
||||||
|
let buf = bufnr('%')
|
||||||
|
|
||||||
|
" Go back to the source buffer and set it up.
|
||||||
|
exec bufwinnr(b:livescript_compile_src_buf) 'wincmd w'
|
||||||
|
let b:livescript_compile_buf = buf
|
||||||
|
endif
|
||||||
|
|
||||||
|
if b:livescript_compile_watch
|
||||||
|
call s:LiveScriptCompileWatchUpdate()
|
||||||
|
|
||||||
|
augroup LiveScriptCompileAuWatch
|
||||||
|
autocmd InsertLeave <buffer> call s:LiveScriptCompileWatchUpdate()
|
||||||
|
autocmd BufWritePost <buffer> call s:LiveScriptCompileWatchUpdate()
|
||||||
|
augroup END
|
||||||
|
else
|
||||||
|
call s:LiveScriptCompileUpdate(a:startline, a:endline)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Complete arguments for the LiveScriptCompile command.
|
||||||
|
function! s:LiveScriptCompileComplete(arg, cmdline, cursor)
|
||||||
|
let args = ['unwatch', 'vertical', 'watch']
|
||||||
|
|
||||||
|
if !len(a:arg)
|
||||||
|
return args
|
||||||
|
endif
|
||||||
|
|
||||||
|
let match = '^' . a:arg
|
||||||
|
|
||||||
|
for arg in args
|
||||||
|
if arg =~ match
|
||||||
|
return [arg]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Don't overwrite the CoffeeCompile variables.
|
||||||
|
if !exists("s:livescript_compile_buf")
|
||||||
|
call s:LiveScriptCompileResetVars()
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Peek at compiled LiveScript.
|
||||||
|
command! -range=% -bar -nargs=* -complete=customlist,s:LiveScriptCompileComplete
|
||||||
|
\ LiveScriptCompile call s:LiveScriptCompile(<line1>, <line2>, <q-args>)
|
||||||
|
" Run some LiveScript.
|
||||||
|
command! -range=% -bar LiveScriptRun <line1>,<line2>:w !lsc -sp
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
|
||||||
|
|
||||||
" Vim filetype plugin
|
|
||||||
" Language: Markdown
|
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
||||||
" Last Change: 2013 May 30
|
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
|
||||||
|
|
||||||
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
|
|
||||||
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
|
|
||||||
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:
|
|
||||||
|
|
||||||
if exists('b:undo_ftplugin')
|
|
||||||
let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
|
|
||||||
else
|
|
||||||
let b:undo_ftplugin = "setl cms< com< fo< flp<"
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! MarkdownFold()
|
|
||||||
let line = getline(v:lnum)
|
|
||||||
|
|
||||||
" Regular headers
|
|
||||||
let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=')
|
|
||||||
if depth > 0
|
|
||||||
return ">" . depth
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Setext style headings
|
|
||||||
let nextline = getline(v:lnum + 1)
|
|
||||||
if (line =~ '^.\+$') && (nextline =~ '^=\+$')
|
|
||||||
return ">1"
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (line =~ '^.\+$') && (nextline =~ '^-\+$')
|
|
||||||
return ">2"
|
|
||||||
endif
|
|
||||||
|
|
||||||
return "="
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if has("folding") && exists("g:markdown_folding")
|
|
||||||
setlocal foldexpr=MarkdownFold()
|
|
||||||
setlocal foldmethod=expr
|
|
||||||
let b:undo_ftplugin .= " foldexpr< foldmethod<"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
||||||
|
|
||||||
endif
|
|
||||||
63
ftplugin/mma.vim
Normal file
63
ftplugin/mma.vim
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
|
||||||
|
|
||||||
|
"Vim filetype plugin
|
||||||
|
" Language: Mathematica
|
||||||
|
" Maintainer: R. Menon <rsmenon@icloud.com>
|
||||||
|
" Last Change: Feb 26, 2013
|
||||||
|
|
||||||
|
" Initialization {
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
"}
|
||||||
|
|
||||||
|
" Syntax completion function {
|
||||||
|
if exists('&ofu')
|
||||||
|
setlocal omnifunc=syntaxcomplete#Complete
|
||||||
|
setlocal completefunc=syntaxcomplete#Complete
|
||||||
|
endif
|
||||||
|
"}
|
||||||
|
|
||||||
|
" Main functions {
|
||||||
|
if has('python')
|
||||||
|
" Random ID generator {
|
||||||
|
function! RandomID()
|
||||||
|
|
||||||
|
"Python implementation follows; do not alter indentations/whitespace
|
||||||
|
python << EOF
|
||||||
|
import random, string, vim
|
||||||
|
vim.command("let l:id = '" + (''.join(random.sample(string.ascii_uppercase + string.digits, 8))) + "'")
|
||||||
|
EOF
|
||||||
|
|
||||||
|
return l:id
|
||||||
|
endfunction
|
||||||
|
"}
|
||||||
|
|
||||||
|
"Unit test template {
|
||||||
|
function! Test()
|
||||||
|
if exists("*strftime")
|
||||||
|
let l:date = strftime("%Y%m%d") . "-"
|
||||||
|
else
|
||||||
|
let l:date = ""
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:testid = expand("%:t") . "-" . l:date . RandomID()
|
||||||
|
let l:template = "Test[\rtest\r,\rresult\r,\rTestID -> \"" . l:testid . "\"\r\b]"
|
||||||
|
exe ":normal i" . l:template
|
||||||
|
endfunction
|
||||||
|
"}
|
||||||
|
endif
|
||||||
|
"}
|
||||||
|
|
||||||
|
" Cleanup {
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
"}
|
||||||
|
|
||||||
|
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker:
|
||||||
|
|
||||||
|
endif
|
||||||
5
ftplugin/nginx.vim
Normal file
5
ftplugin/nginx.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
|
||||||
|
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|
||||||
|
|
||||||
" Vim filetype plugin file
|
|
||||||
" Language: Perl 6
|
|
||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
|
||||||
" Last Change: {{LAST_CHANGE}}
|
|
||||||
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
|
||||||
"
|
|
||||||
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
|
|
||||||
|
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
|
|
||||||
" Make sure the continuation lines below do not cause problems in
|
|
||||||
" compatibility mode.
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
setlocal formatoptions-=t
|
|
||||||
setlocal formatoptions+=crqol
|
|
||||||
setlocal keywordprg=p6doc
|
|
||||||
|
|
||||||
setlocal comments=:#\|,:#=,:#
|
|
||||||
setlocal commentstring=#%s
|
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly Perl-related files
|
|
||||||
if has("gui_win32")
|
|
||||||
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
|
||||||
\ "Perl Modules (*.pm)\t*.pm\n" .
|
|
||||||
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
|
||||||
\ "All Files (*.*)\t*.*\n"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Provided by Ned Konz <ned at bike-nomad dot com>
|
|
||||||
"---------------------------------------------
|
|
||||||
setlocal include=\\<\\(use\\\|require\\)\\>
|
|
||||||
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
|
|
||||||
setlocal define=[^A-Za-z_]
|
|
||||||
|
|
||||||
" The following line changes a global variable but is necessary to make
|
|
||||||
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
|
|
||||||
" the problem. If this causes a " problem for you, add an
|
|
||||||
" after/ftplugin/perl6.vim file that contains
|
|
||||||
" set isfname-=:
|
|
||||||
set isfname+=:
|
|
||||||
setlocal iskeyword=@,48-57,_,192-255,-
|
|
||||||
|
|
||||||
" Set this once, globally.
|
|
||||||
if !exists("perlpath")
|
|
||||||
if executable("perl6")
|
|
||||||
try
|
|
||||||
if &shellxquote != '"'
|
|
||||||
let perlpath = system('perl6 -e "@*INC.join(q/,/).say"')
|
|
||||||
else
|
|
||||||
let perlpath = system("perl6 -e '@*INC.join(q/,/).say'")
|
|
||||||
endif
|
|
||||||
let perlpath = substitute(perlpath,',.$',',,','')
|
|
||||||
catch /E145:/
|
|
||||||
let perlpath = ".,,"
|
|
||||||
endtry
|
|
||||||
else
|
|
||||||
" If we can't call perl to get its path, just default to using the
|
|
||||||
" current directory and the directory of the current file.
|
|
||||||
let perlpath = ".,,"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Append perlpath to the existing path value, if it is set. Since we don't
|
|
||||||
" use += to do it because of the commas in perlpath, we have to handle the
|
|
||||||
" global / local settings, too.
|
|
||||||
if &l:path == ""
|
|
||||||
if &g:path == ""
|
|
||||||
let &l:path=perlpath
|
|
||||||
else
|
|
||||||
let &l:path=&g:path.",".perlpath
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let &l:path=&l:path.",".perlpath
|
|
||||||
endif
|
|
||||||
"---------------------------------------------
|
|
||||||
|
|
||||||
" Undo the stuff we changed.
|
|
||||||
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" .
|
|
||||||
\ " | unlet! b:browsefilter"
|
|
||||||
|
|
||||||
" Restore the saved compatibility options.
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -1,22 +1,37 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
||||||
|
|
||||||
" Vim plugin file
|
if exists('b:loaded_plantuml_plugin')
|
||||||
" Language: PlantUML
|
|
||||||
" Maintainer: Aaron C. Meadows < language name at shadowguarddev dot com>
|
|
||||||
" Last Change: 19-Jun-2012
|
|
||||||
" Version: 0.1
|
|
||||||
|
|
||||||
if exists("g:loaded_plantuml_plugin")
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_plantuml_plugin = 1
|
let b:loaded_plantuml_plugin = 1
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
if !exists("g:plantuml_executable_script")
|
if !exists('g:plantuml_executable_script')
|
||||||
let g:plantuml_executable_script="plantuml"
|
let g:plantuml_executable_script='plantuml'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
autocmd Filetype plantuml let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%"))
|
if exists('loaded_matchit')
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
let b:match_words =
|
||||||
|
\ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' .
|
||||||
|
\ ',\<if\>:\<elseif\>:\<else\>:\<endif\>' .
|
||||||
|
\ ',\<rnote\>:\<endrnote\>' .
|
||||||
|
\ ',\<hnote\>:\<endhnote\>' .
|
||||||
|
\ ',\<title\>:\<endtitle\>' .
|
||||||
|
\ ',\<\while\>:\<endwhile\>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:makeprg=g:plantuml_executable_script . ' ' . fnameescape(expand('%'))
|
||||||
|
|
||||||
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
||||||
|
|
||||||
|
let b:endwise_addition = '\=index(["note","legend"], submatch(0))!=-1 ? "end " . submatch(0) : "end"'
|
||||||
|
let b:endwise_words = 'loop,group,alt,note,legend'
|
||||||
|
let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$'
|
||||||
|
let b:endwise_syngroups = 'plantumlKeyword'
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ setlocal formatoptions=tcqro
|
|||||||
" Enable autocompletion of hyphenated PowerShell commands,
|
" Enable autocompletion of hyphenated PowerShell commands,
|
||||||
" e.g. Get-Content or Get-ADUser
|
" e.g. Get-Content or Get-ADUser
|
||||||
setlocal iskeyword+=-
|
setlocal iskeyword+=-
|
||||||
|
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
||||||
|
setlocal bomb
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||||
if has("gui_win32")
|
if has("gui_win32")
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ let b:did_ftplugin = 1
|
|||||||
setlocal tw=0
|
setlocal tw=0
|
||||||
setlocal commentstring=#%s
|
setlocal commentstring=#%s
|
||||||
setlocal formatoptions=tcqro
|
setlocal formatoptions=tcqro
|
||||||
|
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
||||||
|
setlocal bomb
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||||
if has("gui_win32")
|
if has("gui_win32")
|
||||||
|
|||||||
5
ftplugin/purescript.vim
Normal file
5
ftplugin/purescript.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'purescript') == -1
|
||||||
|
|
||||||
|
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
|
||||||
|
|
||||||
|
endif
|
||||||
5
ftplugin/raml.vim
Normal file
5
ftplugin/raml.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'raml') == -1
|
||||||
|
|
||||||
|
set ts=2 sts=2 sw=2 et
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -71,26 +71,26 @@ endif
|
|||||||
|
|
||||||
function! s:query_path(root) abort
|
function! s:query_path(root) abort
|
||||||
let code = "print $:.join %q{,}"
|
let code = "print $:.join %q{,}"
|
||||||
if &shell =~# 'sh'
|
if &shell =~# 'sh' && empty(&shellxquote)
|
||||||
let prefix = 'env PATH='.shellescape($PATH).' '
|
let prefix = 'env PATH='.shellescape($PATH).' '
|
||||||
else
|
else
|
||||||
let prefix = ''
|
let prefix = ''
|
||||||
endif
|
endif
|
||||||
if &shellxquote == "'"
|
if &shellxquote == "'"
|
||||||
let path_check = prefix.'ruby -e "' . code . '"'
|
let path_check = prefix.'ruby --disable-gems -e "' . code . '"'
|
||||||
else
|
else
|
||||||
let path_check = prefix."ruby -e '" . code . "'"
|
let path_check = prefix."ruby --disable-gems -e '" . code . "'"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let cd = haslocaldir() ? 'lcd' : 'cd'
|
let cd = haslocaldir() ? 'lcd' : 'cd'
|
||||||
let cwd = getcwd()
|
let cwd = fnameescape(getcwd())
|
||||||
try
|
try
|
||||||
exe cd fnameescape(a:root)
|
exe cd fnameescape(a:root)
|
||||||
let path = split(system(path_check),',')
|
let path = split(system(path_check),',')
|
||||||
exe cd fnameescape(cwd)
|
exe cd cwd
|
||||||
return path
|
return path
|
||||||
finally
|
finally
|
||||||
exe cd fnameescape(cwd)
|
exe cd cwd
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -164,29 +164,29 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
|||||||
nmap <buffer><script> <SID>: :<C-U>
|
nmap <buffer><script> <SID>: :<C-U>
|
||||||
nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
||||||
|
|
||||||
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR>
|
nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR>
|
||||||
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR>
|
nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR>
|
||||||
nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR>
|
nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR>
|
||||||
nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR>
|
nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR>
|
||||||
xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR>
|
xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR>
|
||||||
xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR>
|
xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR>
|
||||||
xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR>
|
xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR>
|
||||||
xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR>
|
xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR>
|
||||||
|
|
||||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR>
|
nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR>
|
||||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR>
|
nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR>
|
||||||
nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR>
|
nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR>
|
||||||
nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR>
|
nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR>
|
||||||
xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR>
|
xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR>
|
||||||
xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR>
|
xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR>
|
||||||
xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR>
|
xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR>
|
||||||
xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR>
|
xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR>
|
||||||
|
|
||||||
let b:undo_ftplugin = b:undo_ftplugin
|
let b:undo_ftplugin = b:undo_ftplugin
|
||||||
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
|
||||||
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
|
\."| sil! exe 'unmap <buffer> [m' | sil! exe 'unmap <buffer> ]m' | sil! exe 'unmap <buffer> [M' | sil! exe 'unmap <buffer> ]M'"
|
||||||
|
|
||||||
if maparg('im','n') == ''
|
if maparg('im','x') == '' && maparg('im','o') == '' && maparg('am','x') == '' && maparg('am','o') == ''
|
||||||
onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
onoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
||||||
onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
|
onoremap <silent> <buffer> am :<C-U>call <SID>wrap_a('[m',']M')<CR>
|
||||||
xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
xnoremap <silent> <buffer> im :<C-U>call <SID>wrap_i('[m',']M')<CR>
|
||||||
@@ -196,7 +196,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
|
|||||||
\."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
|
\."| sil! exe 'xunmap <buffer> im' | sil! exe 'xunmap <buffer> am'"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if maparg('iM','n') == ''
|
if maparg('iM','x') == '' && maparg('iM','o') == '' && maparg('aM','x') == '' && maparg('aM','o') == ''
|
||||||
onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
onoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
||||||
onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
|
onoremap <silent> <buffer> aM :<C-U>call <SID>wrap_a('[[','][')<CR>
|
||||||
xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
xnoremap <silent> <buffer> iM :<C-U>call <SID>wrap_i('[[','][')<CR>
|
||||||
@@ -290,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
|
|||||||
norm! gv
|
norm! gv
|
||||||
endif
|
endif
|
||||||
let i = 0
|
let i = 0
|
||||||
|
call map(a:syn, 'hlID(v:val)')
|
||||||
while i < cnt
|
while i < cnt
|
||||||
let i = i + 1
|
let i = i + 1
|
||||||
let line = line('.')
|
let line = line('.')
|
||||||
let col = col('.')
|
let col = col('.')
|
||||||
let pos = search(a:pattern,'W'.a:flags)
|
let pos = search(a:pattern,'W'.a:flags)
|
||||||
while pos != 0 && s:synname() !~# a:syn
|
while pos != 0 && index(a:syn, s:synid()) < 0
|
||||||
let pos = search(a:pattern,'W'.a:flags)
|
let pos = search(a:pattern,'W'.a:flags)
|
||||||
endwhile
|
endwhile
|
||||||
if pos == 0
|
if pos == 0
|
||||||
@@ -305,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
|
|||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:synname() abort
|
function! s:synid() abort
|
||||||
return synIDattr(synID(line('.'),col('.'),0),'name')
|
return synID(line('.'),col('.'),0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:wrap_i(back,forward) abort
|
function! s:wrap_i(back,forward) abort
|
||||||
@@ -362,7 +363,7 @@ function! RubyCursorFile() abort
|
|||||||
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
|
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
|
||||||
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
|
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
|
||||||
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
|
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
|
||||||
if s:synname() ==# 'rubyConstant'
|
if s:synid() ==# hlID('rubyConstant')
|
||||||
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
|
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
|
||||||
let cfile = substitute(cfile,'::','/','g')
|
let cfile = substitute(cfile,'::','/','g')
|
||||||
let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
|
let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
|||||||
" Description: Vim syntax file for Rust
|
" Description: Vim syntax file for Rust
|
||||||
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
" Maintainer: Kevin Ballard <kevin@sb.org>
|
" Maintainer: Kevin Ballard <kevin@sb.org>
|
||||||
" Last Change: January 29, 2015
|
" Last Change: June 08, 2016
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
@@ -14,6 +14,9 @@ let b:did_ftplugin = 1
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
|
augroup rust.vim
|
||||||
|
autocmd!
|
||||||
|
|
||||||
" Variables {{{1
|
" Variables {{{1
|
||||||
|
|
||||||
" The rust source code at present seems to typically omit a leader on /*!
|
" The rust source code at present seems to typically omit a leader on /*!
|
||||||
@@ -45,7 +48,6 @@ endif
|
|||||||
" This includeexpr isn't perfect, but it's a good start
|
" This includeexpr isn't perfect, but it's a good start
|
||||||
setlocal includeexpr=substitute(v:fname,'::','/','g')
|
setlocal includeexpr=substitute(v:fname,'::','/','g')
|
||||||
|
|
||||||
" NOT adding .rc as it's being phased out (0.7)
|
|
||||||
setlocal suffixesadd=.rs
|
setlocal suffixesadd=.rs
|
||||||
|
|
||||||
if exists("g:ftplugin_rust_source_path")
|
if exists("g:ftplugin_rust_source_path")
|
||||||
@@ -56,7 +58,33 @@ if exists("g:loaded_delimitMate")
|
|||||||
if exists("b:delimitMate_excluded_regions")
|
if exists("b:delimitMate_excluded_regions")
|
||||||
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
||||||
endif
|
endif
|
||||||
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
|
||||||
|
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
||||||
|
|
||||||
|
" For this buffer, when delimitMate issues the `User delimitMate_map`
|
||||||
|
" event in the autocommand system, add the above-defined extra excluded
|
||||||
|
" regions to delimitMate's state, if they have not already been added.
|
||||||
|
autocmd User <buffer>
|
||||||
|
\ if expand('<afile>') ==# 'delimitMate_map' && match(
|
||||||
|
\ delimitMate#Get("excluded_regions"),
|
||||||
|
\ s:delimitMate_extra_excluded_regions) == -1
|
||||||
|
\| let b:delimitMate_excluded_regions =
|
||||||
|
\ delimitMate#Get("excluded_regions")
|
||||||
|
\ . s:delimitMate_extra_excluded_regions
|
||||||
|
\|endif
|
||||||
|
|
||||||
|
" For this buffer, when delimitMate issues the `User delimitMate_unmap`
|
||||||
|
" event in the autocommand system, delete the above-defined extra excluded
|
||||||
|
" regions from delimitMate's state (the deletion being idempotent and
|
||||||
|
" having no effect if the extra excluded regions are not present in the
|
||||||
|
" targeted part of delimitMate's state).
|
||||||
|
autocmd User <buffer>
|
||||||
|
\ if expand('<afile>') ==# 'delimitMate_unmap'
|
||||||
|
\| let b:delimitMate_excluded_regions = substitute(
|
||||||
|
\ delimitMate#Get("excluded_regions"),
|
||||||
|
\ '\C\V' . s:delimitMate_extra_excluded_regions,
|
||||||
|
\ '', 'g')
|
||||||
|
\|endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
|
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
|
||||||
@@ -84,16 +112,6 @@ xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
|
|||||||
onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
|
onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
|
||||||
onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
|
onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
|
||||||
|
|
||||||
" %-matching. <:> is handy for generics.
|
|
||||||
set matchpairs+=<:>
|
|
||||||
" There are two minor issues with it; (a) comparison operators in expressions,
|
|
||||||
" where a less-than may match a greater-than later on—this is deemed a trivial
|
|
||||||
" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the
|
|
||||||
" highlighting perspective (built into Vim), but the actual % functionality
|
|
||||||
" can be fixed by this use of matchit.vim.
|
|
||||||
let b:match_skip = 's:comment\|string\|rustArrow'
|
|
||||||
source $VIMRUNTIME/macros/matchit.vim
|
|
||||||
|
|
||||||
" Commands {{{1
|
" Commands {{{1
|
||||||
|
|
||||||
" See |:RustRun| for docs
|
" See |:RustRun| for docs
|
||||||
@@ -114,6 +132,9 @@ command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
|
|||||||
" See |:RustFmt| for docs
|
" See |:RustFmt| for docs
|
||||||
command! -buffer RustFmt call rustfmt#Format()
|
command! -buffer RustFmt call rustfmt#Format()
|
||||||
|
|
||||||
|
" See |:RustFmtRange| for docs
|
||||||
|
command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>)
|
||||||
|
|
||||||
" Mappings {{{1
|
" Mappings {{{1
|
||||||
|
|
||||||
" Bind ⌘R in MacVim to :RustRun
|
" Bind ⌘R in MacVim to :RustRun
|
||||||
@@ -165,6 +186,23 @@ let b:undo_ftplugin = "
|
|||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
|
" Code formatting on save
|
||||||
|
if get(g:, "rustfmt_autosave", 0)
|
||||||
|
autocmd BufWritePre *.rs silent! call rustfmt#Format()
|
||||||
|
endif
|
||||||
|
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" %-matching. <:> is handy for generics.
|
||||||
|
set matchpairs+=<:>
|
||||||
|
" There are two minor issues with it; (a) comparison operators in expressions,
|
||||||
|
" where a less-than may match a greater-than later on—this is deemed a trivial
|
||||||
|
" issue—and (b) `Fn() -> X` syntax. This latter issue is irremediable from the
|
||||||
|
" highlighting perspective (built into Vim), but the actual % functionality
|
||||||
|
" can be fixed by this use of matchit.vim.
|
||||||
|
let b:match_skip = 's:comment\|string\|rustArrow'
|
||||||
|
source $VIMRUNTIME/macros/matchit.vim
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
|
||||||
|
|
||||||
" Vim filetype plugin
|
|
||||||
" Language: Sass
|
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
||||||
" Last Change: 2010 Jul 26
|
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
|
||||||
if exists("b:did_ftplugin")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
|
|
||||||
|
|
||||||
setlocal comments=://
|
|
||||||
setlocal commentstring=//\ %s
|
|
||||||
setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
|
||||||
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
|
||||||
setlocal omnifunc=csscomplete#CompleteCSS
|
|
||||||
setlocal suffixesadd=.sass,.scss,.css
|
|
||||||
|
|
||||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -18,7 +18,11 @@ silent! setlocal formatoptions+=j
|
|||||||
|
|
||||||
" Just like c.vim, but additionally doesn't wrap text onto /** line when
|
" Just like c.vim, but additionally doesn't wrap text onto /** line when
|
||||||
" formatting. Doesn't bungle bulleted lists when formatting.
|
" formatting. Doesn't bungle bulleted lists when formatting.
|
||||||
|
if get(g:, 'scala_scaladoc_indent', 0)
|
||||||
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
else
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
endif
|
||||||
setlocal commentstring=//\ %s
|
setlocal commentstring=//\ %s
|
||||||
|
|
||||||
setlocal shiftwidth=2 softtabstop=2 expandtab
|
setlocal shiftwidth=2 softtabstop=2 expandtab
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||||
|
|
||||||
" Vim filetype plugin
|
if exists('b:did_indent') && b:did_indent
|
||||||
" Language: SCSS
|
" be kind. allow users to override this. Does it work?
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
||||||
" Last Change: 2010 Jul 26
|
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! ftplugin/sass.vim
|
setlocal indentexpr=scss_indent#GetIndent(v:lnum)
|
||||||
|
|
||||||
|
" Automatically insert the current comment leader after hitting <Enter>
|
||||||
|
" in Insert mode respectively after hitting 'o' or 'O' in Normal mode
|
||||||
|
setlocal formatoptions+=ro
|
||||||
|
|
||||||
|
" SCSS comments are either /* */ or //
|
||||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
13
ftplugin/slim.vim
Normal file
13
ftplugin/slim.vim
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl isk<"
|
||||||
|
|
||||||
|
setlocal iskeyword+=-
|
||||||
|
setlocal commentstring=/%s
|
||||||
|
|
||||||
|
endif
|
||||||
5
ftplugin/tmux.vim
Normal file
5
ftplugin/tmux.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
||||||
|
|
||||||
|
setlocal commentstring=#\ %s
|
||||||
|
|
||||||
|
endif
|
||||||
23
ftplugin/vue.vim
Normal file
23
ftplugin/vue.vim
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vue') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin
|
||||||
|
" Language: Vue.js
|
||||||
|
" Maintainer: Eduardo San Martin Morote
|
||||||
|
" Author: Adriaan Zonnenberg
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/html.vim
|
||||||
|
|
||||||
|
setlocal suffixesadd+=.vue
|
||||||
|
|
||||||
|
if exists('g:loaded_ale')
|
||||||
|
let g:ale_linters = get(g:, 'ale_linters', {})
|
||||||
|
let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint'])
|
||||||
|
let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {})
|
||||||
|
let g:ale_linter_aliases.vue = get(g:ale_linter_aliases, 'vue', 'javascript')
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -16,7 +16,7 @@ setlocal formatoptions=cl
|
|||||||
|
|
||||||
let s:comment = '\v^\s*#' " # comment
|
let s:comment = '\v^\s*#' " # comment
|
||||||
let s:array_entry = '\v^\s*-\s' " - foo
|
let s:array_entry = '\v^\s*-\s' " - foo
|
||||||
let s:named_module_entry = '\v^\s*-\s*(name|hosts):\s*\S' " - name: 'do stuff'
|
let s:named_module_entry = '\v^\s*-\s*(name|hosts|role):\s*\S' " - name: 'do stuff'
|
||||||
let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items:
|
let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items:
|
||||||
let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package
|
let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package
|
||||||
let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: >
|
let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: >
|
||||||
@@ -29,6 +29,11 @@ function GetAnsibleIndent(lnum)
|
|||||||
if a:lnum == 1 || !prevnonblank(a:lnum-1)
|
if a:lnum == 1 || !prevnonblank(a:lnum-1)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
if exists("g:ansible_unindent_after_newline")
|
||||||
|
if (a:lnum -1) != prevnonblank(a:lnum - 1)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
let prevlnum = prevnonblank(a:lnum - 1)
|
let prevlnum = prevnonblank(a:lnum - 1)
|
||||||
let maintain = indent(prevlnum)
|
let maintain = indent(prevlnum)
|
||||||
let increase = maintain + &sw
|
let increase = maintain + &sw
|
||||||
|
|||||||
@@ -4,56 +4,96 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
|
|||||||
" Language: Blade (Laravel)
|
" Language: Blade (Laravel)
|
||||||
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
" Maintainer: Jason Walton <jwalton512@gmail.com>
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! indent/html.vim
|
runtime! indent/html.vim
|
||||||
|
let s:htmlindent = &indentexpr
|
||||||
|
|
||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
|
runtime! indent/php.vim
|
||||||
|
let s:phpindent = &indentexpr
|
||||||
|
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
|
||||||
|
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim\|php\|' .
|
||||||
|
\ 'component\|slot\|prepend'
|
||||||
|
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
|
||||||
|
|
||||||
|
if exists('g:blade_custom_directives_pairs')
|
||||||
|
let s:directives_start .= '\|' . join(keys(g:blade_custom_directives_pairs), '\|')
|
||||||
|
let s:directives_end .= '\|' . join(values(g:blade_custom_directives_pairs), '\|')
|
||||||
|
endif
|
||||||
|
|
||||||
setlocal autoindent
|
setlocal autoindent
|
||||||
setlocal indentexpr=GetBladeIndent()
|
setlocal indentexpr=GetBladeIndent()
|
||||||
setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty,=@show
|
exe 'setlocal indentkeys=o,O,<>>,!^F,0=}},0=!!},=@' . substitute(s:directives_end, '\\|', ',=@', 'g')
|
||||||
|
|
||||||
" Only define the function once.
|
" Only define the function once.
|
||||||
if exists("*GetBladeIndent")
|
if exists('*GetBladeIndent')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
function! s:IsStartingDelimiter(lnum)
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
return line =~# '\%(\w\|@\)\@<!@\%(' . s:directives_start . '\)\%(.*@end\|.*@stop\)\@!'
|
||||||
|
\ || line =~# '{{\%(.*}}\)\@!'
|
||||||
|
\ || line =~# '{!!\%(.*!!}\)\@!'
|
||||||
|
\ || line =~# '<?\%(.*?>\)\@!'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! GetBladeIndent()
|
function! GetBladeIndent()
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
let lnum = prevnonblank(v:lnum - 1)
|
||||||
if lnum == 0
|
if lnum == 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line = substitute(substitute(getline(lnum), '\s\+$', '', ''), '^\s\+', '', '')
|
let line = getline(lnum)
|
||||||
let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')
|
let cline = getline(v:lnum)
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
let cindent = indent(v:lnum)
|
|
||||||
if cline =~# '@\%(else\|elseif\|empty\|end\|show\)'
|
" 1. Check for special directives
|
||||||
let indent = indent - &sw
|
" @section is a single-line directive if it has a second argument.
|
||||||
else
|
" @php is a single-line directive if it is followed by parentheses.
|
||||||
if exists("*GetBladeIndentCustom")
|
if (line =~# '@section\%(.*@end\)\@!' && line !~# '@section\s*([^,]*)')
|
||||||
let hindent = GetBladeIndentCustom()
|
\ || line =~# '@php\s*('
|
||||||
else
|
return indent
|
||||||
let hindent = HtmlIndent()
|
|
||||||
endif
|
|
||||||
if hindent > -1
|
|
||||||
let indent = hindent
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let increase = indent + &sw
|
|
||||||
if indent = indent(lnum)
|
|
||||||
let indent = cindent <= indent ? -1 : increase
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if line =~# '@\%(section\)\%(.*\s*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'
|
" 2. When the current line is an ending delimiter: decrease indentation
|
||||||
return indent
|
" if the previous line wasn't a starting delimiter.
|
||||||
elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\)\%(.*\s*@end\)\@!'
|
if cline =~# '^\s*@\%(' . s:directives_end . '\)'
|
||||||
return increase
|
\ || cline =~# '\%(<?.*\)\@<!?>'
|
||||||
else
|
\ || cline =~# '\%({{.*\)\@<!}}'
|
||||||
return indent
|
\ || cline =~# '\%({!!.*\)\@<!!!}'
|
||||||
|
return s:IsStartingDelimiter(lnum) ? indent : indent - &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" 3. Increase indentation if the line contains a starting delimiter.
|
||||||
|
if s:IsStartingDelimiter(lnum)
|
||||||
|
return indent + &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" 4. External indent scripts (PHP and HTML)
|
||||||
|
execute 'let indent = ' . s:htmlindent
|
||||||
|
|
||||||
|
if exists('*GetBladeIndentCustom')
|
||||||
|
let indent = GetBladeIndentCustom()
|
||||||
|
elseif line !~# '^\s*\%(#\|//\)\|\*/\s*$' && (
|
||||||
|
\ searchpair('@include\%(If\)\?\s*(', '', ')', 'bWr') ||
|
||||||
|
\ searchpair('{!!', '', '!!}', 'bWr') ||
|
||||||
|
\ searchpair('{{', '', '}}', 'bWr') ||
|
||||||
|
\ searchpair('<?', '', '?>', 'bWr') ||
|
||||||
|
\ searchpair('@php\s*(\@!', '', '@endphp', 'bWr') )
|
||||||
|
" Only use PHP's indent if the region spans multiple lines
|
||||||
|
if !s:IsStartingDelimiter(v:lnum)
|
||||||
|
execute 'let indent = ' . s:phpindent
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return indent
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
46
indent/caddyfile.vim
Normal file
46
indent/caddyfile.vim
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'caddyfile') == -1
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal nolisp
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetCaddyfileIndent(v:lnum)
|
||||||
|
setlocal indentkeys+=<:>,0=},0=)
|
||||||
|
" setlocal cindent
|
||||||
|
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
func s:sw()
|
||||||
|
return shiftwidth()
|
||||||
|
endfunc
|
||||||
|
else
|
||||||
|
func s:sw()
|
||||||
|
return &sw
|
||||||
|
endfunc
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GetCaddyfileIndent(lnum)
|
||||||
|
let prevlnum = prevnonblank(a:lnum-1)
|
||||||
|
if prevlnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let thisl = substitute(getline(a:lnum), '#.*$', '', '')
|
||||||
|
let prevl = substitute(getline(prevlnum), '#.*$', '', '')
|
||||||
|
|
||||||
|
let ind = indent(prevlnum)
|
||||||
|
|
||||||
|
if prevl =~ '{\s*$'
|
||||||
|
let ind += s:sw()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if thisl =~ '^\s*}\s*$'
|
||||||
|
let ind -= s:sw()
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -89,7 +89,7 @@ if exists("*searchpairpos")
|
|||||||
function! s:match_pairs(open, close, stopat)
|
function! s:match_pairs(open, close, stopat)
|
||||||
" Stop only on vector and map [ resp. {. Ignore the ones in strings and
|
" Stop only on vector and map [ resp. {. Ignore the ones in strings and
|
||||||
" comments.
|
" comments.
|
||||||
if a:stopat == 0
|
if a:stopat == 0 && g:clojure_maxlines > 0
|
||||||
let stopat = max([line(".") - g:clojure_maxlines, 0])
|
let stopat = max([line(".") - g:clojure_maxlines, 0])
|
||||||
else
|
else
|
||||||
let stopat = a:stopat
|
let stopat = a:stopat
|
||||||
@@ -123,7 +123,7 @@ if exists("*searchpairpos")
|
|||||||
if s:syn_id_name() !~? "string"
|
if s:syn_id_name() !~? "string"
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
if s:current_char() != '\\'
|
if s:current_char() != '\'
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
call cursor(0, col("$") - 1)
|
call cursor(0, col("$") - 1)
|
||||||
@@ -189,6 +189,16 @@ if exists("*searchpairpos")
|
|||||||
return val
|
return val
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Check if form is a reader conditional, that is, it is prefixed by #?
|
||||||
|
" or @#?
|
||||||
|
function! s:is_reader_conditional_special_case(position)
|
||||||
|
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Returns 1 for opening brackets, -1 for _anything else_.
|
" Returns 1 for opening brackets, -1 for _anything else_.
|
||||||
function! s:bracket_type(char)
|
function! s:bracket_type(char)
|
||||||
return stridx('([{', a:char) > -1 ? 1 : -1
|
return stridx('([{', a:char) > -1 ? 1 : -1
|
||||||
@@ -256,6 +266,10 @@ if exists("*searchpairpos")
|
|||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + &shiftwidth - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if s:is_reader_conditional_special_case(paren)
|
||||||
|
return paren
|
||||||
|
endif
|
||||||
|
|
||||||
" In case we are at the last character, we use the paren position.
|
" In case we are at the last character, we use the paren position.
|
||||||
if col("$") - 1 == paren[1]
|
if col("$") - 1 == paren[1]
|
||||||
return paren
|
return paren
|
||||||
|
|||||||
@@ -8,6 +8,32 @@ let b:did_indent = 1
|
|||||||
setlocal cindent
|
setlocal cindent
|
||||||
setlocal cinoptions+=j1,J1
|
setlocal cinoptions+=j1,J1
|
||||||
|
|
||||||
|
setlocal indentexpr=DartIndent()
|
||||||
|
|
||||||
let b:undo_indent = 'setl cin< cino<'
|
let b:undo_indent = 'setl cin< cino<'
|
||||||
|
|
||||||
|
if exists("*DartIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! DartIndent()
|
||||||
|
" Default to cindent in most cases
|
||||||
|
let indentTo = cindent(v:lnum)
|
||||||
|
|
||||||
|
let previousLine = getline(prevnonblank(v:lnum - 1))
|
||||||
|
let currentLine = getline(v:lnum)
|
||||||
|
|
||||||
|
" Don't indent after an annotation
|
||||||
|
if previousLine =~# '^\s*@.*$'
|
||||||
|
let indentTo = indent(v:lnum - 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent after opening List literal
|
||||||
|
if previousLine =~# '\[$' && !(currentLine =~# '^\s*\]')
|
||||||
|
let indentTo = indent(v:lnum - 1) + &shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
return indentTo
|
||||||
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ runtime! indent/elixir.vim
|
|||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
setlocal indentexpr=
|
setlocal indentexpr=
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
if exists("b:eelixir_subtype")
|
if exists("b:eelixir_subtype")
|
||||||
exe "runtime! indent/".b:eelixir_subtype.".vim"
|
exe "runtime! indent/".b:eelixir_subtype.".vim"
|
||||||
else
|
else
|
||||||
@@ -53,19 +56,21 @@ function! GetEelixirIndent(...)
|
|||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
elseif line =~# '\S\s*<%\s*end\s*%>'
|
elseif line =~# '\S\s*<%\s*end\s*%>'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
if line =~# '<%[=%]\=\s*.*\<do\s*%>'
|
if line =~# '<%[=%]\=\s*.*\(\<do\|->\)\s*%>' ||
|
||||||
let ind = ind + &sw
|
\ line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
||||||
elseif line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
|
let ind += &sw
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
endif
|
||||||
if cline =~# '^\s*%>\s*$'
|
if cline =~# '^\s*%>\s*$'
|
||||||
let ind = ind - &sw
|
let ind -= &sw
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -2,144 +2,47 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
|||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
end
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal nosmartindent
|
setlocal indentexpr=elixir#indent(v:lnum)
|
||||||
|
|
||||||
setlocal indentexpr=GetElixirIndent()
|
setlocal indentkeys+=0=end,0=catch,0=rescue,0=after,0=else,=->,0},0],0),0=\|>,0=<>
|
||||||
setlocal indentkeys+=0),0],0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue
|
" TODO: @jbodah 2017-02-27: all operators should cause reindent when typed
|
||||||
|
|
||||||
if exists("*GetElixirIndent")
|
function! elixir#indent(lnum)
|
||||||
finish
|
let lnum = a:lnum
|
||||||
|
let text = getline(lnum)
|
||||||
|
let prev_nb_lnum = prevnonblank(lnum-1)
|
||||||
|
let prev_nb_text = getline(prev_nb_lnum)
|
||||||
|
|
||||||
|
call elixir#indent#debug("==> Indenting line " . lnum)
|
||||||
|
call elixir#indent#debug("text = '" . text . "'")
|
||||||
|
|
||||||
|
let handlers = [
|
||||||
|
\'top_of_file',
|
||||||
|
\'starts_with_end',
|
||||||
|
\'starts_with_mid_or_end_block_keyword',
|
||||||
|
\'following_trailing_do',
|
||||||
|
\'following_trailing_binary_operator',
|
||||||
|
\'starts_with_pipe',
|
||||||
|
\'starts_with_close_bracket',
|
||||||
|
\'starts_with_binary_operator',
|
||||||
|
\'inside_nested_construct',
|
||||||
|
\'starts_with_comment',
|
||||||
|
\'inside_generic_block'
|
||||||
|
\]
|
||||||
|
for handler in handlers
|
||||||
|
call elixir#indent#debug('testing handler elixir#indent#handle_'.handler)
|
||||||
|
let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
|
||||||
|
if indent != -1
|
||||||
|
call elixir#indent#debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
||||||
|
return indent
|
||||||
endif
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
call elixir#indent#debug("defaulting")
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
let s:no_colon_before = ':\@<!'
|
|
||||||
let s:no_colon_after = ':\@!'
|
|
||||||
let s:symbols_end = '\]\|}\|)'
|
|
||||||
let s:symbols_start = '\[\|{\|('
|
|
||||||
let s:arrow = '^.*->$'
|
|
||||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
|
||||||
let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '".s:skip_syntax."'"
|
|
||||||
let s:block_start = '\<\%(do\|fn\)\>'
|
|
||||||
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
|
||||||
let s:block_end = 'end'
|
|
||||||
let s:starts_with_pipeline = '^\s*|>.*$'
|
|
||||||
let s:ending_with_assignment = '=\s*$'
|
|
||||||
|
|
||||||
let s:indent_keywords = '\<'.s:no_colon_before.'\%('.s:block_start.'\|'.s:block_middle.'\)$'.'\|'.s:arrow
|
|
||||||
let s:deindent_keywords = '^\s*\<\%('.s:block_end.'\|'.s:block_middle.'\)\>'.'\|'.s:arrow
|
|
||||||
|
|
||||||
let s:pair_start = '\<\%('.s:no_colon_before.s:block_start.'\)\>'.s:no_colon_after
|
|
||||||
let s:pair_middle = '\<\%('.s:block_middle.'\)\>'.s:no_colon_after.'\zs'
|
|
||||||
let s:pair_end = '\<\%('.s:no_colon_before.s:block_end.'\)\>\zs'
|
|
||||||
|
|
||||||
let s:inside_block = 0
|
|
||||||
|
|
||||||
function! GetElixirIndent()
|
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
|
||||||
|
|
||||||
" At the start of the file use zero indent.
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
return 0
|
||||||
endif
|
|
||||||
|
|
||||||
let opened_symbol = 0
|
|
||||||
let current_line = getline(v:lnum)
|
|
||||||
let last_line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
|
|
||||||
" TODO: Remove these 2 lines
|
|
||||||
" I don't know why, but for the test on spec/indent/lists_spec.rb:24.
|
|
||||||
" Vim is making some mess on parsing the syntax of 'end', it is being
|
|
||||||
" recognized as 'elixirString' when should be recognized as 'elixirBlock'.
|
|
||||||
" This forces vim to sync the syntax.
|
|
||||||
call synID(v:lnum, 1, 1)
|
|
||||||
syntax sync fromstart
|
|
||||||
|
|
||||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
|
|
||||||
|
|
||||||
if last_line !~ s:arrow
|
|
||||||
let split_line = split(last_line, '\zs')
|
|
||||||
let opened_symbol += count(split_line, '(') - count(split_line, ')')
|
|
||||||
let opened_symbol += count(split_line, '[') - count(split_line, ']')
|
|
||||||
let opened_symbol += count(split_line, '{') - count(split_line, '}')
|
|
||||||
end
|
|
||||||
|
|
||||||
" if start symbol is followed by a character, indent based on the
|
|
||||||
" whitespace after the symbol, otherwise use the default shiftwidth
|
|
||||||
if last_line =~ '\('.s:symbols_start.'\).'
|
|
||||||
let opened_prefix = matchlist(last_line, '\('.s:symbols_start.'\)\s*')[0]
|
|
||||||
let ind += (opened_symbol * strlen(opened_prefix))
|
|
||||||
else
|
|
||||||
let ind += (opened_symbol * &sw)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if last_line =~ '^\s*\('.s:symbols_end.'\)' || last_line =~ s:indent_keywords
|
|
||||||
let ind += &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if current_line =~ '^\s*\('.s:symbols_end.'\)'
|
|
||||||
let ind -= &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if last_line =~ s:ending_with_assignment && opened_symbol == 0
|
|
||||||
let b:old_ind = indent(lnum)
|
|
||||||
let ind += &sw
|
|
||||||
end
|
|
||||||
|
|
||||||
" if line starts with pipeline
|
|
||||||
" and last line ends with a pipeline,
|
|
||||||
" align them
|
|
||||||
if last_line =~ '|>.*$' &&
|
|
||||||
\ current_line =~ s:starts_with_pipeline
|
|
||||||
let ind = float2nr(match(last_line, '|>') / &sw) * &sw
|
|
||||||
|
|
||||||
" if line starts with pipeline
|
|
||||||
" and last line is an attribution
|
|
||||||
" indents pipeline in same level as attribution
|
|
||||||
elseif current_line =~ s:starts_with_pipeline &&
|
|
||||||
\ last_line =~ '^[^=]\+=.\+$'
|
|
||||||
|
|
||||||
if !exists('b:old_ind') || b:old_ind == 0
|
|
||||||
let b:old_ind = indent(lnum)
|
|
||||||
end
|
|
||||||
let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" if last line starts with pipeline
|
|
||||||
" and current line doesn't start with pipeline
|
|
||||||
" returns the indentation before the pipeline
|
|
||||||
if last_line =~ s:starts_with_pipeline &&
|
|
||||||
\ current_line !~ s:starts_with_pipeline
|
|
||||||
let ind = b:old_ind
|
|
||||||
endif
|
|
||||||
|
|
||||||
if current_line =~ s:deindent_keywords
|
|
||||||
let bslnum = searchpair(
|
|
||||||
\ s:pair_start,
|
|
||||||
\ s:pair_middle,
|
|
||||||
\ s:pair_end,
|
|
||||||
\ 'nbW',
|
|
||||||
\ s:block_skip
|
|
||||||
\ )
|
|
||||||
|
|
||||||
let ind = indent(bslnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" indent case statements '->'
|
|
||||||
if current_line =~ s:arrow
|
|
||||||
let ind += &sw
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ind
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') == -1
|
||||||
|
|
||||||
" Language: ember-script
|
" Language: ember-script
|
||||||
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
|
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
|
||||||
" URL: http://github.com/heartsentwined/vim-ember-script
|
" URL: http://github.com/yalesov/vim-ember-script
|
||||||
" Version: 1.0.1
|
" Version: 1.0.4
|
||||||
" Last Change: 2013 Apr 17
|
" Last Change: 2016 Jul 6
|
||||||
" License: GPL-3.0
|
" License: ISC
|
||||||
|
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1
|
||||||
|
|
||||||
" Language: emblem
|
" Language: emblem
|
||||||
" Maintainer: heartsentwined <heartsentwined@cogito-lab.com>
|
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
|
||||||
" URL: http://github.com/heartsentwined/vim-emblem
|
" URL: http://github.com/yalesov/vim-emblem
|
||||||
" Version: 1.2.0
|
" Version: 2.0.1
|
||||||
" Last Change: 2013 Apr 22
|
" Last Change: 2016 Jul 6
|
||||||
" License: GPL-3.0
|
" License: ISC
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'erlang') == -1
|
|||||||
" Contributors: Edwin Fine <efine145_nospam01 at usa dot net>
|
" Contributors: Edwin Fine <efine145_nospam01 at usa dot net>
|
||||||
" Pawel 'kTT' Salata <rockplayer.pl@gmail.com>
|
" Pawel 'kTT' Salata <rockplayer.pl@gmail.com>
|
||||||
" Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
|
" Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
|
||||||
" Last Update: 2013-Jul-21
|
" Last Update: 2017-Feb-28
|
||||||
" License: Vim license
|
" License: Vim license
|
||||||
" URL: https://github.com/hcs42/vim-erlang
|
" URL: https://github.com/vim-erlang/vim-erlang-runtime
|
||||||
|
|
||||||
" Note About Usage:
|
" Note About Usage:
|
||||||
" This indentation script works best with the Erlang syntax file created by
|
" This indentation script works best with the Erlang syntax file created by
|
||||||
@@ -528,7 +528,9 @@ endfunction
|
|||||||
" ok. % IsLineAtomContinuation = false
|
" ok. % IsLineAtomContinuation = false
|
||||||
function! s:IsLineAtomContinuation(lnum)
|
function! s:IsLineAtomContinuation(lnum)
|
||||||
if has('syntax_items')
|
if has('syntax_items')
|
||||||
return synIDattr(synID(a:lnum, 1, 0), 'name') =~# '^erlangQuotedAtom'
|
let syn_name = synIDattr(synID(a:lnum, 1, 0), 'name')
|
||||||
|
return syn_name =~# '^erlangQuotedAtom' ||
|
||||||
|
\ syn_name =~# '^erlangQuotedRecord'
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
@@ -682,7 +684,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol, lnum, i)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
|
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
|
||||||
return [1, a:stored_vcol + &sw + 2]
|
return [1, a:stored_vcol + shiftwidth() + 2]
|
||||||
else
|
else
|
||||||
return [1, s:UnexpectedToken(a:token, a:stack)]
|
return [1, s:UnexpectedToken(a:token, a:stack)]
|
||||||
endif
|
endif
|
||||||
@@ -691,7 +693,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol, lnum, i)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
|
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
|
||||||
return [1, a:stored_vcol + &sw]
|
return [1, a:stored_vcol + shiftwidth()]
|
||||||
elseif a:stack[0] ==# ';'
|
elseif a:stack[0] ==# ';'
|
||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
|
|
||||||
@@ -843,7 +845,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
|
|
||||||
elseif token ==# 'begin'
|
elseif token ==# 'begin'
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
" case EXPR of BRANCHES end
|
" case EXPR of BRANCHES end
|
||||||
@@ -894,11 +896,11 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack == ['->']
|
elseif stack == ['->']
|
||||||
call s:Log(' LTI is in a branch after ' .
|
call s:Log(' LTI is in a branch after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
elseif stack == ['when']
|
elseif stack == ['when']
|
||||||
call s:Log(' LTI is in a guard after ' .
|
call s:Log(' LTI is in a guard after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
else
|
else
|
||||||
return s:UnexpectedToken(token, stack)
|
return s:UnexpectedToken(token, stack)
|
||||||
endif
|
endif
|
||||||
@@ -934,7 +936,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching ' .
|
call s:Log(' LTI is in a condition; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# 'align_to_begin_element'
|
elseif stack[0] ==# 'align_to_begin_element'
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol
|
let stored_vcol = curr_vcol
|
||||||
@@ -943,23 +945,23 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching ' .
|
call s:Log(' LTI is in a branch; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching ' .
|
call s:Log(' LTI is in a guard; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw + 2
|
let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
elseif token ==# 'fun'
|
elseif token ==# 'fun'
|
||||||
@@ -985,7 +987,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" stack = ['when'] => LTI is in a guard
|
" stack = ['when'] => LTI is in a guard
|
||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
call s:Log(' LTI is in a condition; matching "fun" found')
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
|
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
call s:Log(' LTI is in a condition; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
@@ -993,15 +995,15 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching "fun" found')
|
call s:Log(' LTI is in a branch; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching "fun" found')
|
call s:Log(' LTI is in a guard; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw + 2
|
let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Pass: we have a function reference (e.g. "fun f/0")
|
" Pass: we have a function reference (e.g. "fun f/0")
|
||||||
@@ -1275,7 +1277,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" when A,
|
" when A,
|
||||||
" LTI
|
" LTI
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Example:
|
" Example:
|
||||||
@@ -1307,7 +1309,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" If LTI is between an 'after' and the corresponding
|
" If LTI is between an 'after' and the corresponding
|
||||||
" 'end', then let's return
|
" 'end', then let's return
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ if exists("*GetErubyIndent")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" this file uses line continuations
|
||||||
|
let s:cpo_sav = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
function! GetErubyIndent(...)
|
function! GetErubyIndent(...)
|
||||||
" The value of a single shift-width
|
" The value of a single shift-width
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
@@ -93,6 +97,7 @@ function! GetErubyIndent(...)
|
|||||||
let ind = ind + sw
|
let ind = ind + sw
|
||||||
endif
|
endif
|
||||||
if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>'
|
if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>'
|
||||||
|
\ && synID(v:lnum, match(cline, '\S') + 1, 1) != hlID('htmlEndTag')
|
||||||
let ind = ind - sw
|
let ind = ind - sw
|
||||||
endif
|
endif
|
||||||
if cline =~# '^\s*[-=]\=%>\s*$'
|
if cline =~# '^\s*[-=]\=%>\s*$'
|
||||||
@@ -101,6 +106,9 @@ function! GetErubyIndent(...)
|
|||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_sav
|
||||||
|
unlet! s:cpo_sav
|
||||||
|
|
||||||
" vim:set sw=2 sts=2 ts=8 noet:
|
" vim:set sw=2 sts=2 ts=8 noet:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -77,6 +77,6 @@ function! GoIndent(lnum)
|
|||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" vim:ts=4:sw=4:et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -32,17 +32,19 @@ function! GetGoHTMLTmplIndent(lnum)
|
|||||||
|
|
||||||
" If need to indent based on last line
|
" If need to indent based on last line
|
||||||
let last_line = getline(a:lnum-1)
|
let last_line = getline(a:lnum-1)
|
||||||
if last_line =~ '^\s*{{\s*\%(if\|else\|range\|with\|define\|block\).*}}'
|
if last_line =~ '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}'
|
||||||
let ind += sw
|
let ind += sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" End of FuncMap block
|
" End of FuncMap block
|
||||||
let current_line = getline(a:lnum)
|
let current_line = getline(a:lnum)
|
||||||
if current_line =~ '^\s*{{\s*\%(else\|end\).*}}'
|
if current_line =~ '^\s*{{-\=\s*\%(else\|end\).*}}'
|
||||||
let ind -= sw
|
let ind -= sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ if exists('b:did_indent')
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get(g:, 'haskell_indent_disable', 0)
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
if !exists('g:haskell_indent_if')
|
if !exists('g:haskell_indent_if')
|
||||||
@@ -60,18 +64,35 @@ if !exists('g:haskell_indent_guard')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal indentexpr=GetHaskellIndent()
|
setlocal indentexpr=GetHaskellIndent()
|
||||||
setlocal indentkeys=0{,0},0(,0),0[,0],!^F,o,O,0\=,0=where,0=let,0=deriving,0\,,<space>
|
setlocal indentkeys=0},0),0],!^F,o,O,0=where,0=let,0=deriving,<space>
|
||||||
|
|
||||||
function! s:isInBlock(hlstack)
|
function! s:isInBlock(hlstack)
|
||||||
return index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1
|
return index(a:hlstack, 'haskellDelimiter') > -1 || index(a:hlstack, 'haskellParens') > -1 || index(a:hlstack, 'haskellBrackets') > -1 || index(a:hlstack, 'haskellBlock') > -1 || index(a:hlstack, 'haskellBlockComment') > -1 || index(a:hlstack, 'haskellPragma') > -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:stripComment(line)
|
||||||
|
if a:line =~ '^\s*--\(-*\s\+\|$\)'
|
||||||
|
return ''
|
||||||
|
else
|
||||||
|
let l:stripped = split(a:line, '-- ')
|
||||||
|
if len(l:stripped) > 1
|
||||||
|
return substitute(l:stripped[0], '\s*$', '', '')
|
||||||
|
else
|
||||||
|
return a:line
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:isSYN(grp, line, col)
|
||||||
|
return index(s:getHLStack(a:line, a:col), a:grp) != -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:getNesting(hlstack)
|
function! s:getNesting(hlstack)
|
||||||
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens"')
|
return filter(a:hlstack, 'v:val == "haskellBlock" || v:val == "haskellBrackets" || v:val == "haskellParens" || v:val == "haskellBlockComment" || v:val == "haskellPragma" ')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:getHLStack()
|
function! s:getHLStack(line, col)
|
||||||
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
return map(synstack(a:line, a:col), 'synIDattr(v:val, "name")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" indent matching character
|
" indent matching character
|
||||||
@@ -110,35 +131,58 @@ function! s:indentGuard(pos, prevline)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! GetHaskellIndent()
|
function! GetHaskellIndent()
|
||||||
let l:hlstack = s:getHLStack()
|
let l:hlstack = s:getHLStack(line('.'), col('.'))
|
||||||
|
|
||||||
" do not indent in strings and quasiquotes
|
" do not indent in strings and quasiquotes
|
||||||
if index(l:hlstack, 'haskellString') > -1 || index(l:hlstack, 'haskellQuasiQuote') > -1
|
if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -1
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" blockcomment handling
|
let l:prevline = s:stripComment(getline(v:lnum - 1))
|
||||||
if index(l:hlstack, 'haskellBlockComment') > -1
|
|
||||||
for l:c in range(v:lnum - 1, 0, -1)
|
|
||||||
let l:line = getline(l:c)
|
|
||||||
if l:line =~ '{-'
|
|
||||||
return 1 + match(l:line, '{-')
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:prevline = getline(v:lnum - 1)
|
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
|
|
||||||
|
" indent multiline strings
|
||||||
|
if index(l:hlstack, 'haskellString') > -1
|
||||||
|
if l:line =~ '^\s*\\'
|
||||||
|
return match(l:prevline, '["\\]')
|
||||||
|
else
|
||||||
|
return - 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" reset
|
" reset
|
||||||
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
|
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" comment indentation
|
" { foo :: Int
|
||||||
if l:prevline =~ '^\s*--'
|
" >>,
|
||||||
return match(l:prevline, '\S')
|
"
|
||||||
|
" |
|
||||||
|
" ...
|
||||||
|
" >>,
|
||||||
|
if l:line =~ '^\s*,'
|
||||||
|
if s:isInBlock(s:getHLStack(line('.'), col('.')))
|
||||||
|
normal! 0
|
||||||
|
call search(',', 'cW')
|
||||||
|
let l:n = s:getNesting(s:getHLStack(line('.'), col('.')))
|
||||||
|
call search('[([{]', 'bW')
|
||||||
|
let l:cl = line('.')
|
||||||
|
let l:cc = col('.')
|
||||||
|
|
||||||
|
while l:n != s:getNesting(s:getHLStack(l:cl, l:cc)) || s:isSYN('haskellString', l:cl, l:cc) || s:isSYN('haskellChar', l:cl, l:cc)
|
||||||
|
call search('[([{]', 'bW')
|
||||||
|
let l:cl = line('.')
|
||||||
|
let l:cc = col('.')
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return l:cc - 1
|
||||||
|
else
|
||||||
|
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
|
||||||
|
if l:s > -1
|
||||||
|
return l:s
|
||||||
|
end
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" operator at end of previous line
|
" operator at end of previous line
|
||||||
@@ -168,11 +212,20 @@ function! GetHaskellIndent()
|
|||||||
" >>>>y = 2
|
" >>>>y = 2
|
||||||
if l:prevline =~ '\C\<let\>\s\+.\+$'
|
if l:prevline =~ '\C\<let\>\s\+.\+$'
|
||||||
if l:line =~ '\C^\s*\<let\>'
|
if l:line =~ '\C^\s*\<let\>'
|
||||||
return match(l:prevline, '\C\<let\>')
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s
|
||||||
|
endif
|
||||||
elseif l:line =~ '\C^\s*\<in\>'
|
elseif l:line =~ '\C^\s*\<in\>'
|
||||||
return match(l:prevline, '\C\<let\>') + g:haskell_indent_in
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_in
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
return match(l:prevline, '\C\<let\>') + g:haskell_indent_let
|
let l:s = match(l:prevline, '\C\<let\>')
|
||||||
|
if s:isSYN('haskellLet', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_let
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -192,35 +245,49 @@ function! GetHaskellIndent()
|
|||||||
" where
|
" where
|
||||||
" >>foo
|
" >>foo
|
||||||
"
|
"
|
||||||
|
if l:prevline =~ '\C\<where\>\s*$'
|
||||||
|
return match(l:prevline, '\S') + get(g:, 'haskell_indent_after_bare_where', &shiftwidth)
|
||||||
|
endif
|
||||||
|
|
||||||
" do
|
" do
|
||||||
" >>foo
|
" >>foo
|
||||||
"
|
"
|
||||||
" foo =
|
" foo =
|
||||||
" >>bar
|
" >>bar
|
||||||
if l:prevline =~ '\C\(\<where\>\|\<do\>\|=\)\s*$'
|
if l:prevline =~ '\C\(\<do\>\|=\)\s*$'
|
||||||
return match(l:prevline, '\S') + &shiftwidth
|
return match(l:prevline, '\S') + &shiftwidth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" do foo
|
||||||
|
" >>>bar
|
||||||
|
if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
|
||||||
|
let l:s = match(l:prevline, '\C\<do\>')
|
||||||
|
if s:isSYN('haskellKeyword', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_do
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" case foo of
|
||||||
|
" >>bar -> quux
|
||||||
|
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
|
||||||
|
if get(g:,'haskell_indent_case_alternative', 0)
|
||||||
|
return match(l:prevline, '\S') + &shiftwidth
|
||||||
|
else
|
||||||
|
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
"" where foo
|
"" where foo
|
||||||
"" >>>>>>bar
|
"" >>>>>>bar
|
||||||
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, ':: ')
|
||||||
else
|
else
|
||||||
return match(l:prevline, '\C\<where\>') + g:haskell_indent_where
|
let l:s = match(l:prevline, '\C\<where\>')
|
||||||
|
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)
|
||||||
|
return l:s + g:haskell_indent_where
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" do foo
|
|
||||||
" >>>bar
|
|
||||||
if l:prevline =~ '\C\<do\>\s\+\S\+.*$'
|
|
||||||
return match(l:prevline, '\C\<do\>') + g:haskell_indent_do
|
|
||||||
endif
|
|
||||||
|
|
||||||
" case foo of
|
|
||||||
" >>bar -> quux
|
|
||||||
if l:prevline =~ '\C\<case\>.\+\<of\>\s*$'
|
|
||||||
return match(l:prevline, '\C\<case\>') + g:haskell_indent_case
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" newtype Foo = Foo
|
" newtype Foo = Foo
|
||||||
@@ -243,6 +310,14 @@ function! GetHaskellIndent()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" foo :: Int
|
||||||
|
" -> Int
|
||||||
|
" >>>>-> Int
|
||||||
|
"
|
||||||
|
" foo :: Monad m
|
||||||
|
" => Functor f
|
||||||
|
" >>>>=> Int
|
||||||
|
"
|
||||||
" foo :: Int
|
" foo :: Int
|
||||||
" -> Int
|
" -> Int
|
||||||
" foo x
|
" foo x
|
||||||
@@ -251,9 +326,12 @@ function! GetHaskellIndent()
|
|||||||
" :: Int
|
" :: Int
|
||||||
" -> Int
|
" -> Int
|
||||||
" foo x
|
" foo x
|
||||||
if l:prevline =~ '^\s*[-=]>' && l:line !~ '^\s*[-=]>'
|
if l:prevline =~ '^\s*[-=]>'
|
||||||
|
if l:line =~ '^\s*[-=]>'
|
||||||
|
return match(l:prevline, '[-=]')
|
||||||
|
else
|
||||||
if s:isInBlock(l:hlstack)
|
if s:isInBlock(l:hlstack)
|
||||||
return match(l:prevline, '[^\s-=>]')
|
return match(l:prevline, '[^-=]')
|
||||||
else
|
else
|
||||||
let l:m = matchstr(l:line, '^\s*\zs\<\S\+\>\ze')
|
let l:m = matchstr(l:line, '^\s*\zs\<\S\+\>\ze')
|
||||||
let l:l = l:prevline
|
let l:l = l:prevline
|
||||||
@@ -261,8 +339,8 @@ function! GetHaskellIndent()
|
|||||||
|
|
||||||
while v:lnum != l:c
|
while v:lnum != l:c
|
||||||
" fun decl
|
" fun decl
|
||||||
|
if l:l =~ ('^\s*' . l:m . '\(\s*::\|\n\s\+::\)')
|
||||||
let l:s = match(l:l, l:m)
|
let l:s = match(l:l, l:m)
|
||||||
if l:s >= 0
|
|
||||||
if match(l:l, '\C^\s*\<default\>') > -1
|
if match(l:l, '\C^\s*\<default\>') > -1
|
||||||
return l:s - 8
|
return l:s - 8
|
||||||
else
|
else
|
||||||
@@ -279,6 +357,7 @@ function! GetHaskellIndent()
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" | otherwise = ...
|
" | otherwise = ...
|
||||||
" foo
|
" foo
|
||||||
@@ -318,7 +397,7 @@ function! GetHaskellIndent()
|
|||||||
|
|
||||||
" foo
|
" foo
|
||||||
" >>{
|
" >>{
|
||||||
if l:line =~ '^\s*{' && l:prevline !~ '^{'
|
if l:line =~ '^\s*{ '
|
||||||
let l:s = match(l:prevline, '\S')
|
let l:s = match(l:prevline, '\S')
|
||||||
if l:s >= 0
|
if l:s >= 0
|
||||||
return l:s + &shiftwidth
|
return l:s + &shiftwidth
|
||||||
@@ -327,12 +406,17 @@ function! GetHaskellIndent()
|
|||||||
|
|
||||||
" in foo
|
" in foo
|
||||||
" where bar
|
" where bar
|
||||||
|
"
|
||||||
|
" or
|
||||||
|
"
|
||||||
|
" foo
|
||||||
|
" >>where
|
||||||
if l:line =~ '\C^\s*\<where\>'
|
if l:line =~ '\C^\s*\<where\>'
|
||||||
if match(l:prevline, '\C^\s\+in\s\+') == 0
|
if match(l:prevline, '\C^\s\+in\s\+') == 0
|
||||||
return match(l:prevline, 'in') - g:haskell_indent_in
|
return match(l:prevline, 'in') - g:haskell_indent_in
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return match(l:prevline, '\S') + &shiftwidth
|
return match(l:prevline, '\S') + get(g:, 'haskell_indent_before_where', &shiftwidth)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" let x = 1
|
" let x = 1
|
||||||
@@ -364,32 +448,6 @@ function! GetHaskellIndent()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" { foo :: Int
|
|
||||||
" >>,
|
|
||||||
"
|
|
||||||
" |
|
|
||||||
" ...
|
|
||||||
" >>,
|
|
||||||
if l:line =~ '^\s*,'
|
|
||||||
if s:isInBlock(l:hlstack)
|
|
||||||
normal! 0
|
|
||||||
call search(',', 'cW')
|
|
||||||
let l:n = s:getNesting(s:getHLStack())
|
|
||||||
call search('[(\[{]', 'bW')
|
|
||||||
|
|
||||||
while l:n != s:getNesting(s:getHLStack())
|
|
||||||
call search('[(\[{]', 'bW')
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return col('.') - 1
|
|
||||||
else
|
|
||||||
let l:s = s:indentGuard(match(l:line, ','), l:prevline)
|
|
||||||
if l:s > -1
|
|
||||||
return l:s
|
|
||||||
end
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" |
|
" |
|
||||||
" ...
|
" ...
|
||||||
" >>|
|
" >>|
|
||||||
@@ -425,22 +483,8 @@ function! GetHaskellIndent()
|
|||||||
if l:line =~ '^\s*]'
|
if l:line =~ '^\s*]'
|
||||||
return s:indentMatching(']')
|
return s:indentMatching(']')
|
||||||
endif
|
endif
|
||||||
"
|
|
||||||
" indent import
|
|
||||||
if l:line =~ '\C^\s*import'
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" do not reindent indented lines
|
|
||||||
if match(l:prevline, '\S') < match(l:line, '\S')
|
|
||||||
return -1
|
return -1
|
||||||
endif
|
|
||||||
|
|
||||||
if l:line !~ '^\s*[=-]>\s' && l:line =~ '^\s*[!#$%&*+./<>?@\\^|~-]\+'
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
return match(l:prevline, '\S')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ setlocal indentkeys=o,O,*<Return>,<>>,{,},!^F
|
|||||||
|
|
||||||
|
|
||||||
let s:tags = []
|
let s:tags = []
|
||||||
|
let s:no_tags = []
|
||||||
|
|
||||||
" [-- <ELEMENT ? - - ...> --]
|
" [-- <ELEMENT ? - - ...> --]
|
||||||
call add(s:tags, 'a')
|
call add(s:tags, 'a')
|
||||||
@@ -165,6 +166,44 @@ call add(s:tags, 'text')
|
|||||||
call add(s:tags, 'textPath')
|
call add(s:tags, 'textPath')
|
||||||
call add(s:tags, 'tref')
|
call add(s:tags, 'tref')
|
||||||
call add(s:tags, 'tspan')
|
call add(s:tags, 'tspan')
|
||||||
|
" Common self closing SVG elements
|
||||||
|
call add(s:no_tags, 'animate')
|
||||||
|
call add(s:no_tags, 'animateTransform')
|
||||||
|
call add(s:no_tags, 'circle')
|
||||||
|
call add(s:no_tags, 'ellipse')
|
||||||
|
call add(s:no_tags, 'feBlend')
|
||||||
|
call add(s:no_tags, 'feColorMatrix')
|
||||||
|
call add(s:no_tags, 'feComposite')
|
||||||
|
call add(s:no_tags, 'feConvolveMatrix')
|
||||||
|
call add(s:no_tags, 'feDisplacementMap')
|
||||||
|
call add(s:no_tags, 'feFlood')
|
||||||
|
call add(s:no_tags, 'feFuncR')
|
||||||
|
call add(s:no_tags, 'feFuncG')
|
||||||
|
call add(s:no_tags, 'feFuncB')
|
||||||
|
call add(s:no_tags, 'feFuncA')
|
||||||
|
call add(s:no_tags, 'feGaussianBlur')
|
||||||
|
call add(s:no_tags, 'feImage')
|
||||||
|
call add(s:no_tags, 'feMergeNode')
|
||||||
|
call add(s:no_tags, 'feMorphology')
|
||||||
|
call add(s:no_tags, 'feOffset')
|
||||||
|
call add(s:no_tags, 'fePointLight')
|
||||||
|
call add(s:no_tags, 'feSpotLight')
|
||||||
|
call add(s:no_tags, 'feTile')
|
||||||
|
call add(s:no_tags, 'feTurbulence')
|
||||||
|
call add(s:no_tags, 'hatchpath')
|
||||||
|
call add(s:no_tags, 'hkern')
|
||||||
|
call add(s:no_tags, 'image')
|
||||||
|
call add(s:no_tags, 'line')
|
||||||
|
call add(s:no_tags, 'mpath')
|
||||||
|
call add(s:no_tags, 'polygon')
|
||||||
|
call add(s:no_tags, 'polyline')
|
||||||
|
call add(s:no_tags, 'path')
|
||||||
|
call add(s:no_tags, 'rect')
|
||||||
|
call add(s:no_tags, 'solidColor')
|
||||||
|
call add(s:no_tags, 'stop')
|
||||||
|
call add(s:no_tags, 'use')
|
||||||
|
call add(s:no_tags, 'view')
|
||||||
|
call add(s:no_tags, 'vkern')
|
||||||
|
|
||||||
call add(s:tags, 'html')
|
call add(s:tags, 'html')
|
||||||
call add(s:tags, 'head')
|
call add(s:tags, 'head')
|
||||||
@@ -177,8 +216,6 @@ call add(s:tags, 'tr')
|
|||||||
call add(s:tags, 'th')
|
call add(s:tags, 'th')
|
||||||
call add(s:tags, 'td')
|
call add(s:tags, 'td')
|
||||||
|
|
||||||
let s:no_tags = []
|
|
||||||
|
|
||||||
call add(s:no_tags, 'base')
|
call add(s:no_tags, 'base')
|
||||||
call add(s:no_tags, 'link')
|
call add(s:no_tags, 'link')
|
||||||
call add(s:no_tags, 'meta')
|
call add(s:no_tags, 'meta')
|
||||||
|
|||||||
@@ -2,26 +2,40 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') ==
|
|||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Javascript
|
" Language: Javascript
|
||||||
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
|
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
||||||
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
" 0. Initialization {{{1
|
" Last Change: May 16, 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')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
setlocal nosmartindent
|
" 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 formatexpr=Fixedgq(v:lnum,v:count)
|
setlocal autoindent nolisp nosmartindent
|
||||||
setlocal indentkeys=0{,0},0),0],0\,:,!^F,o,O,e
|
setlocal indentkeys+=0],0)
|
||||||
|
" Testable with something like:
|
||||||
|
" vim -eNs "+filetype plugin indent on" "+syntax on" "+set ft=javascript" \
|
||||||
|
" "+norm! gg=G" '+%print' '+:q!' testfile.js \
|
||||||
|
" | diff -uBZ testfile.js -
|
||||||
|
|
||||||
|
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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -30,586 +44,418 @@ set cpo&vim
|
|||||||
|
|
||||||
" Get shiftwidth value
|
" Get shiftwidth value
|
||||||
if exists('*shiftwidth')
|
if exists('*shiftwidth')
|
||||||
func s:sw()
|
function s:sw()
|
||||||
return shiftwidth()
|
return shiftwidth()
|
||||||
endfunc
|
endfunction
|
||||||
else
|
else
|
||||||
func s:sw()
|
function s:sw()
|
||||||
return &sw
|
return &l:shiftwidth ? &l:shiftwidth : &l:tabstop
|
||||||
endfunc
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" 1. Variables {{{1
|
" Performance for forwards search(): start search at pos rather than masking
|
||||||
" ============
|
" matches before pos.
|
||||||
|
let s:z = has('patch-7.4.984') ? 'z' : ''
|
||||||
let s:js_keywords = '^\s*\(break\|catch\|const\|continue\|debugger\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|let\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)'
|
|
||||||
let s:expr_case = '^\s*\(case\s\+[^\:]*\|default\)\s*:\s*'
|
|
||||||
" Regex of syntax group names that are or delimit string or are comments.
|
|
||||||
let s:syng_strcom = '\%(\%(template\)\@<!string\|regex\|comment\)\c'
|
|
||||||
|
|
||||||
" Regex of syntax group names that are or delimit template strings
|
|
||||||
let s:syng_template = 'template\c'
|
|
||||||
|
|
||||||
" Regex of syntax group names that are strings.
|
|
||||||
let s:syng_string = 'regex\c'
|
|
||||||
|
|
||||||
" Regex of syntax group names that are strings or documentation.
|
|
||||||
let s:syng_multiline = 'comment\c'
|
|
||||||
|
|
||||||
" Regex of syntax group names that are line comment.
|
|
||||||
let s:syng_linecom = 'linecomment\c'
|
|
||||||
|
|
||||||
|
let s:syng_com = 'comment\|doc'
|
||||||
" Expression used to check whether we should skip a match with searchpair().
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
let s:skip_expr = "s:syn_at(line('.'),col('.')) =~? b:syng_strcom"
|
||||||
|
|
||||||
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
|
" searchpair() wrapper
|
||||||
|
if has('reltime')
|
||||||
" Regex that defines continuation lines, not including (, {, or [.
|
function s:GetPair(start,end,flags,skip,time,...)
|
||||||
let s:continuation_regex = '\%([\\*/.:]\|+\@<!+\|-\@<!-\|\%(<%\)\@<!=\|\W[|&?]\|||\|&&\|[^=]=[^=>].*,\)' . s:line_term
|
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time)
|
||||||
|
endfunction
|
||||||
" Regex that defines continuation lines.
|
else
|
||||||
" TODO: this needs to deal with if ...: and so on
|
function s:GetPair(start,end,flags,skip,...)
|
||||||
let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
|
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)]))
|
||||||
|
endfunction
|
||||||
let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*([^()]*)[^()]*\))[^()]*\))[^()]*\))\)\|=>\)' . s:line_term
|
|
||||||
|
|
||||||
" Regex that defines blocks.
|
|
||||||
let s:block_regex = '\%([{([]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
|
|
||||||
|
|
||||||
let s:operator_first = '^\s*\%([*/.:?]\|\([-+]\)\1\@!\|||\|&&\)'
|
|
||||||
|
|
||||||
let s:var_stmt = '^\s*\%(const\|let\|var\)'
|
|
||||||
|
|
||||||
let s:comma_first = '^\s*,'
|
|
||||||
let s:comma_last = ',\s*$'
|
|
||||||
|
|
||||||
let s:case_indent = s:sw()
|
|
||||||
let s:case_indent_after = s:sw()
|
|
||||||
let s:m = matchlist(&cinoptions, ':\(.\)')
|
|
||||||
if (len(s:m) > 2)
|
|
||||||
let s:case_indent = s:m[1]
|
|
||||||
endif
|
endif
|
||||||
let s:m = matchlist(&cinoptions, '=\(.\)')
|
|
||||||
if (len(s:m) > 2)
|
function s:syn_at(l,c)
|
||||||
let s:case_indent_after = s:m[1]
|
let pos = join([a:l,a:c],',')
|
||||||
|
if has_key(s:synId_cache,pos)
|
||||||
|
return s:synId_cache[pos]
|
||||||
endif
|
endif
|
||||||
" 2. Auxiliary Functions {{{1
|
let s:synId_cache[pos] = synIDattr(synID(a:l,a:c,0),'name')
|
||||||
" ======================
|
return s:synId_cache[pos]
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string, comment, or is ascii.
|
|
||||||
function s:IsInStringOrComment(lnum, col)
|
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a string.
|
function s:parse_cino(f)
|
||||||
function s:IsInString(lnum, col)
|
let [cin, divider, n] = [strridx(&cino,a:f), 0, '']
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
if cin == -1
|
||||||
endfunction
|
return
|
||||||
|
endif
|
||||||
" Check if the character at lnum:col is inside a template string.
|
let [sign, cstr] = &cino[cin+1] ==# '-' ? [-1, &cino[cin+2:]] : [1, &cino[cin+1:]]
|
||||||
function s:IsInTempl(lnum, col)
|
for c in split(cstr,'\zs')
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_template
|
if c ==# '.' && !divider
|
||||||
endfunction
|
let divider = 1
|
||||||
|
elseif c ==# 's'
|
||||||
" Check if the character at lnum:col is inside a multi-line comment.
|
if n is ''
|
||||||
function s:IsInMultilineComment(lnum, col)
|
let n = s:W
|
||||||
return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
|
else
|
||||||
endfunction
|
let n = str2nr(n) * s:W
|
||||||
|
endif
|
||||||
" Check if the character at lnum:col is a line comment.
|
break
|
||||||
function s:IsLineComment(lnum, col)
|
elseif c =~ '\d'
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom
|
let [n, divider] .= [c, 0]
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
|
|
||||||
function s:PrevNonBlankNonString(lnum)
|
|
||||||
let in_block = 0
|
|
||||||
let lnum = prevnonblank(a:lnum)
|
|
||||||
while lnum > 0
|
|
||||||
" Go in and out of blocks comments as necessary.
|
|
||||||
" If the line isn't empty (with opt. comment) or in a string, end search.
|
|
||||||
let line = getline(lnum)
|
|
||||||
if s:IsInMultilineComment(lnum, matchend(line, '/\*') - 1)
|
|
||||||
if in_block
|
|
||||||
let in_block = 0
|
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
elseif !in_block && s:IsInMultilineComment(lnum, matchend(line, '\*/') - 1)
|
endfor
|
||||||
let in_block = 1
|
return sign * str2nr(n) / max([str2nr(divider),1])
|
||||||
elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
let lnum = prevnonblank(lnum - 1)
|
|
||||||
endwhile
|
|
||||||
return lnum
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
|
" Optimized {skip} expr, used only once per GetJavascriptIndent() call
|
||||||
function s:GetMSL(lnum, in_one_line_scope)
|
function s:skip_func()
|
||||||
" Start on the line we're at and use its indent.
|
if s:topCol == 1 || line('.') < s:scriptTag
|
||||||
let msl = a:lnum
|
return {} " E728, used as limit condition for loops and searchpair()
|
||||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
|
||||||
while lnum > 0
|
|
||||||
" If we have a continuation line, or we're in a string, use line as MSL.
|
|
||||||
" Otherwise, terminate search as we have found our MSL already.
|
|
||||||
let line = getline(lnum)
|
|
||||||
let col = match(line, s:msl_regex) + 1
|
|
||||||
let line2 = getline(msl)
|
|
||||||
let col2 = matchend(line2, ')')
|
|
||||||
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
|
|
||||||
let msl = lnum
|
|
||||||
|
|
||||||
" if there are more closing brackets, continue from the line which has the matching opening bracket
|
|
||||||
elseif col2 > 0 && !s:IsInStringOrComment(msl, col2) && s:LineHasOpeningBrackets(msl)[0] == '2' && !a:in_one_line_scope
|
|
||||||
call cursor(msl, 1)
|
|
||||||
if searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
|
||||||
let lnum = line('.')
|
|
||||||
let msl = lnum
|
|
||||||
endif
|
endif
|
||||||
|
let s:topCol = col('.')
|
||||||
|
if getline('.') =~ '\%<'.s:topCol.'c\/.\{-}\/\|\%>'.s:topCol.'c[''"]\|\\$'
|
||||||
|
if eval(s:skip_expr)
|
||||||
|
let s:topCol = 0
|
||||||
|
endif
|
||||||
|
return !s:topCol
|
||||||
|
elseif s:checkIn || search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
|
||||||
|
let s:checkIn = eval(s:skip_expr)
|
||||||
|
if s:checkIn
|
||||||
|
let s:topCol = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let s:looksyn = line('.')
|
||||||
|
return s:checkIn
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:alternatePair()
|
||||||
|
let [l:pos, pat, l:for] = [getpos('.'), '[][(){};]', 3]
|
||||||
|
while search('\m'.pat,'bW')
|
||||||
|
if s:skip_func() | continue | endif
|
||||||
|
let idx = stridx('])};',s:looking_at())
|
||||||
|
if idx is 3
|
||||||
|
if l:for is 1
|
||||||
|
return s:GetPair('{','}','bW','s:skip_func()',2000) > 0 || setpos('.',l:pos)
|
||||||
|
endif
|
||||||
|
let [pat, l:for] = ['[{}();]', l:for - 1]
|
||||||
|
elseif idx + 1
|
||||||
|
if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000) < 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
|
return
|
||||||
" Don't use lines that are part of a one line scope as msl unless the
|
|
||||||
" flag in_one_line_scope is set to 1
|
|
||||||
"
|
|
||||||
if a:in_one_line_scope
|
|
||||||
break
|
|
||||||
end
|
|
||||||
let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
|
|
||||||
if msl_one_line == 0
|
|
||||||
break
|
|
||||||
endif
|
endif
|
||||||
end
|
|
||||||
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
|
||||||
endwhile
|
endwhile
|
||||||
return msl
|
call setpos('.',l:pos)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:RemoveTrailingComments(content)
|
function s:looking_at()
|
||||||
let single = '\/\/\(.*\)\s*$'
|
return getline('.')[col('.')-1]
|
||||||
let multi = '\/\*\(.*\)\*\/\s*$'
|
|
||||||
return substitute(substitute(a:content, single, '', ''), multi, '', '')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find if the string is inside var statement (but not the first string)
|
function s:token()
|
||||||
function s:InMultiVarStatement(lnum)
|
return s:looking_at() =~ '\k' ? expand('<cword>') : s:looking_at()
|
||||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
endfunction
|
||||||
|
|
||||||
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
|
function s:previous_token()
|
||||||
|
let l:pos = getpos('.')
|
||||||
" loop through previous expressions to find a var statement
|
if search('\m\k\{1,}\|\S','ebW')
|
||||||
while lnum > 0
|
if (strpart(getline('.'),col('.')-2,2) == '*/' || line('.') != l:pos[1] &&
|
||||||
let line = getline(lnum)
|
\ getline('.')[:col('.')-1] =~ '\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com
|
||||||
|
while search('\m\S\ze\_s*\/[/*]','bW')
|
||||||
" if the line is a js keyword
|
if s:syn_at(line('.'),col('.')) !~? s:syng_com
|
||||||
if (line =~ s:js_keywords)
|
return s:token()
|
||||||
" check if the line is a var stmt
|
|
||||||
" if the line has a comma first or comma last then we can assume that we
|
|
||||||
" are in a multiple var statement
|
|
||||||
if (line =~ s:var_stmt)
|
|
||||||
return lnum
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" other js keywords, not a var
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" beginning of program, not a var
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find line above with beginning of the var statement or returns 0 if it's not
|
|
||||||
" this statement
|
|
||||||
function s:GetVarIndent(lnum)
|
|
||||||
let lvar = s:InMultiVarStatement(a:lnum)
|
|
||||||
let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
|
||||||
|
|
||||||
if lvar
|
|
||||||
let line = s:RemoveTrailingComments(getline(prev_lnum))
|
|
||||||
|
|
||||||
" if the previous line doesn't end in a comma, return to regular indent
|
|
||||||
if (line !~ s:comma_last)
|
|
||||||
return indent(prev_lnum) - s:sw()
|
|
||||||
else
|
else
|
||||||
return indent(lvar) + s:sw()
|
return s:token()
|
||||||
endif
|
endif
|
||||||
|
call setpos('.',l:pos)
|
||||||
endif
|
endif
|
||||||
|
return ''
|
||||||
return -1
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
for s:__ in ['__previous_token','__IsBlock']
|
||||||
|
function s:{s:__}(...)
|
||||||
|
let l:pos = getpos('.')
|
||||||
|
try
|
||||||
|
return call('s:'.matchstr(expand('<sfile>'),'.*__\zs\w\+'),a:000)
|
||||||
|
catch
|
||||||
|
finally
|
||||||
|
call setpos('.',l:pos)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
endfor
|
||||||
|
|
||||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
function s:expr_col()
|
||||||
function s:LineHasOpeningBrackets(lnum)
|
if getline('.')[col('.')-2] == ':'
|
||||||
let open_0 = 0
|
return 1
|
||||||
let open_2 = 0
|
endif
|
||||||
let open_4 = 0
|
let [bal, l:pos] = [0, getpos('.')]
|
||||||
let line = getline(a:lnum)
|
while bal < 1 && search('\m[{}?:;]','bW',s:scriptTag)
|
||||||
let pos = match(line, '[][(){}]', 0)
|
if eval(s:skip_expr)
|
||||||
|
continue
|
||||||
|
elseif s:looking_at() == ':'
|
||||||
|
let bal -= strpart(getline('.'),col('.')-2,3) !~ '::'
|
||||||
|
elseif s:looking_at() == '?'
|
||||||
|
let bal += 1
|
||||||
|
elseif s:looking_at() == '{' && getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()
|
||||||
|
let bal = 1
|
||||||
|
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
call setpos('.',l:pos)
|
||||||
|
return max([bal,0])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" configurable regexes that define continuation lines, not including (, {, or [.
|
||||||
|
let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
||||||
|
\ '\C\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)')
|
||||||
|
let s:continuation = get(g:,'javascript_continuation',
|
||||||
|
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||||
|
|
||||||
|
function s:continues(ln,con)
|
||||||
|
let token = matchstr(a:con[-15:],s:continuation)
|
||||||
|
if strlen(token)
|
||||||
|
call cursor(a:ln,strlen(a:con))
|
||||||
|
if token =~ '[/>]'
|
||||||
|
return s:syn_at(a:ln,col('.')) !~? (token == '>' ? 'jsflow\|^html' : 'regex')
|
||||||
|
elseif token =~ '\l'
|
||||||
|
return s:previous_token() != '.'
|
||||||
|
elseif token == ':'
|
||||||
|
return s:expr_col()
|
||||||
|
endif
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:Trim(ln)
|
||||||
|
let pline = substitute(getline(a:ln),'\s*$','','')
|
||||||
|
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
|
||||||
|
while l:max != -1 && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com
|
||||||
|
let pline = pline[: l:max]
|
||||||
|
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
|
||||||
|
let pline = substitute(pline[:-2],'\s*$','','')
|
||||||
|
endwhile
|
||||||
|
return pline
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find line above 'lnum' that isn't empty or in a comment
|
||||||
|
function s:PrevCodeLine(lnum)
|
||||||
|
let l:n = prevnonblank(a:lnum)
|
||||||
|
while l:n
|
||||||
|
if getline(l:n) =~ '^\s*\/[/*]'
|
||||||
|
if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') &&
|
||||||
|
\ s:syn_at(l:n,1) =~? b:syng_str
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let l:n = prevnonblank(l:n-1)
|
||||||
|
elseif stridx(getline(l:n), '*/') + 1 && s:syn_at(l:n,1) =~? s:syng_com
|
||||||
|
let l:pos = getpos('.')
|
||||||
|
call cursor(l:n,1)
|
||||||
|
let l:n = search('\m\S\_s*\/\*','nbW')
|
||||||
|
call setpos('.',l:pos)
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return l:n
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if line 'lnum' has a balanced amount of parentheses.
|
||||||
|
function s:Balanced(lnum)
|
||||||
|
let l:open = 0
|
||||||
|
let l:line = getline(a:lnum)
|
||||||
|
let pos = match(l:line, '[][(){}]', 0)
|
||||||
while pos != -1
|
while pos != -1
|
||||||
if !s:IsInStringOrComment(a:lnum, pos + 1)
|
if s:syn_at(a:lnum,pos + 1) !~? b:syng_strcom
|
||||||
let idx = stridx('(){}[]', line[pos])
|
let l:open += match(' ' . l:line[pos],'[[({]')
|
||||||
if idx % 2 == 0
|
if l:open < 0
|
||||||
let open_{idx} = open_{idx} + 1
|
return
|
||||||
else
|
|
||||||
let open_{idx - 1} = open_{idx - 1} - 1
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let pos = match(line, '[][(){}]', pos + 1)
|
let pos = match(l:line, (l:open ?
|
||||||
|
\ '['.matchstr(['][','()','{}'],l:line[pos]).']' :
|
||||||
|
\ '[][(){}]'), pos + 1)
|
||||||
endwhile
|
endwhile
|
||||||
return (open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0) . (open_4 > 0)
|
return !l:open
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:Match(lnum, regex)
|
function s:OneScope(lnum)
|
||||||
let col = match(getline(a:lnum), a:regex) + 1
|
let pline = s:Trim(a:lnum)
|
||||||
return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
|
call cursor(a:lnum,strlen(pline))
|
||||||
endfunction
|
let kw = 'else do'
|
||||||
|
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
|
||||||
function s:IndentWithContinuation(lnum, ind, width)
|
if s:previous_token() =~# '^\%(await\|each\)$'
|
||||||
" Set up variables to use and search for MSL to the previous line.
|
call s:previous_token()
|
||||||
let p_lnum = a:lnum
|
let kw = 'for'
|
||||||
let lnum = s:GetMSL(a:lnum, 1)
|
|
||||||
let line = getline(lnum)
|
|
||||||
|
|
||||||
" If the previous line wasn't a MSL and is continuation return its indent.
|
|
||||||
" TODO: the || s:IsInString() thing worries me a bit.
|
|
||||||
if p_lnum != lnum
|
|
||||||
if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
|
|
||||||
return a:ind
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Set up more variables now that we know we aren't continuation bound.
|
|
||||||
let msl_ind = indent(lnum)
|
|
||||||
|
|
||||||
" If the previous line ended with [*+/.-=], start a continuation that
|
|
||||||
" indents an extra level.
|
|
||||||
if s:Match(lnum, s:continuation_regex)
|
|
||||||
if lnum == p_lnum
|
|
||||||
return msl_ind + a:width
|
|
||||||
else
|
else
|
||||||
return msl_ind
|
let kw = 'for if let while with'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 &&
|
||||||
return a:ind
|
\ s:__previous_token() != '.' && !s:doWhile()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:InOneLineScope(lnum)
|
function s:doWhile()
|
||||||
let msl = s:GetMSL(a:lnum, 1)
|
if expand('<cword>') ==# 'while'
|
||||||
if msl > 0 && s:Match(msl, s:one_line_scope_regex)
|
let [bal, l:pos] = [0, getpos('.')]
|
||||||
return msl
|
call search('\m\<','cbW')
|
||||||
|
while bal < 1 && search('\m\C[{}]\|\<\%(do\|while\)\>','bW')
|
||||||
|
if eval(s:skip_expr)
|
||||||
|
continue
|
||||||
|
elseif s:looking_at() ==# 'd'
|
||||||
|
let bal += s:__IsBlock(1)
|
||||||
|
elseif s:looking_at() ==# 'w'
|
||||||
|
let bal -= s:__previous_token() != '.'
|
||||||
|
elseif s:looking_at() != '}' || s:GetPair('{','}','bW',s:skip_expr,200) < 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
call setpos('.',l:pos)
|
||||||
|
return max([bal,0])
|
||||||
endif
|
endif
|
||||||
return 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:ExitingOneLineScope(lnum)
|
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
|
||||||
let msl = s:GetMSL(a:lnum, 1)
|
" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
|
||||||
if msl > 0
|
" a continued expression, which could have started in a braceless context
|
||||||
" if the current line is in a one line scope ..
|
function s:iscontOne(i,num,cont)
|
||||||
if s:Match(msl, s:one_line_scope_regex)
|
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
|
||||||
return 0
|
let pind = a:num ? indent(l:num) + s:W : 0
|
||||||
else
|
let ind = indent(l:i) + (a:cont ? 0 : s:W)
|
||||||
let prev_msl = s:GetMSL(msl - 1, 1)
|
while l:i >= l:num && (ind > pind || l:i == l:num)
|
||||||
if s:Match(prev_msl, s:one_line_scope_regex)
|
if indent(l:i) < ind && s:OneScope(l:i)
|
||||||
return prev_msl
|
let bL += s:W
|
||||||
|
let l:i = line('.')
|
||||||
|
elseif !a:cont || bL || ind < indent(a:i)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let ind = min([ind, indent(l:i)])
|
||||||
|
let l:i = s:PrevCodeLine(l:i - 1)
|
||||||
|
endwhile
|
||||||
|
return bL
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
||||||
|
function s:IsBlock(...)
|
||||||
|
if a:0 || s:looking_at() == '{'
|
||||||
|
let l:n = line('.')
|
||||||
|
let char = s:previous_token()
|
||||||
|
if match(s:stack,'\cxml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx'
|
||||||
|
return char != '{'
|
||||||
|
elseif char =~ '\k'
|
||||||
|
if char ==# 'type'
|
||||||
|
return s:__previous_token() !~# '^\%(im\|ex\)port$'
|
||||||
|
endif
|
||||||
|
return index(split('return const let import export extends yield default delete var await void typeof throw case new of in instanceof')
|
||||||
|
\ ,char) < (line('.') != l:n) || s:__previous_token() == '.'
|
||||||
|
elseif char == '>'
|
||||||
|
return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? 'jsflow\|^html'
|
||||||
|
elseif char == '*'
|
||||||
|
return s:__previous_token() == ':'
|
||||||
|
elseif char == ':'
|
||||||
|
return !s:expr_col()
|
||||||
|
elseif char == '/'
|
||||||
|
return s:syn_at(line('.'),col('.')) =~? 'regex'
|
||||||
|
endif
|
||||||
|
return char !~ '[=~!<,.?^%|&([]' &&
|
||||||
|
\ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" 3. GetJavascriptIndent Function {{{1
|
|
||||||
" =========================
|
|
||||||
|
|
||||||
function GetJavascriptIndent()
|
function GetJavascriptIndent()
|
||||||
" 3.1. Setup {{{2
|
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
||||||
" ----------
|
let s:synId_cache = {}
|
||||||
|
|
||||||
" Set up variables for restoring position in file. Could use v:lnum here.
|
|
||||||
let vcol = col('.')
|
|
||||||
|
|
||||||
" 3.2. Work on the current line {{{2
|
|
||||||
" -----------------------------
|
|
||||||
|
|
||||||
let ind = -1
|
|
||||||
" Get the current line.
|
" Get the current line.
|
||||||
let line = getline(v:lnum)
|
call cursor(v:lnum,1)
|
||||||
" previous nonblank line number
|
let l:line = getline('.')
|
||||||
let prevline = prevnonblank(v:lnum - 1)
|
" use synstack as it validates syn state and works in an empty line
|
||||||
|
let s:stack = map(synstack(v:lnum,1),"synIDattr(v:val,'name')")
|
||||||
|
let syns = get(s:stack,-1,'')
|
||||||
|
|
||||||
if (line =~ s:expr_case)
|
" start with strings,comments,etc.
|
||||||
if (getline(prevline) =~ s:expr_case)
|
if syns =~? s:syng_com
|
||||||
return indent(prevline)
|
if l:line =~ '^\s*\*'
|
||||||
else
|
|
||||||
if (getline(prevline) =~ s:block_regex)
|
|
||||||
return indent(prevline) + s:case_indent
|
|
||||||
else
|
|
||||||
return indent(prevline) - s:case_indent_after
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
" If we got a closing bracket on an empty line, find its match and indent
|
|
||||||
" according to it. For parentheses we indent to its column - 1, for the
|
|
||||||
" others we indent to the containing line's MSL's level. Return -1 if fail.
|
|
||||||
let col = matchend(line, '^\s*[],})]')
|
|
||||||
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
|
|
||||||
call cursor(v:lnum, col)
|
|
||||||
|
|
||||||
let lvar = s:InMultiVarStatement(v:lnum)
|
|
||||||
if lvar
|
|
||||||
let prevline_contents = s:RemoveTrailingComments(getline(prevline))
|
|
||||||
|
|
||||||
" check for comma first
|
|
||||||
if (line[col - 1] =~ ',')
|
|
||||||
" if the previous line ends in comma or semicolon don't indent
|
|
||||||
if (prevline_contents =~ '[;,]\s*$')
|
|
||||||
return indent(s:GetMSL(line('.'), 0))
|
|
||||||
" get previous line indent, if it's comma first return prevline indent
|
|
||||||
elseif (prevline_contents =~ s:comma_first)
|
|
||||||
return indent(prevline)
|
|
||||||
" otherwise we indent 1 level
|
|
||||||
else
|
|
||||||
return indent(lvar) + s:sw()
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
|
||||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
|
||||||
if line[col-1]==')' && col('.') != col('$') - 1
|
|
||||||
let ind = virtcol('.')-1
|
|
||||||
else
|
|
||||||
let ind = indent(s:GetMSL(line('.'), 0))
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return ind
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the line is comma first, dedent 1 level
|
|
||||||
if (getline(prevline) =~ s:comma_first)
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
endif
|
|
||||||
if (getline(prevline) =~ s:expr_case)
|
|
||||||
return indent(prevline) + s:case_indent_after
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If line starts with an operator...
|
|
||||||
if (s:Match(v:lnum, s:operator_first))
|
|
||||||
if (s:Match(prevline, s:operator_first))
|
|
||||||
" and so does previous line, don't indent
|
|
||||||
return indent(prevline)
|
|
||||||
end
|
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
|
||||||
if counts[0] == '2'
|
|
||||||
call cursor(prevline, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
|
||||||
if mnum > 0 && s:Match(mnum, s:operator_first)
|
|
||||||
return indent(mnum)
|
|
||||||
end
|
|
||||||
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
|
||||||
" otherwise, indent 1 level
|
|
||||||
return indent(prevline) + s:sw()
|
|
||||||
end
|
|
||||||
" If previous line starts with an operator...
|
|
||||||
elseif s:Match(prevline, s:operator_first) && !s:Match(prevline, s:comma_last) && !s:Match(prevline, '};\=' . s:line_term)
|
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
|
||||||
if counts[0] == '2' && counts[1] == '1'
|
|
||||||
call cursor(prevline, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
|
||||||
if mnum > 0 && !s:Match(mnum, s:operator_first)
|
|
||||||
return indent(mnum) + s:sw()
|
|
||||||
end
|
|
||||||
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
|
|
||||||
if line !~ '^\s*`$'
|
|
||||||
return indent(prevline) + s:sw()
|
|
||||||
endif
|
|
||||||
elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If we are in a multi-line comment, cindent does the right thing.
|
|
||||||
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
|
|
||||||
return cindent(v:lnum)
|
return cindent(v:lnum)
|
||||||
|
elseif l:line !~ '^\s*\/[/*]'
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
elseif syns =~? b:syng_str
|
||||||
|
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
|
||||||
|
let b:js_cache[0] = v:lnum
|
||||||
|
endif
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
let l:lnum = s:PrevCodeLine(v:lnum - 1)
|
||||||
|
if !l:lnum
|
||||||
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Check for multiple var assignments
|
let l:line = substitute(l:line,'^\s*','','')
|
||||||
" let var_indent = s:GetVarIndent(v:lnum)
|
if l:line[:1] == '/*'
|
||||||
" if var_indent >= 0
|
let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
|
||||||
" return var_indent
|
endif
|
||||||
" endif
|
if l:line =~ '^\/[/*]'
|
||||||
|
let l:line = ''
|
||||||
" 3.3. Work on the previous line. {{{2
|
|
||||||
" -------------------------------
|
|
||||||
|
|
||||||
" If the line is empty and the previous nonblank line was a multi-line
|
|
||||||
" comment, use that comment's indent. Deduct one char to account for the
|
|
||||||
" space in ' */'.
|
|
||||||
if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1)
|
|
||||||
return indent(prevline) - 1
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Find a non-blank, non-multi-line string line above the current line.
|
" the containing paren, bracket, or curly. Many hacks for performance
|
||||||
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
|
let [ s:scriptTag, idx ] = [ get(get(b:,'hi_indent',{}),'blocklnr'),
|
||||||
|
\ index([']',')','}'],l:line[0]) ]
|
||||||
" If the line is empty and inside a string, use the previous line.
|
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
|
||||||
if line =~ '^\s*$' && lnum != prevline
|
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
|
||||||
return indent(prevnonblank(v:lnum))
|
call call('cursor',b:js_cache[2] ? b:js_cache[1:] : [0,0])
|
||||||
endif
|
|
||||||
|
|
||||||
" At the start of the file use zero indent.
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
|
||||||
if s:Match(lnum, s:block_regex)
|
|
||||||
if (line =~ s:expr_case)
|
|
||||||
return indent(s:GetMSL(lnum, 0)) + s:sw()/2
|
|
||||||
else
|
else
|
||||||
return indent(s:GetMSL(lnum, 0)) + s:sw()
|
let [s:looksyn, s:checkIn, s:topCol] = [v:lnum - 1, 0, 0]
|
||||||
endif
|
if idx + 1
|
||||||
endif
|
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000)
|
||||||
|
elseif getline(v:lnum) !~ '^\S' && syns =~? 'block'
|
||||||
" Set up variables for current line.
|
call s:GetPair('{','}','bW','s:skip_func()',2000)
|
||||||
let line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
|
||||||
" add indent depending on the bracket type.
|
|
||||||
if line =~ '[[({]'
|
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
|
||||||
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
|
||||||
if col('.') + 1 == col('$') || line =~ s:one_line_scope_regex
|
|
||||||
return ind + s:sw()
|
|
||||||
else
|
else
|
||||||
return virtcol('.')
|
call s:alternatePair()
|
||||||
endif
|
endif
|
||||||
elseif counts[1] == '1' || counts[2] == '1' && counts[0] != '2'
|
|
||||||
return ind + s:sw()
|
|
||||||
else
|
|
||||||
call cursor(v:lnum, vcol)
|
|
||||||
end
|
|
||||||
elseif line =~ '.\+};\=' . s:line_term
|
|
||||||
call cursor(lnum, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
let mnum = searchpair('{', '', '}', 'bW', s:skip_expr)
|
|
||||||
if mnum > 0
|
|
||||||
return indent(s:GetMSL(mnum, 0))
|
|
||||||
end
|
|
||||||
elseif line =~ '.\+);\=' || line =~ s:comma_last
|
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
|
||||||
if counts[0] == '2'
|
|
||||||
call cursor(lnum, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
|
||||||
if mnum > 0
|
|
||||||
return indent(s:GetMSL(mnum, 0))
|
|
||||||
end
|
|
||||||
elseif line !~ s:var_stmt
|
|
||||||
return indent(prevline)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
" 3.4. Work on the MSL line. {{{2
|
|
||||||
" --------------------------
|
|
||||||
|
|
||||||
let ind_con = ind
|
|
||||||
let ind = s:IndentWithContinuation(lnum, ind_con, s:sw())
|
|
||||||
|
|
||||||
" }}}2
|
|
||||||
"
|
|
||||||
"
|
|
||||||
let ols = s:InOneLineScope(lnum)
|
|
||||||
if ols > 0
|
|
||||||
let ind = ind + s:sw()
|
|
||||||
else
|
|
||||||
let ols = s:ExitingOneLineScope(lnum)
|
|
||||||
while ols > 0 && ind > 0
|
|
||||||
let ind = ind - s:sw()
|
|
||||||
let ols = s:InOneLineScope(ols - 1)
|
|
||||||
endwhile
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [s:scriptTag,0] : getpos('.')[1:2])
|
||||||
|
let num = b:js_cache[1]
|
||||||
|
|
||||||
|
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0]
|
||||||
|
if !b:js_cache[2] || s:IsBlock()
|
||||||
|
let ilnum = line('.')
|
||||||
|
let pline = s:Trim(l:lnum)
|
||||||
|
if b:js_cache[2] && s:looking_at() == ')' && s:GetPair('(',')','bW',s:skip_expr,100) > 0
|
||||||
|
let num = ilnum == num ? line('.') : num
|
||||||
|
if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.'
|
||||||
|
let switch_offset = &cino !~ ':' ? s:W : max([-indent(num),s:parse_cino(':')])
|
||||||
|
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
|
||||||
|
return indent(num) + switch_offset
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if idx < 0 && pline[-1:] !~ '[{;]'
|
||||||
|
let isOp = (l:line =~# s:opfirst || s:continues(l:lnum,pline)) * s:W
|
||||||
|
let bL = s:iscontOne(l:lnum,b:js_cache[1],isOp)
|
||||||
|
let bL -= (bL && l:line[0] == '{') * s:W
|
||||||
|
endif
|
||||||
|
elseif idx < 0 && getline(b:js_cache[1])[b:js_cache[2]-1] == '(' && &cino =~ '('
|
||||||
|
let pval = s:parse_cino('(')
|
||||||
|
return !pval || !search('\m\S','nbW',num) && !s:parse_cino('U') ?
|
||||||
|
\ (s:parse_cino('w') ? 0 : -!!search('\m\S','W'.s:z,num)) + virtcol('.') :
|
||||||
|
\ max([indent('.') + pval + s:GetPair('(',')','nbrmW',s:skip_expr,100,num) * s:W,0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
" main return
|
||||||
|
if l:line =~ '^[])}]\|^|}'
|
||||||
|
return max([indent(num),0])
|
||||||
|
elseif num
|
||||||
|
return indent(num) + s:W + switch_offset + bL + isOp
|
||||||
|
endif
|
||||||
|
return bL + isOp
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
function! Fixedgq(lnum, count)
|
|
||||||
let l:tw = &tw ? &tw : 80;
|
|
||||||
|
|
||||||
let l:count = a:count
|
|
||||||
let l:first_char = indent(a:lnum) + 1
|
|
||||||
|
|
||||||
if mode() == 'i' " gq was not pressed, but tw was set
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" This gq is only meant to do code with strings, not comments
|
|
||||||
if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char)
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Put all the lines on one line and do normal spliting after that
|
|
||||||
if l:count > 1
|
|
||||||
while l:count > 1
|
|
||||||
let l:count -= 1
|
|
||||||
normal J
|
|
||||||
endwhile
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:winview = winsaveview()
|
|
||||||
|
|
||||||
call cursor(a:lnum, l:tw + 1)
|
|
||||||
let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum)
|
|
||||||
call cursor(a:lnum, l:tw + 1)
|
|
||||||
let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum)
|
|
||||||
|
|
||||||
" No need for special treatment, normal gq handles edgecases better
|
|
||||||
if breakpoint[1] == orig_breakpoint[1]
|
|
||||||
call winrestview(l:winview)
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Try breaking after string
|
|
||||||
if breakpoint[1] <= indent(a:lnum)
|
|
||||||
call cursor(a:lnum, l:tw + 1)
|
|
||||||
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if breakpoint[1] != 0
|
|
||||||
call feedkeys("r\<CR>")
|
|
||||||
else
|
|
||||||
let l:count = l:count - 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" run gq on new lines
|
|
||||||
if l:count == 1
|
|
||||||
call feedkeys("gqq")
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)
|
|||||||
|
|
||||||
" Check if the character at lnum:col is inside a string.
|
" Check if the character at lnum:col is inside a string.
|
||||||
function s:IsInString(lnum, col)
|
function s:IsInString(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') == jsonString
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') == "jsonString"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty, or in a string.
|
" Find line above 'lnum' that isn't empty, or in a string.
|
||||||
@@ -143,7 +143,11 @@ function GetJSONIndent()
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
" if s:Match(lnum, s:block_regex)
|
" if s:Match(lnum, s:block_regex)
|
||||||
|
" if exists('*shiftwidth')
|
||||||
" return indent(lnum) + shiftwidth()
|
" return indent(lnum) + shiftwidth()
|
||||||
|
" else
|
||||||
|
" return indent(lnum) + &sw
|
||||||
|
" endif
|
||||||
" endif
|
" endif
|
||||||
|
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
" If the previous line contained an opening bracket, and we are still in it,
|
||||||
@@ -151,7 +155,11 @@ function GetJSONIndent()
|
|||||||
if line =~ '[[({]'
|
if line =~ '[[({]'
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
||||||
|
if exists('*shiftwidth')
|
||||||
return ind + shiftwidth()
|
return ind + shiftwidth()
|
||||||
|
else
|
||||||
|
return ind + &sw
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
call cursor(v:lnum, vcol)
|
call cursor(v:lnum, vcol)
|
||||||
end
|
end
|
||||||
|
|||||||
26
indent/litcoffee.vim
Normal file
26
indent/litcoffee.vim
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! indent/coffee.vim
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetLitCoffeeIndent()
|
||||||
|
|
||||||
|
if exists('*GetLitCoffeeIndent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function GetLitCoffeeIndent()
|
||||||
|
if searchpair('^ \|\t', '', '$', 'bWnm') > 0
|
||||||
|
return GetCoffeeIndent(v:lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
268
indent/ls.vim
Normal file
268
indent/ls.vim
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'livescript') == -1
|
||||||
|
|
||||||
|
" Language: LiveScript
|
||||||
|
" Maintainer: George Zahariev
|
||||||
|
" URL: http://github.com/gkz/vim-ls
|
||||||
|
" License: WTFPL
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetLiveScriptIndent(v:lnum)
|
||||||
|
" Make sure GetLiveScriptIndent is run when these are typed so they can be
|
||||||
|
" indented or outdented.
|
||||||
|
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetLiveScriptIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Keywords to indent after
|
||||||
|
let s:INDENT_AFTER_KEYWORD = '^\%(if\|unless\|else\|for\|while\|until\|'
|
||||||
|
\ . 'loop\|case\|default\|try\|catch\|finally\|'
|
||||||
|
\ . 'class\|do\|new\|let\|with\|function\)\>'
|
||||||
|
|
||||||
|
" Operators to indent after
|
||||||
|
let s:INDENT_AFTER_OPERATOR = '\%([([{:=]\|[-=]>\)$'
|
||||||
|
|
||||||
|
" Keywords and operators that continue a line
|
||||||
|
let s:CONTINUATION = '\<\%(is\|isnt\|and\|or\|do\)\>$'
|
||||||
|
\ . '\|'
|
||||||
|
\ . '\%(-\@<!-\|+\@<!+\|<\|[-~]\@<!>\|\*\|/\@<!/\|%\||\|'
|
||||||
|
\ . '&\|,\|\.\@<!\.\)$'
|
||||||
|
|
||||||
|
" Operators that block continuation indenting
|
||||||
|
let s:CONTINUATION_BLOCK = '[([{:=]$'
|
||||||
|
|
||||||
|
" A continuation dot access
|
||||||
|
let s:DOT_ACCESS = '^\.'
|
||||||
|
|
||||||
|
" Keywords to outdent after
|
||||||
|
let s:OUTDENT_AFTER = '^\%(return\|break\|continue\|throw\)\>'
|
||||||
|
|
||||||
|
" A compound assignment like `... = if ...`
|
||||||
|
let s:COMPOUND_ASSIGNMENT = '[:=]\s*\%(if\|unless\|for\|while\|until\|'
|
||||||
|
\ . 'try\|class\|do\|new\|let\|with\)\>'
|
||||||
|
|
||||||
|
" A postfix condition like `return ... if ...`.
|
||||||
|
let s:POSTFIX_CONDITION = '\S\s\+\zs\<\%(if\|unless\)\>'
|
||||||
|
|
||||||
|
" A single-line else statement like `else ...` but not `else if ...
|
||||||
|
let s:SINGLE_LINE_ELSE = '^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
|
||||||
|
|
||||||
|
" Max lines to look back for a match
|
||||||
|
let s:MAX_LOOKBACK = 50
|
||||||
|
|
||||||
|
" Get the linked syntax name of a character.
|
||||||
|
function! s:SyntaxName(linenum, col)
|
||||||
|
return synIDattr(synIDtrans(synID(a:linenum, a:col, 1)), 'name')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a comment.
|
||||||
|
function! s:IsComment(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) == 'Comment'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a string.
|
||||||
|
function! s:IsString(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) == 'Constant'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a character is in a comment or string.
|
||||||
|
function! s:IsCommentOrString(linenum, col)
|
||||||
|
return s:SyntaxName(a:linenum, a:col) =~ 'Comment\|Constant'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a whole line is a comment.
|
||||||
|
function! s:IsCommentLine(linenum)
|
||||||
|
" Check the first non-whitespace character.
|
||||||
|
return s:IsComment(a:linenum, indent(a:linenum) + 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Repeatedly search a line for a regex until one is found outside a string or
|
||||||
|
" comment.
|
||||||
|
function! s:SmartSearch(linenum, regex)
|
||||||
|
" Start at the first column.
|
||||||
|
let col = 0
|
||||||
|
|
||||||
|
" Search until there are no more matches, unless a good match is found.
|
||||||
|
while 1
|
||||||
|
call cursor(a:linenum, col + 1)
|
||||||
|
let [_, col] = searchpos(a:regex, 'cn', a:linenum)
|
||||||
|
|
||||||
|
" No more matches.
|
||||||
|
if !col
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:IsCommentOrString(a:linenum, col)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" No good match found.
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Skip a match if it's in a comment or string, is a single-line statement that
|
||||||
|
" isn't adjacent, or is a postfix condition.
|
||||||
|
function! s:ShouldSkip(startlinenum, linenum, col)
|
||||||
|
if s:IsCommentOrString(a:linenum, a:col)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Check for a single-line statement that isn't adjacent.
|
||||||
|
if s:SmartSearch(a:linenum, '\<then\>') && a:startlinenum - a:linenum > 1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:SmartSearch(a:linenum, s:POSTFIX_CONDITION) &&
|
||||||
|
\ !s:SmartSearch(a:linenum, s:COMPOUND_ASSIGNMENT)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find the farthest line to look back to, capped to line 1 (zero and negative
|
||||||
|
" numbers cause bad things).
|
||||||
|
function! s:MaxLookback(startlinenum)
|
||||||
|
return max([1, a:startlinenum - s:MAX_LOOKBACK])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the skip expression for searchpair().
|
||||||
|
function! s:SkipExpr(startlinenum)
|
||||||
|
return "s:ShouldSkip(" . a:startlinenum . ", line('.'), col('.'))"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Search for pairs of text.
|
||||||
|
function! s:SearchPair(start, end)
|
||||||
|
" The cursor must be in the first column for regexes to match.
|
||||||
|
call cursor(0, 1)
|
||||||
|
|
||||||
|
let startlinenum = line('.')
|
||||||
|
|
||||||
|
" Don't need the W flag since MaxLookback caps the search to line 1.
|
||||||
|
return searchpair(a:start, '', a:end, 'bcn',
|
||||||
|
\ s:SkipExpr(startlinenum),
|
||||||
|
\ s:MaxLookback(startlinenum))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Try to find a previous matching line.
|
||||||
|
function! s:GetMatch(curline)
|
||||||
|
let firstchar = a:curline[0]
|
||||||
|
|
||||||
|
if firstchar == '}'
|
||||||
|
return s:SearchPair('{', '}')
|
||||||
|
elseif firstchar == ')'
|
||||||
|
return s:SearchPair('(', ')')
|
||||||
|
elseif firstchar == ']'
|
||||||
|
return s:SearchPair('\[', '\]')
|
||||||
|
elseif a:curline =~ '^else\>'
|
||||||
|
return s:SearchPair('\<\%(if\|unless\|case\|when\)\>', '\<else\>')
|
||||||
|
elseif a:curline =~ '^catch\>'
|
||||||
|
return s:SearchPair('\<try\>', '\<catch\>')
|
||||||
|
elseif a:curline =~ '^finally\>'
|
||||||
|
return s:SearchPair('\<try\>', '\<finally\>')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the nearest previous line that isn't a comment.
|
||||||
|
function! s:GetPrevNormalLine(startlinenum)
|
||||||
|
let curlinenum = a:startlinenum
|
||||||
|
|
||||||
|
while curlinenum > 0
|
||||||
|
let curlinenum = prevnonblank(curlinenum - 1)
|
||||||
|
|
||||||
|
if !s:IsCommentLine(curlinenum)
|
||||||
|
return curlinenum
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the contents of a line without leading or trailing whitespace.
|
||||||
|
function! s:GetTrimmedLine(linenum)
|
||||||
|
return substitute(substitute(getline(a:linenum), '^\s\+', '', ''),
|
||||||
|
\ '\s\+$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:GetLiveScriptIndent(curlinenum)
|
||||||
|
let prevlinenum = s:GetPrevNormalLine(a:curlinenum)
|
||||||
|
|
||||||
|
" Don't do anything if there's no previous line.
|
||||||
|
if !prevlinenum
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let curline = s:GetTrimmedLine(a:curlinenum)
|
||||||
|
|
||||||
|
" Try to find a previous matching statement. This handles outdenting.
|
||||||
|
let matchlinenum = s:GetMatch(curline)
|
||||||
|
|
||||||
|
if matchlinenum
|
||||||
|
return indent(matchlinenum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prevline = s:GetTrimmedLine(prevlinenum)
|
||||||
|
let previndent = indent(prevlinenum)
|
||||||
|
|
||||||
|
" Always indent after these operators.
|
||||||
|
if prevline =~ s:INDENT_AFTER_OPERATOR
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent after a continuation if it's the first.
|
||||||
|
if prevline =~ s:CONTINUATION
|
||||||
|
let prevprevlinenum = s:GetPrevNormalLine(prevlinenum)
|
||||||
|
let prevprevline = s:GetTrimmedLine(prevprevlinenum)
|
||||||
|
|
||||||
|
if prevprevline !~ s:CONTINUATION && prevprevline !~ s:CONTINUATION_BLOCK
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent after these keywords and compound assignments if they aren't a
|
||||||
|
" single-line statement.
|
||||||
|
if prevline =~ s:INDENT_AFTER_KEYWORD || prevline =~ s:COMPOUND_ASSIGNMENT
|
||||||
|
if !s:SmartSearch(prevlinenum, '\<then\>') && prevline !~ s:SINGLE_LINE_ELSE
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent a dot access if it's the first.
|
||||||
|
if curline =~ s:DOT_ACCESS && prevline !~ s:DOT_ACCESS
|
||||||
|
return previndent + &shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Outdent after these keywords if they don't have a postfix condition and
|
||||||
|
" aren't a single-line statement.
|
||||||
|
if prevline =~ s:OUTDENT_AFTER
|
||||||
|
if !s:SmartSearch(prevlinenum, s:POSTFIX_CONDITION) ||
|
||||||
|
\ s:SmartSearch(prevlinenum, '\<then\>')
|
||||||
|
return previndent - &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" No indenting or outdenting is needed.
|
||||||
|
return -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Wrap s:GetLiveScriptIndent to keep the cursor position.
|
||||||
|
function! GetLiveScriptIndent(curlinenum)
|
||||||
|
let oldcursor = getpos('.')
|
||||||
|
let indent = s:GetLiveScriptIndent(a:curlinenum)
|
||||||
|
call setpos('.', oldcursor)
|
||||||
|
|
||||||
|
return indent
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
126
indent/lua.vim
Normal file
126
indent/lua.vim
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lua') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Lua
|
||||||
|
" URL: https://github.com/tbastos/vim-lua
|
||||||
|
|
||||||
|
" Initialization ------------------------------------------{{{1
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal nosmartindent
|
||||||
|
|
||||||
|
setlocal indentexpr=GetLuaIndent()
|
||||||
|
setlocal indentkeys+=0=end,0=until,0=elseif,0=else
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetLuaIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Variables -----------------------------------------------{{{1
|
||||||
|
|
||||||
|
let s:open_patt = '\%(\<\%(function\|if\|repeat\|do\)\>\|(\|{\)'
|
||||||
|
let s:middle_patt = '\<\%(else\|elseif\)\>'
|
||||||
|
let s:close_patt = '\%(\<\%(end\|until\)\>\|)\|}\)'
|
||||||
|
|
||||||
|
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
|
||||||
|
let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
|
||||||
|
|
||||||
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
|
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ 'luaComment\\|luaString'"
|
||||||
|
|
||||||
|
" Auxiliary Functions -------------------------------------{{{1
|
||||||
|
|
||||||
|
function s:IsInCommentOrString(lnum, col)
|
||||||
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ 'luaCommentLong\|luaStringLong'
|
||||||
|
\ && !(getline(a:lnum) =~ '^\s*\%(--\)\?\[=*\[') " opening tag is not considered 'in'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find line above 'lnum' that isn't blank, in a comment or string.
|
||||||
|
function s:PrevLineOfCode(lnum)
|
||||||
|
let lnum = prevnonblank(a:lnum)
|
||||||
|
while s:IsInCommentOrString(lnum, 1)
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return lnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Gets line contents, excluding trailing comments.
|
||||||
|
function s:GetContents(lnum)
|
||||||
|
return substitute(getline(a:lnum), '\v\m--.*$', '', '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" GetLuaIndent Function -----------------------------------{{{1
|
||||||
|
|
||||||
|
function GetLuaIndent()
|
||||||
|
" if the line is in a long comment or string, don't change the indent
|
||||||
|
if s:IsInCommentOrString(v:lnum, 1)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prev_line = s:PrevLineOfCode(v:lnum - 1)
|
||||||
|
if prev_line == 0
|
||||||
|
" this is the first non-empty line
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let contents_cur = s:GetContents(v:lnum)
|
||||||
|
let contents_prev = s:GetContents(prev_line)
|
||||||
|
|
||||||
|
let original_cursor_pos = getpos(".")
|
||||||
|
|
||||||
|
let i = 0
|
||||||
|
|
||||||
|
" check if the previous line opens blocks
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
|
\ 'mrb', s:skip_expr, prev_line)
|
||||||
|
if num_pairs > 0
|
||||||
|
let i += num_pairs
|
||||||
|
endif
|
||||||
|
|
||||||
|
" special case: call(with, {anon = function() -- should indent only once
|
||||||
|
if num_pairs > 1 && contents_prev =~ s:anon_func_start
|
||||||
|
let i = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" check if current line closes blocks
|
||||||
|
call cursor(prev_line, col([prev_line,'$']))
|
||||||
|
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||||
|
\ 'mr', s:skip_expr, v:lnum)
|
||||||
|
if num_pairs > 0
|
||||||
|
let i -= num_pairs
|
||||||
|
endif
|
||||||
|
|
||||||
|
" special case: end}) -- end of call with anon func should unindent once
|
||||||
|
if num_pairs > 1 && contents_cur =~ s:anon_func_end
|
||||||
|
let i = -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if the previous line closed a paren, unindent (except with anon funcs)
|
||||||
|
call cursor(prev_line - 1, col([prev_line - 1, '$']))
|
||||||
|
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
||||||
|
if num_pairs > 0 && contents_prev !~ s:anon_func_end
|
||||||
|
let i -= 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if this line closed a paren, indent (except with anon funcs)
|
||||||
|
call cursor(prev_line, col([prev_line, '$']))
|
||||||
|
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
||||||
|
if num_pairs > 0 && contents_cur !~ s:anon_func_end
|
||||||
|
let i += 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" restore cursor
|
||||||
|
call setpos(".", original_cursor_pos)
|
||||||
|
|
||||||
|
return indent(prev_line) + (&sw * i)
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -121,7 +121,7 @@ function! GetNimIndent(lnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
||||||
\ || pline =~ '=\s*\(object\|enum\|tuple\|generic\)'
|
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
|
||||||
return plindent + &sw
|
return plindent + &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
131
indent/perl6.vim
131
indent/perl6.vim
@@ -1,131 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
|
||||||
|
|
||||||
" Vim indent file
|
|
||||||
" Language: Perl 6
|
|
||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
|
||||||
" Last Change: {{LAST_CHANGE}}
|
|
||||||
" Contributors: Andy Lester <andy@petdance.com>
|
|
||||||
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
|
||||||
"
|
|
||||||
" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr>
|
|
||||||
|
|
||||||
" Suggestions and improvements by :
|
|
||||||
" Aaron J. Sherman (use syntax for hints)
|
|
||||||
" Artem Chuprina (play nice with folding)
|
|
||||||
" TODO:
|
|
||||||
" This file still relies on stuff from the Perl 5 syntax file, which Perl 6
|
|
||||||
" does not use.
|
|
||||||
"
|
|
||||||
" Things that are not or not properly indented (yet) :
|
|
||||||
" - Continued statements
|
|
||||||
" print "foo",
|
|
||||||
" "bar";
|
|
||||||
" print "foo"
|
|
||||||
" if bar();
|
|
||||||
" - Multiline regular expressions (m//x)
|
|
||||||
" (The following probably needs modifying the perl syntax file)
|
|
||||||
" - qw() lists
|
|
||||||
" - Heredocs with terminators that don't match \I\i*
|
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
|
||||||
if exists("b:did_indent")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_indent = 1
|
|
||||||
|
|
||||||
" Is syntax highlighting active ?
|
|
||||||
let b:indent_use_syntax = has("syntax")
|
|
||||||
|
|
||||||
setlocal indentexpr=GetPerl6Indent()
|
|
||||||
|
|
||||||
" we reset it first because the Perl 5 indent file might have been loaded due
|
|
||||||
" to a .pl/pm file extension, and indent files don't clean up afterwards
|
|
||||||
setlocal indentkeys&
|
|
||||||
|
|
||||||
setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and
|
|
||||||
if !b:indent_use_syntax
|
|
||||||
setlocal indentkeys+=0=EO
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
function! GetPerl6Indent()
|
|
||||||
|
|
||||||
" Get the line to be indented
|
|
||||||
let cline = getline(v:lnum)
|
|
||||||
|
|
||||||
" Indent POD markers to column 0
|
|
||||||
if cline =~ '^\s*=\L\@!'
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Get current syntax item at the line's first char
|
|
||||||
let csynid = ''
|
|
||||||
if b:indent_use_syntax
|
|
||||||
let csynid = synIDattr(synID(v:lnum,1,0),"name")
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Don't reindent POD and heredocs
|
|
||||||
if csynid =~ "^p6Pod"
|
|
||||||
return indent(v:lnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" Now get the indent of the previous perl line.
|
|
||||||
|
|
||||||
" Find a non-blank line above the current line.
|
|
||||||
let lnum = prevnonblank(v:lnum - 1)
|
|
||||||
" Hit the start of the file, use zero indent.
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
" Skip heredocs, POD, and comments on 1st column
|
|
||||||
if b:indent_use_syntax
|
|
||||||
let skippin = 2
|
|
||||||
while skippin
|
|
||||||
let synid = synIDattr(synID(lnum,1,0),"name")
|
|
||||||
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
|
|
||||||
let lnum = prevnonblank(lnum - 1)
|
|
||||||
if lnum == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let line = getline(lnum)
|
|
||||||
let ind = indent(lnum)
|
|
||||||
let skippin = 1
|
|
||||||
else
|
|
||||||
let skippin = 0
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
|
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
|
||||||
if cline =~ '^\s*[)}\]»>]'
|
|
||||||
let ind = ind - &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Indent lines that begin with 'or' or 'and'
|
|
||||||
if cline =~ '^\s*\(or\|and\)\>'
|
|
||||||
if line !~ '^\s*\(or\|and\)\>'
|
|
||||||
let ind = ind + &sw
|
|
||||||
endif
|
|
||||||
elseif line =~ '^\s*\(or\|and\)\>'
|
|
||||||
let ind = ind - &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ind
|
|
||||||
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
|
|
||||||
|
|
||||||
endif
|
|
||||||
59
indent/plantuml.vim
Normal file
59
indent/plantuml.vim
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetPlantUMLIndent()
|
||||||
|
setlocal indentkeys=o,O,<CR>,<:>,!^F,0end,0else,}
|
||||||
|
|
||||||
|
" only define the indent code once
|
||||||
|
if exists('*GetPlantUMLIndent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:incIndent =
|
||||||
|
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\)\>\|' .
|
||||||
|
\ '^\s*ref\>[^:]*$\|' .
|
||||||
|
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .
|
||||||
|
\ '^\s*title\s*$\|' .
|
||||||
|
\ '^\s*skinparam\>.*{\s*$\|' .
|
||||||
|
\ '^\s*\%(state\|class\|partition\|rectangle\|enum\|interface\|namespace\)\>.*{'
|
||||||
|
|
||||||
|
let s:decIndent = '^\s*\%(end\|else\|}\)'
|
||||||
|
|
||||||
|
function! GetPlantUMLIndent(...) abort
|
||||||
|
"for current line, use arg if given or v:lnum otherwise
|
||||||
|
let clnum = a:0 ? a:1 : v:lnum
|
||||||
|
|
||||||
|
if !s:insidePlantUMLTags(clnum)
|
||||||
|
return indent(clnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let pnum = prevnonblank(clnum-1)
|
||||||
|
let pindent = indent(pnum)
|
||||||
|
let pline = getline(pnum)
|
||||||
|
let cline = getline(clnum)
|
||||||
|
|
||||||
|
if cline =~ s:decIndent
|
||||||
|
if pline =~ s:incIndent
|
||||||
|
return pindent
|
||||||
|
else
|
||||||
|
return pindent - shiftwidth()
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif pline =~ s:incIndent
|
||||||
|
return pindent + shiftwidth()
|
||||||
|
endif
|
||||||
|
|
||||||
|
return pindent
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:insidePlantUMLTags(lnum) abort
|
||||||
|
call cursor(a:lnum, 1)
|
||||||
|
return search('@startuml', 'Wbn') && search('@enduml', 'Wn')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
21
indent/proto.vim
Normal file
21
indent/proto.vim
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Protobuf
|
||||||
|
" Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||||
|
" Last Change: Fri, 15 Mar 2002 07:53:54 CET
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" Protobuf is like indenting C
|
||||||
|
setlocal cindent
|
||||||
|
setlocal expandtab
|
||||||
|
setlocal shiftwidth=2
|
||||||
|
|
||||||
|
let b:undo_indent = "setl cin<"
|
||||||
|
|
||||||
|
endif
|
||||||
894
indent/ruby.vim
894
indent/ruby.vim
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user