mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
115 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8454d66ab | ||
|
|
a60e299a3c | ||
|
|
b8a5504021 | ||
|
|
cea0d08a06 | ||
|
|
43085dc02f | ||
|
|
4d8423c962 | ||
|
|
e204a7223b | ||
|
|
7a0f2d974f | ||
|
|
15aeea662e | ||
|
|
d15651463a | ||
|
|
0c79dd3e73 | ||
|
|
4e95df7c7e | ||
|
|
31c55b85a0 | ||
|
|
199846c6d8 | ||
|
|
f95026252c | ||
|
|
4f3df59be7 | ||
|
|
26790941f6 | ||
|
|
fbc2af9e82 | ||
|
|
d4f252565a | ||
|
|
48e07bc501 | ||
|
|
c8897c9c18 | ||
|
|
34eb36e6d1 | ||
|
|
84ec4eedcd | ||
|
|
66b769328c | ||
|
|
ae18284e5a | ||
|
|
e3024f21fc | ||
|
|
31d757fc7b | ||
|
|
556c56d185 | ||
|
|
fe84062992 | ||
|
|
8742443e69 | ||
|
|
832dfece76 | ||
|
|
933e42ea1f | ||
|
|
cdd6d73e39 | ||
|
|
a48874df4c | ||
|
|
21849c2e18 | ||
|
|
664aa988f6 | ||
|
|
3ddca5da46 | ||
|
|
140430ffb7 | ||
|
|
d527002849 | ||
|
|
15727e7eb0 | ||
|
|
6b169212f8 | ||
|
|
2edc785a5e | ||
|
|
445e026010 | ||
|
|
fca45b2c2b | ||
|
|
ebf9ec9d62 | ||
|
|
9caa678708 | ||
|
|
8f2a71643a | ||
|
|
af763ef221 | ||
|
|
5ded0682bd | ||
|
|
26c678b08d | ||
|
|
17ecfbdabc | ||
|
|
0217fb50fe | ||
|
|
5023da62ec | ||
|
|
957228cc25 | ||
|
|
7aae831309 | ||
|
|
671078ef6c | ||
|
|
aebef2c2e7 | ||
|
|
e8245dbf17 | ||
|
|
9fd5c11a20 | ||
|
|
679ccf0303 | ||
|
|
eacf785f5a | ||
|
|
83bd298476 | ||
|
|
415261dd1f | ||
|
|
4d18a5e5dd | ||
|
|
a55b6aa3aa | ||
|
|
1d45a6d4f0 | ||
|
|
420a65e9b0 | ||
|
|
2254b83675 | ||
|
|
12755e3583 | ||
|
|
cbad6b1e0a | ||
|
|
fabb550c17 | ||
|
|
9d9ed14485 | ||
|
|
5005f1e27a | ||
|
|
571f76e6b6 | ||
|
|
e4f906d9a5 | ||
|
|
8b3a563bd0 | ||
|
|
0475f2b8d1 | ||
|
|
1d9a032a66 | ||
|
|
86721731c7 | ||
|
|
6f7257ade2 | ||
|
|
25ed6ff970 | ||
|
|
521220f389 | ||
|
|
b4cb58661e | ||
|
|
ebf81f7369 | ||
|
|
b69fbad1af | ||
|
|
fc272a0aa2 | ||
|
|
65f090faef | ||
|
|
58f9b8cd02 | ||
|
|
1ba88cc7d8 | ||
|
|
ca2fbfe038 | ||
|
|
b06535a1c6 | ||
|
|
2c59360e01 | ||
|
|
4f0bde6d67 | ||
|
|
833b2fadd5 | ||
|
|
efa1a55dc7 | ||
|
|
63922a1d1e | ||
|
|
0cd0b7f894 | ||
|
|
ec5884b1d0 | ||
|
|
92f779dc77 | ||
|
|
9d887c4b38 | ||
|
|
edfcded9fd | ||
|
|
c39dff0b10 | ||
|
|
288b0d2423 | ||
|
|
1597b7b766 | ||
|
|
ed677c34d5 | ||
|
|
c161994e96 | ||
|
|
f238378221 | ||
|
|
0d5f661cfd | ||
|
|
e99f88ff00 | ||
|
|
cad135aa01 | ||
|
|
678fc65514 | ||
|
|
aad3df96e7 | ||
|
|
629a1e1c93 | ||
|
|
d43b70d939 | ||
|
|
ec1c943069 |
18
.github/ISSUE_TEMPLATE/add-language.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/add-language.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: Add language
|
||||||
|
about: Add support for new language
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--- vim-polyglot accepts only lightweight, maintained github-hosted vim plugins -->
|
||||||
|
|
||||||
|
**GitHub repository url**
|
||||||
|
|
||||||
|
|
||||||
|
**Is this plugin well maintained?**
|
||||||
|
|
||||||
|
|
||||||
|
**Is this plugin lightweight? (no advanced functionality, just indent and syntax support)**
|
||||||
20
.github/ISSUE_TEMPLATE/add-support-for-language.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/add-support-for-language.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Add support for language
|
||||||
|
about: ''
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Report vim-polyglot bug
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Vim-polyglot is not responsible for bugs of plugins it uses. Please report only bugs that happen when plugin is used as part of vim-polyglot and doesn't happen when just install the plugin -->
|
||||||
|
|
||||||
|
**Does this bug happen when you install plugin without vim-polyglot?**
|
||||||
|
|
||||||
|
**Describe the bug:**
|
||||||
|
|
||||||
|
**To Reproduce:**
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 1.9.3
|
- 2.6
|
||||||
sudo: false
|
sudo: false
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- vim-gtk
|
- vim-gtk
|
||||||
before_script:
|
before_script:
|
||||||
- "export DISPLAY=:99.0"
|
- "./build"
|
||||||
- "sh -e /etc/init.d/xvfb start"
|
script: xvfb-run bundle exec rspec --format=documentation
|
||||||
script: bundle exec rspec --format=documentation
|
|
||||||
|
|||||||
28
Gemfile.lock
28
Gemfile.lock
@@ -1,16 +1,21 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
diff-lcs (1.1.3)
|
diff-lcs (1.3)
|
||||||
rspec (2.12.0)
|
rspec (3.8.0)
|
||||||
rspec-core (~> 2.12.0)
|
rspec-core (~> 3.8.0)
|
||||||
rspec-expectations (~> 2.12.0)
|
rspec-expectations (~> 3.8.0)
|
||||||
rspec-mocks (~> 2.12.0)
|
rspec-mocks (~> 3.8.0)
|
||||||
rspec-core (2.12.2)
|
rspec-core (3.8.0)
|
||||||
rspec-expectations (2.12.1)
|
rspec-support (~> 3.8.0)
|
||||||
diff-lcs (~> 1.1.3)
|
rspec-expectations (3.8.2)
|
||||||
rspec-mocks (2.12.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
vimrunner (0.3.0)
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-mocks (3.8.0)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.8.0)
|
||||||
|
rspec-support (3.8.0)
|
||||||
|
vimrunner (0.3.4)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@@ -18,3 +23,6 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
rspec
|
rspec
|
||||||
vimrunner
|
vimrunner
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.16.2
|
||||||
|
|||||||
87
README.md
87
README.md
@@ -1,4 +1,6 @@
|
|||||||
# vim-polyglot [![Build Status][travis-img-url]][travis-url] []()
|

|
||||||
|
|
||||||
|
[![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 +10,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 100+ times faster** than the <!--Package Count-->114<!--/Package Count--> packages it consists of.
|
- It **installs and updates 120+ times faster** than the <!--Package Count-->147<!--/Package Count--> packages it consists of.
|
||||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||||
@@ -43,6 +45,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
## Language packs
|
## Language packs
|
||||||
|
|
||||||
<!--Language Packs-->
|
<!--Language Packs-->
|
||||||
|
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl) (syntax)
|
||||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
||||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax)
|
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax)
|
||||||
- [applescript](https://github.com/mityu/vim-applescript) (syntax, indent)
|
- [applescript](https://github.com/mityu/vim-applescript) (syntax, indent)
|
||||||
@@ -57,106 +60,138 @@ If you need full functionality of any plugin, please use it directly with your p
|
|||||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
||||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, compiler, indent, autoload, ftplugin)
|
||||||
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
||||||
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin)
|
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin)
|
||||||
|
- [csv](https://github.com/chrisbra/csv.vim) (syntax, autoload, ftplugin)
|
||||||
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
|
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
|
||||||
|
- [cue](https://github.com/mgrabovsky/vim-cuesheet) (syntax)
|
||||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
|
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
|
||||||
- [dockerfile](https://github.com/docker/docker) (syntax)
|
- [dhall](https://github.com/vmchale/dhall-vim) (syntax, ftplugin)
|
||||||
|
- [dlang](https://github.com/JesseKPhillips/d.vim) (syntax, indent)
|
||||||
|
- [dockerfile](https://github.com/ekalinin/Dockerfile.vim) (syntax, indent, ftplugin)
|
||||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
|
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [elm](https://github.com/ElmCast/elm-vim) (syntax, indent, autoload, ftplugin)
|
- [elm](https://github.com/ElmCast/elm-vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
|
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
|
||||||
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
|
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
|
||||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
|
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
|
||||||
- [ferm](https://github.com/vim-scripts/ferm.vim) (syntax)
|
- [ferm](https://github.com/vim-scripts/ferm.vim) (syntax)
|
||||||
- [fish](https://github.com/dag/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
|
- [fish](https://github.com/georgewitteman/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
|
- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers) (syntax)
|
||||||
- [fsharp](https://github.com/fsharp/vim-fsharp) (syntax, indent)
|
- [fsharp](https://github.com/fsharp/vim-fsharp) (syntax, indent)
|
||||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
|
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
|
||||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
|
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
|
||||||
- [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax)
|
- [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax)
|
||||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
|
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
|
||||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
|
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
|
||||||
- [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, ftplugin)
|
- [gradle](https://github.com/tfnico/vim-gradle) (compiler)
|
||||||
|
- [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, autoload, ftplugin, after)
|
||||||
|
- [groovy-indent](https://github.com/vim-scripts/groovyindent-unix) (indent)
|
||||||
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
||||||
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
|
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
|
||||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
|
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
|
||||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
|
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
|
||||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
|
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
|
||||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
|
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
|
||||||
|
- [hcl](https://github.com/b4b4r07/vim-hcl) (syntax, indent, ftplugin)
|
||||||
|
- [helm](https://github.com/towolf/vim-helm) (syntax)
|
||||||
|
- [hive](https://github.com/zebradil/hive.vim) (syntax, ftplugin)
|
||||||
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [i3](https://github.com/PotatoesMaster/i3-vim-syntax) (syntax, ftplugin)
|
- [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin)
|
||||||
|
- [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin)
|
||||||
|
- [ion](https://github.com/vmchale/ion-vim) (syntax, ftplugin)
|
||||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
|
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax)
|
||||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
||||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
||||||
|
- [jinja](https://github.com/lepture/vim-jinja) (syntax, indent)
|
||||||
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
|
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
|
||||||
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
||||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
||||||
- [jsx](https://github.com/mxw/vim-jsx) (after)
|
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (autoload, after)
|
||||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
|
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
|
||||||
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent)
|
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftplugin)
|
||||||
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
||||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
||||||
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin)
|
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond) (syntax, indent, compiler, ftplugin)
|
||||||
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
||||||
|
- [llvm](https://github.com/rhysd/vim-llvm) (syntax, indent, ftplugin)
|
||||||
|
- [log](https://github.com/MTDL9/vim-log-highlighting) (syntax)
|
||||||
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
||||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
||||||
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent)
|
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent, ftplugin)
|
||||||
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
- [mathematica](https://github.com/voldikss/vim-mma) (syntax, ftplugin)
|
||||||
|
- [mdx](https://github.com/jxnblk/vim-mdx-js) (syntax)
|
||||||
|
- [meson](https://github.com/mesonbuild/meson) (syntax, indent, ftplugin)
|
||||||
|
- [moonscript](https://github.com/leafo/moonscript-vim) (syntax, indent, ftplugin)
|
||||||
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||||
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, compiler, ftplugin)
|
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, compiler, 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/rgrinberg/vim-ocaml) (syntax, indent, compiler, ftplugin)
|
||||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
- [octave](https://github.com/McSinyx/vim-octave) (syntax, indent)
|
||||||
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
||||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||||
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
|
- [pgsql](https://github.com/lifepillar/pgsql.vim) (syntax, indent)
|
||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin)
|
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin)
|
||||||
|
- [pony](https://github.com/jakwings/vim-pony) (syntax, indent, autoload, ftplugin)
|
||||||
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin)
|
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, ftplugin)
|
||||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
||||||
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
||||||
- [puppet](https://github.com/voxpupuli/vim-puppet) (syntax, indent, ftplugin)
|
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, autoload, ftplugin)
|
||||||
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
||||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||||
- [python-ident](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
||||||
- [python](https://github.com/vim-python/python-syntax) (syntax)
|
- [python](https://github.com/vim-python/python-syntax) (syntax)
|
||||||
|
- [qmake](https://github.com/artoj/qmake-syntax-vim) (syntax)
|
||||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
|
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
|
||||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax)
|
||||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, autoload, ftplugin)
|
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, ftplugin)
|
||||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||||
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
||||||
|
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
|
||||||
- [rspec](https://github.com/sheerun/rspec.vim) (syntax)
|
- [rspec](https://github.com/sheerun/rspec.vim) (syntax)
|
||||||
|
- [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, indent, autoload, ftplugin)
|
||||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
|
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin)
|
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
||||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
|
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin)
|
||||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin)
|
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, indent, ftplugin)
|
||||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
||||||
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
|
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
|
||||||
|
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
|
||||||
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
|
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
|
||||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
||||||
|
- [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent)
|
||||||
|
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
|
||||||
|
- [svg](https://github.com/vim-scripts/svg.vim) (syntax)
|
||||||
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
|
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin)
|
||||||
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
|
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
|
||||||
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax)
|
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax, ftplugin)
|
||||||
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, ftplugin)
|
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, autoload, ftplugin)
|
||||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
|
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
|
||||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
|
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
|
||||||
- [tmux](https://github.com/keith/tmux.vim) (syntax, ftplugin)
|
- [tmux](https://github.com/ericpruitt/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)
|
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
|
||||||
|
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
|
||||||
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
|
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
|
||||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin)
|
- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (syntax, indent, compiler, ftplugin)
|
||||||
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent)
|
- [v](https://github.com/ollykel/v-vim) (syntax, indent, ftplugin)
|
||||||
|
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent, ftplugin)
|
||||||
- [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)
|
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
|
||||||
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
|
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
|
||||||
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
|
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
|
||||||
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
|
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
|
||||||
|
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax) (syntax)
|
||||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||||
|
- [xml](https://github.com/amadeus/vim-xml) (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)
|
||||||
|
- [zephir](https://github.com/xwsoul/vim-zephir) (syntax)
|
||||||
|
- [zig](https://github.com/ziglang/zig.vim) (syntax, autoload, ftplugin)
|
||||||
<!--/Language Packs-->
|
<!--/Language Packs-->
|
||||||
|
|
||||||
## Updating
|
## Updating
|
||||||
@@ -170,7 +205,7 @@ Please make sure you have `syntax on` in your `.vimrc`, otherwise syntax files a
|
|||||||
Individual language packs can be disabled by setting `g:polyglot_disabled` as follows:
|
Individual language packs can be disabled by setting `g:polyglot_disabled` as follows:
|
||||||
|
|
||||||
```viml
|
```viml
|
||||||
" ~/.vimrc
|
" ~/.vimrc, declare this variable before polyglot is loaded
|
||||||
let g:polyglot_disabled = ['css']
|
let g:polyglot_disabled = ['css']
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rspec') == -1
|
|
||||||
|
|
||||||
autocmd BufReadPost,BufNewFile *_spec.rb set syntax=rspec
|
|
||||||
autocmd BufReadPost,BufNewFile *_spec.rb setlocal commentstring=#\ %s
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
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+=-,.,*
|
||||||
setlocal commentstring=--\ %s
|
setlocal commentstring=--\ %s
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
||||||
|
|
||||||
if exists("loaded_matchit")
|
if exists("loaded_matchit")
|
||||||
let b:match_ignorecase = 0
|
let b:match_ignorecase = 0
|
||||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
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+='
|
||||||
|
|
||||||
|
|||||||
5
after/ftplugin/idris.vim
Normal file
5
after/ftplugin/idris.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||||
|
|
||||||
|
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, 'javascript') == -1
|
||||||
|
|
||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: JavaScript
|
" Language: JavaScript
|
||||||
" Maintainer: vim-javascript community
|
" Maintainer: vim-javascript community
|
||||||
@@ -14,3 +14,38 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Vim ftplugin file
|
||||||
|
"
|
||||||
|
" Language: javascript.jsx
|
||||||
|
" Maintainer: MaxMEllon <maxmellon1994@gmail.com>
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" modified from html.vim
|
||||||
|
" For matchit plugin
|
||||||
|
if exists("loaded_matchit")
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||||
|
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" For andymass/vim-matchup plugin
|
||||||
|
if exists("loaded_matchup")
|
||||||
|
setlocal matchpairs=(:),{:},[:],<:>
|
||||||
|
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||||
|
let b:match_skip = 's:comment\|string'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:original_commentstring = &l:commentstring
|
||||||
|
|
||||||
|
augroup jsx_comment
|
||||||
|
autocmd! CursorMoved <buffer>
|
||||||
|
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring)
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
setlocal suffixesadd+=.jsx
|
||||||
|
|
||||||
|
endif
|
||||||
|
|||||||
5
after/ftplugin/javascriptreact.vim
Normal file
5
after/ftplugin/javascriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/javascript.vim
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" Vim ftplugin file
|
|
||||||
"
|
|
||||||
" Language: JSX (JavaScript)
|
|
||||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
|
||||||
"
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
" modified from html.vim
|
|
||||||
if exists("loaded_matchit")
|
|
||||||
let b:match_ignorecase = 0
|
|
||||||
let s:jsx_match_words = '(:),\[:\],{:},<:>,' .
|
|
||||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
|
||||||
let b:match_words = exists('b:match_words')
|
|
||||||
\ ? b:match_words . ',' . s:jsx_match_words
|
|
||||||
\ : s:jsx_match_words
|
|
||||||
endif
|
|
||||||
|
|
||||||
setlocal suffixesadd+=.jsx
|
|
||||||
|
|
||||||
endif
|
|
||||||
477
after/ftplugin/llvm.vim
Normal file
477
after/ftplugin/llvm.vim
Normal file
@@ -0,0 +1,477 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||||
|
|
||||||
|
" Copyright (c) 2018 rhysd
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to deal
|
||||||
|
" in the Software without restriction, including without limitation the rights
|
||||||
|
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
" copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
" THE SOFTWARE.
|
||||||
|
|
||||||
|
if get(g:, 'llvm_extends_official', 1) == 0
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:llvm_ext_no_mapping = get(g:, 'llvm_ext_no_mapping', 0)
|
||||||
|
let g:llvm_ext_lli_executable = get(g:, 'llvm_ext_lli_executable', 'lli')
|
||||||
|
|
||||||
|
let s:KIND_BLOCK_PREC = 0
|
||||||
|
let s:KIND_BLOCK_FOLLOW = 1
|
||||||
|
let s:KIND_FUNC_BEGIN = 2
|
||||||
|
let s:KIND_FUNC_END = 3
|
||||||
|
|
||||||
|
function! s:section_delim_at(lnum) abort
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let m = matchlist(line, '^\([^:]\+\):\%( \+; preds = \(%.\+\)\)\=$')
|
||||||
|
if !empty(m)
|
||||||
|
if m[2] ==# ''
|
||||||
|
return [s:KIND_BLOCK_PREC, m[1]]
|
||||||
|
else
|
||||||
|
return [s:KIND_BLOCK_FOLLOW, m[1], split(m[2], ',\s*')]
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if line =~# '^}$'
|
||||||
|
return [s:KIND_FUNC_END]
|
||||||
|
endif
|
||||||
|
if line =~# '^define\>'
|
||||||
|
return [s:KIND_FUNC_BEGIN]
|
||||||
|
endif
|
||||||
|
return []
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:is_section_delim(line, func_delim) abort
|
||||||
|
let sec = s:section_delim_at(a:line)
|
||||||
|
if empty(sec)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let kind = sec[0]
|
||||||
|
return kind == s:KIND_BLOCK_PREC || kind == s:KIND_BLOCK_FOLLOW || kind == func_delim
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:next_section(stop_func_begin) abort
|
||||||
|
let func_delim = a:stop_func_begin ? s:KIND_FUNC_BEGIN : s:KIND_FUNC_END
|
||||||
|
let last = line('$') - 1
|
||||||
|
let line = line('.')
|
||||||
|
while line < last
|
||||||
|
let line += 1
|
||||||
|
if s:is_section_delim(line, func_delim)
|
||||||
|
call cursor(line, col('.'))
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:prev_section(stop_func_begin) abort
|
||||||
|
let func_delim = a:stop_func_begin ? s:KIND_FUNC_BEGIN : s:KIND_FUNC_END
|
||||||
|
let line = line('.')
|
||||||
|
while line > 1
|
||||||
|
let line -= 1
|
||||||
|
if s:is_section_delim(line, func_delim)
|
||||||
|
call cursor(line, col('.'))
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !g:llvm_ext_no_mapping
|
||||||
|
nnoremap <buffer><silent>]] :<C-u>call <SID>next_section(1)<CR>
|
||||||
|
nnoremap <buffer><silent>[[ :<C-u>call <SID>prev_section(1)<CR>
|
||||||
|
nnoremap <buffer><silent>][ :<C-u>call <SID>next_section(0)<CR>
|
||||||
|
nnoremap <buffer><silent>[] :<C-u>call <SID>prev_section(0)<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:function_range_at(linum) abort
|
||||||
|
let line = a:linum
|
||||||
|
while line >= 1
|
||||||
|
let s = getline(line)
|
||||||
|
if s =~# '^define\>'
|
||||||
|
let start = line
|
||||||
|
break
|
||||||
|
elseif s =~# '^}$'
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
let line -= 1
|
||||||
|
endwhile
|
||||||
|
if line < 1
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let line = a:linum
|
||||||
|
let last = line('$')
|
||||||
|
while line <= last
|
||||||
|
let s = getline(line)
|
||||||
|
if s =~# '^}$'
|
||||||
|
let end = line
|
||||||
|
break
|
||||||
|
elseif s =~# '^define\>'
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
let line += 1
|
||||||
|
endwhile
|
||||||
|
if line > last
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
return [start, end]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:blocks_graph_at(linum) abort
|
||||||
|
let func_range = s:function_range_at(a:linum)
|
||||||
|
if empty(func_range)
|
||||||
|
return {}
|
||||||
|
endif
|
||||||
|
let line = func_range[0] + 1
|
||||||
|
let last = func_range[1] - 1
|
||||||
|
let graph = {}
|
||||||
|
while line <= last
|
||||||
|
let block = s:section_delim_at(line)
|
||||||
|
if empty(block)
|
||||||
|
let line += 1
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
let block_name = '%' . block[1]
|
||||||
|
if block[0] == s:KIND_BLOCK_PREC
|
||||||
|
let graph[block_name] = {'line': line, 'follows': [], 'preds': []}
|
||||||
|
elseif block[0] == s:KIND_BLOCK_FOLLOW
|
||||||
|
let graph[block_name] = {'line': line, 'follows': [], 'preds': block[2]}
|
||||||
|
for follow in block[2]
|
||||||
|
call add(graph[follow].follows, block_name)
|
||||||
|
endfor
|
||||||
|
else
|
||||||
|
echoerr 'unreachable'
|
||||||
|
endif
|
||||||
|
let line += 1
|
||||||
|
endwhile
|
||||||
|
return graph
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:find_pred_block(linum) abort
|
||||||
|
let sec = s:section_delim_at(a:linum)
|
||||||
|
if empty(sec) || sec[0] != s:KIND_BLOCK_PREC && sec[0] != s:KIND_BLOCK_FOLLOW
|
||||||
|
throw 'No block is starting at line ' . a:linum
|
||||||
|
endif
|
||||||
|
if sec[0] != s:KIND_BLOCK_FOLLOW
|
||||||
|
throw printf("Block '%s' has no pred block", sec[1])
|
||||||
|
endif
|
||||||
|
let block_name = '%' . sec[1]
|
||||||
|
let pred_block = sec[2][0]
|
||||||
|
|
||||||
|
let graph = s:blocks_graph_at(a:linum)
|
||||||
|
if empty(graph)
|
||||||
|
throw 'No block is found in function at line ' . a:linum
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !has_key(graph, pred_block)
|
||||||
|
throw printf("Block '%s' (pred block of '%s') not found in function", pred_block, block_name)
|
||||||
|
endif
|
||||||
|
return graph[pred_block]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:move_to_pred_block() abort
|
||||||
|
try
|
||||||
|
let b = s:find_pred_block(line('.'))
|
||||||
|
call cursor(b.line, col('.'))
|
||||||
|
catch
|
||||||
|
echohl ErrorMsg | echom v:exception | echohl None
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:find_following_block(linum) abort
|
||||||
|
let sec = s:section_delim_at(a:linum)
|
||||||
|
if empty(sec) || sec[0] != s:KIND_BLOCK_PREC && sec[0] != s:KIND_BLOCK_FOLLOW
|
||||||
|
throw 'No block is starting at line ' . a:linum
|
||||||
|
endif
|
||||||
|
let block_name = '%' . sec[1]
|
||||||
|
|
||||||
|
let graph = s:blocks_graph_at(a:linum)
|
||||||
|
if empty(graph)
|
||||||
|
throw 'No block is found in function at line ' . a:linum
|
||||||
|
endif
|
||||||
|
|
||||||
|
let follows = graph[block_name].follows
|
||||||
|
if empty(follows)
|
||||||
|
throw printf("Block '%s' has no following block", block_name)
|
||||||
|
endif
|
||||||
|
|
||||||
|
echom printf("Block '%s' has %d following blocks: %s", block_name, len(follows), join(follows, ', '))
|
||||||
|
|
||||||
|
if !has_key(graph, follows[0])
|
||||||
|
throw printf("Block '%s' is not defined in function at line %d", follows[0], a:linum)
|
||||||
|
endif
|
||||||
|
return graph[follows[0]]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:move_to_following_block() abort
|
||||||
|
try
|
||||||
|
let b = s:find_following_block(line('.'))
|
||||||
|
call cursor(b.line, col('.'))
|
||||||
|
catch
|
||||||
|
echohl ErrorMsg | echom v:exception | echohl None
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !g:llvm_ext_no_mapping
|
||||||
|
nnoremap <buffer><silent>[b :<C-u>call <SID>move_to_pred_block()<CR>
|
||||||
|
nnoremap <buffer><silent>]b :<C-u>call <SID>move_to_following_block()<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:get_func_identifiers(line) abort
|
||||||
|
let idx = stridx(a:line, '@')
|
||||||
|
if idx == -1
|
||||||
|
" Invalid signature
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" e.g. define internal i32 @foo(...) { -> @foo(...) {
|
||||||
|
let sig = a:line[idx:]
|
||||||
|
|
||||||
|
let idx = stridx(sig, '(')
|
||||||
|
if idx == -1
|
||||||
|
" Invalid signature
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" @foo(...) { -> @foo
|
||||||
|
let idents = [sig[:idx-1]]
|
||||||
|
|
||||||
|
" @foo(...) { -> ...) {
|
||||||
|
let params = sig[idx+1:]
|
||||||
|
|
||||||
|
let idx = strridx(sig, ')')
|
||||||
|
if idx == -1
|
||||||
|
return idents
|
||||||
|
endif
|
||||||
|
|
||||||
|
" ...) { -> ...
|
||||||
|
let params = params[:idx-1]
|
||||||
|
|
||||||
|
" Gather parameters in function signature
|
||||||
|
while params !=# ''
|
||||||
|
let m = matchlist(params, '^[^%]*\(%\%("[^"]\+"\|[[:alnum:]_.]\+\)\)\s*\(.*\)$')
|
||||||
|
if empty(m)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let idents += [m[1]]
|
||||||
|
let params = m[2]
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return idents
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_identifiers(line) abort
|
||||||
|
" Registers and type defs
|
||||||
|
let m = matchlist(a:line, '^\s*\(%\S\+\)\s\+=')
|
||||||
|
if !empty(m)
|
||||||
|
return [m[1]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Constants
|
||||||
|
let m = matchlist(a:line, '^\(@\S\+\)\s\+=.\+\<constant\>')
|
||||||
|
if !empty(m)
|
||||||
|
return [m[1]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Labels for basic blocks
|
||||||
|
let m = matchlist(a:line, '^\([^:]\+\):\%(\s\+; preds = .\+\)\=$')
|
||||||
|
if !empty(m)
|
||||||
|
return ['%' . m[1]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Meta variables
|
||||||
|
let m = matchlist(a:line, '^\(!\S\+\)\s\+=')
|
||||||
|
if !empty(m)
|
||||||
|
return [m[1]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Attributes
|
||||||
|
let m = matchlist(a:line, '^attributes\s\+\(#\d\+\)\s\+=')
|
||||||
|
if !empty(m)
|
||||||
|
return [m[1]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:line =~# '^\%(declare\|define\)\>'
|
||||||
|
return s:get_func_identifiers(a:line)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return []
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:extract_identifier(word) abort
|
||||||
|
if strlen(a:word) <= 1
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prefix = a:word[0]
|
||||||
|
if prefix ==# '@' || prefix ==# '%' || prefix ==# '!'
|
||||||
|
if prefix ==# '!' && a:word[1] ==# '{'
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:word[1] == '"'
|
||||||
|
let idx = stridx(a:word, '"', 2)
|
||||||
|
if idx == -1
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
" @"foo" or %"foo"
|
||||||
|
return a:word[:idx]
|
||||||
|
else
|
||||||
|
" @foo or %foo
|
||||||
|
return matchstr(a:word, '^[@%!][[:alnum:]_.]\+')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if prefix ==# '#'
|
||||||
|
return matchstr(a:word, '^#\d\+')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:jump_to_identifier_at(linum, ident) abort
|
||||||
|
let line = getline(a:linum)
|
||||||
|
let column = stridx(line, a:ident) + 1
|
||||||
|
if column == 0
|
||||||
|
let column = col('.')
|
||||||
|
endif
|
||||||
|
call cursor(a:linum, column)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:browser_open_command() abort
|
||||||
|
if exists('g:llvm_ext_browser_open_command')
|
||||||
|
return g:llvm_ext_browser_open_command
|
||||||
|
endif
|
||||||
|
if exists('s:browser_opener')
|
||||||
|
return s:browser_opener
|
||||||
|
endif
|
||||||
|
let s:browser_opener = ''
|
||||||
|
if has('mac')
|
||||||
|
let s:browser_opener = 'open'
|
||||||
|
elseif has('win32') || has('win64')
|
||||||
|
let s:browser_opener = 'cmd /q /c start ""'
|
||||||
|
else
|
||||||
|
for cmd in ['xdg-open', 'chromium', 'google-chrome', 'firefox']
|
||||||
|
if executable(cmd)
|
||||||
|
let s:browser_opener = cmd
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
return s:browser_opener
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:open_browser(url) abort
|
||||||
|
let cmd = s:browser_open_command()
|
||||||
|
if cmd ==# ''
|
||||||
|
throw "Failed to open a browser. I don't know how to open a browser: Please set g:llvm_ext_browser_open_command"
|
||||||
|
endif
|
||||||
|
let cmdline = cmd . ' ' . shellescape(a:url)
|
||||||
|
let out = system(cmdline)
|
||||||
|
if v:shell_error
|
||||||
|
throw printf("Failed to open a browser with command '%s': %s", cmdline, out)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:goto_definition() abort
|
||||||
|
" Open language reference manual under the cursor in browser
|
||||||
|
let syn_name = synIDattr(synID(line('.'),col('.'),1),'name')
|
||||||
|
if syn_name ==# 'llvmStatement'
|
||||||
|
let word = expand('<cword>')
|
||||||
|
if word !=# ''
|
||||||
|
try
|
||||||
|
" Open browser assuming a word under the cursor is an instruction
|
||||||
|
call s:open_browser('https://llvm.org/docs/LangRef.html#' . word . '-instruction')
|
||||||
|
catch /^Failed to open a browser/
|
||||||
|
echohl ErrorMsg | echom v:exception | echohl None
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" XXX: This does not support identifiers which contains spaces
|
||||||
|
let word = expand('<cWORD>')
|
||||||
|
if word ==# ''
|
||||||
|
echom 'No identifier found under the cursor'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let ident = s:extract_identifier(word)
|
||||||
|
if ident ==# ''
|
||||||
|
echom 'No identifier found under the cursor'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Definition tends to be near its usages. Look back at first.
|
||||||
|
let line = line('.')
|
||||||
|
while line > 0
|
||||||
|
for found in s:get_identifiers(getline(line))
|
||||||
|
if ident ==# found
|
||||||
|
call s:jump_to_identifier_at(line, ident)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let line -= 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
let line = line('.') + 1
|
||||||
|
let last = line('$')
|
||||||
|
while line <= last
|
||||||
|
for found in s:get_identifiers(getline(line))
|
||||||
|
if ident ==# found
|
||||||
|
call s:jump_to_identifier_at(line, ident)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let line += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
echom "No definition for '" . ident . "' found"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !g:llvm_ext_no_mapping
|
||||||
|
nnoremap <buffer><silent>K :<C-u>call <SID>goto_definition()<CR>
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:run_lli(...) abort
|
||||||
|
if !has('job') || !has('channel') || !has('terminal')
|
||||||
|
echohl ErrorMsg
|
||||||
|
echomsg ':LLI requires terminal feature. Please update your Vim to 8.0+'
|
||||||
|
echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !executable(g:llvm_ext_lli_executable)
|
||||||
|
echohl ErrorMsg
|
||||||
|
echomsg g:llvm_ext_lli_executable . ' is not executable. Please set g:llvm_ext_lli_executable'
|
||||||
|
echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:0 > 0
|
||||||
|
let bufnr = term_start([g:llvm_ext_lli_executable, a:1])
|
||||||
|
echo 'Run lli in termnal buffer(' . bufnr . ')'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let tmpfile = tempname()
|
||||||
|
call writefile(getline(1, '$'), tmpfile)
|
||||||
|
let Cleanup = {ch -> filereadable(tmpfile) ? delete(tmpfile) : 0}
|
||||||
|
let bufnr = term_start([g:llvm_ext_lli_executable, tmpfile], {'close_cb': Cleanup, 'exit_cb': Cleanup})
|
||||||
|
echo 'Run lli in termnal buffer(' . bufnr . ')'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !exists(':LLI')
|
||||||
|
command! -buffer -nargs=? -bar -complete=file LLI call <SID>run_lli(<f-args>)
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,20 +1,11 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||||
|
|
||||||
if !exists('g:puppet_align_hashes')
|
if !exists('g:puppet_align_hashes')
|
||||||
let g:puppet_align_hashes = 1
|
let g:puppet_align_hashes = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:puppet_align_hashes && exists(':Tabularize')
|
if g:puppet_align_hashes
|
||||||
inoremap <buffer> <silent> > ><Esc>:call <SID>puppetalign()<CR>a
|
inoremap <buffer> <silent> => =><Esc>:call puppet#align#AlignHashrockets()<CR>$a
|
||||||
function! s:puppetalign()
|
|
||||||
let p = '^\s*\w+\s*[=+]>.*$'
|
|
||||||
let column = strlen(substitute(getline('.')[0:col('.')],'\([^=]\|=[^>]\)','','g'))
|
|
||||||
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=>\s*\zs.*'))
|
|
||||||
Tabularize /=>/l1
|
|
||||||
normal! 0
|
|
||||||
echo repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position)
|
|
||||||
call search(repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
|
||||||
endfunction
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
|
||||||
|
|
||||||
if !exists('g:terraform_align')
|
|
||||||
let g:terraform_align = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:terraform_remap_spacebar')
|
|
||||||
let g:terraform_remap_spacebar = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:terraform_fold_sections')
|
|
||||||
let g:terraform_fold_sections = 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
|
|
||||||
|
|
||||||
if g:terraform_fold_sections
|
|
||||||
function! TerraformFolds()
|
|
||||||
let thisline = getline(v:lnum)
|
|
||||||
if match(thisline, '^resource') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^provider') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^module') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^variable') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^output') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^data') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^terraform') >= 0
|
|
||||||
return ">1"
|
|
||||||
elseif match(thisline, '^locals') >= 0
|
|
||||||
return ">1"
|
|
||||||
else
|
|
||||||
return "="
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
setlocal foldmethod=expr
|
|
||||||
setlocal foldexpr=TerraformFolds()
|
|
||||||
setlocal foldlevel=1
|
|
||||||
|
|
||||||
function! TerraformFoldText()
|
|
||||||
let foldsize = (v:foldend-v:foldstart)
|
|
||||||
return getline(v:foldstart).' ('.foldsize.' lines)'
|
|
||||||
endfunction
|
|
||||||
setlocal foldtext=TerraformFoldText()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Re-map the space bar to fold and unfold
|
|
||||||
if get(g:, "terraform_remap_spacebar", 1)
|
|
||||||
"inoremap <space> <C-O>za
|
|
||||||
nnoremap <space> za
|
|
||||||
onoremap <space> <C-C>za
|
|
||||||
vnoremap <space> zf
|
|
||||||
endif
|
|
||||||
|
|
||||||
" 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
|
|
||||||
|
|
||||||
" Set the commentstring
|
|
||||||
if exists('g:terraform_commentstring')
|
|
||||||
let &l:commentstring=g:terraform_commentstring
|
|
||||||
else
|
|
||||||
setlocal commentstring=#%s
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
32
after/ftplugin/tsx.vim
Normal file
32
after/ftplugin/tsx.vim
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
" modified from html.vim
|
||||||
|
" For matchit plugin
|
||||||
|
|
||||||
|
if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("loaded_matchit")
|
||||||
|
let b:match_ignorecase = 0
|
||||||
|
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||||
|
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" For andymass/vim-matchup plugin
|
||||||
|
if exists("loaded_matchup")
|
||||||
|
setlocal matchpairs=(:),{:},[:],<:>
|
||||||
|
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||||
|
let b:match_skip = 's:comment\|string'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:original_commentstring = &l:commentstring
|
||||||
|
|
||||||
|
augroup jsx_comment
|
||||||
|
autocmd! CursorMoved <buffer>
|
||||||
|
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring)
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
setlocal suffixesadd+=.tsx
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/ftplugin/typescriptreact.vim
Normal file
5
after/ftplugin/typescriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/tsx.vim
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Yaml
|
" Language: Yaml
|
||||||
" Author: Henrique Barcelos
|
" Author: Henrique Barcelos
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
|
||||||
|
|
||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <mick@kochm.co>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Load the coffee and html indent functions.
|
|
||||||
silent! unlet b:did_indent
|
|
||||||
runtime indent/coffee.vim
|
|
||||||
let s:coffeeIndentExpr = &l:indentexpr
|
|
||||||
|
|
||||||
" Load html last so it can overwrite coffee settings.
|
|
||||||
silent! unlet b:did_indent
|
|
||||||
runtime indent/html.vim
|
|
||||||
let s:htmlIndentExpr = &l:indentexpr
|
|
||||||
|
|
||||||
" Inject our wrapper indent function.
|
|
||||||
setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
|
|
||||||
|
|
||||||
function! GetCoffeeHtmlIndent(curlinenum)
|
|
||||||
" See if we're inside a coffeescript block.
|
|
||||||
let scriptlnum = searchpair('<script [^>]*type=[''"]\?text/coffeescript[''"]\?[^>]*>', '',
|
|
||||||
\ '</script>', 'bWn')
|
|
||||||
let prevlnum = prevnonblank(a:curlinenum)
|
|
||||||
|
|
||||||
" If we're in the script block and the previous line isn't the script tag
|
|
||||||
" itself, use coffee indenting.
|
|
||||||
if scriptlnum && scriptlnum != prevlnum
|
|
||||||
exec 'return ' s:coffeeIndentExpr
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Otherwise use html indenting.
|
|
||||||
exec 'return ' s:htmlIndentExpr
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
endif
|
|
||||||
33
after/indent/javascript.vim
Normal file
33
after/indent/javascript.vim
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Vim indent file
|
||||||
|
"
|
||||||
|
" Language: javascript.jsx
|
||||||
|
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
let s:did_indent = b:did_indent
|
||||||
|
unlet b:did_indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:keepcpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
if exists('s:did_indent')
|
||||||
|
let b:did_indent = s:did_indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal indentexpr=GetJsxIndent()
|
||||||
|
setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
|
||||||
|
|
||||||
|
function! GetJsxIndent()
|
||||||
|
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:keepcpo
|
||||||
|
unlet s:keepcpo
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/indent/javascriptreact.vim
Normal file
5
after/indent/javascriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/javascript.vim
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Objective-C
|
" Language: Objective-C
|
||||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||||
|
|||||||
38
after/indent/tsx.vim
Normal file
38
after/indent/tsx.vim
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Vim indent file
|
||||||
|
"
|
||||||
|
" Language: typescript.jsx
|
||||||
|
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||||
|
" Depends: leafgarland/typescript-vim
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('b:did_indent')
|
||||||
|
let s:did_indent = b:did_indent
|
||||||
|
unlet b:did_indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:keepcpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
if exists('s:did_indent')
|
||||||
|
let b:did_indent = s:did_indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal indentexpr=GetJsxIndent()
|
||||||
|
setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
|
||||||
|
|
||||||
|
function! GetJsxIndent()
|
||||||
|
return jsx_pretty#indent#get(function('GetTypescriptIndent'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:keepcpo
|
||||||
|
unlet s:keepcpo
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/indent/typescriptreact.vim
Normal file
5
after/indent/typescriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/tsx.vim
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
||||||
|
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: C Additions
|
" Language: C Additions
|
||||||
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
||||||
@@ -36,6 +36,19 @@ if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
|||||||
hi def link cCustomMemVar Function
|
hi def link cCustomMemVar Function
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" -----------------------------------------------------------------------------
|
||||||
|
" Highlight POSIX functions.
|
||||||
|
" -----------------------------------------------------------------------------
|
||||||
|
if exists('g:cpp_posix_standard') && g:cpp_posix_standard
|
||||||
|
syn keyword cPOSIXFunction socket accept bind connect getsockname
|
||||||
|
syn keyword cPOSIXFunction listen recv recvfrom recvmsg
|
||||||
|
syn keyword cPOSIXFunction send sendto sendmsg setsockopt socketpair
|
||||||
|
syn keyword cPOSIXFunction htonl htons ntohl ntohs
|
||||||
|
syn keyword cPOSIXFunction inet_ntop inet_pton getaddrinfo
|
||||||
|
syn keyword cPOSIXFunction poll select pselect
|
||||||
|
hi def link cPOSIXFunction Function
|
||||||
|
endif
|
||||||
|
|
||||||
" -----------------------------------------------------------------------------
|
" -----------------------------------------------------------------------------
|
||||||
" Source: aftersyntaxc.vim
|
" Source: aftersyntaxc.vim
|
||||||
" -----------------------------------------------------------------------------
|
" -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
let s:current_syntax=b:current_syntax
|
let s:current_syntax=b:current_syntax
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
||||||
|
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: C++ Additions
|
" Language: C++ Additions
|
||||||
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
||||||
" URL: http://www.haeggblad.com
|
" URL: http://www.haeggblad.com
|
||||||
" Last Change: 1 Feb 2018
|
" Last Change: 29 Jun 2019
|
||||||
" Version: 0.6
|
" Version: 0.6
|
||||||
" Changelog:
|
" Changelog:
|
||||||
" 0.1 - initial version.
|
" 0.1 - initial version.
|
||||||
@@ -633,21 +633,19 @@ syntax keyword cppSTLios unitbuf
|
|||||||
syntax keyword cppSTLios uppercase
|
syntax keyword cppSTLios uppercase
|
||||||
"syntax keyword cppSTLios ws
|
"syntax keyword cppSTLios ws
|
||||||
syntax keyword cppSTLiterator back_insert_iterator
|
syntax keyword cppSTLiterator back_insert_iterator
|
||||||
syntax keyword cppSTLiterator bidirectional_iterator
|
|
||||||
syntax keyword cppSTLiterator const_iterator
|
syntax keyword cppSTLiterator const_iterator
|
||||||
syntax keyword cppSTLiterator const_reverse_iterator
|
syntax keyword cppSTLiterator const_reverse_iterator
|
||||||
syntax keyword cppSTLiterator forward_iterator
|
|
||||||
syntax keyword cppSTLiterator front_insert_iterator
|
syntax keyword cppSTLiterator front_insert_iterator
|
||||||
syntax keyword cppSTLiterator input_iterator
|
|
||||||
syntax keyword cppSTLiterator insert_iterator
|
syntax keyword cppSTLiterator insert_iterator
|
||||||
syntax keyword cppSTLiterator istreambuf_iterator
|
syntax keyword cppSTLiterator istreambuf_iterator
|
||||||
syntax keyword cppSTLiterator istream_iterator
|
syntax keyword cppSTLiterator istream_iterator
|
||||||
|
syntax keyword cppSTLiterator ostreambuf_iterator
|
||||||
|
syntax keyword cppSTLiterator ostream_iterator
|
||||||
syntax keyword cppSTLiterator iterator
|
syntax keyword cppSTLiterator iterator
|
||||||
syntax keyword cppSTLiterator ostream_iterator
|
syntax keyword cppSTLiterator ostream_iterator
|
||||||
syntax keyword cppSTLiterator output_iterator
|
syntax keyword cppSTLiterator output_iterator
|
||||||
syntax keyword cppSTLiterator random_access_iterator
|
|
||||||
syntax keyword cppSTLiterator raw_storage_iterator
|
syntax keyword cppSTLiterator raw_storage_iterator
|
||||||
syntax keyword cppSTLiterator reverse_bidirectional_iterator
|
syntax keyword cppSTLiterator move_iterator
|
||||||
syntax keyword cppSTLiterator reverse_iterator
|
syntax keyword cppSTLiterator reverse_iterator
|
||||||
syntax keyword cppSTLiterator_tag bidirectional_iterator_tag
|
syntax keyword cppSTLiterator_tag bidirectional_iterator_tag
|
||||||
syntax keyword cppSTLiterator_tag forward_iterator_tag
|
syntax keyword cppSTLiterator_tag forward_iterator_tag
|
||||||
@@ -962,6 +960,12 @@ if !exists("cpp_no_cpp11")
|
|||||||
syntax keyword cppSTLtype atomic_uintmax_t
|
syntax keyword cppSTLtype atomic_uintmax_t
|
||||||
syntax keyword cppSTLconstant ATOMIC_FLAG_INIT
|
syntax keyword cppSTLconstant ATOMIC_FLAG_INIT
|
||||||
syntax keyword cppSTLenum memory_order
|
syntax keyword cppSTLenum memory_order
|
||||||
|
syntax keyword cppSTLtype memory_order_relaxed
|
||||||
|
syntax keyword cppSTLtype memory_order_consume
|
||||||
|
syntax keyword cppSTLtype memory_order_acquire
|
||||||
|
syntax keyword cppSTLtype memory_order_release
|
||||||
|
syntax keyword cppSTLtype memory_order_acq_rel
|
||||||
|
syntax keyword cppSTLtype memory_order_seq_cst
|
||||||
syntax keyword cppSTLfunction is_lock_free
|
syntax keyword cppSTLfunction is_lock_free
|
||||||
syntax keyword cppSTLfunction compare_exchange_weak
|
syntax keyword cppSTLfunction compare_exchange_weak
|
||||||
syntax keyword cppSTLfunction compare_exchange_strong
|
syntax keyword cppSTLfunction compare_exchange_strong
|
||||||
@@ -1587,6 +1591,8 @@ endif " C++14
|
|||||||
|
|
||||||
|
|
||||||
if !exists("cpp_no_cpp17")
|
if !exists("cpp_no_cpp17")
|
||||||
|
syntax keyword cppSTLnamespace pmr
|
||||||
|
|
||||||
" algorithm
|
" algorithm
|
||||||
syntax keyword cppSTLfunction clamp
|
syntax keyword cppSTLfunction clamp
|
||||||
syntax keyword cppSTLfunction for_each_n
|
syntax keyword cppSTLfunction for_each_n
|
||||||
@@ -1979,84 +1985,278 @@ endif " C++17
|
|||||||
|
|
||||||
|
|
||||||
if !exists("cpp_no_cpp20")
|
if !exists("cpp_no_cpp20")
|
||||||
|
syntax keyword cppType char8_t
|
||||||
|
syntax keyword cppStatement co_yield co_return co_await
|
||||||
|
syntax keyword cppStorageClass consteval
|
||||||
|
syntax keyword cppSTLnamespace ranges
|
||||||
|
|
||||||
|
" algorithm
|
||||||
|
syntax keyword cppSTLfunction shift_left
|
||||||
|
syntax keyword cppSTLfunction shift_right
|
||||||
|
syntax keyword cppSTLfunction lexicographical_compare_three_way
|
||||||
|
|
||||||
|
" bit
|
||||||
|
syntax keyword cppSTLcast bit_cast
|
||||||
|
syntax keyword cppSTLfunction ispow2
|
||||||
|
syntax keyword cppSTLfunction ceil2
|
||||||
|
syntax keyword cppSTLfunction floor2
|
||||||
|
syntax keyword cppSTLfunction log2p1
|
||||||
|
syntax keyword cppSTLfunction rotl
|
||||||
|
syntax keyword cppSTLfunction rotr
|
||||||
|
syntax keyword cppSTLfunction countl_zero
|
||||||
|
syntax keyword cppSTLfunction countl_one
|
||||||
|
syntax keyword cppSTLfunction countr_zero
|
||||||
|
syntax keyword cppSTLfunction countr_one
|
||||||
|
syntax keyword cppSTLfunction popcount
|
||||||
|
syntax keyword cppSTLtype endian
|
||||||
|
|
||||||
|
" compare
|
||||||
|
syntax keyword cppSTLtype weak_equality
|
||||||
|
syntax keyword cppSTLtype strong_equality
|
||||||
|
syntax keyword cppSTLtype partial_ordering
|
||||||
|
syntax keyword cppSTLtype weak_ordering
|
||||||
|
syntax keyword cppSTLtype strong_ordering
|
||||||
|
syntax keyword cppSTLtype common_comparison_category
|
||||||
|
syntax keyword cppSTLtype compare_three_way_result
|
||||||
|
syntax keyword cppSTLtype compare_three_way
|
||||||
|
syntax keyword cppSTLtype strong_order
|
||||||
|
syntax keyword cppSTLtype weak_order
|
||||||
|
syntax keyword cppSTLtype parital_order
|
||||||
|
syntax keyword cppSTLtype compare_strong_order_fallback
|
||||||
|
syntax keyword cppSTLtype compare_weak_order_fallback
|
||||||
|
syntax keyword cppSTLtype compare_parital_order_fallback
|
||||||
|
syntax keyword cppSTLfunction is_eq
|
||||||
|
syntax keyword cppSTLfunction is_neq
|
||||||
|
syntax keyword cppSTLfunction is_lt
|
||||||
|
syntax keyword cppSTLfunction is_lteq
|
||||||
|
syntax keyword cppSTLfunction is_gt
|
||||||
|
syntax keyword cppSTLfunction is_gteq
|
||||||
|
|
||||||
|
" format
|
||||||
|
syntax keyword cppSTLtype formatter
|
||||||
|
syntax keyword cppSTLtype basic_format_parse_context
|
||||||
|
syntax keyword cppSTLtype format_parse_context
|
||||||
|
syntax keyword cppSTLtype wformat_parse_context
|
||||||
|
syntax keyword cppSTLtype basic_format_context
|
||||||
|
syntax keyword cppSTLtype format_context
|
||||||
|
syntax keyword cppSTLtype wformat_context
|
||||||
|
syntax keyword cppSTLtype basic_format_arg
|
||||||
|
syntax keyword cppSTLtype basic_format_args
|
||||||
|
syntax keyword cppSTLtype format_args
|
||||||
|
syntax keyword cppSTLtype wformat_args
|
||||||
|
syntax keyword cppSTLtype format_args_t
|
||||||
|
syntax keyword cppSTLtype format_error
|
||||||
|
syntax keyword cppSTLfuntion format
|
||||||
|
syntax keyword cppSTLfuntion format_to
|
||||||
|
syntax keyword cppSTLfuntion format_to_n
|
||||||
|
syntax keyword cppSTLfuntion formatted_size
|
||||||
|
syntax keyword cppSTLfuntion vformat
|
||||||
|
syntax keyword cppSTLfuntion vformat_to
|
||||||
|
syntax keyword cppSTLfuntion visit_format_arg
|
||||||
|
syntax keyword cppSTLfuntion make_format_args
|
||||||
|
syntax keyword cppSTLfuntion make_wformat_args
|
||||||
|
|
||||||
|
" iterator
|
||||||
|
syntax keyword cppSTLtype default_sentinel_t unreachable_sentinel_t
|
||||||
|
syntax keyword cppSTLiterator common_iterator
|
||||||
|
syntax keyword cppSTLiterator counted_iterator
|
||||||
|
syntax keyword cppSTLiterator_tag contiguous_iterator_tag
|
||||||
|
|
||||||
|
" memory
|
||||||
|
syntax keyword cppSTLfunction to_address
|
||||||
|
syntax keyword cppSTLfunction assume_aligned
|
||||||
|
syntax keyword cppSTLfunction make_unique_default_init
|
||||||
|
syntax keyword cppSTLfunction allocate_shared_default_init
|
||||||
|
|
||||||
|
" source_location
|
||||||
|
syntax keyword cppSTLtype source_location
|
||||||
|
|
||||||
|
" span
|
||||||
|
syntax keyword cppSTLtype span
|
||||||
|
syntax keyword cppSTLfunction as_bytes
|
||||||
|
syntax keyword cppSTLfunction as_writable_bytes
|
||||||
|
syntax keyword cppSTLconstant dynamic_extent
|
||||||
|
|
||||||
|
" syncstream
|
||||||
|
syntax keyword cppSTLtype basic_syncbuf
|
||||||
|
syntax keyword cppSTLtype basic_osyncstream
|
||||||
|
syntax keyword cppSTLtype syncbuf
|
||||||
|
syntax keyword cppSTLtype wsyncbuf
|
||||||
|
syntax keyword cppSTLtype osyncstream
|
||||||
|
syntax keyword cppSTLtype wosyncstream
|
||||||
|
|
||||||
" type_traits
|
" type_traits
|
||||||
syntax keyword cppSTLtype remove_cvref remove_cvref_t
|
syntax keyword cppSTLtype remove_cvref remove_cvref_t
|
||||||
|
syntax keyword cppSTLtype common_reference common_reference_t
|
||||||
|
syntax keyword cppSTLfunction is_constant_evaluated
|
||||||
|
syntax keyword cppSTLfunction is_pointer_interconvertible
|
||||||
|
syntax keyword cppSTLfunction is_corresponding_member
|
||||||
|
syntax keyword cppSTLtype is_nothrow_convertible
|
||||||
|
syntax keyword cppSTLbool is_nothrow_convertible_v
|
||||||
|
syntax keyword cppSTLtype is_layout_compatible
|
||||||
|
syntax keyword cppSTLbool is_layout_compatible_v
|
||||||
|
syntax keyword cppSTLtype is_bounded_array
|
||||||
|
syntax keyword cppSTLbool is_bounded_array_v
|
||||||
|
syntax keyword cppSTLtype is_unbounded_array
|
||||||
|
syntax keyword cppSTLbool is_unbounded_array_v
|
||||||
|
syntax keyword cppSTLtype is_pointer_interconvertible_base_of
|
||||||
|
syntax keyword cppSTLbool is_pointer_interconvertible_base_of_v
|
||||||
|
syntax keyword cppSTLtype has_strong_structural_equality
|
||||||
|
syntax keyword cppSTLbool has_strong_structural_equality_v
|
||||||
|
|
||||||
|
" version
|
||||||
|
" TODO
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight
|
if exists('g:cpp_concepts_highlight')
|
||||||
syntax keyword cppStatement concept
|
syntax keyword cppStatement concept
|
||||||
syntax keyword cppStorageClass requires
|
syntax keyword cppStorageClass requires
|
||||||
syntax keyword cppSTLtype DefaultConstructible
|
|
||||||
syntax keyword cppSTLtype MoveConstructible
|
if g:cpp_concepts_highlight == 1
|
||||||
syntax keyword cppSTLtype CopyConstructible
|
syntax keyword cppSTLconcept DefaultConstructible
|
||||||
syntax keyword cppSTLtype MoveAssignable
|
syntax keyword cppSTLconcept MoveConstructible
|
||||||
syntax keyword cppSTLtype CopyAssignable
|
syntax keyword cppSTLconcept CopyConstructible
|
||||||
syntax keyword cppSTLtype Destructible
|
syntax keyword cppSTLconcept MoveAssignable
|
||||||
syntax keyword cppSTLtype TriviallyCopyable
|
syntax keyword cppSTLconcept CopyAssignable
|
||||||
syntax keyword cppSTLtype TrivialType
|
syntax keyword cppSTLconcept Destructible
|
||||||
syntax keyword cppSTLtype StandardLayoutType
|
syntax keyword cppSTLconcept TriviallyCopyable
|
||||||
syntax keyword cppSTLtype PODType
|
syntax keyword cppSTLconcept TrivialType
|
||||||
syntax keyword cppSTLtype EqualityComparable
|
syntax keyword cppSTLconcept StandardLayoutType
|
||||||
syntax keyword cppSTLtype LessThanComparable
|
syntax keyword cppSTLconcept PODType
|
||||||
syntax keyword cppSTLtype Swappable
|
syntax keyword cppSTLconcept EqualityComparable
|
||||||
syntax keyword cppSTLtype ValueSwappable
|
syntax keyword cppSTLconcept LessThanComparable
|
||||||
syntax keyword cppSTLtype NullablePointer
|
syntax keyword cppSTLconcept Swappable
|
||||||
syntax keyword cppSTLtype Hash
|
syntax keyword cppSTLconcept ValueSwappable
|
||||||
syntax keyword cppSTLtype Allocator
|
syntax keyword cppSTLconcept NullablePointer
|
||||||
syntax keyword cppSTLtype FunctionObject
|
syntax keyword cppSTLconcept Hash
|
||||||
syntax keyword cppSTLtype Callable
|
syntax keyword cppSTLconcept Allocator
|
||||||
syntax keyword cppSTLtype Predicate
|
syntax keyword cppSTLconcept FunctionObject
|
||||||
syntax keyword cppSTLtype BinaryPredicate
|
syntax keyword cppSTLconcept Callable
|
||||||
syntax keyword cppSTLtype Compare
|
syntax keyword cppSTLconcept Predicate
|
||||||
syntax keyword cppSTLtype Container
|
syntax keyword cppSTLconcept BinaryPredicate
|
||||||
syntax keyword cppSTLtype ReversibleContainer
|
syntax keyword cppSTLconcept Compare
|
||||||
syntax keyword cppSTLtype AllocatorAwareContainer
|
syntax keyword cppSTLconcept Container
|
||||||
syntax keyword cppSTLtype SequenceContainer
|
syntax keyword cppSTLconcept ReversibleContainer
|
||||||
syntax keyword cppSTLtype ContiguousContainer
|
syntax keyword cppSTLconcept AllocatorAwareContainer
|
||||||
syntax keyword cppSTLtype AssociativeContainer
|
syntax keyword cppSTLconcept SequenceContainer
|
||||||
syntax keyword cppSTLtype UnorderedAssociativeContainer
|
syntax keyword cppSTLconcept ContiguousContainer
|
||||||
syntax keyword cppSTLtype DefaultInsertable
|
syntax keyword cppSTLconcept AssociativeContainer
|
||||||
syntax keyword cppSTLtype CopyInsertable
|
syntax keyword cppSTLconcept UnorderedAssociativeContainer
|
||||||
syntax keyword cppSTLtype CopyInsertable
|
syntax keyword cppSTLconcept DefaultInsertable
|
||||||
syntax keyword cppSTLtype MoveInsertable
|
syntax keyword cppSTLconcept CopyInsertable
|
||||||
syntax keyword cppSTLtype EmplaceConstructible
|
syntax keyword cppSTLconcept CopyInsertable
|
||||||
syntax keyword cppSTLtype Erasable
|
syntax keyword cppSTLconcept MoveInsertable
|
||||||
syntax keyword cppSTLtype Iterator
|
syntax keyword cppSTLconcept EmplaceConstructible
|
||||||
syntax keyword cppSTLtype InputIterator
|
syntax keyword cppSTLconcept Erasable
|
||||||
syntax keyword cppSTLtype OutputIterator
|
syntax keyword cppSTLconcept Iterator
|
||||||
syntax keyword cppSTLtype ForwardIterator
|
syntax keyword cppSTLconcept InputIterator
|
||||||
syntax keyword cppSTLtype BidirectionalIterator
|
syntax keyword cppSTLconcept OutputIterator
|
||||||
syntax keyword cppSTLtype RandomAccessIterator
|
syntax keyword cppSTLconcept ForwardIterator
|
||||||
syntax keyword cppSTLtype ContiguousIterator
|
syntax keyword cppSTLconcept BidirectionalIterator
|
||||||
syntax keyword cppSTLtype UnformattedInputFunction
|
syntax keyword cppSTLconcept RandomAccessIterator
|
||||||
syntax keyword cppSTLtype FormattedInputFunction
|
syntax keyword cppSTLconcept ContiguousIterator
|
||||||
syntax keyword cppSTLtype UnformattedOutputFunction
|
syntax keyword cppSTLconcept UnformattedInputFunction
|
||||||
syntax keyword cppSTLtype FormattedOutputFunction
|
syntax keyword cppSTLconcept FormattedInputFunction
|
||||||
syntax keyword cppSTLtype SeedSequence
|
syntax keyword cppSTLconcept UnformattedOutputFunction
|
||||||
syntax keyword cppSTLtype UniformRandomBitGenerator
|
syntax keyword cppSTLconcept FormattedOutputFunction
|
||||||
syntax keyword cppSTLtype RandomNumberEngine
|
syntax keyword cppSTLconcept SeedSequence
|
||||||
syntax keyword cppSTLtype RandomNumberEngineAdaptor
|
syntax keyword cppSTLconcept UniformRandomBitGenerator
|
||||||
syntax keyword cppSTLtype RandomNumberDistribution
|
syntax keyword cppSTLconcept RandomNumberEngine
|
||||||
syntax keyword cppSTLtype BasicLockable
|
syntax keyword cppSTLconcept RandomNumberEngineAdaptor
|
||||||
syntax keyword cppSTLtype Lockable
|
syntax keyword cppSTLconcept RandomNumberDistribution
|
||||||
syntax keyword cppSTLtype TimedLockable
|
syntax keyword cppSTLconcept BasicLockable
|
||||||
syntax keyword cppSTLtype Mutex
|
syntax keyword cppSTLconcept Lockable
|
||||||
syntax keyword cppSTLtype TimedMutex
|
syntax keyword cppSTLconcept TimedLockable
|
||||||
syntax keyword cppSTLtype SharedMutex
|
syntax keyword cppSTLconcept Mutex
|
||||||
syntax keyword cppSTLtype SharedTimedMutex
|
syntax keyword cppSTLconcept TimedMutex
|
||||||
syntax keyword cppSTLtype UnaryTypeTrait
|
syntax keyword cppSTLconcept SharedMutex
|
||||||
syntax keyword cppSTLtype BinaryTypeTrait
|
syntax keyword cppSTLconcept SharedTimedMutex
|
||||||
syntax keyword cppSTLtype TransformationTrait
|
syntax keyword cppSTLconcept UnaryTypeTrait
|
||||||
syntax keyword cppSTLtype Clock
|
syntax keyword cppSTLconcept BinaryTypeTrait
|
||||||
syntax keyword cppSTLtype TrivialClock
|
syntax keyword cppSTLconcept TransformationTrait
|
||||||
syntax keyword cppSTLtype CharTraits
|
syntax keyword cppSTLconcept Clock
|
||||||
syntax keyword cppSTLtype pos_type
|
syntax keyword cppSTLconcept TrivialClock
|
||||||
syntax keyword cppSTLtype off_type
|
syntax keyword cppSTLconcept CharTraits
|
||||||
syntax keyword cppSTLtype BitmaskType
|
syntax keyword cppSTLconcept pos_type
|
||||||
syntax keyword cppSTLtype NumericType
|
syntax keyword cppSTLconcept off_type
|
||||||
syntax keyword cppSTLtype RegexTraits
|
syntax keyword cppSTLconcept BitmaskType
|
||||||
syntax keyword cppSTLtype LiteralType
|
syntax keyword cppSTLconcept NumericType
|
||||||
|
syntax keyword cppSTLconcept RegexTraits
|
||||||
|
syntax keyword cppSTLconcept LiteralType
|
||||||
|
elseif g:cpp_concepts_highlight == 2
|
||||||
|
syntax keyword cppSTLconcept same_as
|
||||||
|
syntax keyword cppSTLconcept derived_from
|
||||||
|
syntax keyword cppSTLconcept convertible_to
|
||||||
|
syntax keyword cppSTLconcept common_reference_with
|
||||||
|
syntax keyword cppSTLconcept common_with
|
||||||
|
syntax keyword cppSTLconcept integral
|
||||||
|
syntax keyword cppSTLconcept signed_integral
|
||||||
|
syntax keyword cppSTLconcept unsigned_integral
|
||||||
|
syntax keyword cppSTLconcept assignable_from
|
||||||
|
syntax keyword cppSTLconcept swappable
|
||||||
|
syntax keyword cppSTLconcept swappable_with
|
||||||
|
syntax keyword cppSTLconcept destructible
|
||||||
|
syntax keyword cppSTLconcept constructible_from
|
||||||
|
syntax keyword cppSTLconcept default_constructible
|
||||||
|
syntax keyword cppSTLconcept move_constructible
|
||||||
|
syntax keyword cppSTLconcept copy_constructible
|
||||||
|
syntax keyword cppSTLconcept boolean
|
||||||
|
syntax keyword cppSTLconcept equality_comparable
|
||||||
|
syntax keyword cppSTLconcept equality_comparable_with
|
||||||
|
syntax keyword cppSTLconcept totally_ordered
|
||||||
|
syntax keyword cppSTLconcept totally_ordered_with
|
||||||
|
syntax keyword cppSTLconcept movable
|
||||||
|
syntax keyword cppSTLconcept copyable
|
||||||
|
syntax keyword cppSTLconcept semiregular
|
||||||
|
syntax keyword cppSTLconcept regular
|
||||||
|
syntax keyword cppSTLconcept invocable
|
||||||
|
syntax keyword cppSTLconcept regular_invocable
|
||||||
|
syntax keyword cppSTLconcept predicate
|
||||||
|
syntax keyword cppSTLconcept relation
|
||||||
|
syntax keyword cppSTLconcept strict_weak_order
|
||||||
|
syntax keyword cppSTLconcept readable
|
||||||
|
syntax keyword cppSTLconcept writable
|
||||||
|
syntax keyword cppSTLconcept weakly_incrementable
|
||||||
|
syntax keyword cppSTLconcept incrementable
|
||||||
|
syntax keyword cppSTLconcept input_or_output_iterator
|
||||||
|
syntax keyword cppSTLconcept sentinal_for
|
||||||
|
syntax keyword cppSTLconcept sized_sentinal_for
|
||||||
|
syntax keyword cppSTLconcept input_iterator
|
||||||
|
syntax keyword cppSTLconcept output_iterator
|
||||||
|
syntax keyword cppSTLconcept forward_iterator
|
||||||
|
syntax keyword cppSTLconcept bidirectional_iterator
|
||||||
|
syntax keyword cppSTLconcept random_access_iterator
|
||||||
|
syntax keyword cppSTLconcept input_iterator
|
||||||
|
syntax keyword cppSTLconcept output_iterator
|
||||||
|
syntax keyword cppSTLconcept bidirectional_iterator
|
||||||
|
syntax keyword cppSTLconcept random_access_iterator
|
||||||
|
syntax keyword cppSTLconcept contiguous_iterator
|
||||||
|
syntax keyword cppSTLconcept indirectly_unary_invocable
|
||||||
|
syntax keyword cppSTLconcept indirectly_regular_unary_invocable
|
||||||
|
syntax keyword cppSTLconcept indirect_unary_predicate
|
||||||
|
syntax keyword cppSTLconcept indirect_relation
|
||||||
|
syntax keyword cppSTLconcept indirect_strict_weak_order
|
||||||
|
syntax keyword cppSTLconcept indirectly_movable
|
||||||
|
syntax keyword cppSTLconcept indirectly_movable_storable
|
||||||
|
syntax keyword cppSTLconcept indirectly_copyable
|
||||||
|
syntax keyword cppSTLconcept indirectly_copyable_storable
|
||||||
|
syntax keyword cppSTLconcept indirectly_swappable
|
||||||
|
syntax keyword cppSTLconcept indirectly_comparable
|
||||||
|
syntax keyword cppSTLconcept permutable
|
||||||
|
syntax keyword cppSTLconcept mergeable
|
||||||
|
syntax keyword cppSTLconcept sortable
|
||||||
|
syntax keyword cppSTLconcept range
|
||||||
|
syntax keyword cppSTLconcept sized_range
|
||||||
|
syntax keyword cppSTLconcept output_range
|
||||||
|
syntax keyword cppSTLconcept input_range
|
||||||
|
syntax keyword cppSTLconcept bidirectional_range
|
||||||
|
syntax keyword cppSTLconcept random_access_range
|
||||||
|
syntax keyword cppSTLconcept contiguous_range
|
||||||
|
syntax keyword cppSTLconcept common_range
|
||||||
|
syntax keyword cppSTLconcept viewable_range
|
||||||
|
syntax keyword cppSTLconcept uniform_random_bit_generator
|
||||||
|
endif
|
||||||
endif " C++ concepts
|
endif " C++ concepts
|
||||||
|
|
||||||
|
|
||||||
@@ -2086,6 +2286,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
|||||||
HiLink cppSTLiterator Typedef
|
HiLink cppSTLiterator Typedef
|
||||||
HiLink cppSTLiterator_tag Typedef
|
HiLink cppSTLiterator_tag Typedef
|
||||||
HiLink cppSTLenum Typedef
|
HiLink cppSTLenum Typedef
|
||||||
|
HiLink cppSTLconcept Typedef
|
||||||
HiLink cppSTLios Function
|
HiLink cppSTLios Function
|
||||||
HiLink cppSTLcast Statement " be consistent with official syntax
|
HiLink cppSTLcast Statement " be consistent with official syntax
|
||||||
HiLink cppRawString String
|
HiLink cppRawString String
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
|
||||||
|
|
||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Sven Felix Oberquelle <Svelix.Github@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
|
||||||
let s:current_syntax_save = b:current_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
|
||||||
" priority than hamlInterpolation.
|
|
||||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
|
||||||
syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
|
||||||
\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
|
|
||||||
\ end="^\%(\z1 \| *$\)\@!"
|
|
||||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
|
||||||
\ keepend
|
|
||||||
|
|
||||||
if exists('s:current_syntax_save')
|
|
||||||
let b:current_syntax = s:current_syntax_save
|
|
||||||
unlet s:current_syntax_save
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
17
after/syntax/haskell.vim
Normal file
17
after/syntax/haskell.vim
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1
|
||||||
|
|
||||||
|
" store and remove current syntax value
|
||||||
|
let old_syntax = b:current_syntax
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn include @dhall syntax/dhall.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn region dhallBlock matchgroup=quasiQuote start=/\[\$\?staticDhallExpression|/ end=/|\]/ contains=@dhall
|
||||||
|
|
||||||
|
hi def link quasiQuote Underlined
|
||||||
|
|
||||||
|
" restore current syntax value
|
||||||
|
let b:current_syntax = old_syntax
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scala') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scala') == -1
|
||||||
|
|
||||||
" Extends standard help syntax with highlighting of Scala code.
|
" Extends standard help syntax with highlighting of Scala code.
|
||||||
"
|
"
|
||||||
" Place code between !sc! and !/sc! delimiters. These will be hidden if Vim is
|
" Place code between !sc! and !/sc! delimiters. These will be hidden if Vim is
|
||||||
|
|||||||
@@ -1,42 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
|
||||||
|
|
||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <mick@kochm.co>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
|
||||||
let s:current_syntax_save = b:current_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Syntax highlighting for text/coffeescript script tags
|
|
||||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
|
||||||
syn region coffeeScript start=#<script [^>]*type=['"]\?text/coffeescript['"]\?[^>]*>#
|
|
||||||
\ end=#</script>#me=s-1 keepend
|
|
||||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
|
||||||
\ containedin=htmlHead
|
|
||||||
|
|
||||||
if exists('s:current_syntax_save')
|
|
||||||
let b:current_syntax = s:current_syntax_save
|
|
||||||
unlet s:current_syntax_save
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
|
||||||
|
|
||||||
" Language: OpenGL Shading Language
|
|
||||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
|
||||||
|
|
||||||
syn include @GLSL syntax/glsl.vim
|
|
||||||
syn region ShaderScript
|
|
||||||
\ start="<script [^>]*type=\('\|\"\)x-shader/x-\(vertex\|fragment\)\('\|\"\)[^>]*>"
|
|
||||||
\ keepend
|
|
||||||
\ end="</script>"me=s-1
|
|
||||||
\ contains=@GLSL,htmlScriptTag,@htmlPreproc
|
|
||||||
|
|
||||||
endif
|
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||||
|
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: HTML (version 5.1)
|
" Language: HTML (version 5.1)
|
||||||
" Last Change: 2017 Feb 15
|
" Last Change: 2017 Feb 15
|
||||||
@@ -51,33 +14,3 @@ syntax region htmlComment start=+<!--+ end=+-->+ contains=@Spell
|
|||||||
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
||||||
|
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
|
||||||
|
|
||||||
if !exists("g:less_html_style_tags")
|
|
||||||
let g:less_html_style_tags = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !g:less_html_style_tags
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Unset (but preserve) so that less will run.
|
|
||||||
if exists("b:current_syntax")
|
|
||||||
let s:pre_less_cur_syn = b:current_syntax
|
|
||||||
unlet b:current_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Inspired by code from github.com/kchmck/vim-coffee-script
|
|
||||||
" and the html syntax file included with vim 7.4.
|
|
||||||
|
|
||||||
syn include @htmlLess syntax/less.vim
|
|
||||||
|
|
||||||
" We have to explicitly add to htmlHead (containedin) as that region specifies 'contains'.
|
|
||||||
syn region lessStyle start=+<style [^>]*type *=[^>]*text/less[^>]*>+ keepend end=+</style>+ contains=@htmlLess,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc containedin=htmlHead
|
|
||||||
|
|
||||||
" Reset since 'less' isn't really the current_syntax.
|
|
||||||
if exists("s:pre_less_cur_syn")
|
|
||||||
let b:current_syntax = s:pre_less_cur_syn
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|||||||
82
after/syntax/idris.vim
Normal file
82
after/syntax/idris.vim
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||||
|
|
||||||
|
" This script allows for unicode concealing of certain characters
|
||||||
|
" For instance -> goes to →
|
||||||
|
"
|
||||||
|
" It needs vim >= 7.3, set nocompatible, set enc=utf-8
|
||||||
|
"
|
||||||
|
" If you want to turn this on, let g:idris_conceal = 1
|
||||||
|
|
||||||
|
if !exists('g:idris_conceal') || !has('conceal') || &enc != 'utf-8'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: set fenc=utf-8:
|
||||||
|
syntax match idrNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ
|
||||||
|
syntax match idrNiceOperator "<-" conceal cchar=←
|
||||||
|
syntax match idrNiceOperator "->" conceal cchar=→
|
||||||
|
syntax match idrNiceOperator "\<sum\>" conceal cchar=∑
|
||||||
|
syntax match idrNiceOperator "\<product\>" conceal cchar=∏
|
||||||
|
syntax match idrNiceOperator "\<sqrt\>" conceal cchar=√
|
||||||
|
syntax match idrNiceOperator "\<pi\>" conceal cchar=π
|
||||||
|
syntax match idrNiceOperator "==" conceal cchar=≡
|
||||||
|
syntax match idrNiceOperator "\/=" conceal cchar=≠
|
||||||
|
|
||||||
|
|
||||||
|
let s:extraConceal = 1
|
||||||
|
|
||||||
|
let s:doubleArrow = 1
|
||||||
|
" Set this to 0 to use the more technically correct arrow from bar
|
||||||
|
|
||||||
|
" Some windows font don't support some of the characters,
|
||||||
|
" so if they are the main font, we don't load them :)
|
||||||
|
if has("win32")
|
||||||
|
let s:incompleteFont = [ 'Consolas'
|
||||||
|
\ , 'Lucida Console'
|
||||||
|
\ , 'Courier New'
|
||||||
|
\ ]
|
||||||
|
let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '')
|
||||||
|
for s:fontName in s:incompleteFont
|
||||||
|
if s:mainfont ==? s:fontName
|
||||||
|
let s:extraConceal = 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:extraConceal
|
||||||
|
syntax match idrNiceOperator "Void" conceal cchar=⊥
|
||||||
|
|
||||||
|
" Match greater than and lower than w/o messing with Kleisli composition
|
||||||
|
syntax match idrNiceOperator "<=\ze[^<]" conceal cchar=≤
|
||||||
|
syntax match idrNiceOperator ">=\ze[^>]" conceal cchar=≥
|
||||||
|
|
||||||
|
if s:doubleArrow
|
||||||
|
syntax match idrNiceOperator "=>" conceal cchar=⇒
|
||||||
|
else
|
||||||
|
syntax match idrNiceOperator "=>" conceal cchar=↦
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax match idrNiceOperator "=\zs<<" conceal cchar=«
|
||||||
|
|
||||||
|
syntax match idrNiceOperator "++" conceal cchar=⧺
|
||||||
|
syntax match idrNiceOperator "::" conceal cchar=∷
|
||||||
|
syntax match idrNiceOperator "-<" conceal cchar=↢
|
||||||
|
syntax match idrNiceOperator ">-" conceal cchar=↣
|
||||||
|
syntax match idrNiceOperator "-<<" conceal cchar=⤛
|
||||||
|
syntax match idrNiceOperator ">>-" conceal cchar=⤜
|
||||||
|
|
||||||
|
" Only replace the dot, avoid taking spaces around.
|
||||||
|
syntax match idrNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘
|
||||||
|
syntax match idrNiceOperator "\.\." conceal cchar=‥
|
||||||
|
|
||||||
|
syntax match idrNiceOperator "`elem`" conceal cchar=∈
|
||||||
|
syntax match idrNiceOperator "`notElem`" conceal cchar=∉
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi link idrNiceOperator Operator
|
||||||
|
hi! link Conceal Operator
|
||||||
|
setlocal conceallevel=2
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
59
after/syntax/javascript.vim
Normal file
59
after/syntax/javascript.vim
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Vim syntax file
|
||||||
|
"
|
||||||
|
" Language: javascript.jsx
|
||||||
|
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
let s:jsx_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syntax case match
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax = b:current_syntax
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('s:current_syntax')
|
||||||
|
let b:current_syntax = s:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
if hlexists("jsDebugger") || hlexists("jsNoise") " yuezk/vim-js or pangloss/vim-javascript
|
||||||
|
syntax cluster jsExpression add=jsxRegion
|
||||||
|
elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
|
||||||
|
" refine the javascript line comment
|
||||||
|
syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||||
|
syntax cluster javascriptValue add=jsxRegion
|
||||||
|
syntax cluster javascriptNoReserved add=jsxElement,jsxTag
|
||||||
|
else " build-in javascript syntax
|
||||||
|
" refine the javascript line comment
|
||||||
|
syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||||
|
|
||||||
|
" refine the template string syntax
|
||||||
|
syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr
|
||||||
|
|
||||||
|
" add a javaScriptBlock group for build-in syntax
|
||||||
|
syntax region javaScriptBlock
|
||||||
|
\ matchgroup=javaScriptBraces
|
||||||
|
\ start="{"
|
||||||
|
\ end="}"
|
||||||
|
\ contained
|
||||||
|
\ extend
|
||||||
|
\ contains=javaScriptBlock,@javaScriptEmbededExpr,javaScript.*
|
||||||
|
\ fold
|
||||||
|
|
||||||
|
syntax cluster javaScriptEmbededExpr add=jsxRegion,javaScript.*
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime syntax/jsx_pretty.vim
|
||||||
|
|
||||||
|
let b:current_syntax = 'javascript.jsx'
|
||||||
|
|
||||||
|
let &cpo = s:jsx_cpo
|
||||||
|
unlet s:jsx_cpo
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,28 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
"
|
||||||
|
" Language: GraphQL
|
||||||
|
" Maintainer: Jon Parise <jon@indelible.org>
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
let s:current_syntax = b:current_syntax
|
let s:current_syntax = b:current_syntax
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
@@ -9,19 +32,33 @@ if exists('s:current_syntax')
|
|||||||
let b:current_syntax = s:current_syntax
|
let b:current_syntax = s:current_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:tags = '\%(' . join(g:graphql_javascript_tags, '\|') . '\)'
|
let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
|
||||||
|
|
||||||
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
|
if graphql#has_syntax_group('jsTemplateExpression')
|
||||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
" pangloss/vim-javascript
|
||||||
|
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
|
||||||
|
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||||
|
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
|
||||||
|
|
||||||
" Support expression interpolation ((${...})) inside template strings.
|
hi def link graphqlTemplateString jsTemplateString
|
||||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
|
hi def link graphqlTaggedTemplate jsTaggedTemplate
|
||||||
|
hi def link graphqlTemplateExpression jsTemplateExpression
|
||||||
|
|
||||||
hi def link graphqlTemplateString jsTemplateString
|
syn cluster jsExpression add=graphqlTaggedTemplate
|
||||||
hi def link graphqlTaggedTemplate jsTaggedTemplate
|
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||||
hi def link graphqlTemplateExpression jsTemplateExpression
|
elseif graphql#has_syntax_group('javaScriptStringT')
|
||||||
|
" runtime/syntax/javascript.vim
|
||||||
|
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend'
|
||||||
|
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||||
|
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=@javaScriptEmbededExpr containedin=graphqlFold keepend
|
||||||
|
|
||||||
syn cluster jsExpression add=graphqlTaggedTemplate
|
hi def link graphqlTemplateString javaScriptStringT
|
||||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
hi def link graphqlTaggedTemplate javaScriptEmbed
|
||||||
|
hi def link graphqlTemplateExpression javaScriptEmbed
|
||||||
|
|
||||||
|
syn cluster htmlJavaScript add=graphqlTaggedTemplate
|
||||||
|
syn cluster javaScriptEmbededExpr add=graphqlTaggedTemplate
|
||||||
|
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
5
after/syntax/javascriptreact.vim
Normal file
5
after/syntax/javascriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/javascript.vim
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/syntax/javascriptreact/graphql.vim
Normal file
5
after/syntax/javascriptreact/graphql.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
runtime! after/syntax/javascript/graphql.vim
|
||||||
|
|
||||||
|
endif
|
||||||
225
after/syntax/jsx_pretty.vim
Normal file
225
after/syntax/jsx_pretty.vim
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
|
||||||
|
|
||||||
|
" detect jsx region
|
||||||
|
syntax region jsxRegion
|
||||||
|
\ start=+\%(\%(\_[([,?:=+\-*/>{}]\|<\s\+\|&&\|||\|=>\|\<return\|\<default\|\<await\|\<yield\)\_s*\)\@<=<\_s*\%(>\|\z(\%(script\|T\s*>\s*(\)\@!\<[_$A-Za-z][-:._$A-Za-z0-9]*\>\)\%(\_s*\%([-+*)\]}&|?,]\|/\%([/*]\|\_s*>\)\@!\)\)\@!\)+
|
||||||
|
\ end=++
|
||||||
|
\ contains=jsxElement
|
||||||
|
|
||||||
|
" <tag id="sample">
|
||||||
|
" ~~~~~~~~~~~~~~~~~
|
||||||
|
" and self close tag
|
||||||
|
" <tag id="sample" />
|
||||||
|
" ~~~~~~~~~~~~~~~~~~~
|
||||||
|
syntax region jsxTag
|
||||||
|
\ start=+<+
|
||||||
|
\ matchgroup=jsxOpenPunct
|
||||||
|
\ end=+>+
|
||||||
|
\ matchgroup=NONE
|
||||||
|
\ end=+\%(/\_s*>\)\@=+
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxOpenTag,jsxAttrib,jsxExpressionBlock,jsxSpreadOperator,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
|
||||||
|
\ keepend
|
||||||
|
\ extend
|
||||||
|
\ skipwhite
|
||||||
|
\ skipempty
|
||||||
|
\ nextgroup=jsxCloseString
|
||||||
|
|
||||||
|
" <tag></tag>
|
||||||
|
" ~~~~~~~~~~~
|
||||||
|
" and fragment
|
||||||
|
" <></>
|
||||||
|
" ~~~~~
|
||||||
|
" and self close tag
|
||||||
|
" <tag />
|
||||||
|
" ~~~~~~~
|
||||||
|
syntax region jsxElement
|
||||||
|
\ start=+<\_s*\%(>\|\${\|\z(\<[-:._$A-Za-z0-9]\+\>\)\)+
|
||||||
|
\ end=+/\_s*>+
|
||||||
|
\ end=+<\_s*/\_s*\z1\_s*>+
|
||||||
|
\ contains=jsxElement,jsxTag,jsxExpressionBlock,jsxComment,jsxCloseTag,@Spell
|
||||||
|
\ keepend
|
||||||
|
\ extend
|
||||||
|
\ contained
|
||||||
|
\ fold
|
||||||
|
|
||||||
|
" <tag key={this.props.key}>
|
||||||
|
" ~~~~
|
||||||
|
" and fragment start tag
|
||||||
|
" <>
|
||||||
|
" ~~
|
||||||
|
exe 'syntax region jsxOpenTag
|
||||||
|
\ matchgroup=jsxOpenPunct
|
||||||
|
\ start=+<+
|
||||||
|
\ end=+>+
|
||||||
|
\ matchgroup=NONE
|
||||||
|
\ end=+\>+
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxTagName
|
||||||
|
\ nextgroup=jsxAttrib
|
||||||
|
\ skipwhite
|
||||||
|
\ skipempty
|
||||||
|
\ ' .(s:highlight_close_tag ? 'transparent' : '')
|
||||||
|
|
||||||
|
|
||||||
|
" <tag key={this.props.key}>
|
||||||
|
" ~~~~~~~~~~~~~~~~
|
||||||
|
syntax region jsxExpressionBlock
|
||||||
|
\ matchgroup=jsxBraces
|
||||||
|
\ start=+{+
|
||||||
|
\ end=+}+
|
||||||
|
\ contained
|
||||||
|
\ extend
|
||||||
|
\ contains=@jsExpression,jsSpreadExpression,@javascriptExpression,javascriptSpreadOp,@javaScriptEmbededExpr,@typescriptExpression,typescriptObjectSpread,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment
|
||||||
|
|
||||||
|
" <foo.bar>
|
||||||
|
" ~
|
||||||
|
syntax match jsxDot +\.+ contained
|
||||||
|
|
||||||
|
" <foo:bar>
|
||||||
|
" ~
|
||||||
|
syntax match jsxNamespace +:+ contained
|
||||||
|
|
||||||
|
" <tag id="sample">
|
||||||
|
" ~
|
||||||
|
syntax match jsxEqual +=+ contained skipwhite skipempty nextgroup=jsxString,jsxExpressionBlock,jsxRegion
|
||||||
|
|
||||||
|
" <tag />
|
||||||
|
" ~~
|
||||||
|
syntax match jsxCloseString +/\_s*>+ contained
|
||||||
|
|
||||||
|
" </tag>
|
||||||
|
" ~~~~~~
|
||||||
|
" and fragment close tag
|
||||||
|
" </>
|
||||||
|
" ~~~
|
||||||
|
syntax region jsxCloseTag
|
||||||
|
\ matchgroup=jsxClosePunct
|
||||||
|
\ start=+<\_s*/+
|
||||||
|
\ end=+>+
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxTagName
|
||||||
|
|
||||||
|
" <tag key={this.props.key}>
|
||||||
|
" ~~~
|
||||||
|
syntax match jsxAttrib
|
||||||
|
\ +\<[_$A-Za-z][-:_$A-Za-z0-9]*\>+
|
||||||
|
\ contained
|
||||||
|
\ nextgroup=jsxEqual
|
||||||
|
\ skipwhite
|
||||||
|
\ skipempty
|
||||||
|
\ contains=jsxAttribKeyword,jsxNamespace
|
||||||
|
|
||||||
|
" <MyComponent ...>
|
||||||
|
" ~~~~~~~~~~~
|
||||||
|
" NOT
|
||||||
|
" <someCamel ...>
|
||||||
|
" ~~~~~
|
||||||
|
exe 'syntax match jsxComponentName
|
||||||
|
\ +\<[_$]\?[A-Z][-_$A-Za-z0-9]*\>+
|
||||||
|
\ contained
|
||||||
|
\ ' .(s:highlight_close_tag ? 'transparent' : '')
|
||||||
|
|
||||||
|
" <tag key={this.props.key}>
|
||||||
|
" ~~~
|
||||||
|
exe 'syntax match jsxTagName
|
||||||
|
\ +\<[-:._$A-Za-z0-9]\+\>+
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxComponentName,jsxDot,jsxNamespace
|
||||||
|
\ nextgroup=jsxAttrib
|
||||||
|
\ skipempty
|
||||||
|
\ skipwhite
|
||||||
|
\ ' .(s:highlight_close_tag ? 'transparent' : '')
|
||||||
|
|
||||||
|
" <tag id="sample">
|
||||||
|
" ~~~~~~~~
|
||||||
|
" and
|
||||||
|
" <tag id='sample'>
|
||||||
|
" ~~~~~~~~
|
||||||
|
syntax region jsxString start=+\z(["']\)+ skip=+\\\\\|\\\z1\|\\\n+ end=+\z1+ contained contains=@Spell
|
||||||
|
|
||||||
|
let s:tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
|
||||||
|
let s:enable_tagged_jsx = !empty(s:tags)
|
||||||
|
|
||||||
|
" add support to JSX inside the tagged template string
|
||||||
|
" https://github.com/developit/htm
|
||||||
|
if s:enable_tagged_jsx
|
||||||
|
exe 'syntax match jsxRegion +\%(' . join(s:tags, '\|') . '\)\%(\_s*`\)\@=+ contains=jsTemplateStringTag,jsTaggedTemplate,javascriptTagRef skipwhite skipempty nextgroup=jsxTaggedRegion'
|
||||||
|
|
||||||
|
syntax region jsxTaggedRegion
|
||||||
|
\ matchgroup=jsxBackticks
|
||||||
|
\ start=+`+
|
||||||
|
\ end=+`+
|
||||||
|
\ extend
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxElement,jsxExpressionBlock
|
||||||
|
\ transparent
|
||||||
|
|
||||||
|
syntax region jsxExpressionBlock
|
||||||
|
\ matchgroup=jsxBraces
|
||||||
|
\ start=+\${+
|
||||||
|
\ end=+}+
|
||||||
|
\ extend
|
||||||
|
\ contained
|
||||||
|
\ contains=@jsExpression,jsSpreadExpression,@javascriptExpression,javascriptSpreadOp,@javaScriptEmbededExpr,@typescriptExpression,typescriptObjectSpread
|
||||||
|
|
||||||
|
syntax region jsxOpenTag
|
||||||
|
\ matchgroup=jsxOpenPunct
|
||||||
|
\ start=+<\%(\${\)\@=+
|
||||||
|
\ matchgroup=NONE
|
||||||
|
\ end=+}\@1<=+
|
||||||
|
\ contained
|
||||||
|
\ contains=jsxExpressionBlock
|
||||||
|
\ skipwhite
|
||||||
|
\ skipempty
|
||||||
|
\ nextgroup=jsxAttrib,jsxSpreadOperator
|
||||||
|
|
||||||
|
syntax keyword jsxAttribKeyword class contained
|
||||||
|
|
||||||
|
syntax match jsxSpreadOperator +\.\.\.+ contained nextgroup=jsxExpressionBlock skipwhite
|
||||||
|
|
||||||
|
syntax match jsxCloseTag +<//>+ contained
|
||||||
|
|
||||||
|
syntax match jsxComment +<!--\_.\{-}-->+
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Highlight the tag name
|
||||||
|
highlight def link jsxTag Function
|
||||||
|
highlight def link jsxTagName Identifier
|
||||||
|
highlight def link jsxComponentName Function
|
||||||
|
|
||||||
|
highlight def link jsxAttrib Type
|
||||||
|
highlight def link jsxAttribKeyword jsxAttrib
|
||||||
|
highlight def link jsxString String
|
||||||
|
highlight def link jsxComment Comment
|
||||||
|
|
||||||
|
highlight def link jsxDot Operator
|
||||||
|
highlight def link jsxNamespace Operator
|
||||||
|
highlight def link jsxEqual Operator
|
||||||
|
highlight def link jsxSpreadOperator Operator
|
||||||
|
highlight def link jsxBraces Special
|
||||||
|
|
||||||
|
if s:highlight_close_tag
|
||||||
|
highlight def link jsxCloseString Identifier
|
||||||
|
highlight def link jsxOpenPunct jsxTag
|
||||||
|
else
|
||||||
|
" Highlight the jsxCloseString (i.e. />), jsxPunct (i.e. <,>) and jsxCloseTag (i.e. <//>)
|
||||||
|
highlight def link jsxCloseString Comment
|
||||||
|
highlight def link jsxOpenPunct jsxPunct
|
||||||
|
endif
|
||||||
|
|
||||||
|
highlight def link jsxPunct jsxCloseString
|
||||||
|
highlight def link jsxClosePunct jsxPunct
|
||||||
|
highlight def link jsxCloseTag jsxCloseString
|
||||||
|
|
||||||
|
let s:vim_jsx_pretty_colorful_config = get(g:, 'vim_jsx_pretty_colorful_config', 0)
|
||||||
|
|
||||||
|
if s:vim_jsx_pretty_colorful_config == 1
|
||||||
|
highlight def link jsObjectKey Label
|
||||||
|
highlight def link jsArrowFuncArgs Type
|
||||||
|
highlight def link jsFuncArgs Type
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
26
after/syntax/llvm.vim
Normal file
26
after/syntax/llvm.vim
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||||
|
|
||||||
|
" Copyright (c) 2018 rhysd
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to deal
|
||||||
|
" in the Software without restriction, including without limitation the rights
|
||||||
|
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
" copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
" THE SOFTWARE.
|
||||||
|
|
||||||
|
syn keyword llvmKeyword attributes
|
||||||
|
syn match llvmNoName /#\d\+\>/
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,17 +1,8 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mdx') == -1
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" Vim syntax file
|
" based on mxw/vim-jsx
|
||||||
"
|
|
||||||
" Language: JSX (JavaScript)
|
|
||||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
|
||||||
" Depends: pangloss/vim-javascript
|
|
||||||
"
|
|
||||||
" CREDITS: Inspired by Facebook.
|
|
||||||
"
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
" Prologue; load in XML syntax.
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
let s:current_syntax=b:current_syntax
|
let s:current_syntax=b:current_syntax
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
@@ -21,25 +12,10 @@ if exists('s:current_syntax')
|
|||||||
let b:current_syntax=s:current_syntax
|
let b:current_syntax=s:current_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Officially, vim-jsx depends on the pangloss/vim-javascript syntax package
|
|
||||||
" (and is tested against it exclusively). However, in practice, we make some
|
|
||||||
" effort towards compatibility with other packages.
|
|
||||||
"
|
|
||||||
" These are the plugin-to-syntax-element correspondences:
|
|
||||||
"
|
|
||||||
" - pangloss/vim-javascript: jsBlock, jsExpression
|
|
||||||
" - jelera/vim-javascript-syntax: javascriptBlock
|
|
||||||
" - othree/yajs.vim: javascriptNoReserved
|
|
||||||
|
|
||||||
|
|
||||||
" JSX attributes should color as JS. Note the trivial end pattern; we let
|
" JSX attributes should color as JS. Note the trivial end pattern; we let
|
||||||
" jsBlock take care of ending the region.
|
" jsBlock take care of ending the region.
|
||||||
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
syn region xmlString contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
||||||
|
|
||||||
" JSX comments inside XML tag should color as comment. Note the trivial end pattern; we let
|
|
||||||
" jsComment take care of ending the region.
|
|
||||||
syn region xmlString contained start=+//+ end=++ contains=jsComment
|
|
||||||
|
|
||||||
" JSX child blocks behave just like JSX attributes, except that (a) they are
|
" JSX child blocks behave just like JSX attributes, except that (a) they are
|
||||||
" syntactically distinct, and (b) they need the syn-extend argument, or else
|
" syntactically distinct, and (b) they need the syn-extend argument, or else
|
||||||
" nested XML end-tag patterns may end the outer jsxRegion.
|
" nested XML end-tag patterns may end the outer jsxRegion.
|
||||||
@@ -53,7 +29,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
|||||||
" and generic Flow type annotations (http://flowtype.org/).
|
" and generic Flow type annotations (http://flowtype.org/).
|
||||||
syn region jsxRegion
|
syn region jsxRegion
|
||||||
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
||||||
\ skip=+<!--\_.\{-}-->+
|
\ skip=+<!--\_.\{-}-->+
|
||||||
\ end=+</\z1\_\s\{-}>+
|
\ end=+</\z1\_\s\{-}>+
|
||||||
\ end=+/>+
|
\ end=+/>+
|
||||||
1471
after/syntax/mma.vim
1471
after/syntax/mma.vim
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||||
|
|
||||||
" ARC type modifiers
|
" ARC type modifiers
|
||||||
syn keyword objcTypeModifier __bridge __bridge_retained __bridge_transfer __autoreleasing __strong __weak __unsafe_unretained
|
syn keyword objcTypeModifier __bridge __bridge_retained __bridge_transfer __autoreleasing __strong __weak __unsafe_unretained
|
||||||
|
|
||||||
|
|||||||
4
after/syntax/reason.vim
Normal file
4
after/syntax/reason.vim
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'reason') == -1
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rspec') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rspec') == -1
|
||||||
|
|
||||||
"
|
"
|
||||||
" An rspec syntax file
|
" An rspec syntax file
|
||||||
" Originally from http://www.vim.org/scripts/script.php?script_id=2286
|
" Originally from http://www.vim.org/scripts/script.php?script_id=2286
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yard') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yard') == -1
|
||||||
|
|
||||||
" Ruby syntax extensions for highlighting YARD documentation.
|
" Ruby syntax extensions for highlighting YARD documentation.
|
||||||
"
|
"
|
||||||
" Author: Joel Holdbrooks <https://github.com/noprompt>
|
" Author: Joel Holdbrooks <https://github.com/noprompt>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
if !get(g:, 'rust_conceal', 0) || !has('conceal') || &encoding !=# 'utf-8'
|
if !get(g:, 'rust_conceal', 0) || !has('conceal') || &encoding !=# 'utf-8'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
||||||
|
|
||||||
" adds support for cleverref package
|
" adds support for cleverref package
|
||||||
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
|
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
|
||||||
syn region texRefZone matchgroup=texStatement start="\\Cref{" end="}\|%stopzone\>" contains=@texRefGroup
|
syn region texRefZone matchgroup=texStatement start="\\Cref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||||
|
|||||||
63
after/syntax/tsx.vim
Normal file
63
after/syntax/tsx.vim
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" Vim syntax file
|
||||||
|
"
|
||||||
|
" Language: javascript.jsx
|
||||||
|
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||||
|
" Depends: leafgarland/typescript-vim
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
if get(g:, 'vim_jsx_pretty_disable_tsx', 0)
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:jsx_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syntax case match
|
||||||
|
|
||||||
|
if exists('b:current_syntax')
|
||||||
|
let s:current_syntax = b:current_syntax
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('s:current_syntax')
|
||||||
|
let b:current_syntax = s:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
" refine the typescript line comment
|
||||||
|
syntax region typescriptLineComment start=+//+ end=/$/ contains=@Spell,typescriptCommentTodo,typescriptRef extend keepend
|
||||||
|
|
||||||
|
for syntax_name in ['tsxRegion', 'tsxFragment']
|
||||||
|
if hlexists(syntax_name)
|
||||||
|
exe 'syntax clear ' . syntax_name
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if !hlexists('typescriptTypeCast')
|
||||||
|
" add a typescriptBlock group for typescript
|
||||||
|
syntax region typescriptBlock
|
||||||
|
\ matchgroup=typescriptBraces
|
||||||
|
\ start="{"
|
||||||
|
\ end="}"
|
||||||
|
\ contained
|
||||||
|
\ extend
|
||||||
|
\ contains=@typescriptExpression,typescriptBlock
|
||||||
|
\ fold
|
||||||
|
hi def link typescriptTypeBrackets typescriptOpSymbols
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime syntax/jsx_pretty.vim
|
||||||
|
syntax cluster typescriptExpression add=jsxRegion,typescriptParens
|
||||||
|
" Fix type casting ambiguity with JSX syntax
|
||||||
|
syntax match typescriptTypeBrackets +[<>]+ contained
|
||||||
|
syntax match typescriptTypeCast +<\([_$A-Za-z0-9]\+\)>\%(\s*\%([_$A-Za-z0-9]\+\s*;\?\|(\)\%(\_[^<]*</\1>\)\@!\)\@=+ contains=typescriptTypeBrackets,@typescriptType,typescriptType nextgroup=@typescriptExpression
|
||||||
|
|
||||||
|
let b:current_syntax = 'typescript.tsx'
|
||||||
|
|
||||||
|
let &cpo = s:jsx_cpo
|
||||||
|
unlet s:jsx_cpo
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,28 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
"
|
||||||
|
" Language: GraphQL
|
||||||
|
" Maintainer: Jon Parise <jon@indelible.org>
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
let s:current_syntax = b:current_syntax
|
let s:current_syntax = b:current_syntax
|
||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
@@ -9,7 +32,7 @@ if exists('s:current_syntax')
|
|||||||
let b:current_syntax = s:current_syntax
|
let b:current_syntax = s:current_syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:tags = '\%(' . join(g:graphql_javascript_tags, '\|') . '\)'
|
let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
|
||||||
|
|
||||||
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend'
|
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend'
|
||||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||||
|
|||||||
5
after/syntax/typescriptreact.vim
Normal file
5
after/syntax/typescriptreact.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
source <sfile>:h/tsx.vim
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/syntax/typescriptreact/graphql.vim
Normal file
5
after/syntax/typescriptreact/graphql.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
runtime! after/syntax/typescript/graphql.vim
|
||||||
|
|
||||||
|
endif
|
||||||
5
after/syntax/vue/graphql.vim
Normal file
5
after/syntax/vue/graphql.vim
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
runtime! after/syntax/javascript/graphql.vim
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||||
|
|
||||||
" To make this file do stuff, add something like the following (without the
|
" To make this file do stuff, add something like the following (without the
|
||||||
" leading ") to your ~/.vimrc:
|
" leading ") to your ~/.vimrc:
|
||||||
" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim
|
" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim
|
||||||
@@ -27,7 +27,7 @@ syn match yamlBlock "[>|]\d\?[+-]"
|
|||||||
syn region yamlComment start="\#" end="$"
|
syn region yamlComment start="\#" end="$"
|
||||||
syn match yamlIndicator "#YAML:\S\+"
|
syn match yamlIndicator "#YAML:\S\+"
|
||||||
|
|
||||||
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)'" end="'" skip="\\'"
|
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)\@<='" end="'" skip="\\'"
|
||||||
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
||||||
syn region yamlString matchgroup=yamlBlock start=/[>|]\s*\n\+\z(\s\+\)\S/rs=s+1 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
syn region yamlString matchgroup=yamlBlock start=/[>|]\s*\n\+\z(\s\+\)\S/rs=s+1 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||||
syn region yamlString matchgroup=yamlBlock start=/[>|]\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+2 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
syn region yamlString matchgroup=yamlBlock start=/[>|]\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+2 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" Support for LaTex-to-Unicode conversion as in the Julia REPL "
|
" Support for LaTex-to-Unicode conversion as in the Julia REPL "
|
||||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@@ -21,6 +21,9 @@ function! s:L2U_Setup()
|
|||||||
if !has_key(b:, "l2u_cmdtab_set")
|
if !has_key(b:, "l2u_cmdtab_set")
|
||||||
let b:l2u_cmdtab_set = 0
|
let b:l2u_cmdtab_set = 0
|
||||||
endif
|
endif
|
||||||
|
if !has_key(b:, "l2u_keymap_set")
|
||||||
|
let b:l2u_keymap_set = 0
|
||||||
|
endif
|
||||||
|
|
||||||
" Did we activate the L2U as-you-type substitutions?
|
" Did we activate the L2U as-you-type substitutions?
|
||||||
if !has_key(b:, "l2u_autosub_set")
|
if !has_key(b:, "l2u_autosub_set")
|
||||||
@@ -76,11 +79,7 @@ function! s:L2U_SetupGlobal()
|
|||||||
" A hack to forcibly get out of completion mode: feed
|
" A hack to forcibly get out of completion mode: feed
|
||||||
" this string with feedkeys()
|
" this string with feedkeys()
|
||||||
if has("win32") || has("win64")
|
if has("win32") || has("win64")
|
||||||
if has("gui_running")
|
let s:l2u_esc_sequence = "\u0006"
|
||||||
let s:l2u_esc_sequence = "\u0006"
|
|
||||||
else
|
|
||||||
let s:l2u_esc_sequence = "\u0006\b"
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
let s:l2u_esc_sequence = "\u0091\b"
|
let s:l2u_esc_sequence = "\u0091\b"
|
||||||
end
|
end
|
||||||
@@ -409,8 +408,8 @@ function! LaTeXtoUnicode#FallbackCallback()
|
|||||||
return
|
return
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" This is the function which is mapped to <S-Tab> in command-line mode
|
" This is the function that performs the substitution in command-line mode
|
||||||
function! LaTeXtoUnicode#CmdTab()
|
function! LaTeXtoUnicode#CmdTab(triggeredbytab)
|
||||||
" first stage
|
" first stage
|
||||||
" analyse command line
|
" analyse command line
|
||||||
let col1 = getcmdpos() - 1
|
let col1 = getcmdpos() - 1
|
||||||
@@ -419,6 +418,9 @@ function! LaTeXtoUnicode#CmdTab()
|
|||||||
let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)
|
let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)
|
||||||
" completion not found
|
" completion not found
|
||||||
if col0 == -1
|
if col0 == -1
|
||||||
|
if a:triggeredbytab
|
||||||
|
call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab>
|
||||||
|
endif
|
||||||
return l
|
return l
|
||||||
endif
|
endif
|
||||||
let base = l[col0 : col1-1]
|
let base = l[col0 : col1-1]
|
||||||
@@ -434,6 +436,9 @@ function! LaTeXtoUnicode#CmdTab()
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if len(partmatches) == 0
|
if len(partmatches) == 0
|
||||||
|
if a:triggeredbytab
|
||||||
|
call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab>
|
||||||
|
endif
|
||||||
return l
|
return l
|
||||||
endif
|
endif
|
||||||
" exact matches are replaced with Unicode
|
" exact matches are replaced with Unicode
|
||||||
@@ -463,8 +468,13 @@ endfunction
|
|||||||
" Setup the L2U tab mapping
|
" Setup the L2U tab mapping
|
||||||
function! s:L2U_SetTab(wait_insert_enter)
|
function! s:L2U_SetTab(wait_insert_enter)
|
||||||
if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled
|
if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled
|
||||||
cmap <buffer> <S-Tab> <Plug>L2UCmdTab
|
let b:l2u_cmdtab_keys = get(g:, "latex_to_unicode_cmd_mapping", ['<Tab>','<S-Tab>'])
|
||||||
cnoremap <buffer> <Plug>L2UCmdTab <C-\>eLaTeXtoUnicode#CmdTab()<CR>
|
if type(b:l2u_cmdtab_keys) != type([]) " avoid using v:t_list for backward compatibility
|
||||||
|
let b:l2u_cmdtab_keys = [b:l2u_cmdtab_keys]
|
||||||
|
endif
|
||||||
|
for k in b:l2u_cmdtab_keys
|
||||||
|
exec 'cnoremap <buffer> '.k.' <C-\>eLaTeXtoUnicode#CmdTab('.(k ==? '<Tab>').')<CR>'
|
||||||
|
endfor
|
||||||
let b:l2u_cmdtab_set = 1
|
let b:l2u_cmdtab_set = 1
|
||||||
endif
|
endif
|
||||||
if b:l2u_tab_set
|
if b:l2u_tab_set
|
||||||
@@ -500,7 +510,9 @@ endfunction
|
|||||||
" Revert the LaTeX-to-Unicode tab mapping settings
|
" Revert the LaTeX-to-Unicode tab mapping settings
|
||||||
function! s:L2U_UnsetTab()
|
function! s:L2U_UnsetTab()
|
||||||
if b:l2u_cmdtab_set
|
if b:l2u_cmdtab_set
|
||||||
cunmap <buffer> <S-Tab>
|
for k in b:l2u_cmdtab_keys
|
||||||
|
exec 'cunmap <buffer> '.k
|
||||||
|
endfor
|
||||||
let b:l2u_cmdtab_set = 0
|
let b:l2u_cmdtab_set = 0
|
||||||
endif
|
endif
|
||||||
if !b:l2u_tab_set
|
if !b:l2u_tab_set
|
||||||
@@ -593,6 +605,21 @@ function! s:L2U_UnsetAutoSub()
|
|||||||
let b:l2u_autosub_set = 0
|
let b:l2u_autosub_set = 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:L2U_SetKeymap()
|
||||||
|
if !b:l2u_keymap_set && get(g:, "latex_to_unicode_keymap", 0) && b:l2u_enabled
|
||||||
|
setlocal keymap=latex2unicode
|
||||||
|
let b:l2u_keymap_set = 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:L2U_UnsetKeymap()
|
||||||
|
if !b:l2u_keymap_set
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
setlocal keymap=
|
||||||
|
let b:l2u_keymap_set = 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Initialization. Can be used to re-init when global settings have changed.
|
" Initialization. Can be used to re-init when global settings have changed.
|
||||||
function! LaTeXtoUnicode#Init(...)
|
function! LaTeXtoUnicode#Init(...)
|
||||||
let wait_insert_enter = a:0 > 0 ? a:1 : 1
|
let wait_insert_enter = a:0 > 0 ? a:1 : 1
|
||||||
@@ -605,9 +632,11 @@ function! LaTeXtoUnicode#Init(...)
|
|||||||
|
|
||||||
call s:L2U_UnsetTab()
|
call s:L2U_UnsetTab()
|
||||||
call s:L2U_UnsetAutoSub()
|
call s:L2U_UnsetAutoSub()
|
||||||
|
call s:L2U_UnsetKeymap()
|
||||||
|
|
||||||
call s:L2U_SetTab(wait_insert_enter)
|
call s:L2U_SetTab(wait_insert_enter)
|
||||||
call s:L2U_SetAutoSub(wait_insert_enter)
|
call s:L2U_SetAutoSub(wait_insert_enter)
|
||||||
|
call s:L2U_SetKeymap()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! LaTeXtoUnicode#Toggle()
|
function! LaTeXtoUnicode#Toggle()
|
||||||
|
|||||||
66
autoload/RstFold.vim
Normal file
66
autoload/RstFold.vim
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
|
||||||
|
|
||||||
|
" Author: Antony Lee <anntzer.lee@gmail.com>
|
||||||
|
" Description: Helper functions for reStructuredText syntax folding
|
||||||
|
" Last Modified: 2018-12-29
|
||||||
|
|
||||||
|
function s:CacheRstFold()
|
||||||
|
if !g:rst_fold_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let closure = {'header_types': {}, 'max_level': 0, 'levels': {}}
|
||||||
|
function closure.Process(match) dict
|
||||||
|
let curline = getcurpos()[1]
|
||||||
|
if has_key(self.levels, curline - 1)
|
||||||
|
" For over+under-lined headers, the regex will match both at the
|
||||||
|
" overline and at the title itself; in that case, skip the second match.
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let lines = split(a:match, '\n')
|
||||||
|
let key = repeat(lines[-1][0], len(lines))
|
||||||
|
if !has_key(self.header_types, key)
|
||||||
|
let self.max_level += 1
|
||||||
|
let self.header_types[key] = self.max_level
|
||||||
|
endif
|
||||||
|
let self.levels[curline] = self.header_types[key]
|
||||||
|
endfunction
|
||||||
|
let save_cursor = getcurpos()
|
||||||
|
let save_mark = getpos("'[")
|
||||||
|
silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn
|
||||||
|
call setpos('.', save_cursor)
|
||||||
|
call setpos("'[", save_mark)
|
||||||
|
let b:RstFoldCache = closure.levels
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function RstFold#GetRstFold()
|
||||||
|
if !g:rst_fold_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !has_key(b:, 'RstFoldCache')
|
||||||
|
call s:CacheRstFold()
|
||||||
|
endif
|
||||||
|
if has_key(b:RstFoldCache, v:lnum)
|
||||||
|
return '>' . b:RstFoldCache[v:lnum]
|
||||||
|
else
|
||||||
|
return '='
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function RstFold#GetRstFoldText()
|
||||||
|
if !g:rst_fold_enabled
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !has_key(b:, 'RstFoldCache')
|
||||||
|
call s:CacheRstFold()
|
||||||
|
endif
|
||||||
|
let indent = repeat(' ', b:RstFoldCache[v:foldstart] - 1)
|
||||||
|
let thisline = getline(v:foldstart)
|
||||||
|
" For over+under-lined headers, skip the overline.
|
||||||
|
let text = thisline =~ '^\([=`:.''"~^_*+#-]\)\1\+$' ? getline(v:foldstart + 1) : thisline
|
||||||
|
return indent . text
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,11 +1,21 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
function! cargo#Load()
|
function! cargo#Load()
|
||||||
" Utility call to get this script loaded, for debugging
|
" Utility call to get this script loaded, for debugging
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! cargo#cmd(args)
|
function! cargo#cmd(args)
|
||||||
execute "! cargo" a:args
|
" Trim trailing spaces. This is necessary since :terminal command parses
|
||||||
|
" trailing spaces as an empty argument.
|
||||||
|
let args = substitute(a:args, '\s\+$', '', '')
|
||||||
|
if has('terminal')
|
||||||
|
let cmd = 'terminal'
|
||||||
|
elseif has('nvim')
|
||||||
|
let cmd = 'noautocmd new | terminal'
|
||||||
|
else
|
||||||
|
let cmd = '!'
|
||||||
|
endif
|
||||||
|
execute cmd 'cargo' args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:nearest_cargo(...) abort
|
function! s:nearest_cargo(...) abort
|
||||||
@@ -86,6 +96,34 @@ function! cargo#bench(args)
|
|||||||
call cargo#cmd("bench " . a:args)
|
call cargo#cmd("bench " . a:args)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! cargo#runtarget(args)
|
||||||
|
let l:filename = expand('%:p')
|
||||||
|
let l:read_manifest = system('cargo read-manifest')
|
||||||
|
let l:metadata = json_decode(l:read_manifest)
|
||||||
|
let l:targets = get(l:metadata, 'targets', [])
|
||||||
|
let l:did_run = 0
|
||||||
|
for l:target in l:targets
|
||||||
|
let l:src_path = get(l:target, 'src_path', '')
|
||||||
|
let l:kinds = get(l:target, 'kind', [])
|
||||||
|
let l:name = get(l:target, 'name', '')
|
||||||
|
if l:src_path == l:filename
|
||||||
|
if index(l:kinds, 'example') != -1
|
||||||
|
let l:did_run = 1
|
||||||
|
call cargo#run("--example " . shellescape(l:name) . " " . a:args)
|
||||||
|
return
|
||||||
|
elseif index(l:kinds, 'bin') != -1
|
||||||
|
let l:did_run = 1
|
||||||
|
call cargo#run("--bin " . shellescape(l:name) . " " . a:args)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if l:did_run != 1
|
||||||
|
call cargo#run(a:args)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: set et sw=4 sts=4 ts=8:
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
function! cargo#quickfix#CmdPre() abort
|
function! cargo#quickfix#CmdPre() abort
|
||||||
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo'
|
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo'
|
||||||
" Preserve the current directory, and 'lcd' to the nearest Cargo file.
|
" Preserve the current directory, and 'lcd' to the nearest Cargo file.
|
||||||
@@ -14,7 +14,7 @@ function! cargo#quickfix#CmdPre() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! cargo#quickfix#CmdPost() abort
|
function! cargo#quickfix#CmdPost() abort
|
||||||
if b:rust_compiler_cargo_qf_prev_cd_saved
|
if exists("b:rust_compiler_cargo_qf_prev_cd_saved") && b:rust_compiler_cargo_qf_prev_cd_saved
|
||||||
" Restore the current directory.
|
" Restore the current directory.
|
||||||
if b:rust_compiler_cargo_qf_has_lcd
|
if b:rust_compiler_cargo_qf_has_lcd
|
||||||
execute 'lchdir! '.b:rust_compiler_cargo_qf_prev_cd
|
execute 'lchdir! '.b:rust_compiler_cargo_qf_prev_cd
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1
|
||||||
|
|
||||||
" Vim completion script
|
" Vim completion script
|
||||||
" Language: Clojure
|
" Language: Clojure
|
||||||
" Maintainer: Sung Pae <self@sungpae.com>
|
" Maintainer: Sung Pae <self@sungpae.com>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
||||||
|
|
||||||
" Language: CoffeeScript
|
" Language: CoffeeScript
|
||||||
" Maintainer: Mick Koch <mick@kochm.co>
|
" Maintainer: Mick Koch <mick@kochm.co>
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
" URL: http://github.com/kchmck/vim-coffee-script
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
@@ -35,28 +35,59 @@ function! s:run_cmd(cmd) abort
|
|||||||
return s:P.system(a:cmd)
|
return s:P.system(a:cmd)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:find_root_by_spec(d) abort
|
function! s:find_root_by(search_dir, d) abort
|
||||||
let dir = finddir('spec', a:d . ';')
|
let found_dir = finddir(a:search_dir, a:d . ';')
|
||||||
if dir ==# ''
|
if found_dir ==# ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Note: ':h:h' for {root}/spec/ -> {root}/spec -> {root}
|
" Note: ':h:h' for {root}/{search_dir}/ -> {root}/{search_dir} -> {root}
|
||||||
return fnamemodify(dir, ':p:h:h')
|
return fnamemodify(found_dir, ':p:h:h')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Search the root directory containing a 'spec/' and a 'src/' directories.
|
||||||
|
"
|
||||||
|
" Searching for the 'spec/' directory is not enough: for example the crystal
|
||||||
|
" compiler has a 'cr_sources/src/spec/' directory that would otherwise give the root
|
||||||
|
" directory as 'cr_source/src/' instead of 'cr_sources/'.
|
||||||
|
function! s:find_root_by_spec_and_src(d) abort
|
||||||
|
" Search for 'spec/'
|
||||||
|
let root = s:find_root_by('spec', a:d)
|
||||||
|
" Check that 'src/' is also there
|
||||||
|
if root !=# '' && isdirectory(root . '/src')
|
||||||
|
return root
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Search for 'src/'
|
||||||
|
let root = s:find_root_by('src', a:d)
|
||||||
|
" Check that 'spec/' is also there
|
||||||
|
if root !=# '' && isdirectory(root . '/spec')
|
||||||
|
return root
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Cannot find a directory containing both 'src/' and 'spec/'
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! crystal_lang#entrypoint_for(file_path) abort
|
function! crystal_lang#entrypoint_for(file_path) abort
|
||||||
let parent_dir = fnamemodify(a:file_path, ':p:h')
|
let parent_dir = fnamemodify(a:file_path, ':p:h')
|
||||||
let root_dir = s:find_root_by_spec(parent_dir)
|
let root_dir = s:find_root_by_spec_and_src(parent_dir)
|
||||||
if root_dir ==# ''
|
if root_dir ==# ''
|
||||||
" No spec diretory found. No need to make temporary file
|
" No spec directory found. No need to make temporary file
|
||||||
return a:file_path
|
return a:file_path
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let required_spec_path = get(b:, 'crystal_required_spec_path', get(g:, 'crystal_required_spec_path', ''))
|
||||||
|
if required_spec_path !=# ''
|
||||||
|
let require_spec_str = './' . required_spec_path
|
||||||
|
else
|
||||||
|
let require_spec_str = './spec/**'
|
||||||
|
endif
|
||||||
|
|
||||||
let temp_name = root_dir . '/__vim-crystal-temporary-entrypoint-' . fnamemodify(a:file_path, ':t')
|
let temp_name = root_dir . '/__vim-crystal-temporary-entrypoint-' . fnamemodify(a:file_path, ':t')
|
||||||
let contents = [
|
let contents = [
|
||||||
\ 'require "spec"',
|
\ 'require "spec"',
|
||||||
\ 'require "./spec/**"',
|
\ 'require "' . require_spec_str . '"',
|
||||||
\ printf('require "./%s"', fnamemodify(a:file_path, ':p')[strlen(root_dir)+1 : ])
|
\ printf('require "./%s"', fnamemodify(a:file_path, ':p')[strlen(root_dir)+1 : ])
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
@@ -230,7 +261,7 @@ endfunction
|
|||||||
|
|
||||||
function! crystal_lang#run_all_spec(...) abort
|
function! crystal_lang#run_all_spec(...) abort
|
||||||
let path = a:0 == 0 ? expand('%:p:h') : a:1
|
let path = a:0 == 0 ? expand('%:p:h') : a:1
|
||||||
let root_path = s:find_root_by_spec(path)
|
let root_path = s:find_root_by_spec_and_src(path)
|
||||||
if root_path ==# ''
|
if root_path ==# ''
|
||||||
return s:echo_error("'spec' directory is not found")
|
return s:echo_error("'spec' directory is not found")
|
||||||
endif
|
endif
|
||||||
@@ -248,9 +279,9 @@ function! crystal_lang#run_current_spec(...) abort
|
|||||||
let source_dir = fnamemodify(path, ':h')
|
let source_dir = fnamemodify(path, ':h')
|
||||||
|
|
||||||
" /foo/bar
|
" /foo/bar
|
||||||
let root_dir = s:find_root_by_spec(source_dir)
|
let root_dir = s:find_root_by_spec_and_src(source_dir)
|
||||||
if root_dir ==# ''
|
if root_dir ==# ''
|
||||||
return s:echo_error("'spec' directory is not found")
|
return s:echo_error("Root directory with 'src/' and 'spec/' not found")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" src
|
" src
|
||||||
|
|||||||
3192
autoload/csv.vim
Normal file
3192
autoload/csv.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||||
|
|
||||||
|
|
||||||
function! s:error(text) abort
|
function! s:error(text) abort
|
||||||
echohl Error
|
echohl Error
|
||||||
@@ -7,68 +7,77 @@ function! s:error(text) abort
|
|||||||
echohl None
|
echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:cexpr(errorformat, joined_lines) abort
|
function! s:cexpr(errorformat, lines, reason) abort
|
||||||
let temp_errorfomat = &errorformat
|
call setqflist([], ' ', {
|
||||||
try
|
\ 'lines': a:lines,
|
||||||
let &errorformat = a:errorformat
|
\ 'efm': a:errorformat,
|
||||||
cexpr a:joined_lines
|
\ 'context': {'reason': a:reason},
|
||||||
copen
|
\})
|
||||||
finally
|
copen
|
||||||
let &errorformat = temp_errorfomat
|
endfunction
|
||||||
endtry
|
|
||||||
|
" If the quickfix list has a context matching [reason], clear and close it.
|
||||||
|
function! s:clearQfList(reason) abort
|
||||||
|
let context = get(getqflist({'context': 1}), 'context', {})
|
||||||
|
if type(context) == v:t_dict &&
|
||||||
|
\ has_key(context, 'reason') &&
|
||||||
|
\ context.reason == a:reason
|
||||||
|
call setqflist([], 'r')
|
||||||
|
cclose
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! dart#fmt(q_args) abort
|
function! dart#fmt(q_args) abort
|
||||||
if executable('dartfmt')
|
let cmd = s:FindDartFmt()
|
||||||
let buffer_content = join(getline(1, '$'), "\n")
|
if type(cmd) != type('') | return | endif
|
||||||
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
|
let buffer_content = getline(1, '$')
|
||||||
if buffer_content ==# joined_lines[:-2] | return | endif
|
let args = '--stdin-name '.expand('%').' '.a:q_args
|
||||||
if 0 == v:shell_error
|
let lines = systemlist(printf('%s %s', cmd, args), join(buffer_content, "\n"))
|
||||||
let win_view = winsaveview()
|
" TODO(https://github.com/dart-lang/sdk/issues/38507) - Remove once the
|
||||||
let lines = split(joined_lines, "\n")
|
" tool no longer emits this line on SDK upgrades.
|
||||||
silent keepjumps call setline(1, lines)
|
if lines[-1] ==# 'Isolate creation failed'
|
||||||
if line('$') > len(lines)
|
let lines = lines[:-2]
|
||||||
silent keepjumps execute string(len(lines)+1).',$ delete'
|
|
||||||
endif
|
|
||||||
call winrestview(win_view)
|
|
||||||
else
|
|
||||||
let errors = split(joined_lines, "\n")[2:]
|
|
||||||
let file_path = expand('%')
|
|
||||||
call map(errors, 'file_path.":".v:val')
|
|
||||||
let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#'
|
|
||||||
call s:cexpr(error_format, join(errors, "\n"))
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
call s:error('cannot execute binary file: dartfmt')
|
|
||||||
endif
|
endif
|
||||||
|
if buffer_content == lines
|
||||||
|
call s:clearQfList('dartfmt')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if 0 == v:shell_error
|
||||||
|
let win_view = winsaveview()
|
||||||
|
silent keepjumps call setline(1, lines)
|
||||||
|
if line('$') > len(lines)
|
||||||
|
silent keepjumps execute string(len(lines)+1).',$ delete'
|
||||||
|
endif
|
||||||
|
call winrestview(win_view)
|
||||||
|
call s:clearQfList('dartfmt')
|
||||||
|
else
|
||||||
|
let errors = lines[2:]
|
||||||
|
let error_format = '%Aline %l\, column %c of %f: %m,%C%.%#'
|
||||||
|
call s:cexpr(error_format, errors, 'dartfmt')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:FindDartFmt() abort
|
||||||
|
if executable('dartfmt') | return 'dartfmt' | endif
|
||||||
|
if executable('flutter')
|
||||||
|
let l:flutter_cmd = resolve(exepath('flutter'))
|
||||||
|
let l:bin = fnamemodify(l:flutter_cmd, ':h')
|
||||||
|
let l:dartfmt = l:bin.'/cache/dart-sdk/bin/dartfmt'
|
||||||
|
if executable(l:dartfmt) | return l:dartfmt | endif
|
||||||
|
endif
|
||||||
|
call s:error('Cannot find a `dartfmt` command')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! dart#analyzer(q_args) abort
|
function! dart#analyzer(q_args) abort
|
||||||
if executable('dartanalyzer')
|
call s:error('DartAnalyzer support has been removed. '.
|
||||||
let path = expand('%:p:gs:\:/:')
|
\'If this broke your workflow please comment on '.
|
||||||
if filereadable(path)
|
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||||
let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path)))
|
|
||||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
|
||||||
else
|
|
||||||
call s:error(printf('cannot read a file: "%s"', path))
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
call s:error('cannot execute binary file: dartanalyzer')
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! dart#tojs(q_args) abort
|
function! dart#tojs(q_args) abort
|
||||||
if executable('dart2js')
|
call s:error('Dart2JS support has been removed. '.
|
||||||
let path = expand('%:p:gs:\:/:')
|
\'If this broke your workflow please comment on '.
|
||||||
if filereadable(path)
|
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||||
let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path)))
|
|
||||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
|
||||||
else
|
|
||||||
call s:error(printf('cannot read a file: "%s"', path))
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
call s:error('cannot execute binary file: dartanalyzer')
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Finds the path to `uri`.
|
" Finds the path to `uri`.
|
||||||
|
|||||||
24
autoload/db/adapter/ecto.vim
Normal file
24
autoload/db/adapter/ecto.vim
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
|
let s:path = expand('<sfile>:h')
|
||||||
|
let s:cmd = join(['mix', 'run', '--no-start', '--no-compile', shellescape(s:path.'/get_repos.exs')])
|
||||||
|
|
||||||
|
function! s:repo_list() abort
|
||||||
|
return map(systemlist(s:cmd), 'split(v:val)')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! db#adapter#ecto#canonicalize(url) abort
|
||||||
|
for l:item in s:repo_list()
|
||||||
|
let l:name = get(l:item, 0)
|
||||||
|
let l:url = get(l:item, 1)
|
||||||
|
if !empty(l:name) && 'ecto:'.l:name ==# a:url
|
||||||
|
return l:url
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! db#adapter#ecto#complete_opaque(url) abort
|
||||||
|
return map(s:repo_list(), 'v:val[0]')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
if !exists("g:elixir_indent_max_lookbehind")
|
if !exists("g:elixir_indent_max_lookbehind")
|
||||||
let g:elixir_indent_max_lookbehind = 30
|
let g:elixir_indent_max_lookbehind = 30
|
||||||
endif
|
endif
|
||||||
@@ -23,6 +23,7 @@ function! elixir#indent#indent(lnum)
|
|||||||
|
|
||||||
let handlers = [
|
let handlers = [
|
||||||
\'top_of_file',
|
\'top_of_file',
|
||||||
|
\'starts_with_string_continuation',
|
||||||
\'following_trailing_binary_operator',
|
\'following_trailing_binary_operator',
|
||||||
\'starts_with_pipe',
|
\'starts_with_pipe',
|
||||||
\'starts_with_binary_operator',
|
\'starts_with_binary_operator',
|
||||||
@@ -33,9 +34,14 @@ function! elixir#indent#indent(lnum)
|
|||||||
\]
|
\]
|
||||||
for handler in handlers
|
for handler in handlers
|
||||||
call s:debug('testing handler elixir#indent#handle_'.handler)
|
call s:debug('testing handler elixir#indent#handle_'.handler)
|
||||||
let context = {'lnum': lnum, 'text': text, 'prev_nb_lnum': prev_nb_lnum, 'prev_nb_text': prev_nb_text}
|
let context = {'lnum': lnum, 'text': text, 'first_nb_char_idx': match(text, '\w'), 'prev_nb_lnum': prev_nb_lnum, 'prev_nb_text': prev_nb_text}
|
||||||
let indent = function('elixir#indent#handle_'.handler)(context)
|
let indent = function('elixir#indent#handle_'.handler)(context)
|
||||||
if indent != -1
|
if indent == -2
|
||||||
|
" Keep indent the same
|
||||||
|
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned -2; returning indent of -1')
|
||||||
|
call cursor(curs_lnum, curs_col)
|
||||||
|
return -1
|
||||||
|
elseif indent != -1
|
||||||
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
|
||||||
call cursor(curs_lnum, curs_col)
|
call cursor(curs_lnum, curs_col)
|
||||||
return indent
|
return indent
|
||||||
@@ -100,7 +106,11 @@ endfunction
|
|||||||
" Returns 0 or 1 based on whether or not the given line number and column
|
" Returns 0 or 1 based on whether or not the given line number and column
|
||||||
" number pair is a string or comment
|
" number pair is a string or comment
|
||||||
function! s:is_string_or_comment(line, col)
|
function! s:is_string_or_comment(line, col)
|
||||||
return synIDattr(synID(a:line, a:col, 1), "name") =~ '\%(String\|Comment\)'
|
return s:syntax_name(a:line, a:col) =~ '\%(String\|Comment\)'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:syntax_name(line, col)
|
||||||
|
return synIDattr(synID(a:line, a:col, 1), "name")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Skip expression for searchpair. Returns 0 or 1 based on whether the value
|
" Skip expression for searchpair. Returns 0 or 1 based on whether the value
|
||||||
@@ -156,6 +166,14 @@ function! elixir#indent#handle_top_of_file(context)
|
|||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! elixir#indent#handle_starts_with_string_continuation(context)
|
||||||
|
if s:syntax_name(a:context.lnum, a:context.first_nb_char_idx) =~ '\(String\|Comment\)$'
|
||||||
|
return -2
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! elixir#indent#handle_follow_prev_nb(context)
|
function! elixir#indent#handle_follow_prev_nb(context)
|
||||||
return s:get_base_indent(a:context.prev_nb_lnum, a:context.prev_nb_text)
|
return s:get_base_indent(a:context.prev_nb_lnum, a:context.prev_nb_text)
|
||||||
endfunction
|
endfunction
|
||||||
@@ -267,7 +285,7 @@ function! elixir#indent#handle_inside_block(context)
|
|||||||
let config = {
|
let config = {
|
||||||
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||||
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||||
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after'), 'pattern_match_clauses': s:keyword('catch\|rescue')},
|
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after\|else'), 'pattern_match_clauses': s:keyword('catch\|rescue\|else')},
|
||||||
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
|
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
|
||||||
\'i': {'aligned_clauses': s:keyword('end\|else'), 'pattern_match_clauses': never_match},
|
\'i': {'aligned_clauses': s:keyword('end\|else'), 'pattern_match_clauses': never_match},
|
||||||
\'[': {'aligned_clauses': ']', 'pattern_match_clauses': never_match},
|
\'[': {'aligned_clauses': ']', 'pattern_match_clauses': never_match},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||||
|
|
||||||
function! elixir#util#get_filename(word) abort
|
function! elixir#util#get_filename(word) abort
|
||||||
let word = a:word
|
let word = a:word
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||||
|
|
||||||
let s:errors = []
|
let s:errors = []
|
||||||
|
|
||||||
function! s:elmOracle(...) abort
|
function! s:elmOracle(...) abort
|
||||||
@@ -349,11 +349,14 @@ function! elm#FindRootDirectory() abort
|
|||||||
if empty(l:elm_root)
|
if empty(l:elm_root)
|
||||||
let l:current_file = expand('%:p')
|
let l:current_file = expand('%:p')
|
||||||
let l:dir_current_file = fnameescape(fnamemodify(l:current_file, ':h'))
|
let l:dir_current_file = fnameescape(fnamemodify(l:current_file, ':h'))
|
||||||
let l:match = findfile('elm-package.json', l:dir_current_file . ';')
|
let l:old_match = findfile('elm-package.json', l:dir_current_file . ';')
|
||||||
if empty(l:match)
|
let l:new_match = findfile('elm.json', l:dir_current_file . ';')
|
||||||
let l:elm_root = ''
|
if !empty(l:new_match)
|
||||||
|
let l:elm_root = fnamemodify(l:new_match, ':p:h')
|
||||||
|
elseif !empty(l:old_match)
|
||||||
|
let l:elm_root = fnamemodify(l:old_match, ':p:h')
|
||||||
else
|
else
|
||||||
let l:elm_root = fnamemodify(l:match, ':p:h')
|
let l:elm_root = ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(l:elm_root)
|
if !empty(l:elm_root)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elm') == -1
|
||||||
|
|
||||||
" IsWin returns 1 if current OS is Windows or 0 otherwise
|
" IsWin returns 1 if current OS is Windows or 0 otherwise
|
||||||
fun! elm#util#IsWin() abort
|
fun! elm#util#IsWin() abort
|
||||||
let l:win = ['win16', 'win32', 'win32unix', 'win64', 'win95']
|
let l:win = ['win16', 'win32', 'win32unix', 'win64', 'win95']
|
||||||
@@ -134,7 +134,13 @@ function! elm#util#GoToModule(name)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:findLocalModule(rel_path, root)
|
function! s:findLocalModule(rel_path, root)
|
||||||
let l:package_json = a:root . '/elm-package.json'
|
let l:old_match = findfile('elm-package.json', a:root . ';')
|
||||||
|
let l:new_match = findfile('elm.json', a:root . ';')
|
||||||
|
if !empty(l:new_match)
|
||||||
|
let l:package_json = l:new_match
|
||||||
|
elseif !empty(l:old_match)
|
||||||
|
let l:package_json = l:old_match
|
||||||
|
endif
|
||||||
if exists('*json_decode')
|
if exists('*json_decode')
|
||||||
let l:package = json_decode(readfile(l:package_json))
|
let l:package = json_decode(readfile(l:package_json))
|
||||||
let l:source_roots = l:package['source-directories']
|
let l:source_roots = l:package['source-directories']
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
|
||||||
|
|
||||||
function! fish#Indent()
|
function! fish#Indent()
|
||||||
let l:shiftwidth = shiftwidth()
|
let l:shiftwidth = shiftwidth()
|
||||||
let l:prevlnum = prevnonblank(v:lnum - 1)
|
let l:prevlnum = prevnonblank(v:lnum - 1)
|
||||||
@@ -9,15 +9,15 @@ function! fish#Indent()
|
|||||||
let l:indent = 0
|
let l:indent = 0
|
||||||
let l:prevline = getline(l:prevlnum)
|
let l:prevline = getline(l:prevlnum)
|
||||||
if l:prevline =~# '\v^\s*switch>'
|
if l:prevline =~# '\v^\s*switch>'
|
||||||
let l:indent = l:shiftwidth * 2
|
return indent(l:prevlnum) + l:shiftwidth
|
||||||
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
|
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
|
||||||
let l:indent = l:shiftwidth
|
let l:indent = l:shiftwidth
|
||||||
endif
|
endif
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
if l:line =~# '\v^\s*end>'
|
if l:line =~# '\v^\s*end>'
|
||||||
return indent(v:lnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent)
|
return indent(l:prevlnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent)
|
||||||
elseif l:line =~# '\v^\s*%(case|else)>'
|
elseif l:line =~# '\v^\s*%(case|else)>'
|
||||||
return indent(v:lnum) - l:shiftwidth
|
return indent(l:prevlnum) - l:shiftwidth
|
||||||
endif
|
endif
|
||||||
return indent(l:prevlnum) + l:indent
|
return indent(l:prevlnum) + l:indent
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||||
|
|
||||||
|
" don't spam the user when Vim is started in Vi compatibility mode
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
function! go#config#AutodetectGopath() abort
|
function! go#config#AutodetectGopath() abort
|
||||||
return get(g:, 'go_autodetect_gopath', 0)
|
return get(g:, 'go_autodetect_gopath', 0)
|
||||||
endfunction
|
endfunction
|
||||||
@@ -19,10 +23,12 @@ endfunction
|
|||||||
function! go#config#SetBuildTags(value) abort
|
function! go#config#SetBuildTags(value) abort
|
||||||
if a:value is ''
|
if a:value is ''
|
||||||
silent! unlet g:go_build_tags
|
silent! unlet g:go_build_tags
|
||||||
|
call go#lsp#ResetWorkspaceDirectories()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:go_build_tags = a:value
|
let g:go_build_tags = a:value
|
||||||
|
call go#lsp#ResetWorkspaceDirectories()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#TestTimeout() abort
|
function! go#config#TestTimeout() abort
|
||||||
@@ -45,8 +51,16 @@ function! go#config#TermMode() abort
|
|||||||
return get(g:, 'go_term_mode', 'vsplit')
|
return get(g:, 'go_term_mode', 'vsplit')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#TermCloseOnExit() abort
|
||||||
|
return get(g:, 'go_term_close_on_exit', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#SetTermCloseOnExit(value) abort
|
||||||
|
let g:go_term_close_on_exit = a:value
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#TermEnabled() abort
|
function! go#config#TermEnabled() abort
|
||||||
return get(g:, 'go_term_enabled', 0)
|
return has('nvim') && get(g:, 'go_term_enabled', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#SetTermEnabled(value) abort
|
function! go#config#SetTermEnabled(value) abort
|
||||||
@@ -70,7 +84,18 @@ function! go#config#StatuslineDuration() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#SnippetEngine() abort
|
function! go#config#SnippetEngine() abort
|
||||||
return get(g:, 'go_snippet_engine', 'automatic')
|
let l:engine = get(g:, 'go_snippet_engine', 'automatic')
|
||||||
|
if l:engine is? "automatic"
|
||||||
|
if get(g:, 'did_plugin_ultisnips') is 1
|
||||||
|
let l:engine = 'ultisnips'
|
||||||
|
elseif get(g:, 'loaded_neosnippet') is 1
|
||||||
|
let l:engine = 'neosnippet'
|
||||||
|
elseif get(g:, 'loaded_minisnip') is 1
|
||||||
|
let l:engine = 'minisnip'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:engine
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#PlayBrowserCommand() abort
|
function! go#config#PlayBrowserCommand() abort
|
||||||
@@ -112,7 +137,7 @@ function! go#config#ListAutoclose() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#InfoMode() abort
|
function! go#config#InfoMode() abort
|
||||||
return get(g:, 'go_info_mode', 'gocode')
|
return get(g:, 'go_info_mode', 'gopls')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#GuruScope() abort
|
function! go#config#GuruScope() abort
|
||||||
@@ -137,6 +162,10 @@ function! go#config#SetGuruScope(scope) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GocodeUnimportedPackages() abort
|
||||||
|
return get(g:, 'go_gocode_unimported_packages', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
||||||
function! go#config#GocodeSocketType() abort
|
function! go#config#GocodeSocketType() abort
|
||||||
return get(g:, 'go_gocode_socket_type', s:sock_type)
|
return get(g:, 'go_gocode_socket_type', s:sock_type)
|
||||||
@@ -147,7 +176,7 @@ function! go#config#GocodeProposeBuiltins() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#GocodeProposeSource() abort
|
function! go#config#GocodeProposeSource() abort
|
||||||
return get(g:, 'go_gocode_propose_source', 1)
|
return get(g:, 'go_gocode_propose_source', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#EchoCommandInfo() abort
|
function! go#config#EchoCommandInfo() abort
|
||||||
@@ -168,12 +197,15 @@ function! go#config#DocUrl() abort
|
|||||||
return godoc_url
|
return godoc_url
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#DocPopupWindow() abort
|
||||||
|
return get(g:, 'go_doc_popup_window', 0)
|
||||||
|
endfunction
|
||||||
function! go#config#DefReuseBuffer() abort
|
function! go#config#DefReuseBuffer() abort
|
||||||
return get(g:, 'go_def_reuse_buffer', 0)
|
return get(g:, 'go_def_reuse_buffer', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#DefMode() abort
|
function! go#config#DefMode() abort
|
||||||
return get(g:, 'go_def_mode', 'guru')
|
return get(g:, 'go_def_mode', 'gopls')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#DeclsIncludes() abort
|
function! go#config#DeclsIncludes() abort
|
||||||
@@ -186,9 +218,10 @@ endfunction
|
|||||||
|
|
||||||
function! go#config#DebugWindows() abort
|
function! go#config#DebugWindows() abort
|
||||||
return get(g:, 'go_debug_windows', {
|
return get(g:, 'go_debug_windows', {
|
||||||
\ 'stack': 'leftabove 20vnew',
|
|
||||||
\ 'out': 'botright 10new',
|
|
||||||
\ 'vars': 'leftabove 30vnew',
|
\ 'vars': 'leftabove 30vnew',
|
||||||
|
\ 'stack': 'leftabove 20new',
|
||||||
|
\ 'goroutines': 'botright 10new',
|
||||||
|
\ 'out': 'botright 5new',
|
||||||
\ }
|
\ }
|
||||||
\ )
|
\ )
|
||||||
|
|
||||||
@@ -200,10 +233,20 @@ endfunction
|
|||||||
|
|
||||||
function! go#config#DebugCommands() abort
|
function! go#config#DebugCommands() abort
|
||||||
" make sure g:go_debug_commands is set so that it can be added to easily.
|
" make sure g:go_debug_commands is set so that it can be added to easily.
|
||||||
let g:go_debug_commands = get(g:, 'go_debug_commands', {})
|
let g:go_debug_commands = get(g:, 'go_debug_commands', [])
|
||||||
return g:go_debug_commands
|
return g:go_debug_commands
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#DebugLogOutput() abort
|
||||||
|
return get(g:, 'go_debug_log_output', 'debugger,rpc')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#LspLog() abort
|
||||||
|
" make sure g:go_lsp_log is set so that it can be added to easily.
|
||||||
|
let g:go_lsp_log = get(g:, 'go_lsp_log', [])
|
||||||
|
return g:go_lsp_log
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#SetDebugDiag(value) abort
|
function! go#config#SetDebugDiag(value) abort
|
||||||
let g:go_debug_diag = a:value
|
let g:go_debug_diag = a:value
|
||||||
endfunction
|
endfunction
|
||||||
@@ -229,19 +272,27 @@ function! go#config#SetTemplateAutocreate(value) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#MetalinterCommand() abort
|
function! go#config#MetalinterCommand() abort
|
||||||
return get(g:, "go_metalinter_command", "")
|
return get(g:, "go_metalinter_command", "golangci-lint")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#MetalinterAutosaveEnabled() abort
|
function! go#config#MetalinterAutosaveEnabled() abort
|
||||||
return get(g:, 'go_metalinter_autosave_enabled', ['vet', 'golint'])
|
let l:default_enabled = ["vet", "golint"]
|
||||||
|
|
||||||
|
if go#config#MetalinterCommand() == "golangci-lint"
|
||||||
|
let l:default_enabled = ["govet", "golint"]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return get(g:, "go_metalinter_autosave_enabled", default_enabled)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#MetalinterEnabled() abort
|
function! go#config#MetalinterEnabled() abort
|
||||||
return get(g:, "go_metalinter_enabled", ['vet', 'golint', 'errcheck'])
|
let l:default_enabled = ["vet", "golint", "errcheck"]
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! go#config#MetalinterDisabled() abort
|
if go#config#MetalinterCommand() == "golangci-lint"
|
||||||
return get(g:, "go_metalinter_disabled", [])
|
let l:default_enabled = ["govet", "golint"]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return get(g:, "go_metalinter_enabled", default_enabled)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#GolintBin() abort
|
function! go#config#GolintBin() abort
|
||||||
@@ -308,16 +359,12 @@ function! go#config#DeclsMode() abort
|
|||||||
return get(g:, "go_decls_mode", "")
|
return get(g:, "go_decls_mode", "")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#DocCommand() abort
|
|
||||||
return get(g:, "go_doc_command", ["godoc"])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! go#config#FmtCommand() abort
|
function! go#config#FmtCommand() abort
|
||||||
return get(g:, "go_fmt_command", "gofmt")
|
return get(g:, "go_fmt_command", "gofmt")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#FmtOptions() abort
|
function! go#config#FmtOptions() abort
|
||||||
return get(g:, "go_fmt_options", {})
|
return get(b:, "go_fmt_options", get(g:, "go_fmt_options", {}))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#FmtFailSilently() abort
|
function! go#config#FmtFailSilently() abort
|
||||||
@@ -332,6 +379,11 @@ function! go#config#PlayOpenBrowser() abort
|
|||||||
return get(g:, "go_play_open_browser", 1)
|
return get(g:, "go_play_open_browser", 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#RenameCommand() abort
|
||||||
|
" delegate to go#config#GorenameBin for backwards compatability.
|
||||||
|
return get(g:, "go_rename_command", go#config#GorenameBin())
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#GorenameBin() abort
|
function! go#config#GorenameBin() abort
|
||||||
return get(g:, "go_gorename_bin", "gorename")
|
return get(g:, "go_gorename_bin", "gorename")
|
||||||
endfunction
|
endfunction
|
||||||
@@ -354,6 +406,10 @@ function! go#config#BinPath() abort
|
|||||||
return get(g:, "go_bin_path", "")
|
return get(g:, "go_bin_path", "")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#SearchBinPathFirst() abort
|
||||||
|
return get(g:, 'go_search_bin_path_first', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#HighlightArrayWhitespaceError() abort
|
function! go#config#HighlightArrayWhitespaceError() abort
|
||||||
return get(g:, 'go_highlight_array_whitespace_error', 0)
|
return get(g:, 'go_highlight_array_whitespace_error', 0)
|
||||||
endfunction
|
endfunction
|
||||||
@@ -382,8 +438,9 @@ function! go#config#HighlightFunctions() abort
|
|||||||
return get(g:, 'go_highlight_functions', 0)
|
return get(g:, 'go_highlight_functions', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#HighlightFunctionArguments() abort
|
function! go#config#HighlightFunctionParameters() abort
|
||||||
return get(g:, 'go_highlight_function_arguments', 0)
|
" fallback to highlight_function_arguments for backwards compatibility
|
||||||
|
return get(g:, 'go_highlight_function_parameters', get(g:, 'go_highlight_function_arguments', 0))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! go#config#HighlightFunctionCalls() abort
|
function! go#config#HighlightFunctionCalls() abort
|
||||||
@@ -422,6 +479,18 @@ function! go#config#HighlightVariableDeclarations() abort
|
|||||||
return get(g:, 'go_highlight_variable_declarations', 0)
|
return get(g:, 'go_highlight_variable_declarations', 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#HighlightDiagnosticErrors() abort
|
||||||
|
return get(g:, 'go_highlight_diagnostic_errors', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#HighlightDiagnosticWarnings() abort
|
||||||
|
return get(g:, 'go_highlight_diagnostic_warnings', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#HighlightDebug() abort
|
||||||
|
return get(g:, 'go_highlight_debug', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#config#FoldEnable(...) abort
|
function! go#config#FoldEnable(...) abort
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
return index(go#config#FoldEnable(), a:1) > -1
|
return index(go#config#FoldEnable(), a:1) > -1
|
||||||
@@ -429,12 +498,61 @@ function! go#config#FoldEnable(...) abort
|
|||||||
return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment'])
|
return get(g:, 'go_fold_enable', ['block', 'import', 'varconst', 'package_comment'])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#EchoGoInfo() abort
|
||||||
|
return get(g:, "go_echo_go_info", 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#CodeCompletionEnabled() abort
|
||||||
|
return get(g:, "go_code_completion_enabled", 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#Updatetime() abort
|
||||||
|
let go_updatetime = get(g:, 'go_updatetime', 800)
|
||||||
|
return go_updatetime == 0 ? &updatetime : go_updatetime
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#ReferrersMode() abort
|
||||||
|
return get(g:, 'go_referrers_mode', 'gopls')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsCompleteUnimported() abort
|
||||||
|
return get(g:, 'go_gopls_complete_unimported', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsDeepCompletion() abort
|
||||||
|
return get(g:, 'go_gopls_deep_completion', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsFuzzyMatching() abort
|
||||||
|
return get(g:, 'go_gopls_fuzzy_matching', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsStaticCheck() abort
|
||||||
|
return get(g:, 'go_gopls_staticcheck', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsUsePlaceholders() abort
|
||||||
|
return get(g:, 'go_gopls_use_placeholders', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#GoplsEnabled() abort
|
||||||
|
return get(g:, 'go_gopls_enabled', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#config#DiagnosticsEnabled() abort
|
||||||
|
return get(g:, 'go_diagnostics_enabled', 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Set the default value. A value of "1" is a shortcut for this, for
|
" Set the default value. A value of "1" is a shortcut for this, for
|
||||||
" compatibility reasons.
|
" compatibility reasons.
|
||||||
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
||||||
unlet g:go_gorename_prefill
|
unlet g:go_gorename_prefill
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" restore Vi compatibility settings
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
" vim: sw=2 ts=2 et
|
" vim: sw=2 ts=2 et
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
39
autoload/graphql.vim
Normal file
39
autoload/graphql.vim
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||||
|
|
||||||
|
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org>
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
"
|
||||||
|
" Language: GraphQL
|
||||||
|
" Maintainer: Jon Parise <jon@indelible.org>
|
||||||
|
|
||||||
|
function! graphql#has_syntax_group(group) abort
|
||||||
|
try
|
||||||
|
silent execute 'silent highlight ' . a:group
|
||||||
|
catch
|
||||||
|
return v:false
|
||||||
|
endtry
|
||||||
|
return v:true
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! graphql#javascript_tags() abort
|
||||||
|
return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||||
|
|
||||||
" Vim completion script
|
" Vim completion script
|
||||||
" Language: HTML and XHTML
|
" Language: HTML and XHTML
|
||||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||||
|
|||||||
41
autoload/jsx_pretty/comment.vim
Normal file
41
autoload/jsx_pretty/comment.vim
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
function! jsx_pretty#comment#update_commentstring(original)
|
||||||
|
let syn_current = s:syn_name(line('.'), col('.'))
|
||||||
|
let syn_start = s:syn_name(line('.'), 1)
|
||||||
|
let save_cursor = getcurpos()
|
||||||
|
|
||||||
|
if syn_start =~? '^jsx'
|
||||||
|
let line = getline(".")
|
||||||
|
let start = len(matchstr(line, '^\s*'))
|
||||||
|
let syn_name = s:syn_name(line('.'), start + 1)
|
||||||
|
|
||||||
|
if line =~ '^\s*//'
|
||||||
|
let &l:commentstring = '// %s'
|
||||||
|
elseif s:syn_contains(line('.'), col('.'), 'jsxTaggedRegion')
|
||||||
|
let &l:commentstring = '<!-- %s -->'
|
||||||
|
elseif syn_name =~? '^jsxAttrib'
|
||||||
|
let &l:commentstring = '// %s'
|
||||||
|
else
|
||||||
|
let &l:commentstring = '{/* %s */}'
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let &l:commentstring = a:original
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Restore the cursor position
|
||||||
|
call setpos('.', save_cursor)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:syn_name(lnum, cnum)
|
||||||
|
let syn_id = get(synstack(a:lnum, a:cnum), -1)
|
||||||
|
return synIDattr(syn_id, "name")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:syn_contains(lnum, cnum, syn_name)
|
||||||
|
let stack = synstack(a:lnum, a:cnum)
|
||||||
|
let syn_names = map(stack, 'synIDattr(v:val, "name")')
|
||||||
|
return index(syn_names, a:syn_name) >= 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
306
autoload/jsx_pretty/indent.vim
Normal file
306
autoload/jsx_pretty/indent.vim
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||||
|
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
function! s:sw()
|
||||||
|
return shiftwidth()
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:sw()
|
||||||
|
return &sw
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Regexp for the start tag
|
||||||
|
let s:start_tag = '<\_s*\%(>\|\${\|\%(\<[-:._$A-Za-z0-9]\+\>\)\)'
|
||||||
|
" Regexp for the end tag
|
||||||
|
let s:end_tag = '\%(<\_s*/\_s*\%(\<[-:._$A-Za-z0-9]\+\>\)\_s*>\|/\_s*>\)'
|
||||||
|
|
||||||
|
function s:trim(line)
|
||||||
|
return substitute(a:line, '^\s*\|\s*$', '', 'g')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the syntax stack at the given position
|
||||||
|
function s:syntax_stack_at(lnum, col)
|
||||||
|
return map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the syntax at the given position
|
||||||
|
function s:syntax_at(lnum, col)
|
||||||
|
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the start col of the non-space charactor
|
||||||
|
function s:start_col(lnum)
|
||||||
|
return len(matchstr(getline(a:lnum), '^\s*')) + 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the start syntax of a given line number
|
||||||
|
function s:start_syntax(lnum)
|
||||||
|
return s:syntax_at(a:lnum, s:start_col(a:lnum))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" The skip function for searchpair
|
||||||
|
function s:skip_if_not(current_lnum, ...)
|
||||||
|
" Skip the match in current line
|
||||||
|
if line('.') == a:current_lnum
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let syntax = s:syntax_at(line('.'), col('.'))
|
||||||
|
return syntax !~? join(a:000, '\|')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified stytax group is the opening tag
|
||||||
|
function s:is_opening_tag(syntax)
|
||||||
|
return a:syntax =~? 'jsxOpenPunct'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified stytax group is the closing tag
|
||||||
|
function s:is_closing_tag(syntax)
|
||||||
|
return a:syntax =~? 'jsxClose'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxRegion
|
||||||
|
function s:is_jsx_region(syntax)
|
||||||
|
return a:syntax =~? 'jsxRegion'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxElement
|
||||||
|
function s:is_jsx_element(syntax)
|
||||||
|
return a:syntax =~? 'jsxElement'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxExpressionBlock
|
||||||
|
function s:is_jsx_expression(syntax)
|
||||||
|
return a:syntax =~? 'jsxExpressionBlock'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxBraces
|
||||||
|
function s:is_jsx_brace(syntax)
|
||||||
|
return a:syntax =~? 'jsxBraces'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxComment
|
||||||
|
function s:is_jsx_comment(syntax)
|
||||||
|
return a:syntax =~? 'jsxComment'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified line is comment related syntax
|
||||||
|
function s:is_comment(syntax)
|
||||||
|
return a:syntax =~? 'comment'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the specified syntax group is the jsxComment
|
||||||
|
function s:is_jsx_backticks(syntax)
|
||||||
|
return a:syntax =~? 'jsxBackticks'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Get the prvious line number
|
||||||
|
function s:prev_lnum(lnum)
|
||||||
|
return prevnonblank(a:lnum - 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Whether the given pos is the parent of the given element who has
|
||||||
|
" element_count jsxElement syntax
|
||||||
|
function s:is_parent_element(pos, element_count)
|
||||||
|
let syntax_stack = s:syntax_stack_at(a:pos[0], a:pos[1])
|
||||||
|
return s:is_opening_tag(syntax_stack[-1]) &&
|
||||||
|
\ count(syntax_stack, 'jsxElement') <= a:element_count
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Compute the indention of the trail punct
|
||||||
|
function s:jsx_indent_trail_punct(lnum)
|
||||||
|
let pair_line = searchpair('<', '', '>', 'bW', 's:skip_if_not(a:lnum, "jsxOpenPunct", "jsxClose")')
|
||||||
|
return indent(pair_line)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Compute the indention of the closing tag
|
||||||
|
function s:jsx_indent_closing_tag(lnum)
|
||||||
|
let pair_line = searchpair(s:start_tag, '', s:end_tag, 'bW', 's:skip_if_not(a:lnum, "jsxOpenPunct", "jsxClose")')
|
||||||
|
return pair_line ? indent(pair_line) : indent(a:lnum)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Compute the indentation of the jsxElement
|
||||||
|
function s:jsx_indent_element(lnum)
|
||||||
|
let syntax_stack = s:syntax_stack_at(a:lnum, s:start_col(a:lnum))
|
||||||
|
let syntax_name = syntax_stack[-1]
|
||||||
|
let element_count = count(syntax_stack, 'jsxElement')
|
||||||
|
|
||||||
|
if s:trim(getline(a:lnum)) =~ '^>'
|
||||||
|
return s:jsx_indent_trail_punct(a:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If current tag is closing tag
|
||||||
|
if s:is_closing_tag(syntax_name)
|
||||||
|
return s:jsx_indent_closing_tag(a:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Normalize the jsxElement count for opening tag
|
||||||
|
if s:is_opening_tag(syntax_name)
|
||||||
|
" <div>
|
||||||
|
" <div></div> <-- jsxRegion->jsxElement->jsxElement->jsxTag->jsxOpenTag->jsxOpenPunct
|
||||||
|
" </div>
|
||||||
|
if s:is_jsx_element(syntax_stack[-4]) && s:is_jsx_element(syntax_stack[-5])
|
||||||
|
let element_count = element_count - 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let start_time = localtime()
|
||||||
|
let pos = searchpos(s:start_tag, 'bW')
|
||||||
|
|
||||||
|
while !s:is_parent_element(pos, element_count)
|
||||||
|
if localtime() - start_time >= 0.5
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
let pos = searchpos(s:start_tag, 'bW')
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return indent(pos[0]) + s:sw()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Compute the indentation of the comment
|
||||||
|
function s:jsx_indent_comment(lnum)
|
||||||
|
let line = s:trim(getline(a:lnum))
|
||||||
|
|
||||||
|
if s:is_jsx_comment(s:start_syntax(a:lnum))
|
||||||
|
if line =~ '^<!--' || line =~ '^-->'
|
||||||
|
return s:jsx_indent_element(a:lnum)
|
||||||
|
else
|
||||||
|
return s:jsx_indent_element(a:lnum) + s:sw()
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if line =~ '^/\*' || line =~ '^//'
|
||||||
|
return s:jsx_indent_element(a:lnum)
|
||||||
|
else
|
||||||
|
return s:jsx_indent_element(a:lnum) + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Compute the indentation of jsxBackticks
|
||||||
|
function s:jsx_indent_backticks(lnum)
|
||||||
|
let tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
|
||||||
|
let start_tag = '\%(' . join(tags, '\|') . '\)`'
|
||||||
|
let end_tag = '\%(' . join(tags, '\|') . '\)\@<!`'
|
||||||
|
let pair_line = searchpair(start_tag, '', end_tag, 'bW', 's:skip_if_not(a:lnum)')
|
||||||
|
|
||||||
|
return indent(pair_line)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Syntax context types:
|
||||||
|
" - jsxRegion
|
||||||
|
" - jsxTaggedRegion
|
||||||
|
" - jsxElement
|
||||||
|
" - jsxExpressionBlock
|
||||||
|
" - Other
|
||||||
|
function s:syntax_context(lnum)
|
||||||
|
let start_col = s:start_col(a:lnum)
|
||||||
|
let syntax_stack = s:syntax_stack_at(a:lnum, start_col)
|
||||||
|
let start_syntax = syntax_stack[-1]
|
||||||
|
let reversed = reverse(syntax_stack)
|
||||||
|
let i = 0
|
||||||
|
|
||||||
|
for syntax_name in reversed
|
||||||
|
" If the current line is jsxExpressionBlock and not starts with jsxBraces
|
||||||
|
if s:is_jsx_expression(syntax_name)
|
||||||
|
return 'jsxExpressionBlock'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_jsx_region(syntax_name)
|
||||||
|
return 'jsxRegion'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_jsx_element(syntax_name)
|
||||||
|
" If current line starts with the opening tag
|
||||||
|
if s:is_opening_tag(start_syntax) || s:is_closing_tag(start_syntax)
|
||||||
|
" And the next syntax is jsxRegion
|
||||||
|
if s:is_jsx_region(reversed[i+1])
|
||||||
|
return 'jsxRegion'
|
||||||
|
elseif reversed[i+1] =~ 'jsxTaggedRegion'
|
||||||
|
return 'jsxTaggedRegion'
|
||||||
|
else
|
||||||
|
return 'jsxElement'
|
||||||
|
endif
|
||||||
|
elseif reversed[i+1] =~ 'jsxTaggedRegion'
|
||||||
|
return 'jsxTaggedRegion'
|
||||||
|
else
|
||||||
|
return 'jsxElement'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = i + 1
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return 'Other'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jsx_pretty#indent#get(js_indent)
|
||||||
|
let line = s:trim(getline(v:lnum))
|
||||||
|
let start_syntax = s:start_syntax(v:lnum)
|
||||||
|
|
||||||
|
if s:is_jsx_backticks(start_syntax)
|
||||||
|
return s:jsx_indent_backticks(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_jsx_brace(start_syntax)
|
||||||
|
return s:jsx_indent_element(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_opening_tag(start_syntax) && line =~ '^>'
|
||||||
|
return s:jsx_indent_trail_punct(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let syntax_context = s:syntax_context(v:lnum)
|
||||||
|
|
||||||
|
if syntax_context == 'jsxRegion'
|
||||||
|
if s:is_closing_tag(start_syntax)
|
||||||
|
return s:jsx_indent_closing_tag(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let prev_lnum = s:prev_lnum(v:lnum)
|
||||||
|
let prev_line = s:trim(getline(prev_lnum))
|
||||||
|
|
||||||
|
if prev_line =~ '[([{=?]$'
|
||||||
|
return indent(prev_lnum) + s:sw()
|
||||||
|
elseif prev_line =~ '[:|&<>]$' &&
|
||||||
|
\ s:trim(getline(s:prev_lnum(prev_lnum))) !~ '[?:|&<>]$'
|
||||||
|
return indent(prev_lnum) + s:sw()
|
||||||
|
else
|
||||||
|
return indent(prev_lnum)
|
||||||
|
endif
|
||||||
|
elseif syntax_context == 'jsxTaggedRegion'
|
||||||
|
if s:is_closing_tag(start_syntax)
|
||||||
|
return s:jsx_indent_closing_tag(v:lnum)
|
||||||
|
elseif s:is_jsx_comment(start_syntax)
|
||||||
|
return s:jsx_indent_comment(v:lnum)
|
||||||
|
else
|
||||||
|
return indent(s:prev_lnum(v:lnum)) + s:sw()
|
||||||
|
endif
|
||||||
|
elseif syntax_context == 'jsxElement'
|
||||||
|
if s:is_jsx_comment(start_syntax)
|
||||||
|
return s:jsx_indent_comment(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:is_comment(start_syntax)
|
||||||
|
return s:jsx_indent_comment(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:jsx_indent_element(v:lnum)
|
||||||
|
elseif syntax_context == 'jsxExpressionBlock'
|
||||||
|
let prev_lnum = s:prev_lnum(v:lnum)
|
||||||
|
let prev_line = s:trim(getline(prev_lnum))
|
||||||
|
|
||||||
|
if line =~ '^?'
|
||||||
|
return indent(prev_lnum) + s:sw()
|
||||||
|
elseif line =~ '^:'
|
||||||
|
return indent(prev_lnum)
|
||||||
|
else
|
||||||
|
return a:js_indent()
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return a:js_indent()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
function! julia#set_syntax_version(jvers)
|
function! julia#set_syntax_version(jvers)
|
||||||
if &filetype != "julia"
|
if &filetype != "julia"
|
||||||
echo "Not a Julia file"
|
echo "Not a Julia file"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
" path to the julia binary to communicate with
|
" path to the julia binary to communicate with
|
||||||
if has('win32') || has('win64')
|
if has('win32') || has('win64')
|
||||||
if exists('g:julia#doc#juliapath')
|
if exists('g:julia#doc#juliapath')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
" Facilities for moving around Julia blocks (e.g. if/end, function/end etc.)
|
" Facilities for moving around Julia blocks (e.g. if/end, function/end etc.)
|
||||||
" (AKA a collection of horrible hacks)
|
" (AKA a collection of horrible hacks)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||||
|
|
||||||
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
|
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
|
||||||
" The symbols are based on Julia version 0.7.0-rc2.0
|
" The symbols are based on Julia version 1.3.0-DEV.263
|
||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
@@ -390,6 +390,7 @@ function! julia_latex_symbols#get_dict()
|
|||||||
\ '\trademark': '™',
|
\ '\trademark': '™',
|
||||||
\ '\:tm:': '™',
|
\ '\:tm:': '™',
|
||||||
\ '\bbZ': 'ℤ',
|
\ '\bbZ': 'ℤ',
|
||||||
|
\ '\ohm': 'Ω',
|
||||||
\ '\mho': '℧',
|
\ '\mho': '℧',
|
||||||
\ '\frakZ': 'ℨ',
|
\ '\frakZ': 'ℨ',
|
||||||
\ '\turnediota': '℩',
|
\ '\turnediota': '℩',
|
||||||
@@ -496,8 +497,8 @@ function! julia_latex_symbols#get_dict()
|
|||||||
\ '\circlearrowright': '↻',
|
\ '\circlearrowright': '↻',
|
||||||
\ '\leftharpoonup': '↼',
|
\ '\leftharpoonup': '↼',
|
||||||
\ '\leftharpoondown': '↽',
|
\ '\leftharpoondown': '↽',
|
||||||
\ '\upharpoonleft': '↾',
|
\ '\upharpoonright': '↾',
|
||||||
\ '\upharpoonright': '↿',
|
\ '\upharpoonleft': '↿',
|
||||||
\ '\rightharpoonup': '⇀',
|
\ '\rightharpoonup': '⇀',
|
||||||
\ '\rightharpoondown': '⇁',
|
\ '\rightharpoondown': '⇁',
|
||||||
\ '\downharpoonright': '⇂',
|
\ '\downharpoonright': '⇂',
|
||||||
|
|||||||
536
autoload/pony.vim
Normal file
536
autoload/pony.vim
Normal file
@@ -0,0 +1,536 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pony') == -1
|
||||||
|
|
||||||
|
" Vim plugin file
|
||||||
|
" Language: Pony
|
||||||
|
" Maintainer: Jak Wings
|
||||||
|
|
||||||
|
" TODO: Make sure echomsg is off for release.
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
|
||||||
|
"let s:skip = '<SID>InCommentOrLiteral(line("."), col("."))'
|
||||||
|
let s:skip2 = '<SID>InLiteral(line("."), col(".")) || <SID>InComment(line("."), col(".")) == 1'
|
||||||
|
let s:skip3 = '!<SID>InKeyword(line("."), col("."))'
|
||||||
|
let s:skip4 = '!<SID>InBracket(line("."), col("."))'
|
||||||
|
let s:cfstart = '\v<%(ifdef|if|match|while|for|repeat|try|with|recover|object|lambda|iftype)>'
|
||||||
|
let s:cfmiddle = '\v<%(then|elseif|else|until|do|in|elseiftype)>|\|'
|
||||||
|
let s:cfend = '\v<end>'
|
||||||
|
let s:bstartp = '\v<%(ifdef|if|then|elseif|else|(match)|while|for|in|do|try|with|recover|repeat|until|(object)|lambda|iftype|elseiftype)>'
|
||||||
|
|
||||||
|
function! pony#Indent()
|
||||||
|
if v:lnum <= 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let l:pnzpos = searchpos('.', 'cbnW')
|
||||||
|
if l:pnzpos == [0, 0]
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:InComment2(l:pnzpos) > 1
|
||||||
|
"echomsg 'Comment' (l:pnzpos[0] . '-' . v:lnum) -1
|
||||||
|
return cindent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:InLiteral2(l:pnzpos)
|
||||||
|
"echomsg 'String' (l:pnzpos[0] . '-' . v:lnum) -1
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:pnzpos
|
||||||
|
|
||||||
|
" NOTE: Lines started in comments and strings are checked already.
|
||||||
|
|
||||||
|
let l:pnblnum = s:PrevNonblank(v:lnum - 1)
|
||||||
|
if l:pnblnum < 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:pnbline = getline(l:pnblnum)
|
||||||
|
let l:pnbindent = indent(l:pnblnum)
|
||||||
|
|
||||||
|
let l:line = getline(v:lnum)
|
||||||
|
let l:indent = l:pnbindent
|
||||||
|
let l:shiftwidth = shiftwidth()
|
||||||
|
|
||||||
|
" FIXME?
|
||||||
|
let l:continuing = 0
|
||||||
|
" If the previous line ends with a unary or binary operator,
|
||||||
|
if s:IsContinued(l:pnblnum)
|
||||||
|
let l:contlnum = l:pnblnum
|
||||||
|
let l:ppcontinued = 0
|
||||||
|
let l:ppnblnum = s:PrevNonblank(l:pnblnum - 1)
|
||||||
|
while s:IsContinued(l:ppnblnum)
|
||||||
|
let l:ppcontinued += 1
|
||||||
|
let l:contlnum = l:ppnblnum
|
||||||
|
let l:ppnblnum = s:PrevNonblank(l:ppnblnum - 1)
|
||||||
|
endwhile
|
||||||
|
"echomsg 'Continued1' l:pnblnum l:contlnum
|
||||||
|
" If the previous line is also continuing another line,
|
||||||
|
if l:ppcontinued
|
||||||
|
let l:continuing = 1
|
||||||
|
if getline(l:contlnum) =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||||
|
" reset the indent level.
|
||||||
|
"echomsg 'Continuing0' (l:contlnum . '-' . v:lnum) (l:shiftwidth * 2)
|
||||||
|
let l:indent = l:shiftwidth * 2
|
||||||
|
else
|
||||||
|
" keep using the previous indent.
|
||||||
|
"echomsg 'Continuing1' (l:pnblnum . '-' . v:lnum) l:pnbindent
|
||||||
|
let l:indent = l:pnbindent
|
||||||
|
endif
|
||||||
|
" if the previous line is part of the definition of a class,
|
||||||
|
elseif l:pnbline =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||||
|
" reset the indent level.
|
||||||
|
"echomsg 'Continuing2' (l:pnblnum . '-' . v:lnum) (l:shiftwidth * 2)
|
||||||
|
let l:continuing = 1
|
||||||
|
let l:indent = l:shiftwidth * 2
|
||||||
|
" if the previous line is part of the definition of a method,
|
||||||
|
elseif l:pnbline =~# '\v^\s*%(fun|new|be)>'
|
||||||
|
" reset the indent level.
|
||||||
|
"echomsg 'Continuing3' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||||
|
let l:continuing = 1
|
||||||
|
let l:indent = l:pnbindent + l:shiftwidth
|
||||||
|
" if the previous line is the start of a definition body,
|
||||||
|
elseif l:pnbline =~# '=>\s*$'
|
||||||
|
" indent this line.
|
||||||
|
"echomsg 'Continuing4' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||||
|
let l:continuing = 1
|
||||||
|
let l:indent = l:pnbindent + l:shiftwidth
|
||||||
|
else
|
||||||
|
" indent this line twice as far.
|
||||||
|
"echomsg 'Continuing5' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth * 2)
|
||||||
|
let l:continuing = 1
|
||||||
|
let l:indent = l:pnbindent + l:shiftwidth * 2
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:contlnum l:ppnblnum l:ppcontinued
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line starts a document string,
|
||||||
|
if !l:continuing && l:line =~# '^\s*"""'
|
||||||
|
let l:ppnblnum = s:PrevNonblank(l:pnblnum - 1)
|
||||||
|
if s:IsContinued(l:ppnblnum)
|
||||||
|
let l:contlnum = l:ppnblnum
|
||||||
|
while s:IsContinued(l:ppnblnum)
|
||||||
|
let l:contlnum = l:ppnblnum
|
||||||
|
let l:ppnblnum = s:PrevNonblank(l:ppnblnum - 1)
|
||||||
|
endwhile
|
||||||
|
if getline(l:contlnum) =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||||
|
" reset the indent level.
|
||||||
|
"echomsg 'DocString' (l:contlnum . '-' . v:lnum) l:shiftwidth
|
||||||
|
return l:shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:contlnum l:ppnblnum
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line contains an unmatched opening bracket
|
||||||
|
if !l:continuing && l:pnbline =~# '[{[(]'
|
||||||
|
" if the line ends with an opening bracket,
|
||||||
|
if l:pnbline =~# '[{[(]\s*$' && !s:InCommentOrLiteral(l:pnblnum, col([l:pnblnum, '$']) - 1)
|
||||||
|
" indent this line.
|
||||||
|
let l:indent += l:shiftwidth
|
||||||
|
else
|
||||||
|
" find the unmatched opening bracket,
|
||||||
|
let l:start = [0, 0]
|
||||||
|
let l:end = col([l:pnblnum, '$']) - 1
|
||||||
|
call cursor(l:pnblnum, l:end)
|
||||||
|
while l:end > 0
|
||||||
|
let l:start = s:OuterPos(l:start, searchpairpos('(', '', ')', 'bnW', s:skip4, l:pnblnum))
|
||||||
|
let l:start = s:OuterPos(l:start, searchpairpos('\[', '', '\]', 'bnW', s:skip4, l:pnblnum))
|
||||||
|
let l:start = s:OuterPos(l:start, searchpairpos('{', '', '}', 'bnW', s:skip4, l:pnblnum))
|
||||||
|
if l:start == [0, 0]
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
" find the matched closing bracket on the same line,
|
||||||
|
call cursor(l:start[0], l:start[1])
|
||||||
|
let l:c = s:CharAtCursor(l:start[0], l:start[1])
|
||||||
|
if searchpair(escape(l:c, '['), '', escape(tr(l:c, '([{', ')]}'), ']'),
|
||||||
|
\ 'znW', s:skip4, l:pnblnum) < 1
|
||||||
|
" the unmatched opening bracket is found,
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let l:end = l:start[1]
|
||||||
|
let l:start = [0, 0]
|
||||||
|
endwhile
|
||||||
|
if l:start != [0, 0]
|
||||||
|
" indent this line.
|
||||||
|
"echomsg 'Open bracket' (l:pnblnum . '-' . v:lnum) (l:indent + l:shiftwidth)
|
||||||
|
let l:indent += l:shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start l:end l:c
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If there is a matched closing bracket on the previous line,
|
||||||
|
" NOTE:
|
||||||
|
" >|[
|
||||||
|
" | (1 -
|
||||||
|
" | 1) * 2]
|
||||||
|
" | command
|
||||||
|
" ^
|
||||||
|
if !l:continuing
|
||||||
|
call cursor(l:pnblnum, 1)
|
||||||
|
" find the last closing bracket,
|
||||||
|
let l:end = [0, 0]
|
||||||
|
let l:end = s:OuterPos(l:end, searchpairpos('(', '', ')', 'zncr', s:skip4, l:pnblnum))
|
||||||
|
let l:end = s:OuterPos(l:end, searchpairpos('\[', '', '\]', 'zncr', s:skip4, l:pnblnum))
|
||||||
|
let l:end = s:OuterPos(l:end, searchpairpos('{', '', '}', 'zncr', s:skip4, l:pnblnum))
|
||||||
|
if l:end != [0, 0]
|
||||||
|
" find the matched opening bracket on another line,
|
||||||
|
let l:c = s:CharAtCursor(l:end[0], l:end[1])
|
||||||
|
let l:start = searchpairpos(escape(tr(l:c, ')]}', '([{'), '['), '', escape(l:c, ']'), 'nbW', s:skip4)
|
||||||
|
if l:start[0] != l:end[0]
|
||||||
|
" and then this line has the same indent as the line the matched bracket stays.
|
||||||
|
"echomsg 'Matched bracket' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||||
|
let l:indent = indent(l:start[0])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start l:end l:c
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If there is a matched closing bracket on this line,
|
||||||
|
" NOTE:
|
||||||
|
" |[
|
||||||
|
" >| (1 -
|
||||||
|
" | 1) * 2
|
||||||
|
" |]
|
||||||
|
" ^ ^
|
||||||
|
if l:line =~# '^\s*[)\]}]'
|
||||||
|
" find the first closing bracket,
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let l:end = [0, 0]
|
||||||
|
let l:end = s:InnerPos(l:end, searchpairpos('(', '', ')', 'zncW', s:skip4, v:lnum))
|
||||||
|
let l:end = s:InnerPos(l:end, searchpairpos('\[', '', '\]', 'zncW', s:skip4, v:lnum))
|
||||||
|
let l:end = s:InnerPos(l:end, searchpairpos('{', '', '}', 'zncW', s:skip4, v:lnum))
|
||||||
|
if l:end != [0, 0]
|
||||||
|
" find the matched opening bracket on another line,
|
||||||
|
let l:c = s:CharAtCursor(l:end[0], l:end[1])
|
||||||
|
let l:start = searchpairpos(escape(tr(l:c, ')]}', '([{'), '['), '', escape(l:c, ']'), 'nbW', s:skip4)
|
||||||
|
if l:start[0] != l:end[0]
|
||||||
|
" and then this line has the same indent as the line the matched bracket stays.
|
||||||
|
"echomsg 'Closing Bracket' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||||
|
let l:indent = indent(l:start[0])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start l:end l:c
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line starts the definition of a method, closure or match case,
|
||||||
|
if l:line =~# '^\s*=>'
|
||||||
|
" find the start of the definition,
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let l:start = searchpairpos('\v<%(new|be|fun|lambda)>|\|', '', '=>\zs', 'bnW', s:skip3)
|
||||||
|
if l:start != [0, 0]
|
||||||
|
" then this line has the same indent as the start.
|
||||||
|
"echomsg 'Method body' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||||
|
return indent(l:start[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line starts a class definition or starts an alias,
|
||||||
|
if l:line =~# '\v^\s*%(actor|class|struct|primitive|trait|interface|use|type)>'
|
||||||
|
" reset the indent level.
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line starts a method definition,
|
||||||
|
if l:line =~# '\v^\s*%(new|be|fun)>'
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bW', s:skip3)
|
||||||
|
if l:start != [0, 0]
|
||||||
|
let l:start = searchpos(s:bstartp, 'zcnpW', l:start[0])
|
||||||
|
" see if it is in an object block,
|
||||||
|
if l:start[2] == 3
|
||||||
|
"echomsg 'Method in object' (l:start[0] . '-' . v:lnum) (l:shiftwidth + indent(l:start[0]))
|
||||||
|
return l:shiftwidth + indent(l:start[0])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return l:shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line starts a match case,
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
if l:line =~# '^\s*|' && s:InKeyword(searchpos('|', 'znW', v:lnum))
|
||||||
|
" find the start or the previous case of the match block,
|
||||||
|
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bnW', s:skip3)
|
||||||
|
if l:start != [0, 0]
|
||||||
|
" then this line has the same indent as the start.
|
||||||
|
"echomsg 'Match case' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||||
|
return indent(l:start[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If this line ends (part of) a control flow,
|
||||||
|
if l:line =~# '\v^\s*%(end|elseif|else|then|in|do|until|elseiftype)>'
|
||||||
|
" find the start or middle of the control block,
|
||||||
|
call cursor(v:lnum, 1)
|
||||||
|
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bnW', s:skip3)
|
||||||
|
if l:start != [0, 0]
|
||||||
|
" then this line has the same indent as the start.
|
||||||
|
"echomsg 'Block end' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||||
|
return indent(l:start[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
unlet! l:start
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line starts a class definition,
|
||||||
|
if l:pnbline =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||||
|
" reset the indent level.
|
||||||
|
if s:IsContinued(l:pnblnum)
|
||||||
|
return l:shiftwidth * 2
|
||||||
|
else
|
||||||
|
return l:shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line starts a method definition,
|
||||||
|
if l:pnbline =~# '\v^\s*%(new|be|fun)>'
|
||||||
|
return l:pnbindent + l:shiftwidth
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the previous line starts (part of) a control flow,
|
||||||
|
call cursor(l:pnblnum, 1)
|
||||||
|
while 1
|
||||||
|
" find the start of the control block,
|
||||||
|
let l:start = searchpos(s:bstartp, 'zcepW', l:pnblnum)
|
||||||
|
if l:start[2] == 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
if !s:InKeyword(l:start[0:1])
|
||||||
|
call cursor(l:pnblnum, l:start[1] + 3)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
let l:index = l:start[2]
|
||||||
|
" find the end of the control block on the same line,
|
||||||
|
let l:end = searchpair(s:cfstart, '', s:cfend, 'znW', s:skip3, l:pnblnum)
|
||||||
|
" if the control block is not ended,
|
||||||
|
if l:end < 1
|
||||||
|
" if this line is a case for a match,
|
||||||
|
if l:index == 2 && l:line =~# '^\s*|'
|
||||||
|
" then this line has the same indent as the start of the match block.
|
||||||
|
return l:pnbindent
|
||||||
|
else
|
||||||
|
" then indent this line.
|
||||||
|
"echomsg 'Block start' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||||
|
return l:pnbindent + l:shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
unlet! l:start l:end l:index
|
||||||
|
|
||||||
|
return l:indent
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:PrevNonblank(lnum)
|
||||||
|
let l:lnum = prevnonblank(a:lnum)
|
||||||
|
while l:lnum > 0 && (s:InComment2(l:lnum, 1) || s:InLiteral2(l:lnum, 1))
|
||||||
|
let l:lnum = prevnonblank(l:lnum - 1)
|
||||||
|
endwhile
|
||||||
|
return l:lnum
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" v
|
||||||
|
" |1 /* comment */
|
||||||
|
" |2
|
||||||
|
function! s:IsContinued(lnum)
|
||||||
|
let l:lnum = s:PrevNonblank(a:lnum)
|
||||||
|
if l:lnum < 1
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let l:line = getline(l:lnum)
|
||||||
|
let l:width = strwidth(substitute(l:line, '\s*$', '', ''))
|
||||||
|
" FIXME?
|
||||||
|
" | 1 + //
|
||||||
|
" | //
|
||||||
|
" | 2
|
||||||
|
return !s:InCommentOrLiteral(a:lnum, l:width)
|
||||||
|
\ && (l:line =~# '\v<%(and|or|xor|is|isnt|as|not|consume|addressof|digestof)\s*$'
|
||||||
|
\ || l:line =~# '\v%([=\-.]\>|[<!=>]\=\~?|\<\<\~?|\>\>\~?|\<:|[+\-*/%<>]\~?|[.,|:@~])\s*$'
|
||||||
|
\ )
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InCommentOrLiteral(...)
|
||||||
|
return call('s:InComment', a:000) || call('s:InLiteral', a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InKeyword(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
for id in s:Or(synstack(l:lnum, l:col), [])
|
||||||
|
if synIDattr(id, 'name') =~# '^ponyKw'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InBracket(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
for id in s:Or(synstack(l:lnum, l:col), [])
|
||||||
|
if synIDattr(id, 'name') ==# 'ponyBracket'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InComment(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
let l:stack = synstack(l:lnum, l:col)
|
||||||
|
let l:i = len(l:stack)
|
||||||
|
while l:i > 0
|
||||||
|
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||||
|
if l:sname =~# '^ponyNestedCommentX\?$'
|
||||||
|
return 1 + l:i - (l:sname =~# 'X$')
|
||||||
|
elseif l:sname =~# '^ponyCommentX\?$'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let l:i -= 1
|
||||||
|
endwhile
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InLiteral(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
let l:stack = synstack(l:lnum, l:col)
|
||||||
|
let l:i = len(l:stack)
|
||||||
|
while l:i > 0
|
||||||
|
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||||
|
if l:sname =~# '^ponyDocumentStringX\?$'
|
||||||
|
return 3
|
||||||
|
elseif l:sname =~# '^ponyStringX\?$'
|
||||||
|
return 2
|
||||||
|
elseif l:sname =~# '^ponyCharacterX\?$'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let l:i -= 1
|
||||||
|
endwhile
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" |// //inside
|
||||||
|
" ^^^^^^^^^^
|
||||||
|
" |/* /*inside*/ */
|
||||||
|
" ^^^^^^^^^^^^^^
|
||||||
|
function! s:InComment2(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
let l:stack = synstack(l:lnum, l:col)
|
||||||
|
let l:i = len(l:stack)
|
||||||
|
while l:i > 0
|
||||||
|
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||||
|
if l:sname ==# 'ponyNestedComment'
|
||||||
|
return 1 + l:i
|
||||||
|
elseif l:sname ==# 'ponyComment'
|
||||||
|
return 1
|
||||||
|
elseif l:sname =~# '\v^pony%(Nested)?CommentX$'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let l:i -= 1
|
||||||
|
endwhile
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" NOTE:
|
||||||
|
" |"inside"
|
||||||
|
" ^^^^^^
|
||||||
|
" |"""inside"""""
|
||||||
|
" ^^^^^^^^^^^^
|
||||||
|
function! s:InLiteral2(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
let l:stack = synstack(l:lnum, l:col)
|
||||||
|
let l:i = len(l:stack)
|
||||||
|
while l:i > 0
|
||||||
|
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||||
|
if l:sname ==# 'ponyDocumentString'
|
||||||
|
return 3
|
||||||
|
elseif l:sname ==# 'ponyString'
|
||||||
|
return 2
|
||||||
|
elseif l:sname ==# 'ponyCharacter'
|
||||||
|
return 1
|
||||||
|
elseif l:sname =~# '\v^pony%(DocumentString|String|Character)X$'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let l:i -= 1
|
||||||
|
endwhile
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:CharAtCursor(...)
|
||||||
|
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||||
|
return matchstr(getline(l:lnum), '\%' . l:col . 'c.')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Or(x, y)
|
||||||
|
return !empty(a:x) ? a:x : a:y
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InnerPos(x, y)
|
||||||
|
if a:x == [0, 0]
|
||||||
|
return a:y
|
||||||
|
elseif a:y == [0, 0]
|
||||||
|
return a:x
|
||||||
|
else
|
||||||
|
return a:x[1] < a:y[1] ? a:x : a:y
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:OuterPos(x, y)
|
||||||
|
if a:x == [0, 0]
|
||||||
|
return a:y
|
||||||
|
elseif a:y == [0, 0]
|
||||||
|
return a:x
|
||||||
|
else
|
||||||
|
return a:x[1] > a:y[1] ? a:x : a:y
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! pony#ClearTrailingSpace(all, alt, ...)
|
||||||
|
let l:force = (a:0 > 0 ? a:1 : 0)
|
||||||
|
if !l:force && (&readonly || !&modifiable || !&modified)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
if a:all
|
||||||
|
for lnum in range(1, line('$'))
|
||||||
|
let l:line = getline(lnum)
|
||||||
|
let l:end = col([lnum, '$']) - 1
|
||||||
|
if l:end > 0 && l:line =~# '\s$' && !s:InLiteral(lnum, l:end)
|
||||||
|
if a:alt
|
||||||
|
call setline(lnum, substitute(l:line, '\S\@<=\s\s*$', '', ''))
|
||||||
|
else
|
||||||
|
call setline(lnum, substitute(l:line, '\s\+$', '', ''))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
else
|
||||||
|
let l:lnum = line('.')
|
||||||
|
let l:end = col('$') - 1
|
||||||
|
let l:line = getline(l:lnum)
|
||||||
|
if l:line =~# '\s$' && !s:InLiteral(l:lnum, l:end)
|
||||||
|
if a:alt
|
||||||
|
call setline(l:lnum, substitute(l:line, '\s\+$', '', ''))
|
||||||
|
else
|
||||||
|
call setline(l:lnum, substitute(l:line, '\S\@<=\s\s*$', '', ''))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
endif
|
||||||
72
autoload/puppet/align.vim
Normal file
72
autoload/puppet/align.vim
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||||
|
|
||||||
|
function! puppet#align#IndentLevel(lnum)
|
||||||
|
return indent(a:lnum) / &shiftwidth
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! puppet#align#LinesInBlock(lnum)
|
||||||
|
let lines = []
|
||||||
|
let indent_level = puppet#align#IndentLevel(a:lnum)
|
||||||
|
|
||||||
|
let marker = a:lnum - 1
|
||||||
|
while marker >= 1
|
||||||
|
let line_text = getline(marker)
|
||||||
|
let line_indent = puppet#align#IndentLevel(marker)
|
||||||
|
|
||||||
|
if line_text =~? '\v\S'
|
||||||
|
if line_indent < indent_level
|
||||||
|
break
|
||||||
|
elseif line_indent == indent_level
|
||||||
|
call add(lines, marker)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let marker -= 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
let marker = a:lnum
|
||||||
|
while marker <= line('$')
|
||||||
|
let line_text = getline(marker)
|
||||||
|
let line_indent = puppet#align#IndentLevel(marker)
|
||||||
|
|
||||||
|
if line_text =~? '\v\S'
|
||||||
|
if line_indent < indent_level
|
||||||
|
break
|
||||||
|
elseif line_indent == indent_level
|
||||||
|
call add(lines, marker)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let marker += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return lines
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format lines with hashrocket (=>)
|
||||||
|
" @param a:1 a line where function should search for first hashrocket
|
||||||
|
" expression, if param is not given, line with active cursor is used
|
||||||
|
function! puppet#align#AlignHashrockets(...) abort
|
||||||
|
let l:lnum = get(a:, 1, line('.'))
|
||||||
|
let lines_in_block = puppet#align#LinesInBlock(l:lnum)
|
||||||
|
let max_left_len = 0
|
||||||
|
let indent_str = printf('%' . indent(l:lnum) . 's', '')
|
||||||
|
|
||||||
|
for line_num in lines_in_block
|
||||||
|
let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$')
|
||||||
|
if !empty(data)
|
||||||
|
let max_left_len = max([max_left_len, strlen(data[1])])
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
for line_num in lines_in_block
|
||||||
|
let data = matchlist(getline(line_num), '^\s*\(.\{-}\S\)\s*=>\s*\(.*\)$')
|
||||||
|
if !empty(data)
|
||||||
|
let new_line = printf('%s%-' . max_left_len . 's => %s', indent_str, data[1], data[2])
|
||||||
|
call setline(line_num, new_line)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
40
autoload/puppet/ctags.vim
Normal file
40
autoload/puppet/ctags.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||||
|
|
||||||
|
|
||||||
|
if !exists('s:ctags_type')
|
||||||
|
let s:ctags_type = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:ctags_options_dir = expand('<sfile>:p:h:h:h') . '/ctags/'
|
||||||
|
|
||||||
|
" Return full path to option file for ctags application
|
||||||
|
function! puppet#ctags#OptionFile()
|
||||||
|
|
||||||
|
if puppet#ctags#Type() == 'universal'
|
||||||
|
let l:ctags_options = 'puppet_u.ctags'
|
||||||
|
else
|
||||||
|
let l:ctags_options = 'puppet.ctags'
|
||||||
|
endif
|
||||||
|
return s:ctags_options_dir . l:ctags_options
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Return type of installed ctags application,
|
||||||
|
" can be 'universal' or 'exuberant'
|
||||||
|
function! puppet#ctags#Type()
|
||||||
|
|
||||||
|
if !s:ctags_type
|
||||||
|
let l:version = system('ctags --version')
|
||||||
|
if l:version =~ 'Universal Ctags'
|
||||||
|
let s:ctags_type = 'universal'
|
||||||
|
elseif l:version =~ 'Exuberant Ctags'
|
||||||
|
let s:ctags_type = 'exuberant'
|
||||||
|
else
|
||||||
|
echoerr 'Unknown version of Ctags'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:ctags_type
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
74
autoload/puppet/format.vim
Normal file
74
autoload/puppet/format.vim
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||||
|
|
||||||
|
"
|
||||||
|
" Simple format using puppet's l:indents and align hashrockets function
|
||||||
|
function! puppet#format#Format() abort
|
||||||
|
let l:start_lnum = v:lnum
|
||||||
|
let l:end_lnum = v:lnum + v:count - 1
|
||||||
|
" Don't modify indentation or alignment if called by textwidth. We'll only
|
||||||
|
" let the fallback function do its thing in this case so that textwidth
|
||||||
|
" still performs the expected feature.
|
||||||
|
if mode() !~# '[iR]'
|
||||||
|
call puppet#format#Indention(l:start_lnum, l:end_lnum)
|
||||||
|
call puppet#format#Hashrocket(l:start_lnum, l:end_lnum)
|
||||||
|
endif
|
||||||
|
call puppet#format#Fallback(l:start_lnum, l:end_lnum)
|
||||||
|
" explicitly avoid falling back to default formatting
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format hashrockets expressions in every line in range start_lnum and
|
||||||
|
" end_lnum, both ends included
|
||||||
|
"
|
||||||
|
" TODO way of using AlignHashrockets function is ineffective, because it
|
||||||
|
" formats same lines again and again, find better way to do it
|
||||||
|
function! puppet#format#Hashrocket(start_lnum, end_lnum) abort
|
||||||
|
let l:lnum = a:start_lnum
|
||||||
|
while l:lnum <= a:end_lnum
|
||||||
|
call puppet#align#AlignHashrockets(l:lnum)
|
||||||
|
let l:lnum += 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Format indention in every line in range start_lnum and end_lnum, both ends
|
||||||
|
" included
|
||||||
|
"
|
||||||
|
function! puppet#format#Indention(start_lnum, end_lnum) abort
|
||||||
|
execute 'normal! ' . a:start_lnum . 'gg=' . a:end_lnum . 'gg'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
""
|
||||||
|
" Use internal vim default autoformat method for every line in range, only
|
||||||
|
" lines which exeed &widthline are formated
|
||||||
|
"
|
||||||
|
function! puppet#format#Fallback(start_lnum, end_lnum) abort
|
||||||
|
" We shouldn't wrap lines based on textwidth if it is disabled
|
||||||
|
if &textwidth == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" I'm using it to check if autoformat expand range
|
||||||
|
let l:eof_lnum = line('$')
|
||||||
|
let l:lnum = a:start_lnum
|
||||||
|
let l:end_lnum = a:end_lnum
|
||||||
|
|
||||||
|
while l:lnum <= l:end_lnum
|
||||||
|
if strlen(getline(l:lnum)) > &textwidth
|
||||||
|
call cursor(l:lnum)
|
||||||
|
execute 'normal! gww'
|
||||||
|
" Checking if autoformat expand number of lines if yes, I will extend
|
||||||
|
" range too
|
||||||
|
if l:eof_lnum < line('$')
|
||||||
|
let l:end_lnum += line('$') - l:eof_lnum
|
||||||
|
let l:eof_lnum = line('$')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let l:lnum += 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1
|
||||||
|
|
||||||
" Sometimes Python issues debugging messages
|
" Sometimes Python issues debugging messages
|
||||||
" which don't belong to a call stack context
|
" which don't belong to a call stack context
|
||||||
" this function filters these messages
|
" this function filters these messages
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1
|
|
||||||
|
|
||||||
if !exists("g:raco_command")
|
|
||||||
let g:raco_command = system("which raco")
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
||||||
|
|
||||||
" Vim completion script
|
" Vim completion script
|
||||||
" Language: Ruby
|
" Language: Ruby
|
||||||
" Maintainer: Mark Guzman <segfault@hasno.info>
|
" Maintainer: Mark Guzman <segfault@hasno.info>
|
||||||
" URL: https://github.com/vim-ruby/vim-ruby
|
" URL: https://github.com/vim-ruby/vim-ruby
|
||||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||||
" Maintainer Version: 0.8.1
|
|
||||||
" ----------------------------------------------------------------------------
|
" ----------------------------------------------------------------------------
|
||||||
"
|
"
|
||||||
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
|
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||||
@@ -55,6 +54,23 @@ if !exists("g:rubycomplete_include_objectspace")
|
|||||||
endif
|
endif
|
||||||
" }}} configuration failsafe initialization
|
" }}} configuration failsafe initialization
|
||||||
|
|
||||||
|
" {{{ regex patterns
|
||||||
|
|
||||||
|
" Regex that defines the start-match for the 'end' keyword.
|
||||||
|
let s:end_start_regex =
|
||||||
|
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
|
||||||
|
\ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' .
|
||||||
|
\ '\|\%(\K\k*[!?]\?\s\+\)\=def\):\@!\>' .
|
||||||
|
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
|
||||||
|
|
||||||
|
" Regex that defines the middle-match for the 'end' keyword.
|
||||||
|
let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
|
||||||
|
|
||||||
|
" Regex that defines the end-match for the 'end' keyword.
|
||||||
|
let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
|
||||||
|
|
||||||
|
" }}} regex patterns
|
||||||
|
|
||||||
" {{{ vim-side support functions
|
" {{{ vim-side support functions
|
||||||
let s:rubycomplete_debug = 0
|
let s:rubycomplete_debug = 0
|
||||||
|
|
||||||
@@ -105,7 +121,7 @@ function! s:GetBufferRubyEntity( name, type, ... )
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let curpos = getpos(".")
|
let curpos = getpos(".")
|
||||||
let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' )
|
let [enum,ecol] = searchpairpos( s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'W' )
|
||||||
call cursor(lastpos[1], lastpos[2])
|
call cursor(lastpos[1], lastpos[2])
|
||||||
|
|
||||||
if lnum > enum
|
if lnum > enum
|
||||||
@@ -130,19 +146,28 @@ function! s:IsPosInClassDef(pos)
|
|||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:IsInComment(pos)
|
||||||
|
let stack = synstack(a:pos[0], a:pos[1])
|
||||||
|
if !empty(stack)
|
||||||
|
return synIDattr(stack[0], 'name') =~ 'ruby\%(.*Comment\|Documentation\)'
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:GetRubyVarType(v)
|
function! s:GetRubyVarType(v)
|
||||||
let stopline = 1
|
let stopline = 1
|
||||||
let vtp = ''
|
let vtp = ''
|
||||||
let pos = getpos('.')
|
let curpos = getpos('.')
|
||||||
let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
|
let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$'
|
||||||
let [lnum,lcol] = searchpos(sstr,'nb',stopline)
|
let [lnum,lcol] = searchpos(sstr,'nb',stopline)
|
||||||
if lnum != 0 && lcol != 0
|
if lnum != 0 && lcol != 0
|
||||||
call setpos('.',pos)
|
call setpos('.',curpos)
|
||||||
let str = getline(lnum)
|
let str = getline(lnum)
|
||||||
let vtp = substitute(str,sstr,'\1','')
|
let vtp = substitute(str,sstr,'\1','')
|
||||||
return vtp
|
return vtp
|
||||||
endif
|
endif
|
||||||
call setpos('.',pos)
|
call setpos('.',curpos)
|
||||||
let ctors = '\(now\|new\|open\|get_instance'
|
let ctors = '\(now\|new\|open\|get_instance'
|
||||||
if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1
|
if exists('g:rubycomplete_rails') && g:rubycomplete_rails == 1 && s:rubycomplete_rails_loaded == 1
|
||||||
let ctors = ctors.'\|find\|create'
|
let ctors = ctors.'\|find\|create'
|
||||||
@@ -152,9 +177,13 @@ function! s:GetRubyVarType(v)
|
|||||||
|
|
||||||
let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)'
|
let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)'
|
||||||
let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr
|
let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr
|
||||||
let [lnum,lcol] = searchpos(sstr,'nb',stopline)
|
let pos = searchpos(sstr,'bW')
|
||||||
if lnum != 0 && lcol != 0
|
while pos != [0,0] && s:IsInComment(pos)
|
||||||
let str = matchstr(getline(lnum),fstr,lcol)
|
let pos = searchpos(sstr,'bW')
|
||||||
|
endwhile
|
||||||
|
if pos != [0,0]
|
||||||
|
let [lnum, col] = pos
|
||||||
|
let str = matchstr(getline(lnum),fstr,col)
|
||||||
let str = substitute(str,'^=\s*','','')
|
let str = substitute(str,'^=\s*','','')
|
||||||
|
|
||||||
call setpos('.',pos)
|
call setpos('.',pos)
|
||||||
@@ -176,7 +205,7 @@ function! s:GetRubyVarType(v)
|
|||||||
end
|
end
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
call setpos('.',pos)
|
call setpos('.',curpos)
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -673,11 +702,10 @@ class VimRubyCompletion
|
|||||||
methods.delete_if { |c| c.match( /'/ ) }
|
methods.delete_if { |c| c.match( /'/ ) }
|
||||||
end
|
end
|
||||||
|
|
||||||
when /^::([A-Z][^:\.\(]*)$/ # Absolute Constant or class methods
|
when /^::([A-Z][^:\.\(]*)?$/ # Absolute Constant or class methods
|
||||||
dprint "const or cls"
|
dprint "const or cls"
|
||||||
receiver = $1
|
receiver = $1
|
||||||
methods = Object.constants
|
methods = Object.constants.collect{ |c| c.to_s }.grep(/^#{receiver}/)
|
||||||
methods.grep(/^#{receiver}/).collect{|e| "::" + e}
|
|
||||||
|
|
||||||
when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods
|
when /^(((::)?[A-Z][^:.\(]*)+?)::?([^:.]*)$/ # Constant or class methods
|
||||||
receiver = $1
|
receiver = $1
|
||||||
@@ -686,13 +714,13 @@ class VimRubyCompletion
|
|||||||
load_buffer_class( receiver )
|
load_buffer_class( receiver )
|
||||||
load_buffer_module( receiver )
|
load_buffer_module( receiver )
|
||||||
begin
|
begin
|
||||||
classes = eval("#{receiver}.constants")
|
constants = eval("#{receiver}.constants").collect{ |c| c.to_s }.grep(/^#{message}/)
|
||||||
#methods = eval("#{receiver}.methods")
|
methods = eval("#{receiver}.methods").collect{ |m| m.to_s }.grep(/^#{message}/)
|
||||||
rescue Exception
|
rescue Exception
|
||||||
dprint "exception: %s" % $!
|
dprint "exception: %s" % $!
|
||||||
|
constants = []
|
||||||
methods = []
|
methods = []
|
||||||
end
|
end
|
||||||
methods.grep(/^#{message}/).collect{|e| receiver + "::" + e}
|
|
||||||
|
|
||||||
when /^(:[^:.]+)\.([^.]*)$/ # Symbol
|
when /^(:[^:.]+)\.([^.]*)$/ # Symbol
|
||||||
dprint "symbol"
|
dprint "symbol"
|
||||||
|
|||||||
@@ -1,27 +1,62 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
" Author: Kevin Ballard
|
|
||||||
" Description: Helper functions for Rust commands/mappings
|
" Description: Helper functions for Rust commands/mappings
|
||||||
" Last Modified: May 27, 2014
|
" Last Modified: May 27, 2014
|
||||||
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
||||||
|
|
||||||
" Jump {{{1
|
function! rust#Load()
|
||||||
|
|
||||||
function! rust#Load()
|
|
||||||
" Utility call to get this script loaded, for debugging
|
" Utility call to get this script loaded, for debugging
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rust#GetConfigVar(name, default)
|
function! rust#GetConfigVar(name, default)
|
||||||
" Local buffer variable with same name takes predeence over global
|
" Local buffer variable with same name takes predeence over global
|
||||||
if has_key(b:, a:name)
|
if has_key(b:, a:name)
|
||||||
return get(b:, a:name)
|
return get(b:, a:name)
|
||||||
endif
|
endif
|
||||||
if has_key(g:, a:name)
|
if has_key(g:, a:name)
|
||||||
return get(g:, a:name)
|
return get(g:, a:name)
|
||||||
endif
|
endif
|
||||||
return a:default
|
return a:default
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Include expression {{{1
|
||||||
|
|
||||||
|
function! rust#IncludeExpr(fname) abort
|
||||||
|
" Remove leading 'crate::' to deal with 2018 edition style 'use'
|
||||||
|
" statements
|
||||||
|
let l:fname = substitute(a:fname, '^crate::', '', '')
|
||||||
|
|
||||||
|
" Remove trailing colons arising from lines like
|
||||||
|
"
|
||||||
|
" use foo::{Bar, Baz};
|
||||||
|
let l:fname = substitute(l:fname, ':\+$', '', '')
|
||||||
|
|
||||||
|
" Replace '::' with '/'
|
||||||
|
let l:fname = substitute(l:fname, '::', '/', 'g')
|
||||||
|
|
||||||
|
" When we have
|
||||||
|
"
|
||||||
|
" use foo::bar::baz;
|
||||||
|
"
|
||||||
|
" we can't tell whether baz is a module or a function; and we can't tell
|
||||||
|
" which modules correspond to files.
|
||||||
|
"
|
||||||
|
" So we work our way up, trying
|
||||||
|
"
|
||||||
|
" foo/bar/baz.rs
|
||||||
|
" foo/bar.rs
|
||||||
|
" foo.rs
|
||||||
|
while l:fname !=# '.'
|
||||||
|
let l:path = findfile(l:fname)
|
||||||
|
if !empty(l:path)
|
||||||
|
return l:fname
|
||||||
|
endif
|
||||||
|
let l:fname = fnamemodify(l:fname, ':h')
|
||||||
|
endwhile
|
||||||
|
return l:fname
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Jump {{{1
|
||||||
|
|
||||||
function! rust#Jump(mode, function) range
|
function! rust#Jump(mode, function) range
|
||||||
let cnt = v:count1
|
let cnt = v:count1
|
||||||
@@ -362,10 +397,19 @@ function! s:RmDir(path)
|
|||||||
echoerr 'Attempted to delete empty path'
|
echoerr 'Attempted to delete empty path'
|
||||||
return 0
|
return 0
|
||||||
elseif a:path ==# '/' || a:path ==# $HOME
|
elseif a:path ==# '/' || a:path ==# $HOME
|
||||||
echoerr 'Attempted to delete protected path: ' . a:path
|
let l:path = expand(a:path)
|
||||||
|
if l:path ==# '/' || l:path ==# $HOME
|
||||||
|
echoerr 'Attempted to delete protected path: ' . a:path
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !isdirectory(a:path)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
return system("rm -rf " . shellescape(a:path))
|
|
||||||
|
" delete() returns 0 when removing file successfully
|
||||||
|
return delete(a:path, 'rf') == 0
|
||||||
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.
|
||||||
@@ -445,12 +489,12 @@ function! s:SearchTestFunctionNameUnderCursor() abort
|
|||||||
let cursor_line = line('.')
|
let cursor_line = line('.')
|
||||||
|
|
||||||
" Find #[test] attribute
|
" Find #[test] attribute
|
||||||
if search('#\[test]', 'bcW') is 0
|
if search('\m\C#\[test\]', 'bcW') is 0
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Move to an opening brace of the test function
|
" Move to an opening brace of the test function
|
||||||
let test_func_line = search('^\s*fn\s\+\h\w*\s*(.\+{$', 'eW')
|
let test_func_line = search('\m\C^\s*fn\s\+\h\w*\s*(.\+{$', 'eW')
|
||||||
if test_func_line is 0
|
if test_func_line is 0
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
@@ -462,19 +506,37 @@ function! s:SearchTestFunctionNameUnderCursor() abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return matchstr(getline(test_func_line), '^\s*fn\s\+\zs\h\w*')
|
return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rust#Test(all, options) abort
|
function! rust#Test(mods, winsize, all, options) abort
|
||||||
let pwd = expand('%:p:h')
|
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
|
||||||
if findfile('Cargo.toml', pwd . ';') ==# ''
|
if manifest ==# ''
|
||||||
return rust#Run(1, '--test ' . a:options)
|
return rust#Run(1, '--test ' . a:options)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let pwd = shellescape(pwd)
|
" <count> defaults to 0, but we prefer an empty string
|
||||||
|
let winsize = a:winsize ? a:winsize : ''
|
||||||
|
|
||||||
|
if has('terminal')
|
||||||
|
if has('patch-8.0.910')
|
||||||
|
let cmd = printf('%s noautocmd %snew | terminal ++curwin ', a:mods, winsize)
|
||||||
|
else
|
||||||
|
let cmd = printf('%s terminal ', a:mods)
|
||||||
|
endif
|
||||||
|
elseif has('nvim')
|
||||||
|
let cmd = printf('%s noautocmd %snew | terminal ', a:mods, winsize)
|
||||||
|
else
|
||||||
|
let cmd = '!'
|
||||||
|
let manifest = shellescape(manifest)
|
||||||
|
endif
|
||||||
|
|
||||||
if a:all
|
if a:all
|
||||||
execute '!cd ' . pwd . ' && cargo test ' . a:options
|
if a:options ==# ''
|
||||||
|
execute cmd . 'cargo test --manifest-path' manifest
|
||||||
|
else
|
||||||
|
execute cmd . 'cargo test --manifest-path' manifest a:options
|
||||||
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -483,11 +545,16 @@ function! rust#Test(all, options) abort
|
|||||||
let func_name = s:SearchTestFunctionNameUnderCursor()
|
let func_name = s:SearchTestFunctionNameUnderCursor()
|
||||||
if func_name ==# ''
|
if func_name ==# ''
|
||||||
echohl ErrorMsg
|
echohl ErrorMsg
|
||||||
echo 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
|
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
|
||||||
echohl None
|
echohl None
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
execute '!cd ' . pwd . ' && cargo test ' . func_name . ' ' . a:options
|
if a:options ==# ''
|
||||||
|
execute cmd . 'cargo test --manifest-path' manifest func_name
|
||||||
|
else
|
||||||
|
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
|
||||||
|
endif
|
||||||
|
return
|
||||||
finally
|
finally
|
||||||
call setpos('.', saved)
|
call setpos('.', saved)
|
||||||
endtry
|
endtry
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
" For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim
|
" For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim
|
||||||
|
|
||||||
let s:global_variable_list = [
|
let s:global_variable_list = [
|
||||||
|
\ '_rustfmt_autosave_because_of_config',
|
||||||
\ 'ftplugin_rust_source_path',
|
\ 'ftplugin_rust_source_path',
|
||||||
\ 'loaded_syntastic_rust_cargo_checker',
|
\ 'loaded_syntastic_rust_cargo_checker',
|
||||||
\ 'loaded_syntastic_rust_filetype',
|
\ 'loaded_syntastic_rust_filetype',
|
||||||
@@ -30,7 +31,6 @@ let s:global_variable_list = [
|
|||||||
\ 'rustc_makeprg_no_percent',
|
\ 'rustc_makeprg_no_percent',
|
||||||
\ 'rustc_path',
|
\ 'rustc_path',
|
||||||
\ 'rustfmt_autosave',
|
\ 'rustfmt_autosave',
|
||||||
\ 'rustfmt_autosave_because_of_config',
|
|
||||||
\ 'rustfmt_autosave_if_config_present',
|
\ 'rustfmt_autosave_if_config_present',
|
||||||
\ 'rustfmt_command',
|
\ 'rustfmt_command',
|
||||||
\ 'rustfmt_emit_files',
|
\ 'rustfmt_emit_files',
|
||||||
@@ -46,7 +46,9 @@ endfunction
|
|||||||
|
|
||||||
function! s:EchoGlobalVariables() abort
|
function! s:EchoGlobalVariables() abort
|
||||||
for l:key in s:global_variable_list
|
for l:key in s:global_variable_list
|
||||||
call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null)))
|
if l:key !~# '^_'
|
||||||
|
call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null)))
|
||||||
|
endif
|
||||||
|
|
||||||
if has_key(b:, l:key)
|
if has_key(b:, l:key)
|
||||||
call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key]))
|
call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key]))
|
||||||
@@ -73,6 +75,12 @@ function! rust#debugging#Info() abort
|
|||||||
echo l:output
|
echo l:output
|
||||||
|
|
||||||
version
|
version
|
||||||
|
|
||||||
|
if exists(":SyntasticInfo")
|
||||||
|
echo "----"
|
||||||
|
echo "Info from Syntastic:"
|
||||||
|
execute "SyntasticInfo"
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rust#debugging#InfoToClipboard() abort
|
function! rust#debugging#InfoToClipboard() abort
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
||||||
|
|
||||||
" For this buffer, when delimitMate issues the `User delimitMate_map`
|
" For this buffer, when delimitMate issues the `User delimitMate_map`
|
||||||
|
|||||||
22
autoload/rust/tags.vim
Normal file
22
autoload/rust/tags.vim
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
|
" Tagbar support code, for the sake of not automatically overriding its
|
||||||
|
" configuration in case Universal Ctags is detected.
|
||||||
|
|
||||||
|
let s:ctags_is_uctags = 0
|
||||||
|
let s:checked_ctags = 0
|
||||||
|
|
||||||
|
function! rust#tags#IsUCtags() abort
|
||||||
|
if s:checked_ctags == 0
|
||||||
|
let l:ctags_bin = get(g:, 'tagbar_ctags_bin', 'ctags')
|
||||||
|
if system(l:ctags_bin.' --version') =~? 'universal ctags'
|
||||||
|
let s:ctags_is_uctags = 1
|
||||||
|
endif
|
||||||
|
let s:checked_ctags = 1
|
||||||
|
endif
|
||||||
|
return s:ctags_is_uctags
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: set et sw=4 sts=4 ts=8:
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
" Author: Stephen Sugden <stephen@stephensugden.com>
|
" Author: Stephen Sugden <stephen@stephensugden.com>
|
||||||
"
|
"
|
||||||
" Adapted from https://github.com/fatih/vim-go
|
" Adapted from https://github.com/fatih/vim-go
|
||||||
@@ -24,18 +24,17 @@ endif
|
|||||||
function! rustfmt#DetectVersion()
|
function! rustfmt#DetectVersion()
|
||||||
" Save rustfmt '--help' for feature inspection
|
" Save rustfmt '--help' for feature inspection
|
||||||
silent let s:rustfmt_help = system(g:rustfmt_command . " --help")
|
silent let s:rustfmt_help = system(g:rustfmt_command . " --help")
|
||||||
let s:rustfmt_unstable_features = 1 - (s:rustfmt_help !~# "--unstable-features")
|
let s:rustfmt_unstable_features = s:rustfmt_help =~# "--unstable-features"
|
||||||
|
|
||||||
" Build a comparable rustfmt version varible out of its `--version` output:
|
" Build a comparable rustfmt version varible out of its `--version` output:
|
||||||
silent let s:rustfmt_version = system(g:rustfmt_command . " --version")
|
silent let l:rustfmt_version_full = system(g:rustfmt_command . " --version")
|
||||||
let s:rustfmt_version = matchlist(s:rustfmt_version, '\vrustfmt ([0-9]+[.][0-9]+[.][0-9]+)')
|
let l:rustfmt_version_list = matchlist(l:rustfmt_version_full,
|
||||||
|
\ '\vrustfmt ([0-9]+[.][0-9]+[.][0-9]+)')
|
||||||
if len(s:rustfmt_version) < 3
|
if len(l:rustfmt_version_list) < 3
|
||||||
let s:rustfmt_version = "0"
|
let s:rustfmt_version = "0"
|
||||||
else
|
else
|
||||||
let s:rustfmt_version = s:rustfmt_version[1]
|
let s:rustfmt_version = l:rustfmt_version_list[1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return s:rustfmt_version
|
return s:rustfmt_version
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ if !exists("g:rustfmt_emit_files")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists("g:rustfmt_file_lines")
|
if !exists("g:rustfmt_file_lines")
|
||||||
let g:rustfmt_file_lines = 1 - (s:rustfmt_help !~# "--file-lines JSON")
|
let g:rustfmt_file_lines = s:rustfmt_help =~# "--file-lines JSON"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let s:got_fmt_error = 0
|
let s:got_fmt_error = 0
|
||||||
@@ -87,11 +86,9 @@ function! s:RustfmtCommandRange(filename, line1, line2)
|
|||||||
let l:write_mode = s:RustfmtWriteMode()
|
let l:write_mode = s:RustfmtWriteMode()
|
||||||
let l:rustfmt_config = s:RustfmtConfig()
|
let l:rustfmt_config = s:RustfmtConfig()
|
||||||
|
|
||||||
" FIXME: When --file-lines gets to be stable, enhance this version range checking
|
" FIXME: When --file-lines gets to be stable, add version range checking
|
||||||
" accordingly.
|
" accordingly.
|
||||||
let l:unstable_features =
|
let l:unstable_features = s:rustfmt_unstable_features ? '--unstable-features' : ''
|
||||||
\ (s:rustfmt_unstable_features && (s:rustfmt_version < '1.'))
|
|
||||||
\ ? '--unstable-features' : ''
|
|
||||||
|
|
||||||
let l:cmd = printf("%s %s %s %s %s --file-lines '[%s]' %s", g:rustfmt_command,
|
let l:cmd = printf("%s %s %s %s %s --file-lines '[%s]' %s", g:rustfmt_command,
|
||||||
\ l:write_mode, g:rustfmt_options,
|
\ l:write_mode, g:rustfmt_options,
|
||||||
@@ -115,10 +112,12 @@ function! s:DeleteLines(start, end) abort
|
|||||||
silent! execute a:start . ',' . a:end . 'delete _'
|
silent! execute a:start . ',' . a:end . 'delete _'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:RunRustfmt(command, tmpname, fail_silently)
|
function! s:RunRustfmt(command, tmpname, from_writepre)
|
||||||
mkview!
|
mkview!
|
||||||
|
|
||||||
let l:stderr_tmpname = tempname()
|
let l:stderr_tmpname = tempname()
|
||||||
|
call writefile([], l:stderr_tmpname)
|
||||||
|
|
||||||
let l:command = a:command . ' 2> ' . l:stderr_tmpname
|
let l:command = a:command . ' 2> ' . l:stderr_tmpname
|
||||||
|
|
||||||
if a:tmpname ==# ''
|
if a:tmpname ==# ''
|
||||||
@@ -133,7 +132,8 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
if exists("*systemlist")
|
if exists("*systemlist")
|
||||||
silent let out = systemlist(l:command, l:buffer)
|
silent let out = systemlist(l:command, l:buffer)
|
||||||
else
|
else
|
||||||
silent let out = split(system(l:command, l:buffer), '\r\?\n')
|
silent let out = split(system(l:command,
|
||||||
|
\ join(l:buffer, "\n")), '\r\?\n')
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if exists("*systemlist")
|
if exists("*systemlist")
|
||||||
@@ -147,9 +147,12 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
|
|
||||||
call delete(l:stderr_tmpname)
|
call delete(l:stderr_tmpname)
|
||||||
|
|
||||||
|
let l:open_lwindow = 0
|
||||||
if v:shell_error == 0
|
if v:shell_error == 0
|
||||||
" remove undo point caused via BufWritePre
|
if a:from_writepre
|
||||||
try | silent undojoin | catch | endtry
|
" remove undo point caused via BufWritePre
|
||||||
|
try | silent undojoin | catch | endtry
|
||||||
|
endif
|
||||||
|
|
||||||
if a:tmpname ==# ''
|
if a:tmpname ==# ''
|
||||||
let l:content = l:out
|
let l:content = l:out
|
||||||
@@ -167,9 +170,9 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
if s:got_fmt_error
|
if s:got_fmt_error
|
||||||
let s:got_fmt_error = 0
|
let s:got_fmt_error = 0
|
||||||
call setloclist(0, [])
|
call setloclist(0, [])
|
||||||
lwindow
|
let l:open_lwindow = 1
|
||||||
endif
|
endif
|
||||||
elseif g:rustfmt_fail_silently == 0 && a:fail_silently == 0
|
elseif g:rustfmt_fail_silently == 0 && !a:from_writepre
|
||||||
" otherwise get the errors and put them in the location list
|
" otherwise get the errors and put them in the location list
|
||||||
let l:errors = []
|
let l:errors = []
|
||||||
|
|
||||||
@@ -199,7 +202,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let s:got_fmt_error = 1
|
let s:got_fmt_error = 1
|
||||||
lwindow
|
let l:open_lwindow = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Restore the current directory if needed
|
" Restore the current directory if needed
|
||||||
@@ -211,6 +214,11 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Open lwindow after we have changed back to the previous directory
|
||||||
|
if l:open_lwindow == 1
|
||||||
|
lwindow
|
||||||
|
endif
|
||||||
|
|
||||||
silent! loadview
|
silent! loadview
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -218,12 +226,12 @@ function! rustfmt#FormatRange(line1, line2)
|
|||||||
let l:tmpname = tempname()
|
let l:tmpname = tempname()
|
||||||
call writefile(getline(1, '$'), l:tmpname)
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
|
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
|
||||||
call s:RunRustfmt(command, l:tmpname, 0)
|
call s:RunRustfmt(command, l:tmpname, v:false)
|
||||||
call delete(l:tmpname)
|
call delete(l:tmpname)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rustfmt#Format()
|
function! rustfmt#Format()
|
||||||
call s:RunRustfmt(s:RustfmtCommand(), '', 0)
|
call s:RunRustfmt(s:RustfmtCommand(), '', v:false)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rustfmt#Cmd()
|
function! rustfmt#Cmd()
|
||||||
@@ -232,10 +240,18 @@ function! rustfmt#Cmd()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rustfmt#PreWrite()
|
function! rustfmt#PreWrite()
|
||||||
|
if !filereadable(expand("%@"))
|
||||||
|
return
|
||||||
|
endif
|
||||||
if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0)
|
if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0)
|
||||||
if findfile('rustfmt.toml', '.;') !=# '' || findfile('.rustfmt.toml', '.;') !=# ''
|
if findfile('rustfmt.toml', '.;') !=# '' || findfile('.rustfmt.toml', '.;') !=# ''
|
||||||
let b:rustfmt_autosave = 1
|
let b:rustfmt_autosave = 1
|
||||||
let b:rustfmt_autosave_because_of_config = 1
|
let b:_rustfmt_autosave_because_of_config = 1
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if has_key(b:, '_rustfmt_autosave_because_of_config')
|
||||||
|
unlet b:_rustfmt_autosave_because_of_config
|
||||||
|
unlet b:rustfmt_autosave
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -243,7 +259,7 @@ function! rustfmt#PreWrite()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call s:RunRustfmt(s:RustfmtCommand(), '', 1)
|
call s:RunRustfmt(s:RustfmtCommand(), '', v:true)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
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
|
|
||||||
34
autoload/smt2.vim
Normal file
34
autoload/smt2.vim
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'smt2') == -1
|
||||||
|
|
||||||
|
" Invokes the solver on current file
|
||||||
|
function! smt2#RunSolver()
|
||||||
|
silent !clear
|
||||||
|
execute "!" . g:smt2_solver_command . " " . bufname("%")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Puts the solver's output in new split (replaces old split)
|
||||||
|
function! smt2#RunSolverAndShowResult()
|
||||||
|
let output = system(g:smt2_solver_command . " " . bufname("%") . " 2>&1")
|
||||||
|
|
||||||
|
" Create split (or reuse existent)
|
||||||
|
if exists("s:outputbufnr") && bufwinnr(s:outputbufnr) > 0
|
||||||
|
execute bufwinnr(s:outputbufnr) . 'wincmd w'
|
||||||
|
else
|
||||||
|
silent! vnew
|
||||||
|
let s:outputbufnr=bufnr('%')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Clear & (re-)fill contents
|
||||||
|
silent! normal! ggdG
|
||||||
|
setlocal filetype=smt2 buftype=nofile nobuflisted noswapfile
|
||||||
|
call append(0, split(output, '\v\n'))
|
||||||
|
normal! gg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Requests the solver's version
|
||||||
|
function! smt2#PrintSolverVersion()
|
||||||
|
silent !clear
|
||||||
|
execute "!" . g:smt2_solver_command . " " . g:smt2_solver_version_switch
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
64
autoload/terraform.vim
Normal file
64
autoload/terraform.vim
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
||||||
|
|
||||||
|
" Ensure no conflict with arguments from the environment
|
||||||
|
let $TF_CLI_ARGS_fmt=''
|
||||||
|
|
||||||
|
function! terraform#fmt()
|
||||||
|
if !filereadable(expand('%:p'))
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let l:curw = winsaveview()
|
||||||
|
" Make a fake change so that the undo point is right.
|
||||||
|
normal! ix
|
||||||
|
normal! "_x
|
||||||
|
silent execute '%!terraform fmt -no-color -'
|
||||||
|
if v:shell_error != 0
|
||||||
|
let output = getline(1, '$')
|
||||||
|
silent undo
|
||||||
|
echo join(output, "\n")
|
||||||
|
endif
|
||||||
|
call winrestview(l:curw)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! terraform#align()
|
||||||
|
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
|
||||||
|
|
||||||
|
function! terraform#commands(ArgLead, CmdLine, CursorPos)
|
||||||
|
let l:commands = [
|
||||||
|
\ 'apply',
|
||||||
|
\ 'console',
|
||||||
|
\ 'destroy',
|
||||||
|
\ 'env',
|
||||||
|
\ 'fmt',
|
||||||
|
\ 'get',
|
||||||
|
\ 'graph',
|
||||||
|
\ 'import',
|
||||||
|
\ 'init',
|
||||||
|
\ 'output',
|
||||||
|
\ 'plan',
|
||||||
|
\ 'providers',
|
||||||
|
\ 'refresh',
|
||||||
|
\ 'show',
|
||||||
|
\ 'taint',
|
||||||
|
\ 'untaint',
|
||||||
|
\ 'validate',
|
||||||
|
\ 'version',
|
||||||
|
\ 'workspace',
|
||||||
|
\ '0.12upgrade',
|
||||||
|
\ 'debug',
|
||||||
|
\ 'force-unlock',
|
||||||
|
\ 'push',
|
||||||
|
\ 'state'
|
||||||
|
\ ]
|
||||||
|
return join(l:commands, "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
||||||
|
|
||||||
" common functions for vifm command-line editing buffer filetype plugins
|
" common functions for vifm command-line editing buffer filetype plugins
|
||||||
" Maintainer: xaizek <xaizek@posteo.net>
|
" Maintainer: xaizek <xaizek@posteo.net>
|
||||||
" Last Change: August 18, 2013
|
" Last Change: August 18, 2013
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
||||||
|
|
||||||
" common functions for vifm plugin related to globals
|
" common functions for vifm plugin related to globals
|
||||||
" Maintainer: xaizek <xaizek@posteo.net>
|
" Maintainer: xaizek <xaizek@posteo.net>
|
||||||
" Last Change: January 02, 2018
|
" Last Change: November 03, 2018
|
||||||
|
|
||||||
" Initializes global variables to defaults unless they are already set
|
" Initializes global variables to defaults unless they are already set
|
||||||
function! vifm#globals#Init()
|
function! vifm#globals#Init()
|
||||||
@@ -26,6 +26,10 @@ function! vifm#globals#Init()
|
|||||||
let g:vifm_term = 'xterm -e'
|
let g:vifm_term = 'xterm -e'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:vifm_embed_term')
|
||||||
|
let g:vifm_embed_term = has('gui_running')
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
let s:_plugin_name = expand('<sfile>:t:r')
|
let s:_plugin_name = expand('<sfile>:t:r')
|
||||||
|
|
||||||
function! vital#{s:_plugin_name}#new() abort
|
function! vital#{s:_plugin_name}#new() abort
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
" ___vital___
|
" ___vital___
|
||||||
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
" ___vital___
|
" ___vital___
|
||||||
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
" ___vital___
|
" ___vital___
|
||||||
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||||
|
|
||||||
" ___vital___
|
" ___vital___
|
||||||
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user