mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 2.6
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- vim-gtk
|
||||
before_script:
|
||||
- "export DISPLAY=:99.0"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
script: bundle exec rspec --format=documentation
|
||||
- "./build"
|
||||
script: xvfb-run bundle exec rspec --format=documentation
|
||||
|
||||
53
README.md
53
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-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.
|
||||
|
||||
- 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-->128<!--/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.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- 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-->
|
||||
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl) (syntax)
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax)
|
||||
- [applescript](https://github.com/mityu/vim-applescript) (syntax, indent)
|
||||
@@ -57,13 +60,16 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, compiler, indent, autoload, ftplugin)
|
||||
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, 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)
|
||||
- [cue](https://github.com/mgrabovsky/vim-cuesheet) (syntax)
|
||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
|
||||
- [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)
|
||||
- [elm](https://github.com/ElmCast/elm-vim) (syntax, indent, autoload, ftplugin)
|
||||
@@ -71,7 +77,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
|
||||
- [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)
|
||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
|
||||
@@ -80,7 +86,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
|
||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
|
||||
- [gradle](https://github.com/tfnico/vim-gradle) (compiler)
|
||||
- [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, ftplugin)
|
||||
- [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)
|
||||
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
|
||||
@@ -88,9 +94,13 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
|
||||
- [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)
|
||||
- [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)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
||||
@@ -98,17 +108,19 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
|
||||
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
||||
- [jsx](https://github.com/amadeus/vim-jsx) (syntax, indent, ftplugin)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (autoload, syntax, indent, ftplugin)
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim) (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)
|
||||
- [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)
|
||||
- [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)
|
||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
||||
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent)
|
||||
- [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)
|
||||
@@ -120,22 +132,22 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (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)
|
||||
- [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)
|
||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
||||
- [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)
|
||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
||||
- [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)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, autoload, ftplugin)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax)
|
||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, ftplugin)
|
||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
||||
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
|
||||
@@ -145,32 +157,41 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
||||
- [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)
|
||||
- [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)
|
||||
- [styled-components](https://github.com/styled-components/vim-styled-components#main) (after)
|
||||
- [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)
|
||||
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
|
||||
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax)
|
||||
- [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)
|
||||
- [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)
|
||||
- [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)
|
||||
- [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)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
|
||||
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
|
||||
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
|
||||
- [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)
|
||||
- [xml](https://github.com/amadeus/vim-xml) (syntax)
|
||||
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
|
||||
- [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-->
|
||||
|
||||
## Updating
|
||||
|
||||
21
after/autoload/styledcomplete.vim
Normal file
21
after/autoload/styledcomplete.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim completion script
|
||||
" Language: styled-components (js/ts)
|
||||
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
|
||||
" URL: https://github.com/styled-components/vim-styled-components
|
||||
|
||||
fun! styledcomplete#CompleteSC(findstart, base)
|
||||
if IsStyledDefinition(line('.'))
|
||||
return csscomplete#CompleteCSS(a:findstart, a:base)
|
||||
endif
|
||||
|
||||
" Only trigger original omnifunc if it was set in the first place
|
||||
if exists('b:prevofu')
|
||||
" create a funcref to call with the previous omnicomplete function
|
||||
let s:funcref = function(b:prevofu)
|
||||
return s:funcref(a:findstart, a:base)
|
||||
endif
|
||||
endfun
|
||||
@@ -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
|
||||
@@ -14,3 +14,79 @@ if exists('b:undo_ftplugin')
|
||||
else
|
||||
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||
endif
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 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
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: styled-components (js/ts)
|
||||
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
|
||||
" URL: https://github.com/styled-components/vim-styled-components
|
||||
|
||||
fu! s:GetSyntaxNames(lnum, cnum)
|
||||
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
|
||||
endfu
|
||||
|
||||
" re-implement SynSOL of vim-jsx
|
||||
fu! s:SynSOL(lnum)
|
||||
return s:GetSyntaxNames(a:lnum, 1)
|
||||
endfu
|
||||
|
||||
"" Return whether the current line is a jsTemplateString
|
||||
fu! IsStyledDefinition(lnum)
|
||||
" iterate through all syntax items in the given line
|
||||
for item in s:SynSOL(a:lnum)
|
||||
" if syntax-item is a jsTemplateString return 1 - true
|
||||
" `==#` is a match case comparison of the item
|
||||
if item ==# 'styledDefinition'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
" fallback to 0 - false
|
||||
return 0
|
||||
endfu
|
||||
|
||||
if exists('&ofu')
|
||||
if &ofu
|
||||
" Do not keep track of previous omnifunc if it was not set in the first
|
||||
" place
|
||||
let b:prevofu=&ofu
|
||||
endif
|
||||
setl omnifunc=styledcomplete#CompleteSC
|
||||
endif
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 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 = '<\([a-zA-Z0-9.]\+\)\(>\|$\|\s\):<\/\1>'
|
||||
|
||||
if !exists('b:loaded_jsx_match_words')
|
||||
let b:loaded_jsx_match_words = 0
|
||||
endif
|
||||
|
||||
if b:loaded_jsx_match_words == 0
|
||||
let b:match_words = exists('b:match_words')
|
||||
\ ? b:match_words . ',' . s:jsx_match_words
|
||||
\ : s:jsx_match_words
|
||||
endif
|
||||
|
||||
let b:loaded_jsx_match_words = 1
|
||||
endif
|
||||
|
||||
setlocal suffixesadd+=.jsx
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
@@ -6,15 +6,6 @@ if !exists('g:puppet_align_hashes')
|
||||
let g:puppet_align_hashes = 1
|
||||
endif
|
||||
|
||||
if g:puppet_align_hashes && exists(':Tabularize')
|
||||
inoremap <buffer> <silent> > ><Esc>:call <SID>puppetalign()<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
|
||||
if g:puppet_align_hashes
|
||||
inoremap <buffer> <silent> => =><Esc>:call puppet#align#AlignHashrockets()<CR>$a
|
||||
endif
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'terraform') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
31
after/ftplugin/typescript.vim
Normal file
31
after/ftplugin/typescript.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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+=.tsx
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'coffee-script') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
206
after/indent/javascript.vim
Normal file
206
after/indent/javascript.vim
Normal file
@@ -0,0 +1,206 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 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\,,!^F,o,O,e,*<Return>,<>>,<<>,/
|
||||
|
||||
function! GetJsxIndent()
|
||||
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
|
||||
endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file
|
||||
" Language: styled-components (js/ts)
|
||||
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
|
||||
" URL: https://github.com/styled-components/vim-styled-components
|
||||
|
||||
" initialize variable to check, if the indentation expression is run
|
||||
" multiple times in a row, which indicates an infinite recursion
|
||||
let s:is_recursion = 0
|
||||
|
||||
" store current indentexpr for later
|
||||
let b:js_ts_indent=&indentexpr
|
||||
|
||||
" set indentexpr for this filetype (styled-components)
|
||||
setlocal indentexpr=GetStyledIndent()
|
||||
|
||||
" add the following keys to trigger reindenting, when in insert mode
|
||||
" - *; - Indent and insert on press of ';' key.
|
||||
" - *<:> - Indent and insert on press of ':' key.
|
||||
set indentkeys+=*;,*<:>,*<Return>
|
||||
|
||||
fu! s:GetSyntaxNames(lnum, cnum)
|
||||
return map(synstack(a:lnum, a:cnum), 'synIDattr(v:val, "name")')
|
||||
endfu
|
||||
|
||||
" re-implement SynSOL of vim-jsx
|
||||
" TODO: add dependency to the readme and remove duplicate implementation
|
||||
fu! s:SynSOL(lnum)
|
||||
return s:GetSyntaxNames(a:lnum, 1)
|
||||
endfu
|
||||
|
||||
" re-implement SynEOL of vim-jsx
|
||||
" TODO: add dependency to the readme and remove duplicate implementation
|
||||
fu! s:SynEOL(lnum, offset)
|
||||
let l:lnum = prevnonblank(a:lnum)
|
||||
let l:col = strlen(getline(l:lnum))
|
||||
|
||||
return s:GetSyntaxNames(l:lnum, l:col + a:offset)
|
||||
endfu
|
||||
|
||||
|
||||
"" Return whether the current line is a jsTemplateString
|
||||
fu! s:IsStyledDefinition(lnum)
|
||||
" iterate through all syntax items in the given line
|
||||
for item in s:SynSOL(a:lnum)
|
||||
" if syntax-item is a jsTemplateString return 1 - true
|
||||
" `==#` is a match case comparison of the item
|
||||
if item ==# 'styledDefinition'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
" fallback to 0 - false
|
||||
return 0
|
||||
endfu
|
||||
|
||||
"" Count occurences of `str` at the beginning of the given `lnum` line
|
||||
fu! s:CountOccurencesInSOL(lnum, str)
|
||||
let l:occurence = 0
|
||||
|
||||
" iterate through all items in the given line
|
||||
for item in s:SynSOL(a:lnum)
|
||||
" if the syntax-item equals the given str increment the counter
|
||||
" `==?` is a case isensitive equal operation
|
||||
if item ==? a:str
|
||||
let l:occurence += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
" return the accumulated count of occurences
|
||||
return l:occurence
|
||||
endfu
|
||||
|
||||
"" Count occurences of `str` at the end of the given `lnum` line
|
||||
fu! s:CountOccurencesInEOL(lnum, str, offset)
|
||||
let l:occurence = 0
|
||||
|
||||
" iterate through all items in the given line
|
||||
for item in s:SynEOL(a:lnum, a:offset)
|
||||
" if the syntax-item equals the given str increment the counter
|
||||
" `==?` is a case insensitive equal operation
|
||||
if item == a:str
|
||||
let l:occurence += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
" return the accumulated count of occurences
|
||||
return l:occurence
|
||||
endfu
|
||||
|
||||
"" Get the indentation of the current line
|
||||
fu! GetStyledIndent()
|
||||
if s:IsStyledDefinition(v:lnum)
|
||||
let l:baseIndent = 0
|
||||
|
||||
" find last non-styled line
|
||||
let l:cnum = v:lnum
|
||||
while s:IsStyledDefinition(l:cnum)
|
||||
let l:cnum -= 1
|
||||
endwhile
|
||||
|
||||
" get indentation of the last non-styled line as base indentation
|
||||
let l:baseIndent = indent(l:cnum)
|
||||
|
||||
" incrementally build indentation based on current indentation
|
||||
" - one shiftwidth for the styled definition region
|
||||
" - one shiftwidth per open nested definition region
|
||||
let l:styledIndent = &sw
|
||||
let l:styledIndent += min([
|
||||
\ s:CountOccurencesInSOL(v:lnum, 'styledNestedRegion'),
|
||||
\ s:CountOccurencesInEOL(v:lnum, 'styledNestedRegion', 0)
|
||||
\ ]) * &sw
|
||||
|
||||
" decrease indentation by one shiftwidth, if the styled definition
|
||||
" region ends on the current line
|
||||
" - either directly via styled definition region, or
|
||||
" - if the very last
|
||||
if s:CountOccurencesInEOL(v:lnum, 'styledDefinition', 1) == 0
|
||||
let l:styledIndent -= &sw
|
||||
endif
|
||||
|
||||
" return the base indentation
|
||||
" (for nested styles inside classes/objects/etc.) plus the actual
|
||||
" indentation inside the styled definition region
|
||||
return l:baseIndent + l:styledIndent
|
||||
elseif len(b:js_ts_indent)
|
||||
let l:result = 0
|
||||
let l:offset = 0
|
||||
|
||||
" increase indentation by one shiftwidth, if the last line ended on a
|
||||
" styledXmlRegion and this line does not continue with it
|
||||
" this is a fix for an incorrectly indented xml prop after a
|
||||
" glamor-styled styledXmlRegion
|
||||
if s:CountOccurencesInEOL(v:lnum-1, 'styledXmlRegion', 0) == 1 &&
|
||||
\ s:CountOccurencesInSOL(v:lnum, 'styledXmlRegion') == 0
|
||||
let l:offset = &sw
|
||||
endif
|
||||
|
||||
" make sure `GetStyledIndent` and `GetJsxIndent` don't infinitely
|
||||
" recurse by incrementing a counter variable, before evaluating the
|
||||
" stored indent expression
|
||||
if s:is_recursion == 0
|
||||
let s:is_recursion = 1
|
||||
let l:result = eval(b:js_ts_indent)
|
||||
endif
|
||||
|
||||
" `is_recursion` being 0 at this point indicates, that
|
||||
" `eval(b:js_ts_indent)` did itself evaluate it's stored indentexpr
|
||||
" and thus it can be assumed, that the current line should be
|
||||
" indented as JS
|
||||
if s:is_recursion == 0
|
||||
" use one of `GetJavascriptIndent` or `GetJsIndent` if existing
|
||||
" fallback to cindent, if not
|
||||
if exists('*GetJavascriptIndent')
|
||||
let l:result = GetJavascriptIndent()
|
||||
elseif exists('*GetJsIndent')
|
||||
let l:result = GetJsIndent()
|
||||
else
|
||||
let l:result = cindent(v:lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
" reset `is_recursion` counter and return the indentation value
|
||||
let s:is_recursion = 0
|
||||
return l:result + l:offset
|
||||
endif
|
||||
|
||||
" if all else fails indent according to C-syntax
|
||||
return cindent(v:lnum)
|
||||
endfu
|
||||
@@ -1,118 +1,5 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
"
|
||||
" Language: JSX (JavaScript)
|
||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Save the current JavaScript indentexpr.
|
||||
let b:jsx_js_indentexpr = &indentexpr
|
||||
|
||||
" Prologue; load in XML indentation.
|
||||
if exists('b:did_indent')
|
||||
let s:did_indent=b:did_indent
|
||||
unlet b:did_indent
|
||||
endif
|
||||
exe 'runtime! indent/xml.vim'
|
||||
if exists('s:did_indent')
|
||||
let b:did_indent=s:did_indent
|
||||
endif
|
||||
|
||||
setlocal indentexpr=GetJsxIndent()
|
||||
|
||||
" JS indentkeys
|
||||
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
|
||||
" XML indentkeys
|
||||
setlocal indentkeys+=*<Return>,<>>,<<>,/
|
||||
|
||||
" Multiline end tag regex (line beginning with '>' or '/>')
|
||||
let s:endtag = '^\s*\/\?>\s*;\='
|
||||
|
||||
" Get all syntax types at the beginning of a given line.
|
||||
fu! SynSOL(lnum)
|
||||
return map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")')
|
||||
endfu
|
||||
|
||||
" Get all syntax types at the end of a given line.
|
||||
fu! SynEOL(lnum)
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
let col = strlen(getline(lnum))
|
||||
return map(synstack(lnum, col), 'synIDattr(v:val, "name")')
|
||||
endfu
|
||||
|
||||
" Check if a syntax attribute is XMLish.
|
||||
fu! SynAttrXMLish(synattr)
|
||||
return a:synattr =~ "^xml" || a:synattr =~ "^jsx"
|
||||
endfu
|
||||
|
||||
" Check if a synstack is XMLish (i.e., has an XMLish last attribute).
|
||||
fu! SynXMLish(syns)
|
||||
return SynAttrXMLish(get(a:syns, -1))
|
||||
endfu
|
||||
|
||||
" Check if a synstack denotes the end of a JSX block.
|
||||
fu! SynJSXBlockEnd(syns)
|
||||
return get(a:syns, -1) =~ '\%(js\|javascript\)Braces' &&
|
||||
\ SynAttrXMLish(get(a:syns, -2))
|
||||
endfu
|
||||
|
||||
" Determine how many jsxRegions deep a synstack is.
|
||||
fu! SynJSXDepth(syns)
|
||||
return len(filter(copy(a:syns), 'v:val ==# "jsxRegion"'))
|
||||
endfu
|
||||
|
||||
" Check whether `cursyn' continues the same jsxRegion as `prevsyn'.
|
||||
fu! SynJSXContinues(cursyn, prevsyn)
|
||||
let curdepth = SynJSXDepth(a:cursyn)
|
||||
let prevdepth = SynJSXDepth(a:prevsyn)
|
||||
|
||||
" In most places, we expect the nesting depths to be the same between any
|
||||
" two consecutive positions within a jsxRegion (e.g., between a parent and
|
||||
" child node, between two JSX attributes, etc.). The exception is between
|
||||
" sibling nodes, where after a completed element (with depth N), we return
|
||||
" to the parent's nesting (depth N - 1). This case is easily detected,
|
||||
" since it is the only time when the top syntax element in the synstack is
|
||||
" jsxRegion---specifically, the jsxRegion corresponding to the parent.
|
||||
return prevdepth == curdepth ||
|
||||
\ (prevdepth == curdepth + 1 && get(a:cursyn, -1) ==# 'jsxRegion')
|
||||
endfu
|
||||
|
||||
" Cleverly mix JS and XML indentation.
|
||||
fu! GetJsxIndent()
|
||||
let cursyn = SynSOL(v:lnum)
|
||||
let prevsyn = SynEOL(v:lnum - 1)
|
||||
|
||||
" Use XML indenting iff:
|
||||
" - the syntax at the end of the previous line was either JSX or was the
|
||||
" closing brace of a jsBlock whose parent syntax was JSX; and
|
||||
" - the current line continues the same jsxRegion as the previous line.
|
||||
if (SynXMLish(prevsyn) || SynJSXBlockEnd(prevsyn)) &&
|
||||
\ SynJSXContinues(cursyn, prevsyn)
|
||||
let ind = XmlIndentGet(v:lnum, 0)
|
||||
|
||||
" Align '/>' and '>' with '<' for multiline tags.
|
||||
if getline(v:lnum) =~? s:endtag
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
" Then correct the indentation of any JSX following '/>' or '>'.
|
||||
if getline(v:lnum - 1) =~? s:endtag
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
else
|
||||
if len(b:jsx_js_indentexpr)
|
||||
" Invoke the base JS package's custom indenter. (For vim-javascript,
|
||||
" e.g., this will be GetJavascriptIndent().)
|
||||
let ind = eval(b:jsx_js_indentexpr)
|
||||
else
|
||||
let ind = cindent(v:lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfu
|
||||
runtime! indent/javascript.vim
|
||||
|
||||
39
after/indent/typescript.vim
Normal file
39
after/indent/typescript.vim
Normal file
@@ -0,0 +1,39 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
"
|
||||
" Language: typescript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
" Depends: leafgarland/typescript-vim
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
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\,,!^F,o,O,e,*<Return>,<>>,<<>,/
|
||||
|
||||
function! GetJsxIndent()
|
||||
return jsx_pretty#indent#get(function('GetTypescriptIndent'))
|
||||
endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/javascript.vim
|
||||
@@ -6,7 +6,7 @@ endif
|
||||
" Language: C++ Additions
|
||||
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
||||
" URL: http://www.haeggblad.com
|
||||
" Last Change: 1 Feb 2018
|
||||
" Last Change: 29 Jun 2019
|
||||
" Version: 0.6
|
||||
" Changelog:
|
||||
" 0.1 - initial version.
|
||||
@@ -964,6 +964,12 @@ if !exists("cpp_no_cpp11")
|
||||
syntax keyword cppSTLtype atomic_uintmax_t
|
||||
syntax keyword cppSTLconstant ATOMIC_FLAG_INIT
|
||||
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 compare_exchange_weak
|
||||
syntax keyword cppSTLfunction compare_exchange_strong
|
||||
@@ -1983,6 +1989,9 @@ endif " C++17
|
||||
if !exists("cpp_no_cpp20")
|
||||
" type_traits
|
||||
syntax keyword cppSTLtype remove_cvref remove_cvref_t
|
||||
syntax keyword cppType char8_t
|
||||
syntax keyword cppStatement co_yield co_return co_await
|
||||
syntax keyword cppStorageClass consteval
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'coffee-script') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
@@ -1,40 +1,3 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'coffee-script') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'glsl') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'html5') != -1
|
||||
finish
|
||||
endif
|
||||
@@ -51,33 +14,3 @@ endif
|
||||
" https://github.com/w3c/html/issues/694
|
||||
syntax region htmlComment start=+<!--+ end=+-->+ contains=@Spell
|
||||
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'less') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
261
after/syntax/javascript.vim
Normal file
261
after/syntax/javascript.vim
Normal file
@@ -0,0 +1,261 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 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("jsNoise") " 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
|
||||
|
||||
" add support to arrow function which returns a tagged template string, e.g.
|
||||
" () => html`<div></div>`
|
||||
syntax cluster afterArrowFunc add=javascriptTagRef
|
||||
else " build-in javascript syntax
|
||||
" refine the javascript line comment
|
||||
syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||
" add a javaScriptBlock group for build-in syntax
|
||||
syntax region javaScriptBlockBuildIn
|
||||
\ contained
|
||||
\ matchgroup=javaScriptBraces
|
||||
\ start="{"
|
||||
\ end="}"
|
||||
\ extend
|
||||
\ contains=javaScriptBlockBuildIn,@javaScriptEmbededExpr,javaScript.*
|
||||
\ fold
|
||||
syntax cluster javaScriptEmbededExpr add=jsxRegion
|
||||
|
||||
" refine the template string syntax
|
||||
syntax region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend
|
||||
syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr,javaScript.*
|
||||
endif
|
||||
|
||||
runtime syntax/jsx_pretty.vim
|
||||
|
||||
let b:current_syntax = 'javascript.jsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file
|
||||
" Language: styled-components (js/ts)
|
||||
" Maintainer: Karl Fleischmann <fleischmann.karl@gmail.com>
|
||||
" URL: https://github.com/styled-components/vim-styled-components
|
||||
|
||||
if exists("b:current_syntax")
|
||||
let s:current_syntax=b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
|
||||
" fix for "-" before cssPositioningProp
|
||||
" - needs to be above CSS include to not match cssVendor definitions
|
||||
syn region cssCustomPositioningPrefix contained
|
||||
\ start='-' end='\%(\s\{-}:\)\@='
|
||||
\ contains=cssPositioningProp
|
||||
|
||||
" introduce CSS cluster from built-in (or single third party syntax file)
|
||||
syn include @CSS syntax/css.vim
|
||||
|
||||
" try to include CSS3 definitions from multiple files
|
||||
" this is only possible on vim version above 7
|
||||
if v:version >= 700
|
||||
try
|
||||
syn include @CSS3 syntax/css/*.vim
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
|
||||
" TODO: include react-native keywords
|
||||
|
||||
" define custom cssAttrRegion
|
||||
" - add ",", "`" and "{" to the end characters
|
||||
" - add "cssPseudoClassId" to it's containing elements
|
||||
" this will incorrectly highlight pseudo elements incorrectly used as
|
||||
" attributes but correctly highlight actual attributes
|
||||
syn region cssCustomAttrRegion contained
|
||||
\ start=":" end="\ze\%(;\|)\|{\|}\|`\)"
|
||||
\ contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,
|
||||
\ cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,
|
||||
\ cssError,cssAttrComma,cssNoise,cssPseudoClassId,
|
||||
\ jsTemplateExpression,
|
||||
\ typescriptInterpolation,typescriptTemplateSubstitution
|
||||
syn region cssCustomAttrRegion contained
|
||||
\ start="transition\s*:" end="\ze\%(;\|)\|{\|}\|`\)"
|
||||
\ contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,
|
||||
\ cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,
|
||||
\ cssVendor,cssError,cssAttrComma,cssNoise,cssPseudoClassId,
|
||||
\ jsTemplateExpression,
|
||||
\ typescriptInterpolation,typescriptTemplateSubstitution
|
||||
|
||||
" define custom css elements to not utilize cssDefinition
|
||||
syn region cssCustomMediaBlock contained fold transparent matchgroup=cssBraces
|
||||
\ start="{" end="}"
|
||||
\ contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,
|
||||
\ cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,
|
||||
\ cssUnicodeEscape,cssVendor,cssTagName,cssClassName,
|
||||
\ cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,
|
||||
\ cssAttributeSelector
|
||||
syn region cssCustomPageWrap contained transparent matchgroup=cssBraces
|
||||
\ start="{" end="}"
|
||||
\ contains=cssPageMargin,cssPageProp,cssCustomAttrRegion,css.*Prop,
|
||||
\ cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,
|
||||
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
|
||||
\ cssHacks
|
||||
syn match cssCustomPageMargin contained skipwhite skipnl
|
||||
\ "@\%(\%(top\|left\|right\|bottom\)-\%(left\|center\|right\|middle\|bottom\)\)\%(-corner\)\="
|
||||
syn match cssCustomKeyFrameSelector "\%(\d*%\|\<from\>\|\<to\>\)" contained
|
||||
\ skipwhite skipnl
|
||||
|
||||
" define css include customly to overwrite nextgroup
|
||||
syn region cssInclude start="@media\>" end="\ze{" skipwhite skipnl
|
||||
\ contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,
|
||||
\ cssMediaMediaAttr,cssVencor,cssMediaType,cssIncludeKeyword,
|
||||
\ cssMediaComma,cssComment
|
||||
\ nextgroup=cssCustomMediaBlock
|
||||
|
||||
" define all non-contained css definitions
|
||||
syn cluster CSSTop
|
||||
\ contains=cssTagName,cssSelectorOp,cssAttributeSelector,cssClassName,
|
||||
\ cssBraces,cssIdentifier,cssIncludeKeyword,cssPage,cssKeyFrame,
|
||||
\ cssFontDescriptor,cssAttrComma,cssPseudoClass,cssUnicodeEscape
|
||||
|
||||
" custom highlights for styled components
|
||||
" - "&" inside top level
|
||||
" - cssTagName inside of jsStrings inside of styledPrefix regions
|
||||
" TODO: override highlighting of cssTagName with more subtle one
|
||||
syn match styledAmpersand contained "&"
|
||||
syn region styledTagNameString matchgroup=jsString contained
|
||||
\ start=+'+ end=+'+ skip=+\\\%(\'\|$\)+
|
||||
\ contains=cssTagName
|
||||
syn region styledTagNameString matchgroup=jsString contained
|
||||
\ start=+"+ end=+"+ skip=+\\\%(\"\|$\)+
|
||||
\ contains=cssTagName
|
||||
syn region styledTagNameString matchgroup=jsString contained
|
||||
\ start=+`+ end=+`+ skip=+\\\%(\`\|$\)+
|
||||
\ contains=cssTagName
|
||||
|
||||
" define custom API sections that trigger the styledDefinition highlighting
|
||||
syn match styledPrefix "\<styled\>\.\k\+"
|
||||
\ transparent fold
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=cssTagName,javascriptTagRef
|
||||
\ containedin=jsFuncBlock,jsParen,jsObject,jsObjectValue
|
||||
syn match styledPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})"
|
||||
\ transparent fold extend
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=jsObject,jsParen
|
||||
\ containedin=jsFuncBlock,jsParen,jsObject,jsObjectValue
|
||||
syn match styledPrefix "\.\<extend\>"
|
||||
\ transparent fold
|
||||
\ nextgroup=styledDefinition
|
||||
\ containedin=jsFuncBlock,jsParen,jsObject,jsObjectValue
|
||||
|
||||
" define emotion css prop
|
||||
" to bypass problems from top-level defined xml/js definitions, this
|
||||
" plugin re-defines keywords/noise for highlighting inside of the custom
|
||||
" xmlAttrib definition
|
||||
syn keyword styledXmlRegionKeyword css contained
|
||||
syn match styledXmlRegionNoise "\%(=\|{\|}\)" contained
|
||||
" only include styledDefinitions inside of xmlAttribs, that are wrapped
|
||||
" in `css={}` regions, `keepend` is necessary to correctly break on the
|
||||
" higher-level xmlAttrib region end
|
||||
syn region styledXmlRegion
|
||||
\ start="\<css\>={" end="}"
|
||||
\ keepend fold
|
||||
\ containedin=xmlAttrib
|
||||
\ contains=styledXmlRegionKeyword,styledXmlRegionNoise,styledDefinition
|
||||
|
||||
" define nested region for indenting
|
||||
syn region styledNestedRegion contained transparent
|
||||
\ matchgroup=cssBraces
|
||||
\ start="{" end="}"
|
||||
|
||||
" re-define cssError to be highlighted correctly in styledNestedRegion
|
||||
syn match cssError contained "{@<>"
|
||||
|
||||
" extend javascript matches to trigger styledDefinition highlighting
|
||||
syn match jsTaggedTemplate extend
|
||||
\ "\<css\>\|\.\<resolve\>\|\.\<global\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
|
||||
\ nextgroup=styledDefinition
|
||||
syn match jsFuncCall "\<styled\>\s*(.\+)" transparent
|
||||
\ nextgroup=styledDefinition
|
||||
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
|
||||
\ contains=styledTagNameString
|
||||
\ nextgroup=styledDefinition
|
||||
syn match jsFuncCall "\.\<withComponent\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))"
|
||||
\ contains=styledTagNameString
|
||||
syn match jsFuncCall "\<dc\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))\%((\)\@="
|
||||
\ contains=styledTagNameString
|
||||
\ nextgroup=styledDefinitionArgument
|
||||
|
||||
" inject css highlighting into custom jsTemplateString region
|
||||
" - use `extend` to not end all nested jsTemplateExpression on the first
|
||||
" closing one
|
||||
syn region styledDefinition contained transparent fold extend
|
||||
\ start="`" end="`" skip="\\\%(`\|$\)"
|
||||
\ contains=@CSSTop,
|
||||
\ css.*Prop,cssValue.*,cssColor,cssUrl,cssImportant,cssError,
|
||||
\ cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,
|
||||
\ cssHacks,
|
||||
\ cssCustom.*,
|
||||
\ jsComment,jsTemplateExpression,
|
||||
\ typescriptInterpolation,typescriptTemplateSubstitution,
|
||||
\ styledAmpersand,styledNestedRegion
|
||||
syn region styledDefinitionArgument contained transparent start=+(+ end=+)+
|
||||
\ contains=styledDefinition
|
||||
|
||||
""" yajs specific extensions
|
||||
" define template tag keywords, that trigger styledDefinitions again to be
|
||||
" contained in and also do contain the `javascriptTagRef` region
|
||||
syn match javascriptTagRefStyledPrefix transparent fold
|
||||
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
|
||||
\ containedin=javascriptTagRef
|
||||
\ contains=javascriptTagRef
|
||||
\ nextgroup=styledDefinition
|
||||
" extend the yajs clusters to include the previously and extraneously defined
|
||||
" styled-related matches
|
||||
syn cluster javascriptExpression
|
||||
\ add=styledPrefix,jsFuncCall,javascriptTagRefStyledPrefix
|
||||
syn cluster javascriptAfterIdentifier add=styledPrefix,jsFuncCall
|
||||
|
||||
" color the custom highlight elements
|
||||
hi def link cssCustomKeyFrameSelector Constant
|
||||
hi def link cssCustomPositioningPrefix StorageClass
|
||||
hi def link styledAmpersand Special
|
||||
|
||||
hi def link styledXmlRegionKeyword Type
|
||||
hi def link styledXmlRegionNoise Noise
|
||||
hi def link styledXmlRegion String
|
||||
|
||||
|
||||
if exists("s:current_syntax")
|
||||
let b:current_syntax=s:current_syntax
|
||||
endif
|
||||
@@ -11,7 +11,7 @@ if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
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'
|
||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'jsx') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
"
|
||||
" 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')
|
||||
let s:current_syntax=b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
syn include @XMLSyntax syntax/xml.vim
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax=s:current_syntax
|
||||
endif
|
||||
|
||||
" Officially, vim-jsx depends on the pangloss/vim-javascript syntax package
|
||||
" (and is tested against it exclusively). However, in practice, we make some
|
||||
" effort towards compatibility with other packages.
|
||||
"
|
||||
" These are the plugin-to-syntax-element correspondences:
|
||||
"
|
||||
" - pangloss/vim-javascript: jsBlock, jsExpression
|
||||
" - jelera/vim-javascript-syntax: javascriptBlock
|
||||
" - othree/yajs.vim: javascriptNoReserved
|
||||
|
||||
|
||||
" JSX attributes should color as JS. Note the trivial end pattern; we let
|
||||
" jsBlock take care of ending the region.
|
||||
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
|
||||
" syntactically distinct, and (b) they need the syn-extend argument, or else
|
||||
" nested XML end-tag patterns may end the outer jsxRegion.
|
||||
syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
||||
\ extend
|
||||
|
||||
" Highlight JSX regions as XML; recursively match.
|
||||
"
|
||||
" Note that we prohibit JSX tags from having a < or word character immediately
|
||||
" preceding it, to avoid conflicts with, respectively, the left shift operator
|
||||
" and generic Flow type annotations (http://flowtype.org/).
|
||||
syn region jsxRegion
|
||||
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z_][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
||||
\ skip=+<!--\_.\{-}-->+
|
||||
\ end=+</\z1\_\s\{-}>+
|
||||
\ end=+/>+
|
||||
\ keepend
|
||||
\ extend
|
||||
|
||||
" Shorthand fragment support
|
||||
"
|
||||
" Note that since the main jsxRegion contains @XMLSyntax, we cannot simply
|
||||
" adjust the regex above since @XMLSyntax will highlight the opening `<` as an
|
||||
" XMLError. Instead we create a new group with the same name that does not
|
||||
" include @XMLSyntax and instead uses matchgroup to get the same highlighting.
|
||||
syn region jsxRegion
|
||||
\ contains=@Spell,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||
\ matchgroup=xmlTag
|
||||
\ start=/<>/
|
||||
\ end=/<\/>/
|
||||
\ keepend
|
||||
\ extend
|
||||
|
||||
" Add jsxRegion to the lowest-level JS syntax cluster.
|
||||
syn cluster jsExpression add=jsxRegion
|
||||
|
||||
" Allow jsxRegion to contain reserved words.
|
||||
syn cluster javascriptNoReserved add=jsxRegion
|
||||
216
after/syntax/jsx_pretty.vim
Normal file
216
after/syntax/jsx_pretty.vim
Normal file
@@ -0,0 +1,216 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
|
||||
|
||||
" <tag id="sample">
|
||||
" ~~~~~~~~~~~~~~~~~
|
||||
" and self close tag
|
||||
" <tag id="sample" />
|
||||
" ~~~~~~~~~~~~~~~~~~~
|
||||
syntax region jsxTag
|
||||
\ start=+<+
|
||||
\ matchgroup=jsxOpenPunct
|
||||
\ end=+>+
|
||||
\ matchgroup=NONE
|
||||
\ end=+\(/\_s*>\)\@=+
|
||||
\ contained
|
||||
\ contains=jsxOpenTag,jsxEscapeJs,jsxAttrib,jsComment,@javascriptComments,javaScriptLineComment,javaScriptComment,typescriptLineComment,typescriptComment,jsxSpreadOperator
|
||||
\ keepend
|
||||
\ extend
|
||||
|
||||
" <tag></tag>
|
||||
" ~~~~~~~~~~~
|
||||
" and fragment
|
||||
" <></>
|
||||
" ~~~~~
|
||||
" and self close tag
|
||||
" <tag />
|
||||
" ~~~~~~~
|
||||
syntax region jsxElement
|
||||
\ start=+<\_s*\(>\|\${\|\z(\<[-:_\.\$0-9A-Za-z]\+\>\)\)+
|
||||
\ end=+/\_s*>+
|
||||
\ end=+<\_s*/\_s*\z1\_s*>+
|
||||
\ contains=jsxElement,jsxEscapeJs,jsxTag,jsxComment,jsxCloseString,jsxCloseTag,@Spell
|
||||
\ keepend
|
||||
\ extend
|
||||
\ contained
|
||||
\ fold
|
||||
|
||||
" detect jsx region
|
||||
syntax region jsxRegion
|
||||
\ start=+\(\(\_[([,?:=+\-*/<>{}]\|&&\|||\|=>\|\<return\|\<default\|\<await\|\<yield\)\_s*\)\@<=<\_s*\(>\|\z(\(script\)\@!\<[_\$A-Za-z][-:_\.\$0-9A-Za-z]*\>\)\(\_s*\([-+*)\]}&|?]\|/\([/*]\|\_s*>\)\@!\)\)\@!\)+
|
||||
\ end=++
|
||||
\ contains=jsxElement
|
||||
|
||||
" <tag key={this.props.key}>
|
||||
" ~~~~~~~~~~~~~~~~
|
||||
syntax region jsxEscapeJs
|
||||
\ start=+{+
|
||||
\ end=++
|
||||
\ extend
|
||||
\ contained
|
||||
\ contains=jsBlock,javascriptBlock,javaScriptBlockBuildIn,typescriptBlock
|
||||
|
||||
" <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' : '')
|
||||
|
||||
" <foo.bar>
|
||||
" ~
|
||||
syntax match jsxDot +\.+ contained display
|
||||
|
||||
" <foo:bar>
|
||||
" ~
|
||||
syntax match jsxNamespace +:+ contained display
|
||||
|
||||
" <tag id="sample">
|
||||
" ~
|
||||
syntax match jsxEqual +=+ contained display nextgroup=jsxString,jsxEscapeJs,jsxRegion skipwhite
|
||||
|
||||
" <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_][-:_\$0-9A-Za-z]*\>+
|
||||
\ contained
|
||||
\ nextgroup=jsxEqual
|
||||
\ skipwhite
|
||||
\ skipempty
|
||||
\ contains=jsxAttribKeyword
|
||||
\ display
|
||||
|
||||
" <MyComponent ...>
|
||||
" ~~~~~~~~~~~
|
||||
" NOT
|
||||
" <someCamel ...>
|
||||
" ~~~~~
|
||||
exe 'syntax match jsxComponentName
|
||||
\ +\<[A-Z][\$0-9A-Za-z]\+\>+
|
||||
\ contained
|
||||
\ display ' .(s:highlight_close_tag ? 'transparent' : '')
|
||||
|
||||
" <tag key={this.props.key}>
|
||||
" ~~~
|
||||
exe 'syntax match jsxTagName
|
||||
\ +\<[-:_\.\$0-9A-Za-z]\+\>+
|
||||
\ contained
|
||||
\ contains=jsxComponentName,jsxDot,jsxNamespace
|
||||
\ nextgroup=jsxAttrib
|
||||
\ skipempty
|
||||
\ skipwhite
|
||||
\ display ' .(s:highlight_close_tag ? 'transparent' : '')
|
||||
|
||||
" <tag id="sample">
|
||||
" ~~~~~~~~
|
||||
" and
|
||||
" <tag id='sample'>
|
||||
" ~~~~~~~~
|
||||
syntax region jsxString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ contained contains=@Spell display
|
||||
|
||||
let s:tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'raw'])
|
||||
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 region jsxTaggedRegion
|
||||
\ start=+\%('. join(s:tags, '\|') .'\)\@<=`+ms=s+1
|
||||
\ end=+`+me=e-1
|
||||
\ extend
|
||||
\ contained
|
||||
\ containedin=jsTemplateString,javascriptTemplate,javaScriptStringT,typescriptStringB
|
||||
\ contains=jsxElement'
|
||||
|
||||
syntax region jsxEscapeJs
|
||||
\ start=+\${+
|
||||
\ end=++
|
||||
\ extend
|
||||
\ contained
|
||||
\ contains=jsTemplateExpression,javascriptTemplateSubstitution,javaScriptEmbed,typescriptInterpolation
|
||||
|
||||
syntax region jsxOpenTag
|
||||
\ matchgroup=jsxOpenPunct
|
||||
\ start=+<\%(\${\)\@=+
|
||||
\ matchgroup=NONE
|
||||
\ end=++
|
||||
\ contained
|
||||
\ contains=jsxEscapeJs
|
||||
\ nextgroup=jsxAttrib,jsxSpreadOperator
|
||||
\ skipwhite
|
||||
\ skipempty
|
||||
|
||||
syntax keyword jsxAttribKeyword class contained display
|
||||
|
||||
syntax match jsxSpreadOperator +\.\.\.+ contained display nextgroup=jsxEscapeJs skipwhite
|
||||
|
||||
syntax match jsxCloseTag +<//>+ display
|
||||
|
||||
syntax match jsxComment +<!--\_.\{-}-->+ display
|
||||
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 jsxEqual Operator
|
||||
highlight def link jsxString String
|
||||
highlight def link jsxDot Operator
|
||||
highlight def link jsxNamespace Operator
|
||||
|
||||
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
|
||||
|
||||
highlight def link jsxComment Comment
|
||||
highlight def link jsxSpreadOperator Operator
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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\+\>/
|
||||
1469
after/syntax/mma.vim
1469
after/syntax/mma.vim
File diff suppressed because it is too large
Load Diff
116
after/syntax/typescript.vim
Normal file
116
after/syntax/typescript.vim
Normal file
@@ -0,0 +1,116 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
" Depends: leafgarland/typescript-vim
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
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
|
||||
|
||||
if !hlexists('typescriptTypeCast')
|
||||
" add a typescriptBlock group for typescript
|
||||
syntax region typescriptBlock
|
||||
\ matchgroup=typescriptBraces
|
||||
\ start="{"
|
||||
\ end="}"
|
||||
\ contained
|
||||
\ extend
|
||||
\ contains=@typescriptExpression,typescriptBlock
|
||||
\ fold
|
||||
endif
|
||||
|
||||
syntax cluster typescriptExpression add=jsxRegion,typescriptParens
|
||||
|
||||
runtime syntax/jsx_pretty.vim
|
||||
|
||||
let b:current_syntax = 'typescript.tsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'styled-components') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/javascript.vim
|
||||
|
||||
" define custom API section, that contains typescript annotations
|
||||
" this is structurally similar to `jsFuncCall`, but allows type
|
||||
" annotations (delimited by brackets (e.g. "<>")) between `styled` and
|
||||
" the function call parenthesis
|
||||
syn match styledTypescriptPrefix
|
||||
\ "\<styled\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>(\%('\k\+'\|\"\k\+\"\|\k\+\))"
|
||||
\ transparent fold extend
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=cssTagName,
|
||||
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
|
||||
\ typescriptParens,typescriptStringS,@typescriptType,
|
||||
\ typescriptType,foldBraces,
|
||||
\ styledTagNameString
|
||||
\ containedin=foldBraces
|
||||
syn match styledTypescriptPrefix
|
||||
\ "\<styled\>\%((\%('\k\+'\|\"\k\+\"\|\k\+\))\|\.\k\+\)<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
|
||||
\ transparent fold extend
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=cssTagName,
|
||||
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
|
||||
\ typescriptParens,typescriptStringS,@typescriptType,
|
||||
\ typescriptType,foldBraces,
|
||||
\ styledTagNameString
|
||||
\ containedin=foldBraces
|
||||
syn match styledTypescriptPrefix "\.\<attrs\>\s*(\%(\n\|\s\|.\)\{-})<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
|
||||
\ transparent fold extend
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=cssTagName,
|
||||
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
|
||||
\ typescriptParens,typescriptStringS,@typescriptType,
|
||||
\ typescriptType,foldBraces,
|
||||
\ styledTagNameString
|
||||
\ containedin=foldBraces
|
||||
syn match styledTypescriptPrefix "\.\<extend\><\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
|
||||
\ transparent fold extend
|
||||
\ nextgroup=styledDefinition
|
||||
\ contains=cssTagName,
|
||||
\ typescriptBraces,typescriptOpSymbols,typescriptEndColons,
|
||||
\ typescriptParens,typescriptStringS,@typescriptType,
|
||||
\ typescriptType,foldBraces,
|
||||
\ styledTagNameString
|
||||
\ containedin=foldBraces
|
||||
|
||||
syn match jsFuncCall "\<styled\>\s*(\%('\k\+'\|\"\k\+\"\|`\k\+`\))<\%(\[\|\]\|{\|}\||\|&\|:\|;\|,\|?\|'\|\"\|\k\|\s\|\n\)\+>"
|
||||
\ transparent fold
|
||||
\ contains=typescriptBraces,typescriptOpSymbols,typescriptEndColons,
|
||||
\ typescriptParens,typescriptStringS,@typescriptType,
|
||||
\ typescriptType,foldBraces,
|
||||
\ styledTagNameString
|
||||
\ nextgroup=styledDefinition
|
||||
\ containedin=foldBraces
|
||||
|
||||
syn cluster typescriptValue add=styledPrefix,jsFuncCall,styledTypescriptPrefix
|
||||
|
||||
""" yats specific extensions
|
||||
" extend typescriptIdentifierName to allow styledDefinitions in their
|
||||
" tagged templates
|
||||
syn match typescriptIdentifierName extend
|
||||
\ "\<css\>\|\<keyframes\>\|\<injectGlobal\>\|\<fontFace\>\|\<createGlobalStyle\>"
|
||||
\ nextgroup=styledDefinition
|
||||
@@ -11,7 +11,7 @@ if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
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 match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
|
||||
@@ -37,21 +37,45 @@ function! s:run_cmd(cmd) abort
|
||||
return s:P.system(a:cmd)
|
||||
endfunction
|
||||
|
||||
function! s:find_root_by_spec(d) abort
|
||||
let dir = finddir('spec', a:d . ';')
|
||||
if dir ==# ''
|
||||
function! s:find_root_by(search_dir, d) abort
|
||||
let found_dir = finddir(a:search_dir, a:d . ';')
|
||||
if found_dir ==# ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
" Note: ':h:h' for {root}/spec/ -> {root}/spec -> {root}
|
||||
return fnamemodify(dir, ':p:h:h')
|
||||
" Note: ':h:h' for {root}/{search_dir}/ -> {root}/{search_dir} -> {root}
|
||||
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
|
||||
|
||||
function! crystal_lang#entrypoint_for(file_path) abort
|
||||
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 ==# ''
|
||||
" No spec diretory found. No need to make temporary file
|
||||
" No spec directory found. No need to make temporary file
|
||||
return a:file_path
|
||||
endif
|
||||
|
||||
@@ -232,7 +256,7 @@ endfunction
|
||||
|
||||
function! crystal_lang#run_all_spec(...) abort
|
||||
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 ==# ''
|
||||
return s:echo_error("'spec' directory is not found")
|
||||
endif
|
||||
@@ -250,9 +274,9 @@ function! crystal_lang#run_current_spec(...) abort
|
||||
let source_dir = fnamemodify(path, ':h')
|
||||
|
||||
" /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 ==# ''
|
||||
return s:echo_error("'spec' directory is not found")
|
||||
return s:echo_error("Root directory with 'src/' and 'spec/' not found")
|
||||
endif
|
||||
|
||||
" src
|
||||
|
||||
3191
autoload/csv.vim
Normal file
3191
autoload/csv.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,22 +9,35 @@ function! s:error(text) abort
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
function! s:cexpr(errorformat, joined_lines) abort
|
||||
let temp_errorfomat = &errorformat
|
||||
try
|
||||
let &errorformat = a:errorformat
|
||||
cexpr a:joined_lines
|
||||
copen
|
||||
finally
|
||||
let &errorformat = temp_errorfomat
|
||||
endtry
|
||||
function! s:cexpr(errorformat, lines, reason) abort
|
||||
call setqflist([], ' ', {
|
||||
\ 'lines': a:lines,
|
||||
\ 'efm': a:errorformat,
|
||||
\ 'context': {'reason': a:reason},
|
||||
\})
|
||||
copen
|
||||
endfunction
|
||||
|
||||
" 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
|
||||
|
||||
function! dart#fmt(q_args) abort
|
||||
if executable('dartfmt')
|
||||
let buffer_content = join(getline(1, '$'), "\n")
|
||||
let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content)
|
||||
if buffer_content ==# joined_lines[:-2] | return | endif
|
||||
let args = '--stdin-name '.expand('%').' '.a:q_args
|
||||
let joined_lines = system(printf('dartfmt %s', args), buffer_content)
|
||||
if buffer_content ==# joined_lines[:-2]
|
||||
call s:clearQfList('dartfmt')
|
||||
return
|
||||
endif
|
||||
if 0 == v:shell_error
|
||||
let win_view = winsaveview()
|
||||
let lines = split(joined_lines, "\n")
|
||||
@@ -33,12 +46,11 @@ function! dart#fmt(q_args) abort
|
||||
silent keepjumps execute string(len(lines)+1).',$ delete'
|
||||
endif
|
||||
call winrestview(win_view)
|
||||
call s:clearQfList('dartfmt')
|
||||
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"))
|
||||
let error_format = '%Aline %l\, column %c of %f: %m,%C%.%#'
|
||||
call s:cexpr(error_format, errors, 'dartfmt')
|
||||
endif
|
||||
else
|
||||
call s:error('cannot execute binary file: dartfmt')
|
||||
@@ -49,8 +61,9 @@ function! dart#analyzer(q_args) abort
|
||||
if executable('dartanalyzer')
|
||||
let path = expand('%:p:gs:\:/:')
|
||||
if filereadable(path)
|
||||
let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path)))
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
||||
let command = printf('dartanalyzer %s %s', a:q_args, shellescape(path))
|
||||
let lines = systemlist(command)
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dartanalyzer')
|
||||
else
|
||||
call s:error(printf('cannot read a file: "%s"', path))
|
||||
endif
|
||||
@@ -63,8 +76,9 @@ function! dart#tojs(q_args) abort
|
||||
if executable('dart2js')
|
||||
let path = expand('%:p:gs:\:/:')
|
||||
if filereadable(path)
|
||||
let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path)))
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines)
|
||||
let command = printf('dart2js %s %s', a:q_args, shellescape(path))
|
||||
let lines = systemlist(command)
|
||||
call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dart2js')
|
||||
else
|
||||
call s:error(printf('cannot read a file: "%s"', path))
|
||||
endif
|
||||
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
@@ -25,6 +25,7 @@ function! elixir#indent#indent(lnum)
|
||||
|
||||
let handlers = [
|
||||
\'top_of_file',
|
||||
\'starts_with_string_continuation',
|
||||
\'following_trailing_binary_operator',
|
||||
\'starts_with_pipe',
|
||||
\'starts_with_binary_operator',
|
||||
@@ -35,9 +36,14 @@ function! elixir#indent#indent(lnum)
|
||||
\]
|
||||
for handler in handlers
|
||||
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)
|
||||
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 cursor(curs_lnum, curs_col)
|
||||
return indent
|
||||
@@ -102,7 +108,11 @@ endfunction
|
||||
" Returns 0 or 1 based on whether or not the given line number and column
|
||||
" number pair is a string or comment
|
||||
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
|
||||
|
||||
" Skip expression for searchpair. Returns 0 or 1 based on whether the value
|
||||
@@ -158,6 +168,14 @@ function! elixir#indent#handle_top_of_file(context)
|
||||
end
|
||||
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)
|
||||
return s:get_base_indent(a:context.prev_nb_lnum, a:context.prev_nb_text)
|
||||
endfunction
|
||||
|
||||
@@ -136,7 +136,13 @@ function! elm#util#GoToModule(name)
|
||||
endfunction
|
||||
|
||||
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')
|
||||
let l:package = json_decode(readfile(l:package_json))
|
||||
let l:source_roots = l:package['source-directories']
|
||||
|
||||
@@ -11,15 +11,15 @@ function! fish#Indent()
|
||||
let l:indent = 0
|
||||
let l:prevline = getline(l:prevlnum)
|
||||
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)>'
|
||||
let l:indent = l:shiftwidth
|
||||
endif
|
||||
let l:line = getline(v:lnum)
|
||||
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)>'
|
||||
return indent(v:lnum) - l:shiftwidth
|
||||
return indent(l:prevlnum) - l:shiftwidth
|
||||
endif
|
||||
return indent(l:prevlnum) + l:indent
|
||||
endfunction
|
||||
|
||||
@@ -25,10 +25,12 @@ endfunction
|
||||
function! go#config#SetBuildTags(value) abort
|
||||
if a:value is ''
|
||||
silent! unlet g:go_build_tags
|
||||
call go#lsp#ResetWorkspaceDirectories()
|
||||
return
|
||||
endif
|
||||
|
||||
let g:go_build_tags = a:value
|
||||
call go#lsp#ResetWorkspaceDirectories()
|
||||
endfunction
|
||||
|
||||
function! go#config#TestTimeout() abort
|
||||
@@ -51,8 +53,16 @@ function! go#config#TermMode() abort
|
||||
return get(g:, 'go_term_mode', 'vsplit')
|
||||
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
|
||||
return get(g:, 'go_term_enabled', 0)
|
||||
return has('nvim') && get(g:, 'go_term_enabled', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#SetTermEnabled(value) abort
|
||||
@@ -118,7 +128,7 @@ function! go#config#ListAutoclose() abort
|
||||
endfunction
|
||||
|
||||
function! go#config#InfoMode() abort
|
||||
return get(g:, 'go_info_mode', 'gocode')
|
||||
return get(g:, 'go_info_mode', 'gopls')
|
||||
endfunction
|
||||
|
||||
function! go#config#GuruScope() abort
|
||||
@@ -178,12 +188,15 @@ function! go#config#DocUrl() abort
|
||||
return godoc_url
|
||||
endfunction
|
||||
|
||||
function! go#config#DocPopupWindow() abort
|
||||
return get(g:, 'go_doc_popup_window', 0)
|
||||
endfunction
|
||||
function! go#config#DefReuseBuffer() abort
|
||||
return get(g:, 'go_def_reuse_buffer', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#DefMode() abort
|
||||
return get(g:, 'go_def_mode', 'guru')
|
||||
return get(g:, 'go_def_mode', 'gopls')
|
||||
endfunction
|
||||
|
||||
function! go#config#DeclsIncludes() abort
|
||||
@@ -214,6 +227,16 @@ function! go#config#DebugCommands() abort
|
||||
return g:go_debug_commands
|
||||
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
|
||||
let g:go_debug_diag = a:value
|
||||
endfunction
|
||||
@@ -239,19 +262,27 @@ function! go#config#SetTemplateAutocreate(value) abort
|
||||
endfunction
|
||||
|
||||
function! go#config#MetalinterCommand() abort
|
||||
return get(g:, "go_metalinter_command", "")
|
||||
return get(g:, "go_metalinter_command", "gometalinter")
|
||||
endfunction
|
||||
|
||||
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
|
||||
|
||||
function! go#config#MetalinterEnabled() abort
|
||||
return get(g:, "go_metalinter_enabled", ['vet', 'golint', 'errcheck'])
|
||||
endfunction
|
||||
let l:default_enabled = ["vet", "golint", "errcheck"]
|
||||
|
||||
function! go#config#MetalinterDisabled() abort
|
||||
return get(g:, "go_metalinter_disabled", [])
|
||||
if go#config#MetalinterCommand() == "golangci-lint"
|
||||
let l:default_enabled = ["govet", "golint"]
|
||||
endif
|
||||
|
||||
return get(g:, "go_metalinter_enabled", default_enabled)
|
||||
endfunction
|
||||
|
||||
function! go#config#GolintBin() abort
|
||||
@@ -448,6 +479,9 @@ 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
|
||||
|
||||
" Set the default value. A value of "1" is a shortcut for this, for
|
||||
" compatibility reasons.
|
||||
|
||||
16
autoload/graphql.vim
Normal file
16
autoload/graphql.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'graphql') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim plugin
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('g:autoloaded_graphql')
|
||||
finish
|
||||
endif
|
||||
let g:autoloaded_graphql = 1
|
||||
|
||||
function! graphql#javascript_tags() abort
|
||||
return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||
endfunction
|
||||
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)
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
218
autoload/jsx_pretty/indent.vim
Normal file
218
autoload/jsx_pretty/indent.vim
Normal file
@@ -0,0 +1,218 @@
|
||||
if exists('g:polyglot_disabled') && (index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('*shiftwidth')
|
||||
function! s:sw()
|
||||
return shiftwidth()
|
||||
endfunction
|
||||
else
|
||||
function! s:sw()
|
||||
return &sw
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Get the syntax group of start of line
|
||||
function! s:syn_sol(lnum)
|
||||
let line = getline(a:lnum)
|
||||
let sol = matchstr(line, '^\s*')
|
||||
return map(synstack(a:lnum, len(sol) + 1), 'synIDattr(v:val, "name")')
|
||||
endfunction
|
||||
|
||||
" Get the syntax group of end of line
|
||||
function! s:syn_eol(lnum)
|
||||
let lnum = prevnonblank(a:lnum)
|
||||
let col = strlen(getline(lnum))
|
||||
return map(synstack(lnum, col), 'synIDattr(v:val, "name")')
|
||||
endfunction
|
||||
|
||||
function! s:prev_indent(lnum)
|
||||
let lnum = prevnonblank(a:lnum - 1)
|
||||
return indent(lnum)
|
||||
endfunction
|
||||
|
||||
function! s:prev_line(lnum)
|
||||
let lnum = prevnonblank(a:lnum - 1)
|
||||
return substitute(getline(lnum), '^\s*\|\s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:syn_attr_jsx(synattr)
|
||||
return a:synattr =~? "^jsx"
|
||||
endfunction
|
||||
|
||||
function! s:syn_xmlish(syns)
|
||||
return s:syn_attr_jsx(get(a:syns, -1))
|
||||
endfunction
|
||||
|
||||
function! s:syn_jsx_element(syns)
|
||||
return get(a:syns, -1) =~? 'jsxElement'
|
||||
endfunction
|
||||
|
||||
function! s:syn_js_comment(syns)
|
||||
return get(a:syns, -1) =~? 'Comment$'
|
||||
endfunction
|
||||
|
||||
function! s:syn_jsx_escapejs(syns)
|
||||
return get(a:syns, -1) =~? '\(\(js\(Template\)\?\|javaScript\(Embed\)\?\|typescript\)Braces\|javascriptTemplateSB\|typescriptInterpolationDelimiter\)' &&
|
||||
\ (get(a:syns, -2) =~? 'jsxEscapeJs' ||
|
||||
\ get(a:syns, -3) =~? 'jsxEscapeJs')
|
||||
endfunction
|
||||
|
||||
function! s:syn_jsx_attrib(syns)
|
||||
return len(filter(copy(a:syns), 'v:val =~? "jsxAttrib"'))
|
||||
endfunction
|
||||
|
||||
let s:start_tag = '<\s*\([-:_\.\$0-9A-Za-z]\+\|>\)'
|
||||
" match `/end_tag>` and `//>`
|
||||
let s:end_tag = '/\%(\s*[-:_\.\$0-9A-Za-z]*\s*\|/\)>'
|
||||
let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
||||
\ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)')
|
||||
|
||||
function! jsx_pretty#indent#get(js_indent)
|
||||
let lnum = v:lnum
|
||||
let line = substitute(getline(lnum), '^\s*\|\s*$', '', 'g')
|
||||
let current_syn = s:syn_sol(lnum)
|
||||
let current_syn_eol = s:syn_eol(lnum)
|
||||
let prev_line_num = prevnonblank(lnum - 1)
|
||||
let prev_syn_sol = s:syn_sol(prev_line_num)
|
||||
let prev_syn_eol = s:syn_eol(prev_line_num)
|
||||
let prev_line = s:prev_line(lnum)
|
||||
let prev_ind = s:prev_indent(lnum)
|
||||
|
||||
if s:syn_xmlish(current_syn)
|
||||
|
||||
if !s:syn_xmlish(prev_syn_sol)
|
||||
\ && !s:syn_jsx_escapejs(prev_syn_sol)
|
||||
\ && !s:syn_jsx_escapejs(prev_syn_eol)
|
||||
\ && !s:syn_js_comment(prev_syn_sol)
|
||||
if line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind + s:sw()
|
||||
endif
|
||||
elseif !s:syn_xmlish(prev_syn_sol) && !s:syn_js_comment(prev_syn_sol) && s:syn_jsx_attrib(current_syn)
|
||||
" For #79
|
||||
return prev_ind + s:sw()
|
||||
" {
|
||||
" <div></div>
|
||||
" ##} <--
|
||||
elseif s:syn_jsx_element(current_syn) && line =~ '}$'
|
||||
let pair_line = searchpair('{', '', '}', 'b')
|
||||
return indent(pair_line)
|
||||
elseif line =~ '^-->$'
|
||||
if prev_line =~ '^<!--'
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind - s:sw()
|
||||
endif
|
||||
elseif prev_line =~ '-->$'
|
||||
return prev_ind
|
||||
" close tag </tag> or /> including </>
|
||||
elseif prev_line =~ s:end_tag . '$'
|
||||
if line =~ '^<\s*' . s:end_tag
|
||||
return prev_ind - s:sw()
|
||||
elseif s:syn_jsx_attrib(prev_syn_sol)
|
||||
return prev_ind - s:sw()
|
||||
else
|
||||
return prev_ind
|
||||
endif
|
||||
elseif line =~ '^\(>\|/\s*>\)'
|
||||
if prev_line =~ '^<'
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind - s:sw()
|
||||
endif
|
||||
elseif prev_line =~ '^\(<\|>\)' &&
|
||||
\ (s:syn_xmlish(prev_syn_eol) || s:syn_js_comment(prev_syn_eol))
|
||||
if line =~ '^<\s*' . s:end_tag
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind + s:sw()
|
||||
endif
|
||||
elseif line =~ '^<\s*' . s:end_tag
|
||||
if !s:syn_xmlish(prev_syn_sol)
|
||||
if s:syn_jsx_escapejs(prev_syn_eol)
|
||||
\ || s:syn_jsx_escapejs(prev_syn_sol)
|
||||
return prev_ind - s:sw()
|
||||
else
|
||||
return prev_ind
|
||||
endif
|
||||
elseif prev_line =~ '^\<return'
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind - s:sw()
|
||||
endif
|
||||
elseif !s:syn_xmlish(prev_syn_eol)
|
||||
if prev_line =~ '\(&&\|||\|=>\|[([{]\|`\)$'
|
||||
" <div>
|
||||
" {
|
||||
" }
|
||||
" </div>
|
||||
if line =~ '^[)\]}]'
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind + s:sw()
|
||||
endif
|
||||
else
|
||||
return prev_ind
|
||||
endif
|
||||
else
|
||||
return prev_ind
|
||||
endif
|
||||
elseif s:syn_jsx_escapejs(current_syn)
|
||||
if line =~ '^}'
|
||||
let char = getline('.')[col('.') - 1]
|
||||
" When pressing enter after the }, keep the indent
|
||||
if char != '}' && search('}', 'b', lnum)
|
||||
return indent(lnum)
|
||||
else
|
||||
let pair_line = searchpair('{', '', '}', 'bW')
|
||||
return indent(pair_line)
|
||||
endif
|
||||
elseif line =~ '^{' || line =~ '^\${'
|
||||
if s:syn_jsx_escapejs(prev_syn_eol)
|
||||
\ || s:syn_jsx_attrib(prev_syn_sol)
|
||||
return prev_ind
|
||||
elseif s:syn_xmlish(prev_syn_eol) && (prev_line =~ s:end_tag || prev_line =~ '-->$')
|
||||
return prev_ind
|
||||
else
|
||||
return prev_ind + s:sw()
|
||||
endif
|
||||
endif
|
||||
elseif line =~ '^`' && s:syn_jsx_escapejs(current_syn_eol)
|
||||
" For `} of template syntax
|
||||
let pair_line = searchpair('{', '', '}', 'bW')
|
||||
return indent(pair_line)
|
||||
elseif line =~ '^/[/*]' " js comment in jsx tag
|
||||
if get(prev_syn_sol, -1) =~ 'Punct'
|
||||
return prev_ind + s:sw()
|
||||
elseif synIDattr(synID(lnum - 1, 1, 1), 'name') =~ 'jsxTag'
|
||||
return prev_ind
|
||||
else
|
||||
return a:js_indent()
|
||||
endif
|
||||
else
|
||||
let ind = a:js_indent()
|
||||
|
||||
" Issue #68
|
||||
" return (<div>
|
||||
" |<div>)
|
||||
if (line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag)
|
||||
\ && !s:syn_xmlish(prev_syn_sol)
|
||||
return prev_ind
|
||||
endif
|
||||
|
||||
" If current syntax is not a jsx syntax group
|
||||
if s:syn_xmlish(prev_syn_eol) && line !~ '^[)\]}]'
|
||||
let sol = matchstr(line, s:opfirst)
|
||||
if sol is ''
|
||||
" Fix javascript continue indent
|
||||
return ind - s:sw()
|
||||
else
|
||||
return ind
|
||||
endif
|
||||
endif
|
||||
return ind
|
||||
endif
|
||||
|
||||
endfunction
|
||||
@@ -3,7 +3,7 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'julia') != -1
|
||||
endif
|
||||
|
||||
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
|
||||
" The symbols are based on Julia version 1.1.0-DEV.695
|
||||
" The symbols are based on Julia version 1.3.0-DEV.263
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -392,6 +392,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\trademark': '™',
|
||||
\ '\:tm:': '™',
|
||||
\ '\bbZ': 'ℤ',
|
||||
\ '\ohm': 'Ω',
|
||||
\ '\mho': '℧',
|
||||
\ '\frakZ': 'ℨ',
|
||||
\ '\turnediota': '℩',
|
||||
@@ -498,8 +499,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\circlearrowright': '↻',
|
||||
\ '\leftharpoonup': '↼',
|
||||
\ '\leftharpoondown': '↽',
|
||||
\ '\upharpoonleft': '↾',
|
||||
\ '\upharpoonright': '↿',
|
||||
\ '\upharpoonright': '↾',
|
||||
\ '\upharpoonleft': '↿',
|
||||
\ '\rightharpoonup': '⇀',
|
||||
\ '\rightharpoondown': '⇁',
|
||||
\ '\downharpoonright': '⇂',
|
||||
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
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
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
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
|
||||
|
||||
61
autoload/puppet/format.vim
Normal file
61
autoload/puppet/format.vim
Normal file
@@ -0,0 +1,61 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
"
|
||||
" 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
|
||||
call puppet#format#Indention(l:start_lnum, l:end_lnum)
|
||||
call puppet#format#Hashrocket(l:start_lnum, l:end_lnum)
|
||||
call puppet#format#Fallback(l:start_lnum, l:end_lnum)
|
||||
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
|
||||
" 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
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'racket') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:raco_command")
|
||||
let g:raco_command = system("which raco")
|
||||
endif
|
||||
@@ -509,7 +509,7 @@ function! rust#Test(all, options) abort
|
||||
return rust#Run(1, '--test ' . a:options)
|
||||
endif
|
||||
|
||||
if exists(':terminal')
|
||||
if has('terminal') || has('nvim')
|
||||
let cmd = 'terminal '
|
||||
else
|
||||
let cmd = '!'
|
||||
@@ -530,7 +530,7 @@ function! rust#Test(all, options) abort
|
||||
let func_name = s:SearchTestFunctionNameUnderCursor()
|
||||
if func_name ==# ''
|
||||
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
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -5,6 +5,7 @@ endif
|
||||
" For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim
|
||||
|
||||
let s:global_variable_list = [
|
||||
\ '_rustfmt_autosave_because_of_config',
|
||||
\ 'ftplugin_rust_source_path',
|
||||
\ 'loaded_syntastic_rust_cargo_checker',
|
||||
\ 'loaded_syntastic_rust_filetype',
|
||||
@@ -32,7 +33,6 @@ let s:global_variable_list = [
|
||||
\ 'rustc_makeprg_no_percent',
|
||||
\ 'rustc_path',
|
||||
\ 'rustfmt_autosave',
|
||||
\ 'rustfmt_autosave_because_of_config',
|
||||
\ 'rustfmt_autosave_if_config_present',
|
||||
\ 'rustfmt_command',
|
||||
\ 'rustfmt_emit_files',
|
||||
@@ -48,7 +48,9 @@ endfunction
|
||||
|
||||
function! s:EchoGlobalVariables() abort
|
||||
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)
|
||||
call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key]))
|
||||
|
||||
21
autoload/rust/tags.vim
Normal file
21
autoload/rust/tags.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'rust') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
if system('ctags --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:
|
||||
@@ -149,6 +149,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
||||
|
||||
call delete(l:stderr_tmpname)
|
||||
|
||||
let l:open_lwindow = 0
|
||||
if v:shell_error == 0
|
||||
" remove undo point caused via BufWritePre
|
||||
try | silent undojoin | catch | endtry
|
||||
@@ -169,7 +170,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
||||
if s:got_fmt_error
|
||||
let s:got_fmt_error = 0
|
||||
call setloclist(0, [])
|
||||
lwindow
|
||||
let l:open_lwindow = 1
|
||||
endif
|
||||
elseif g:rustfmt_fail_silently == 0 && a:fail_silently == 0
|
||||
" otherwise get the errors and put them in the location list
|
||||
@@ -201,7 +202,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
||||
endif
|
||||
|
||||
let s:got_fmt_error = 1
|
||||
lwindow
|
||||
let l:open_lwindow = 1
|
||||
endif
|
||||
|
||||
" Restore the current directory if needed
|
||||
@@ -213,6 +214,11 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
|
||||
endif
|
||||
endif
|
||||
|
||||
" Open lwindow after we have changed back to the previous directory
|
||||
if l:open_lwindow == 1
|
||||
lwindow
|
||||
endif
|
||||
|
||||
silent! loadview
|
||||
endfunction
|
||||
|
||||
@@ -234,10 +240,18 @@ function! rustfmt#Cmd()
|
||||
endfunction
|
||||
|
||||
function! rustfmt#PreWrite()
|
||||
if !filereadable(expand("%@"))
|
||||
return
|
||||
endif
|
||||
if rust#GetConfigVar('rustfmt_autosave_if_config_present', 0)
|
||||
if findfile('rustfmt.toml', '.;') !=# '' || findfile('.rustfmt.toml', '.;') !=# ''
|
||||
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
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'scss') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
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
|
||||
finish
|
||||
endif
|
||||
|
||||
" 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
|
||||
60
autoload/terraform.vim
Normal file
60
autoload/terraform.vim
Normal file
@@ -0,0 +1,60 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'terraform') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
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(A, L, P)
|
||||
return [
|
||||
\ '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'
|
||||
\ ]
|
||||
endfunction
|
||||
43
autoload/zig/config.vim
Normal file
43
autoload/zig/config.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
function! zig#config#ListTypeCommands() abort
|
||||
return get(g:, 'zig_list_type_commands', {})
|
||||
endfunction
|
||||
|
||||
function! zig#config#ListType() abort
|
||||
return get(g:, 'zig_list_type', '')
|
||||
endfunction
|
||||
|
||||
function! zig#config#ListAutoclose() abort
|
||||
return get(g:, 'zig_list_autoclose', 1)
|
||||
endfunction
|
||||
|
||||
function! zig#config#ListHeight() abort
|
||||
return get(g:, "zig_list_height", 0)
|
||||
endfunction
|
||||
|
||||
function! zig#config#FmtAutosave() abort
|
||||
return get(g:, "zig_fmt_autosave", 0)
|
||||
endfunction
|
||||
|
||||
function! zig#config#SetFmtAutosave(value) abort
|
||||
let g:zig_fmt_autosave = a:value
|
||||
endfunction
|
||||
|
||||
function! zig#config#FmtCommand() abort
|
||||
return get(g:, "zig_fmt_command", ['zig', 'fmt', '--color', 'off'])
|
||||
endfunction
|
||||
|
||||
function! zig#config#FmtFailSilently() abort
|
||||
return get(g:, "zig_fmt_fail_silently", 0)
|
||||
endfunction
|
||||
|
||||
function! zig#config#FmtExperimental() abort
|
||||
return get(g:, "zig_fmt_experimental", 0)
|
||||
endfunction
|
||||
|
||||
function! zig#config#Debug() abort
|
||||
return get(g:, 'zig_debug', [])
|
||||
endfunction
|
||||
170
autoload/zig/fmt.vim
Normal file
170
autoload/zig/fmt.vim
Normal file
@@ -0,0 +1,170 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Adapted from fatih/vim-go: autoload/go/fmt.vim
|
||||
"
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
function! zig#fmt#Format() abort
|
||||
if zig#config#FmtExperimental()
|
||||
" Using winsaveview to save/restore cursor state has the problem of
|
||||
" closing folds on save:
|
||||
" https://github.com/fatih/vim-go/issues/502
|
||||
" One fix is to use mkview instead. Unfortunately, this sometimes causes
|
||||
" other bad side effects:
|
||||
" https://github.com/fatih/vim-go/issues/728
|
||||
" and still closes all folds if foldlevel>0:
|
||||
" https://github.com/fatih/vim-go/issues/732
|
||||
let l:curw = {}
|
||||
try
|
||||
mkview!
|
||||
catch
|
||||
let l:curw = winsaveview()
|
||||
endtry
|
||||
|
||||
" save our undo file to be restored after we are done. This is needed to
|
||||
" prevent an additional undo jump due to BufWritePre auto command and also
|
||||
" restore 'redo' history because it's getting being destroyed every
|
||||
" BufWritePre
|
||||
let tmpundofile = tempname()
|
||||
exe 'wundo! ' . tmpundofile
|
||||
else
|
||||
" Save cursor position and many other things.
|
||||
let l:curw = winsaveview()
|
||||
endif
|
||||
|
||||
" Save cursor position and many other things.
|
||||
let l:curw = winsaveview()
|
||||
|
||||
let bin_name = zig#config#FmtCommand()
|
||||
|
||||
" Get current position in file
|
||||
let current_col = col('.')
|
||||
let orig_line_count = line('$')
|
||||
|
||||
" Save current buffer first, else fmt will run on the original file and we
|
||||
" will lose our changes.
|
||||
silent! execute 'write' expand('%')
|
||||
|
||||
let [l:out, l:err] = zig#fmt#run(bin_name, expand('%'))
|
||||
|
||||
if l:err == 0
|
||||
call zig#fmt#update_file(expand('%'))
|
||||
elseif !zig#config#FmtFailSilently()
|
||||
let errors = s:parse_errors(expand('%'), out)
|
||||
call s:show_errors(errors)
|
||||
endif
|
||||
|
||||
let diff_offset = line('$') - orig_line_count
|
||||
|
||||
if zig#config#FmtExperimental()
|
||||
" restore our undo history
|
||||
silent! exe 'rundo ' . tmpundofile
|
||||
call delete(tmpundofile)
|
||||
|
||||
" Restore our cursor/windows positions, folds, etc.
|
||||
if empty(l:curw)
|
||||
silent! loadview
|
||||
else
|
||||
call winrestview(l:curw)
|
||||
endif
|
||||
else
|
||||
" Restore our cursor/windows positions.
|
||||
call winrestview(l:curw)
|
||||
endif
|
||||
|
||||
" be smart and jump to the line the new statement was added/removed
|
||||
call cursor(line('.') + diff_offset, current_col)
|
||||
|
||||
" Syntax highlighting breaks less often.
|
||||
syntax sync fromstart
|
||||
endfunction
|
||||
|
||||
" update_file updates the target file with the given formatted source
|
||||
function! zig#fmt#update_file(target)
|
||||
" remove undo point caused via BufWritePre
|
||||
try | silent undojoin | catch | endtry
|
||||
|
||||
" reload buffer to reflect latest changes
|
||||
silent edit!
|
||||
|
||||
let l:listtype = zig#list#Type("ZigFmt")
|
||||
|
||||
" the title information was introduced with 7.4-2200
|
||||
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
|
||||
if has('patch-7.4.2200')
|
||||
" clean up previous list
|
||||
if l:listtype == "quickfix"
|
||||
let l:list_title = getqflist({'title': 1})
|
||||
else
|
||||
let l:list_title = getloclist(0, {'title': 1})
|
||||
endif
|
||||
else
|
||||
" can't check the title, so assume that the list was for go fmt.
|
||||
let l:list_title = {'title': 'Format'}
|
||||
endif
|
||||
|
||||
if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
|
||||
call zig#list#Clean(l:listtype)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" run runs the gofmt/goimport command for the given source file and returns
|
||||
" the output of the executed command. Target is the real file to be formatted.
|
||||
function! zig#fmt#run(bin_name, target)
|
||||
let l:cmd = []
|
||||
call extend(cmd, a:bin_name)
|
||||
call extend(cmd, [a:target])
|
||||
return zig#util#Exec(l:cmd)
|
||||
endfunction
|
||||
|
||||
" parse_errors parses the given errors and returns a list of parsed errors
|
||||
function! s:parse_errors(filename, content) abort
|
||||
let splitted = split(a:content, '\n')
|
||||
|
||||
" list of errors to be put into location list
|
||||
let errors = []
|
||||
for line in splitted
|
||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||
if !empty(tokens)
|
||||
call add(errors,{
|
||||
\"filename": a:filename,
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[4],
|
||||
\ })
|
||||
endif
|
||||
endfor
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
|
||||
" show_errors opens a location list and shows the given errors. If the given
|
||||
" errors is empty, it closes the the location list
|
||||
function! s:show_errors(errors) abort
|
||||
let l:listtype = zig#list#Type("ZigFmt")
|
||||
if !empty(a:errors)
|
||||
call zig#list#Populate(l:listtype, a:errors, 'Format')
|
||||
echohl Error | echomsg "zig fmt returned error" | echohl None
|
||||
endif
|
||||
|
||||
" this closes the window if there are no errors or it opens
|
||||
" it if there is any
|
||||
call zig#list#Window(l:listtype, len(a:errors))
|
||||
endfunction
|
||||
|
||||
function! zig#fmt#ToggleFmtAutoSave() abort
|
||||
if zig#config#FmtAutosave()
|
||||
call zig#config#SetFmtAutosave(0)
|
||||
call zig#util#EchoProgress("auto fmt disabled")
|
||||
return
|
||||
end
|
||||
|
||||
call zig#config#SetFmtAutosave(1)
|
||||
call zig#util#EchoProgress("auto fmt enabled")
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
162
autoload/zig/list.vim
Normal file
162
autoload/zig/list.vim
Normal file
@@ -0,0 +1,162 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Adapted from fatih/vim-go: autoload/go/list.vim
|
||||
"
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
|
||||
" Window opens the list with the given height up to 10 lines maximum.
|
||||
" Otherwise g:zig_loclist_height is used.
|
||||
"
|
||||
" If no or zero height is given it closes the window by default.
|
||||
" To prevent this, set g:zig_list_autoclose = 0
|
||||
function! zig#list#Window(listtype, ...) abort
|
||||
" we don't use lwindow to close the location list as we need also the
|
||||
" ability to resize the window. So, we are going to use lopen and lclose
|
||||
" for a better user experience. If the number of errors in a current
|
||||
" location list increases/decreases, cwindow will not resize when a new
|
||||
" updated height is passed. lopen in the other hand resizes the screen.
|
||||
if !a:0 || a:1 == 0
|
||||
call zig#list#Close(a:listtype)
|
||||
return
|
||||
endif
|
||||
|
||||
let height = zig#config#ListHeight()
|
||||
if height == 0
|
||||
" prevent creating a large location height for a large set of numbers
|
||||
if a:1 > 10
|
||||
let height = 10
|
||||
else
|
||||
let height = a:1
|
||||
endif
|
||||
endif
|
||||
|
||||
if a:listtype == "locationlist"
|
||||
exe 'lopen ' . height
|
||||
else
|
||||
exe 'copen ' . height
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" Get returns the current items from the list
|
||||
function! zig#list#Get(listtype) abort
|
||||
if a:listtype == "locationlist"
|
||||
return getloclist(0)
|
||||
else
|
||||
return getqflist()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Populate populate the list with the given items
|
||||
function! zig#list#Populate(listtype, items, title) abort
|
||||
if a:listtype == "locationlist"
|
||||
call setloclist(0, a:items, 'r')
|
||||
|
||||
" The last argument ({what}) is introduced with 7.4.2200:
|
||||
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
|
||||
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
|
||||
else
|
||||
call setqflist(a:items, 'r')
|
||||
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Parse parses the given items based on the specified errorformat and
|
||||
" populates the list.
|
||||
function! zig#list#ParseFormat(listtype, errformat, items, title) abort
|
||||
" backup users errorformat, will be restored once we are finished
|
||||
let old_errorformat = &errorformat
|
||||
|
||||
" parse and populate the location list
|
||||
let &errorformat = a:errformat
|
||||
try
|
||||
call zig#list#Parse(a:listtype, a:items, a:title)
|
||||
finally
|
||||
"restore back
|
||||
let &errorformat = old_errorformat
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Parse parses the given items based on the global errorformat and
|
||||
" populates the list.
|
||||
function! zig#list#Parse(listtype, items, title) abort
|
||||
if a:listtype == "locationlist"
|
||||
lgetexpr a:items
|
||||
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
|
||||
else
|
||||
cgetexpr a:items
|
||||
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" JumpToFirst jumps to the first item in the location list
|
||||
function! zig#list#JumpToFirst(listtype) abort
|
||||
if a:listtype == "locationlist"
|
||||
ll 1
|
||||
else
|
||||
cc 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Clean cleans and closes the location list
|
||||
function! zig#list#Clean(listtype) abort
|
||||
if a:listtype == "locationlist"
|
||||
lex []
|
||||
else
|
||||
cex []
|
||||
endif
|
||||
|
||||
call zig#list#Close(a:listtype)
|
||||
endfunction
|
||||
|
||||
" Close closes the location list
|
||||
function! zig#list#Close(listtype) abort
|
||||
let autoclose_window = zig#config#ListAutoclose()
|
||||
if !autoclose_window
|
||||
return
|
||||
endif
|
||||
|
||||
if a:listtype == "locationlist"
|
||||
lclose
|
||||
else
|
||||
cclose
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:listtype(listtype) abort
|
||||
let listtype = zig#config#ListType()
|
||||
if empty(listtype)
|
||||
return a:listtype
|
||||
endif
|
||||
|
||||
return listtype
|
||||
endfunction
|
||||
|
||||
" s:default_list_type_commands is the defaults that will be used for each of
|
||||
" the supported commands (see documentation for g:zig_list_type_commands). When
|
||||
" defining a default, quickfix should be used if the command operates on
|
||||
" multiple files, while locationlist should be used if the command operates on a
|
||||
" single file or buffer. Keys that begin with an underscore are not supported
|
||||
" in g:zig_list_type_commands.
|
||||
let s:default_list_type_commands = {
|
||||
\ "ZigFmt": "locationlist",
|
||||
\ }
|
||||
|
||||
function! zig#list#Type(for) abort
|
||||
let l:listtype = s:listtype(get(s:default_list_type_commands, a:for))
|
||||
if l:listtype == "0"
|
||||
call zig#util#EchoError(printf(
|
||||
\ "unknown list type command value found ('%s'). Please open a bug report in the zig.vim repo.",
|
||||
\ a:for))
|
||||
let l:listtype = "quickfix"
|
||||
endif
|
||||
|
||||
return get(zig#config#ListTypeCommands(), a:for, l:listtype)
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
394
autoload/zig/util.vim
Normal file
394
autoload/zig/util.vim
Normal file
@@ -0,0 +1,394 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Adapted from vim-go: autoload/go/util.vim
|
||||
"
|
||||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
|
||||
" PathSep returns the appropriate OS specific path separator.
|
||||
function! zig#util#PathSep() abort
|
||||
if zig#util#IsWin()
|
||||
return '\'
|
||||
endif
|
||||
return '/'
|
||||
endfunction
|
||||
|
||||
" PathListSep returns the appropriate OS specific path list separator.
|
||||
function! zig#util#PathListSep() abort
|
||||
if zig#util#IsWin()
|
||||
return ";"
|
||||
endif
|
||||
return ":"
|
||||
endfunction
|
||||
|
||||
" LineEnding returns the correct line ending, based on the current fileformat
|
||||
function! zig#util#LineEnding() abort
|
||||
if &fileformat == 'dos'
|
||||
return "\r\n"
|
||||
elseif &fileformat == 'mac'
|
||||
return "\r"
|
||||
endif
|
||||
|
||||
return "\n"
|
||||
endfunction
|
||||
|
||||
" Join joins any number of path elements into a single path, adding a
|
||||
" Separator if necessary and returns the result
|
||||
function! zig#util#Join(...) abort
|
||||
return join(a:000, zig#util#PathSep())
|
||||
endfunction
|
||||
|
||||
" IsWin returns 1 if current OS is Windows or 0 otherwise
|
||||
function! zig#util#IsWin() abort
|
||||
let win = ['win16', 'win32', 'win64', 'win95']
|
||||
for w in win
|
||||
if (has(w))
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" IsMac returns 1 if current OS is macOS or 0 otherwise.
|
||||
function! zig#util#IsMac() abort
|
||||
return has('mac') ||
|
||||
\ has('macunix') ||
|
||||
\ has('gui_macvim') ||
|
||||
\ zig#util#Exec(['uname'])[0] =~? '^darwin'
|
||||
endfunction
|
||||
|
||||
" Checks if using:
|
||||
" 1) Windows system,
|
||||
" 2) And has cygpath executable,
|
||||
" 3) And uses *sh* as 'shell'
|
||||
function! zig#util#IsUsingCygwinShell()
|
||||
return zig#util#IsWin() && executable('cygpath') && &shell =~ '.*sh.*'
|
||||
endfunction
|
||||
|
||||
" Check if Vim jobs API is supported.
|
||||
"
|
||||
" The (optional) first paramter can be added to indicate the 'cwd' or 'env'
|
||||
" parameters will be used, which wasn't added until a later version.
|
||||
function! zig#util#has_job(...) abort
|
||||
" cwd and env parameters to job_start was added in this version.
|
||||
if a:0 > 0 && a:1 is 1
|
||||
return has('job') && has("patch-8.0.0902")
|
||||
endif
|
||||
|
||||
" job was introduced in 7.4.xxx however there are multiple bug fixes and one
|
||||
" of the latest is 8.0.0087 which is required for a stable async API.
|
||||
return has('job') && has("patch-8.0.0087")
|
||||
endfunction
|
||||
|
||||
let s:env_cache = {}
|
||||
|
||||
" env returns the go environment variable for the given key. Where key can be
|
||||
" GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached
|
||||
" version.
|
||||
function! zig#util#env(key) abort
|
||||
let l:key = tolower(a:key)
|
||||
if has_key(s:env_cache, l:key)
|
||||
return s:env_cache[l:key]
|
||||
endif
|
||||
|
||||
if executable('go')
|
||||
let l:var = call('zig#util#'.l:key, [])
|
||||
if zig#util#ShellError() != 0
|
||||
call zig#util#EchoError(printf("'go env %s' failed", toupper(l:key)))
|
||||
return ''
|
||||
endif
|
||||
else
|
||||
let l:var = eval("$".toupper(a:key))
|
||||
endif
|
||||
|
||||
let s:env_cache[l:key] = l:var
|
||||
return l:var
|
||||
endfunction
|
||||
|
||||
" Run a shell command.
|
||||
"
|
||||
" It will temporary set the shell to /bin/sh for Unix-like systems if possible,
|
||||
" so that we always use a standard POSIX-compatible Bourne shell (and not e.g.
|
||||
" csh, fish, etc.) See #988 and #1276.
|
||||
function! s:system(cmd, ...) abort
|
||||
" Preserve original shell and shellredir values
|
||||
let l:shell = &shell
|
||||
let l:shellredir = &shellredir
|
||||
|
||||
if !zig#util#IsWin() && executable('/bin/sh')
|
||||
set shell=/bin/sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
|
||||
try
|
||||
return call('system', [a:cmd] + a:000)
|
||||
finally
|
||||
" Restore original values
|
||||
let &shell = l:shell
|
||||
let &shellredir = l:shellredir
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" System runs a shell command "str". Every arguments after "str" is passed to
|
||||
" stdin.
|
||||
function! zig#util#System(str, ...) abort
|
||||
return call('s:system', [a:str] + a:000)
|
||||
endfunction
|
||||
|
||||
" Exec runs a shell command "cmd", which must be a list, one argument per item.
|
||||
" Every list entry will be automatically shell-escaped
|
||||
" Every other argument is passed to stdin.
|
||||
function! zig#util#Exec(cmd, ...) abort
|
||||
if len(a:cmd) == 0
|
||||
call zig#util#EchoError("zig#util#Exec() called with empty a:cmd")
|
||||
return ['', 1]
|
||||
endif
|
||||
|
||||
let l:bin = a:cmd[0]
|
||||
|
||||
if !executable(l:bin)
|
||||
call zig#util#EchoError(printf("could not find binary '%s'", a:cmd[0]))
|
||||
return ['', 1]
|
||||
endif
|
||||
|
||||
return call('s:exec', [a:cmd] + a:000)
|
||||
endfunction
|
||||
|
||||
function! s:exec(cmd, ...) abort
|
||||
let l:bin = a:cmd[0]
|
||||
let l:cmd = zig#util#Shelljoin([l:bin] + a:cmd[1:])
|
||||
if zig#util#HasDebug('shell-commands')
|
||||
call zig#util#EchoInfo('shell command: ' . l:cmd)
|
||||
endif
|
||||
|
||||
let l:out = call('s:system', [l:cmd] + a:000)
|
||||
return [l:out, zig#util#ShellError()]
|
||||
endfunction
|
||||
|
||||
function! zig#util#ShellError() abort
|
||||
return v:shell_error
|
||||
endfunction
|
||||
|
||||
" StripPath strips the path's last character if it's a path separator.
|
||||
" example: '/foo/bar/' -> '/foo/bar'
|
||||
function! zig#util#StripPathSep(path) abort
|
||||
let last_char = strlen(a:path) - 1
|
||||
if a:path[last_char] == zig#util#PathSep()
|
||||
return strpart(a:path, 0, last_char)
|
||||
endif
|
||||
|
||||
return a:path
|
||||
endfunction
|
||||
|
||||
" StripTrailingSlash strips the trailing slash from the given path list.
|
||||
" example: ['/foo/bar/'] -> ['/foo/bar']
|
||||
function! zig#util#StripTrailingSlash(paths) abort
|
||||
return map(copy(a:paths), 'zig#util#StripPathSep(v:val)')
|
||||
endfunction
|
||||
|
||||
" Shelljoin returns a shell-safe string representation of arglist. The
|
||||
" {special} argument of shellescape() may optionally be passed.
|
||||
function! zig#util#Shelljoin(arglist, ...) abort
|
||||
try
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
if a:0
|
||||
return join(map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')'), ' ')
|
||||
endif
|
||||
|
||||
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
|
||||
finally
|
||||
let &shellslash = ssl_save
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
fu! zig#util#Shellescape(arg)
|
||||
try
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
return shellescape(a:arg)
|
||||
finally
|
||||
let &shellslash = ssl_save
|
||||
endtry
|
||||
endf
|
||||
|
||||
" Shelllist returns a shell-safe representation of the items in the given
|
||||
" arglist. The {special} argument of shellescape() may optionally be passed.
|
||||
function! zig#util#Shelllist(arglist, ...) abort
|
||||
try
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
if a:0
|
||||
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
|
||||
endif
|
||||
return map(copy(a:arglist), 'shellescape(v:val)')
|
||||
finally
|
||||
let &shellslash = ssl_save
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Returns the byte offset for line and column
|
||||
function! zig#util#Offset(line, col) abort
|
||||
if &encoding != 'utf-8'
|
||||
let sep = zig#util#LineEnding()
|
||||
let buf = a:line == 1 ? '' : (join(getline(1, a:line-1), sep) . sep)
|
||||
let buf .= a:col == 1 ? '' : getline('.')[:a:col-2]
|
||||
return len(iconv(buf, &encoding, 'utf-8'))
|
||||
endif
|
||||
return line2byte(a:line) + (a:col-2)
|
||||
endfunction
|
||||
"
|
||||
" Returns the byte offset for the cursor
|
||||
function! zig#util#OffsetCursor() abort
|
||||
return zig#util#Offset(line('.'), col('.'))
|
||||
endfunction
|
||||
|
||||
" Windo is like the built-in :windo, only it returns to the window the command
|
||||
" was issued from
|
||||
function! zig#util#Windo(command) abort
|
||||
let s:currentWindow = winnr()
|
||||
try
|
||||
execute "windo " . a:command
|
||||
finally
|
||||
execute s:currentWindow. "wincmd w"
|
||||
unlet s:currentWindow
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" snippetcase converts the given word to given preferred snippet setting type
|
||||
" case.
|
||||
function! zig#util#snippetcase(word) abort
|
||||
let l:snippet_case = zig#config#AddtagsTransform()
|
||||
if l:snippet_case == "snakecase"
|
||||
return zig#util#snakecase(a:word)
|
||||
elseif l:snippet_case == "camelcase"
|
||||
return zig#util#camelcase(a:word)
|
||||
else
|
||||
return a:word " do nothing
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" snakecase converts a string to snake case. i.e: FooBar -> foo_bar
|
||||
" Copied from tpope/vim-abolish
|
||||
function! zig#util#snakecase(word) abort
|
||||
let word = substitute(a:word, '::', '/', 'g')
|
||||
let word = substitute(word, '\(\u\+\)\(\u\l\)', '\1_\2', 'g')
|
||||
let word = substitute(word, '\(\l\|\d\)\(\u\)', '\1_\2', 'g')
|
||||
let word = substitute(word, '[.-]', '_', 'g')
|
||||
let word = tolower(word)
|
||||
return word
|
||||
endfunction
|
||||
|
||||
" camelcase converts a string to camel case. e.g. FooBar or foo_bar will become
|
||||
" fooBar.
|
||||
" Copied from tpope/vim-abolish.
|
||||
function! zig#util#camelcase(word) abort
|
||||
let word = substitute(a:word, '-', '_', 'g')
|
||||
if word !~# '_' && word =~# '\l'
|
||||
return substitute(word, '^.', '\l&', '')
|
||||
else
|
||||
return substitute(word, '\C\(_\)\=\(.\)', '\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" pascalcase converts a string to 'PascalCase'. e.g. fooBar or foo_bar will
|
||||
" become FooBar.
|
||||
function! zig#util#pascalcase(word) abort
|
||||
let word = zig#util#camelcase(a:word)
|
||||
return toupper(word[0]) . word[1:]
|
||||
endfunction
|
||||
|
||||
" Echo a message to the screen and highlight it with the group in a:hi.
|
||||
"
|
||||
" The message can be a list or string; every line with be :echomsg'd separately.
|
||||
function! s:echo(msg, hi)
|
||||
let l:msg = []
|
||||
if type(a:msg) != type([])
|
||||
let l:msg = split(a:msg, "\n")
|
||||
else
|
||||
let l:msg = a:msg
|
||||
endif
|
||||
|
||||
" Tabs display as ^I or <09>, so manually expand them.
|
||||
let l:msg = map(l:msg, 'substitute(v:val, "\t", " ", "")')
|
||||
|
||||
exe 'echohl ' . a:hi
|
||||
for line in l:msg
|
||||
echom "zig.vim: " . line
|
||||
endfor
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
function! zig#util#EchoSuccess(msg)
|
||||
call s:echo(a:msg, 'Function')
|
||||
endfunction
|
||||
function! zig#util#EchoError(msg)
|
||||
call s:echo(a:msg, 'ErrorMsg')
|
||||
endfunction
|
||||
function! zig#util#EchoWarning(msg)
|
||||
call s:echo(a:msg, 'WarningMsg')
|
||||
endfunction
|
||||
function! zig#util#EchoProgress(msg)
|
||||
redraw
|
||||
call s:echo(a:msg, 'Identifier')
|
||||
endfunction
|
||||
function! zig#util#EchoInfo(msg)
|
||||
call s:echo(a:msg, 'Debug')
|
||||
endfunction
|
||||
|
||||
" Get all lines in the buffer as a a list.
|
||||
function! zig#util#GetLines()
|
||||
let buf = getline(1, '$')
|
||||
if &encoding != 'utf-8'
|
||||
let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")')
|
||||
endif
|
||||
if &l:fileformat == 'dos'
|
||||
" XXX: line2byte() depend on 'fileformat' option.
|
||||
" so if fileformat is 'dos', 'buf' must include '\r'.
|
||||
let buf = map(buf, 'v:val."\r"')
|
||||
endif
|
||||
return buf
|
||||
endfunction
|
||||
|
||||
" Make a named temporary directory which starts with "prefix".
|
||||
"
|
||||
" Unfortunately Vim's tempname() is not portable enough across various systems;
|
||||
" see: https://github.com/mattn/vim-go/pull/3#discussion_r138084911
|
||||
function! zig#util#tempdir(prefix) abort
|
||||
" See :help tempfile
|
||||
if zig#util#IsWin()
|
||||
let l:dirs = [$TMP, $TEMP, 'c:\tmp', 'c:\temp']
|
||||
else
|
||||
let l:dirs = [$TMPDIR, '/tmp', './', $HOME]
|
||||
endif
|
||||
|
||||
let l:dir = ''
|
||||
for l:d in dirs
|
||||
if !empty(l:d) && filewritable(l:d) == 2
|
||||
let l:dir = l:d
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
if l:dir == ''
|
||||
call zig#util#EchoError('Unable to find directory to store temporary directory in')
|
||||
return
|
||||
endif
|
||||
|
||||
" Not great randomness, but "good enough" for our purpose here.
|
||||
let l:rnd = sha256(printf('%s%s', localtime(), fnamemodify(bufname(''), ":p")))
|
||||
let l:tmp = printf("%s/%s%s", l:dir, a:prefix, l:rnd)
|
||||
call mkdir(l:tmp, 'p', 0700)
|
||||
return l:tmp
|
||||
endfunction
|
||||
|
||||
" Report if the user enabled a debug flag in g:zig_debug.
|
||||
function! zig#util#HasDebug(flag)
|
||||
return index(zig#config#Debug(), a:flag) >= 0
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
63
build
63
build
@@ -6,11 +6,13 @@ DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/f
|
||||
# shellcheck disable=SC2034
|
||||
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
|
||||
# shellcheck disable=SC2034
|
||||
DIRS_ALL="syntax indent compiler autoload ftplugin after"
|
||||
DIRS_ALL="syntax indent compiler autoload ftplugin after extras"
|
||||
# shellcheck disable=SC2034
|
||||
DIRS_SYNTAX="syntax indent after/syntax after/indent"
|
||||
# shellcheck disable=SC2034
|
||||
DIRS_NOAFTER="syntax compiler indent autoload ftplugin"
|
||||
DIRS_JAVASCRIPT="${DIRS} extras"
|
||||
read -r -a DIRS_RM <<<"$DIRS_JAVASCRIPT"
|
||||
read -r -a DIRS_RM <<<"$DIRS_ALL"
|
||||
|
||||
OUTPUT=""
|
||||
|
||||
@@ -23,8 +25,10 @@ download() {
|
||||
for pack in $1; do
|
||||
path="$(cut -d ':' -f 2 <<<"$pack")"
|
||||
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
|
||||
repo="$(awk -F\# '{print $1}' <<<"$path")"
|
||||
branch="$(awk -F\# '{print $2}' <<<"$path")"
|
||||
rm -rf "$dir"
|
||||
(mkdir -p "$dir" && curl --silent -L "https://codeload.github.com/$path/tar.gz/master" | tar -zx -C "$dir" --strip 1 && printf '.') &
|
||||
(mkdir -p "$dir" && curl --silent -L "https://codeload.github.com/$repo/tar.gz/${branch:-master}" | tar -zx -C "$dir" --strip 1 && printf '.') &
|
||||
done
|
||||
|
||||
wait
|
||||
@@ -63,7 +67,7 @@ extract() {
|
||||
|
||||
output "${subdirs##, })"$'\n'
|
||||
|
||||
if (echo "julia coffee-script elixir fish git plantuml scala swift jinja mdx" | grep -qF "$name"); then
|
||||
if (echo "julia coffee-script elixir fish git plantuml scala swift jinja" | grep -qF "$name"); then
|
||||
echo "Skipping ftdetect installation of $name" >&2
|
||||
continue
|
||||
fi
|
||||
@@ -123,7 +127,11 @@ copy_file() {
|
||||
touch "$file_in_dst"
|
||||
|
||||
# Use comma instead of / to handle cases like c/c++
|
||||
sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard.vim.template >> "$file_in_dst"
|
||||
if [[ "${package_name}" == "jsx" ]]; then
|
||||
sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard_jsx.vim.template >> "$file_in_dst"
|
||||
else
|
||||
sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard.vim.template >> "$file_in_dst"
|
||||
fi
|
||||
}
|
||||
|
||||
update_readme() {
|
||||
@@ -151,6 +159,7 @@ update_readme() {
|
||||
}
|
||||
|
||||
PACKS="
|
||||
acpiasl:martinlroth/vim-acpi-asl
|
||||
ansible:pearofducks/ansible-vim
|
||||
apiblueprint:sheerun/apiblueprint.vim
|
||||
applescript:mityu/vim-applescript:_SYNTAX
|
||||
@@ -165,13 +174,16 @@ PACKS="
|
||||
cjsx:mtscout6/vim-cjsx
|
||||
clojure:guns/vim-clojure-static
|
||||
cmake:pboettch/vim-cmake-syntax
|
||||
coffee-script:kchmck/vim-coffee-script
|
||||
coffee-script:kchmck/vim-coffee-script:_NOAFTER
|
||||
cql:elubow/cql-vim
|
||||
cryptol:victoredwardocallaghan/cryptol.vim
|
||||
crystal:rhysd/vim-crystal
|
||||
csv:chrisbra/csv.vim
|
||||
cucumber:tpope/vim-cucumber
|
||||
cue:mgrabovsky/vim-cuesheet
|
||||
dart:dart-lang/dart-vim-plugin
|
||||
dhall:vmchale/dhall-vim
|
||||
dlang:JesseKPhillips/d.vim
|
||||
dockerfile:ekalinin/Dockerfile.vim
|
||||
elixir:elixir-lang/vim-elixir
|
||||
elm:ElmCast/elm-vim
|
||||
@@ -179,16 +191,16 @@ PACKS="
|
||||
emblem:yalesov/vim-emblem
|
||||
erlang:vim-erlang/vim-erlang-runtime
|
||||
ferm:vim-scripts/ferm.vim
|
||||
fish:dag/vim-fish
|
||||
fish:georgewitteman/vim-fish
|
||||
flatbuffers:dcharbon/vim-flatbuffers
|
||||
fsharp:fsharp/vim-fsharp:_BASIC
|
||||
git:tpope/vim-git
|
||||
glsl:tikhomirov/vim-glsl
|
||||
glsl:tikhomirov/vim-glsl:_NOAFTER
|
||||
gmpl:maelvalais/gmpl.vim
|
||||
gnuplot:vim-scripts/gnuplot-syntax-highlighting
|
||||
go:fatih/vim-go:_BASIC
|
||||
graphql:jparise/vim-graphql:_ALL
|
||||
gradle:tfnico/vim-gradle
|
||||
graphql:jparise/vim-graphql
|
||||
groovy:vim-scripts/groovy.vim
|
||||
groovy-indent:vim-scripts/groovyindent-unix
|
||||
haml:sheerun/vim-haml
|
||||
@@ -196,9 +208,13 @@ PACKS="
|
||||
haproxy:CH-DanReif/haproxy.vim
|
||||
haskell:neovimhaskell/haskell-vim
|
||||
haxe:yaymukund/vim-haxe
|
||||
hcl:b4b4r07/vim-hcl
|
||||
helm:towolf/vim-helm
|
||||
hive:zebradil/hive.vim
|
||||
html5:othree/html5.vim
|
||||
i3:mboughaba/i3config.vim
|
||||
idris:idris-hackers/idris-vim
|
||||
ion:vmchale/ion-vim
|
||||
jasmine:glanotte/vim-jasmine
|
||||
javascript:pangloss/vim-javascript:_JAVASCRIPT
|
||||
jenkins:martinda/Jenkinsfile-vim-syntax
|
||||
@@ -206,17 +222,19 @@ PACKS="
|
||||
json5:GutenYe/json5.vim
|
||||
json:elzr/vim-json
|
||||
jst:briancollins/vim-jst
|
||||
jsx:amadeus/vim-jsx
|
||||
jsx:MaxMEllon/vim-jsx-pretty
|
||||
julia:JuliaEditorSupport/julia-vim
|
||||
kotlin:udalov/kotlin-vim
|
||||
latex:LaTeX-Box-Team/LaTeX-Box
|
||||
less:groenewege/vim-less
|
||||
liquid:tpope/vim-liquid
|
||||
less:groenewege/vim-less:_NOAFTER
|
||||
lilypond:anowlcalledjosh/vim-lilypond
|
||||
livescript:gkz/vim-ls
|
||||
llvm:rhysd/vim-llvm
|
||||
log:MTDL9/vim-log-highlighting
|
||||
lua:tbastos/vim-lua
|
||||
mako:sophacles/vim-bundle-mako
|
||||
markdown:plasticboy/vim-markdown:_SYNTAX
|
||||
mathematica:rsmenon/vim-mathematica
|
||||
mathematica:voldikss/vim-mma
|
||||
mdx:jxnblk/vim-mdx-js
|
||||
meson:mesonbuild/meson:_ALL:/data/syntax-highlighting/vim/
|
||||
moonscript:leafo/moonscript-vim
|
||||
@@ -228,21 +246,21 @@ PACKS="
|
||||
octave:vim-scripts/octave.vim--
|
||||
opencl:petRUShka/vim-opencl
|
||||
perl:vim-perl/vim-perl
|
||||
pgsql:exu/pgsql.vim
|
||||
pgsql:lifepillar/pgsql.vim
|
||||
php:StanAngeloff/php.vim
|
||||
plantuml:aklt/plantuml-syntax
|
||||
pony:jakwings/vim-pony
|
||||
powershell:PProvost/vim-ps1
|
||||
protobuf:uarun/vim-protobuf
|
||||
pug:digitaltoad/vim-pug
|
||||
puppet:voxpupuli/vim-puppet
|
||||
puppet:rodjek/vim-puppet
|
||||
purescript:purescript-contrib/purescript-vim
|
||||
python-compiler:aliev/vim-compiler-python
|
||||
python-indent:Vimjas/vim-python-pep8-indent
|
||||
python:vim-python/python-syntax
|
||||
qmake:artoj/qmake-syntax-vim
|
||||
qml:peterhoeg/vim-qml
|
||||
r-lang:vim-scripts/R.vim
|
||||
r-lang:vim-scripts/R.vim:_BASIC
|
||||
racket:wlangstroth/vim-racket
|
||||
ragel:jneen/ragel.vim
|
||||
raml:IN3D/vim-raml
|
||||
@@ -256,29 +274,38 @@ PACKS="
|
||||
scss:cakebaker/scss-syntax.vim
|
||||
slim:slim-template/vim-slim
|
||||
slime:slime-lang/vim-slime-syntax
|
||||
smt2:bohlender/vim-smt2
|
||||
solidity:tomlion/vim-solidity
|
||||
styled-components:styled-components/vim-styled-components#main:_ALL
|
||||
stylus:wavded/vim-stylus
|
||||
svelte:evanleck/vim-svelte
|
||||
svg-indent:jasonshell/vim-svg-indent
|
||||
svg:vim-scripts/svg.vim
|
||||
swift:keith/swift.vim
|
||||
sxhkd:baskerville/vim-sxhkdrc
|
||||
systemd:wgwoods/vim-systemd-syntax
|
||||
terraform:hashivim/vim-terraform
|
||||
textile:timcharper/textile.vim
|
||||
thrift:solarnz/thrift.vim
|
||||
tmux:keith/tmux.vim
|
||||
tmux:ericpruitt/tmux.vim:_ALL:/vim/
|
||||
tomdoc:wellbredgrapefruit/tomdoc.vim
|
||||
toml:cespare/vim-toml
|
||||
tptp:c-cube/vim-tptp
|
||||
twig:lumiliet/vim-twig
|
||||
typescript:leafgarland/typescript-vim
|
||||
typescript:HerringtonDarkholme/yats.vim
|
||||
vala:arrufat/vala.vim
|
||||
vbnet:vim-scripts/vbnet.vim
|
||||
vcl:smerrill/vcl-vim-plugin
|
||||
vifm:vifm/vifm.vim
|
||||
vm:lepture/vim-velocity
|
||||
vue:posva/vim-vue
|
||||
xdc:amal-khailtash/vim-xdc-syntax
|
||||
xml:amadeus/vim-xml
|
||||
xls:vim-scripts/XSLT-syntax
|
||||
yaml:stephpy/vim-yaml
|
||||
yard:sheerun/vim-yardoc
|
||||
zephir:xwsoul/vim-zephir
|
||||
zig:ziglang/zig.vim
|
||||
"
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
@@ -11,5 +11,5 @@ if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet errorformat=%f:%l:\ %t:\ %m
|
||||
CompilerSet errorformat=%f:%l:%c:\ %t:\ %m,%f:%l:\ %t:\ %m
|
||||
CompilerSet makeprg=mix\ credo\ suggest\ --format=flycheck
|
||||
|
||||
23
compiler/lilypond.vim
Normal file
23
compiler/lilypond.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" LilyPond compiler file
|
||||
" Language: LilyPond
|
||||
" Maintainer: Heikki Junes <hjunes@cc.hut.fi>
|
||||
" Last Change: 2004 Mar 01
|
||||
"
|
||||
" Installed As: vim/compiler/lilypond.vim
|
||||
"
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "lilypond"
|
||||
|
||||
" default make
|
||||
setlocal makeprg=lilypond\ $*
|
||||
" errorformat for lily (with columns) and gcc
|
||||
" (how to see multiple-line error messages?)
|
||||
setlocal errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m
|
||||
"
|
||||
@@ -11,5 +11,10 @@ if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet errorformat=%A%t%*[^:]:\ %m,%C%f:%l:\ %m,%C%f:%l,%Z
|
||||
CompilerSet makeprg=mix
|
||||
CompilerSet makeprg=mix\ compile
|
||||
CompilerSet errorformat=
|
||||
\%Wwarning:\ %m,
|
||||
\%C%f:%l,%Z,
|
||||
\%E==\ Compilation\ error\ in\ file\ %f\ ==,
|
||||
\%C**\ (%\\w%\\+)\ %f:%l:\ %m,%Z
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@ endif
|
||||
if get(g:, 'rustc_makeprg_no_percent', 0)
|
||||
CompilerSet makeprg=rustc
|
||||
else
|
||||
CompilerSet makeprg=rustc\ \%
|
||||
if has('patch-7.4.191')
|
||||
CompilerSet makeprg=rustc\ \%:S
|
||||
else
|
||||
CompilerSet makeprg=rustc\ \%
|
||||
endif
|
||||
endif
|
||||
|
||||
" New errorformat (after nightly 2016/08/10)
|
||||
|
||||
@@ -2,33 +2,24 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') !=
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("current_compiler")
|
||||
if exists('current_compiler')
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "typescript"
|
||||
|
||||
if !exists("g:typescript_compiler_binary")
|
||||
let g:typescript_compiler_binary = "tsc"
|
||||
let current_compiler='typescript'
|
||||
|
||||
if !exists('g:typescript_compiler_binary')
|
||||
let g:typescript_compiler_binary = 'tsc'
|
||||
endif
|
||||
|
||||
if !exists("g:typescript_compiler_options")
|
||||
let g:typescript_compiler_options = ""
|
||||
if !exists('g:typescript_compiler_options')
|
||||
if exists('g:syntastic_typescript_tsc_args')
|
||||
let g:typescript_compiler_options = g:syntastic_typescript_tsc_args
|
||||
else
|
||||
let g:typescript_compiler_options = ''
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command! -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
execute 'CompilerSet makeprg='
|
||||
\ . escape(g:typescript_compiler_binary, ' ')
|
||||
\ . '\ '
|
||||
\ . escape(g:typescript_compiler_options, ' ')
|
||||
\ . '\ $*\ %'
|
||||
let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %'
|
||||
|
||||
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
20
config.vim
20
config.vim
@@ -3,6 +3,14 @@ if !exists('g:jsx_ext_required')
|
||||
let g:jsx_ext_required = 0
|
||||
endif
|
||||
|
||||
" Make csv loading faster
|
||||
if !exists('g:csv_start')
|
||||
let g:csv_start = 1
|
||||
endif
|
||||
if !exists('g:csv_end')
|
||||
let g:csv_end = 2
|
||||
endif
|
||||
|
||||
" Disable json concealing by default
|
||||
if !exists('g:vim_json_syntax_conceal')
|
||||
let g:vim_json_syntax_conceal = 0
|
||||
@@ -36,8 +44,9 @@ augroup filetypedetect
|
||||
|
||||
|
||||
" elixir
|
||||
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||
au BufRead,BufNewFile *.eex,*.leex set filetype=eelixir
|
||||
au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||
|
||||
" fish
|
||||
autocmd BufRead,BufNewFile *.fish setfiletype fish
|
||||
@@ -71,12 +80,13 @@ augroup filetypedetect
|
||||
|
||||
"jinja
|
||||
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja
|
||||
|
||||
"tsx
|
||||
autocmd BufNewFile,BufRead *.tsx setfiletype typescript.jsx
|
||||
augroup END
|
||||
|
||||
" Fix for https://github.com/sheerun/vim-polyglot/issues/236#issuecomment-387984954
|
||||
if (!exists('g:graphql_javascript_tags'))
|
||||
let g:graphql_javascript_tags = ['gql', 'graphql', 'Relay.QL']
|
||||
endif
|
||||
|
||||
augroup filetypedetect
|
||||
autocmd BufNewFile,BufReadPost *.tsx setlocal filetype=typescript.tsx
|
||||
augroup END
|
||||
|
||||
@@ -10,7 +10,7 @@ syntax match jsDocTags contained "@\(alias\|api\|augments\|borrows\|cla
|
||||
" tags containing type and param
|
||||
syntax match jsDocTags contained "@\(arg\|argument\|cfg\|param\|property\|prop\|typedef\)\>" skipwhite nextgroup=jsDocType
|
||||
" tags containing type but no param
|
||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|return\|returns\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||
syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|return\|returns\|yields\)\>" skipwhite nextgroup=jsDocTypeNoParam
|
||||
" tags containing references
|
||||
syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" skipwhite nextgroup=jsDocSeeTag
|
||||
" other tags (no extra syntax)
|
||||
|
||||
@@ -3,6 +3,14 @@ if !exists('g:jsx_ext_required')
|
||||
let g:jsx_ext_required = 0
|
||||
endif
|
||||
|
||||
" Make csv loading faster
|
||||
if !exists('g:csv_start')
|
||||
let g:csv_start = 1
|
||||
endif
|
||||
if !exists('g:csv_end')
|
||||
let g:csv_end = 2
|
||||
endif
|
||||
|
||||
" Disable json concealing by default
|
||||
if !exists('g:vim_json_syntax_conceal')
|
||||
let g:vim_json_syntax_conceal = 0
|
||||
@@ -36,8 +44,9 @@ augroup filetypedetect
|
||||
|
||||
|
||||
" elixir
|
||||
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
|
||||
au BufRead,BufNewFile *.eex call s:setf('eelixir')
|
||||
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||
au BufRead,BufNewFile *.eex,*.leex set filetype=eelixir
|
||||
au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||
|
||||
" fish
|
||||
autocmd BufRead,BufNewFile *.fish setfiletype fish
|
||||
@@ -71,15 +80,24 @@ augroup filetypedetect
|
||||
|
||||
"jinja
|
||||
autocmd BufNewFile,BufRead *.jinja2,*.j2,*.jinja,*.nunjucks,*.nunjs,*.njk set ft=jinja
|
||||
|
||||
"tsx
|
||||
autocmd BufNewFile,BufRead *.tsx setfiletype typescript.jsx
|
||||
augroup END
|
||||
|
||||
" Fix for https://github.com/sheerun/vim-polyglot/issues/236#issuecomment-387984954
|
||||
if (!exists('g:graphql_javascript_tags'))
|
||||
let g:graphql_javascript_tags = ['gql', 'graphql', 'Relay.QL']
|
||||
endif
|
||||
|
||||
augroup filetypedetect
|
||||
autocmd BufNewFile,BufReadPost *.tsx setlocal filetype=typescript.tsx
|
||||
augroup END
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'acpiasl') == -1
|
||||
augroup filetypedetect
|
||||
" acpiasl, from asl.vim in martinlroth/vim-acpi-asl
|
||||
au BufRead,BufNewFile *.asl set filetype=asl
|
||||
au BufRead,BufNewFile *.dsl set filetype=asl
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
augroup filetypedetect
|
||||
" ansible, from ansible.vim in pearofducks/ansible-vim
|
||||
@@ -241,6 +259,14 @@ autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'csv') == -1
|
||||
augroup filetypedetect
|
||||
" csv, from csv.vim in chrisbra/csv.vim
|
||||
" Install Filetype detection for CSV files
|
||||
au BufRead,BufNewFile *.csv,*.dat,*.tsv,*.tab set filetype=csv
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cucumber') == -1
|
||||
augroup filetypedetect
|
||||
" cucumber, from cucumber.vim in tpope/vim-cucumber
|
||||
@@ -263,12 +289,59 @@ autocmd BufRead,BufNewFile *.dart set filetype=dart
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1
|
||||
augroup filetypedetect
|
||||
" dhall, from dhall.vim in vmchale/dhall-vim
|
||||
augroup dhall
|
||||
autocmd BufNewFile,BufRead *.dhall set filetype=dhall
|
||||
augroup END
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
|
||||
augroup filetypedetect
|
||||
" dlang, from d.vim in JesseKPhillips/d.vim
|
||||
autocmd BufNewFile,BufRead *.d setf d
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
|
||||
augroup filetypedetect
|
||||
" dlang, from dcov.vim in JesseKPhillips/d.vim
|
||||
autocmd BufNewFile,BufRead *.lst set filetype=dcov
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
|
||||
augroup filetypedetect
|
||||
" dlang, from dd.vim in JesseKPhillips/d.vim
|
||||
au BufRead,BufNewFile *.dd set filetype=dd
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
|
||||
augroup filetypedetect
|
||||
" dlang, from ddoc.vim in JesseKPhillips/d.vim
|
||||
au BufRead,BufNewFile *.ddoc set filetype=ddoc
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dlang') == -1
|
||||
augroup filetypedetect
|
||||
" dlang, from dsdl.vim in JesseKPhillips/d.vim
|
||||
autocmd BufNewFile,BufRead *.sdl set filetype=dsdl
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
|
||||
augroup filetypedetect
|
||||
" dockerfile, from Dockerfile.vim in ekalinin/Dockerfile.vim
|
||||
" vint: -ProhibitAutocmdWithNoGroup
|
||||
|
||||
" Dockerfile
|
||||
autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
|
||||
autocmd BufRead,BufNewFile [Dd]ockerfile set ft=Dockerfile
|
||||
autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile
|
||||
autocmd BufRead,BufNewFile [Dd]ockerfile.vim set ft=vim
|
||||
autocmd BufRead,BufNewFile *.dock set ft=Dockerfile
|
||||
autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile
|
||||
augroup end
|
||||
@@ -277,6 +350,8 @@ endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
|
||||
augroup filetypedetect
|
||||
" dockerfile, from docker-compose.vim in ekalinin/Dockerfile.vim
|
||||
" vint: -ProhibitAutocmdWithNoGroup
|
||||
|
||||
" docker-compose.yml
|
||||
autocmd BufRead,BufNewFile docker-compose*.{yaml,yml}* set ft=yaml.docker-compose
|
||||
augroup end
|
||||
@@ -365,7 +440,7 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'glsl') == -1
|
||||
augroup filetypedetect
|
||||
" glsl, from glsl.vim in tikhomirov/vim-glsl
|
||||
" glsl, from glsl.vim in tikhomirov/vim-glsl:_NOAFTER
|
||||
" Language: OpenGL Shading Language
|
||||
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
|
||||
|
||||
@@ -430,6 +505,14 @@ unlet s:cpo_save
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
augroup filetypedetect
|
||||
" graphql, from graphql.vim in jparise/vim-graphql:_ALL
|
||||
" vint: -ProhibitAutocmdWithNoGroup
|
||||
au BufRead,BufNewFile *.graphql,*.graphqls,*.gql setfiletype graphql
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gradle') == -1
|
||||
augroup filetypedetect
|
||||
" gradle, from gradle.vim in tfnico/vim-gradle
|
||||
@@ -438,14 +521,6 @@ au BufNewFile,BufRead *.gradle set filetype=groovy
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
augroup filetypedetect
|
||||
" graphql, from graphql.vim in jparise/vim-graphql
|
||||
" vint: -ProhibitAutocmdWithNoGroup
|
||||
au BufRead,BufNewFile *.graphql,*.graphqls,*.gql setfiletype graphql
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
augroup filetypedetect
|
||||
" haml, from haml.vim in sheerun/vim-haml
|
||||
@@ -458,8 +533,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') ==
|
||||
augroup filetypedetect
|
||||
" handlebars, from mustache.vim in mustache/vim-mustache-handlebars
|
||||
if has("autocmd")
|
||||
au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim
|
||||
au BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim
|
||||
au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim indent/handlebars.vim
|
||||
au BufNewFile,BufRead *.handlebars,*.hdbs,*.hbs,*.hb set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim
|
||||
endif
|
||||
augroup end
|
||||
endif
|
||||
@@ -487,6 +562,32 @@ autocmd BufNewFile,BufRead *.hx setf haxe
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'hcl') == -1
|
||||
augroup filetypedetect
|
||||
" hcl, from hcl.vim in b4b4r07/vim-hcl
|
||||
autocmd BufNewFile,BufRead *.hcl set filetype=hcl
|
||||
autocmd BufNewFile,BufRead *.nomad set filetype=hcl
|
||||
autocmd BufNewFile,BufRead *.tf set filetype=hcl
|
||||
autocmd BufNewFile,BufRead Appfile set filetype=hcl
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'helm') == -1
|
||||
augroup filetypedetect
|
||||
" helm, from helm.vim in towolf/vim-helm
|
||||
autocmd BufRead,BufNewFile */templates/*.yaml,*/templates/*.tpl set ft=helm
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'hive') == -1
|
||||
augroup filetypedetect
|
||||
" hive, from hive.vim in zebradil/hive.vim
|
||||
autocmd BufNewFile,BufRead *.hql set filetype=hive
|
||||
autocmd BufNewFile,BufRead *.ql set filetype=hive
|
||||
autocmd BufNewFile,BufRead *.q set filetype=hive
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
|
||||
augroup filetypedetect
|
||||
" i3, from i3config.vim in mboughaba/i3config.vim
|
||||
@@ -512,6 +613,19 @@ au BufNewFile,BufRead *.lidr setf lidris
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ion') == -1
|
||||
augroup filetypedetect
|
||||
" ion, from ion.vim in vmchale/ion-vim
|
||||
autocmd BufNewFile,BufRead ~/.config/ion/initrc set filetype=ion
|
||||
autocmd BufNewFile,BufRead *.ion set filetype=ion
|
||||
|
||||
autocmd BufNewFile,BufRead,StdinReadPost *
|
||||
\ if getline(1) =~ '^#!.*\Wion\s*$' |
|
||||
\ set ft=ion |
|
||||
\ endif
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jasmine') == -1
|
||||
augroup filetypedetect
|
||||
" jasmine, from jasmine.vim in glanotte/vim-jasmine
|
||||
@@ -528,11 +642,8 @@ fun! s:SelectJavascript()
|
||||
endif
|
||||
endfun
|
||||
|
||||
augroup javascript_syntax_detection
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setfiletype javascript
|
||||
autocmd BufNewFile,BufRead * call s:SelectJavascript()
|
||||
augroup END
|
||||
autocmd BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setfiletype javascript
|
||||
autocmd BufNewFile,BufRead * call s:SelectJavascript()
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -540,11 +651,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1
|
||||
augroup filetypedetect
|
||||
" jenkins, from Jenkinsfile.vim in martinda/Jenkinsfile-vim-syntax
|
||||
" Jenkinsfile
|
||||
autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile
|
||||
autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile
|
||||
autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile
|
||||
autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile
|
||||
autocmd BufRead,BufNewFile *.Jenkinsfile setf Jenkinsfile
|
||||
|
||||
augroup JenkinsAUGroup
|
||||
autocmd BufRead,BufNewFile *Jenkins* set ft=Jenkinsfile
|
||||
autocmd BufRead,BufNewFile *jenkins* set ft=Jenkinsfile
|
||||
augroup END
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -577,59 +688,6 @@ au BufNewFile,BufRead *.ect set filetype=jst
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsx') == -1
|
||||
augroup filetypedetect
|
||||
" jsx, from javascript.vim in amadeus/vim-jsx
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftdetect file
|
||||
"
|
||||
" Language: JSX (JavaScript)
|
||||
" Maintainer: Max Wang <mxawng@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
|
||||
|
||||
" if g:jsx_check_react_import == 1
|
||||
" parse the first line of js file (skipping comments). When it has a 'react'
|
||||
" importation, we guess the user writes jsx
|
||||
" endif
|
||||
let s:jsx_prevalent_pattern =
|
||||
\ '\v\C%^\_s*%(%(//.*\_$|/\*\_.{-}\*/)@>\_s*)*%(import\s+\k+\s+from\s+|%(\l+\s+)=\k+\s*\=\s*require\s*\(\s*)[`"'']react>'
|
||||
|
||||
" Whether to set the JSX filetype on *.js files.
|
||||
fu! <SID>EnableJSX()
|
||||
" Whether the .jsx extension is required.
|
||||
if !exists('g:jsx_ext_required')
|
||||
let g:jsx_ext_required = 0
|
||||
endif
|
||||
|
||||
" Whether the @jsx pragma is required.
|
||||
if !exists('g:jsx_pragma_required')
|
||||
let g:jsx_pragma_required = 0
|
||||
endif
|
||||
|
||||
if g:jsx_pragma_required && !exists('b:jsx_ext_found')
|
||||
" Look for the @jsx pragma. It must be included in a docblock comment
|
||||
" before anything else in the file (except whitespace).
|
||||
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
|
||||
endif
|
||||
|
||||
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
|
||||
if g:jsx_ext_required && !exists('b:jsx_ext_found') &&
|
||||
\ !(get(g:,'jsx_check_react_import') && search(s:jsx_prevalent_pattern, 'nw'))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfu
|
||||
|
||||
autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1
|
||||
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx
|
||||
autocmd BufNewFile,BufRead *.js
|
||||
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
||||
augroup filetypedetect
|
||||
" kotlin, from kotlin.vim in udalov/kotlin-vim
|
||||
@@ -640,30 +698,18 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
augroup filetypedetect
|
||||
" less, from less.vim in groenewege/vim-less
|
||||
" less, from less.vim in groenewege/vim-less:_NOAFTER
|
||||
autocmd BufNewFile,BufRead *.less setf less
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'liquid') == -1
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'lilypond') == -1
|
||||
augroup filetypedetect
|
||||
" liquid, from liquid.vim in tpope/vim-liquid
|
||||
" Liquid
|
||||
au BufNewFile,BufRead *.liquid set ft=liquid
|
||||
|
||||
au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html set ft=liquid
|
||||
au BufNewFile,BufRead *.html,*.xml,*.textile
|
||||
\ if getline(1) == '---' | set ft=liquid | endif
|
||||
au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md
|
||||
\ if getline(1) == '---' |
|
||||
\ let b:liquid_subtype = 'markdown' |
|
||||
\ set ft=liquid |
|
||||
\ endif
|
||||
|
||||
" Set subtype for Shopify alternate templates
|
||||
au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid
|
||||
\ let b:liquid_subtype = 'html' |
|
||||
\ set ft=liquid |
|
||||
" lilypond, from lilypond.vim in anowlcalledjosh/vim-lilypond
|
||||
"
|
||||
" Installed As: vim/ftdetect/lilypond.vim
|
||||
"
|
||||
au! BufNewFile,BufRead *.ly,*.ily set ft=lilypond
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -680,6 +726,36 @@ autocmd BufNewFile,BufRead *Slakefile set filetype=ls
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
augroup filetypedetect
|
||||
" llvm, from llvm-lit.vim in rhysd/vim-llvm
|
||||
au BufRead,BufNewFile lit.*cfg set filetype=python
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
augroup filetypedetect
|
||||
" llvm, from llvm.vim in rhysd/vim-llvm
|
||||
au BufRead,BufNewFile *.ll set filetype=llvm
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
augroup filetypedetect
|
||||
" llvm, from tablegen.vim in rhysd/vim-llvm
|
||||
au BufRead,BufNewFile *.td set filetype=tablegen
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'log') == -1
|
||||
augroup filetypedetect
|
||||
" log, from log.vim in MTDL9/vim-log-highlighting
|
||||
|
||||
au BufNewFile,BufRead *.log set filetype=log
|
||||
au BufNewFile,BufRead *_log set filetype=log
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||
augroup filetypedetect
|
||||
" mako, from mako.vim in sophacles/vim-bundle-mako
|
||||
@@ -711,6 +787,27 @@ au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,i
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
|
||||
augroup filetypedetect
|
||||
" mathematica, from mma.vim in voldikss/vim-mma
|
||||
autocmd BufNewFile,BufRead *.wl set filetype=mma
|
||||
autocmd BufNewFile,BufRead *.wls set filetype=mma
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mdx') == -1
|
||||
augroup filetypedetect
|
||||
" mdx, from mdx.vim in jxnblk/vim-mdx-js
|
||||
" Vim ftdetect file
|
||||
"
|
||||
" Language: MDX
|
||||
" Maintainer: Brent Jackson <jxnblk@gmail.com>
|
||||
"
|
||||
|
||||
autocmd BufNewFile,BufRead *.mdx set filetype=markdown.mdx
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'meson') == -1
|
||||
augroup filetypedetect
|
||||
" meson, from meson.vim in mesonbuild/meson:_ALL:/data/syntax-highlighting/vim/
|
||||
@@ -773,8 +870,8 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
|
||||
augroup filetypedetect
|
||||
" ocaml, from jbuild.vim in rgrinberg/vim-ocaml
|
||||
au BufRead,BufNewFile jbuild,dune,dune-project set ft=jbuild
|
||||
" ocaml, from dune.vim in rgrinberg/vim-ocaml
|
||||
au BufRead,BufNewFile jbuild,dune,dune-project set ft=dune
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -880,9 +977,8 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pgsql') == -1
|
||||
augroup filetypedetect
|
||||
" pgsql, from pgsql.vim in exu/pgsql.vim
|
||||
" postgreSQL
|
||||
au BufNewFile,BufRead *.pgsql setf pgsql
|
||||
" pgsql, from pgsql.vim in lifepillar/pgsql.vim
|
||||
au BufNewFile,BufRead *.pgsql let b:sql_type_override='pgsql' | setfiletype sql
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -959,7 +1055,7 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||
augroup filetypedetect
|
||||
" puppet, from puppet.vim in voxpupuli/vim-puppet
|
||||
" puppet, from puppet.vim in rodjek/vim-puppet
|
||||
au! BufRead,BufNewFile *.pp setfiletype puppet
|
||||
au! BufRead,BufNewFile Puppetfile setfiletype ruby
|
||||
augroup end
|
||||
@@ -1009,7 +1105,7 @@ endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1
|
||||
augroup filetypedetect
|
||||
" racket, from racket.vim in wlangstroth/vim-racket
|
||||
au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket
|
||||
au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -1156,8 +1252,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
" rust, from rust.vim in rust-lang/rust.vim
|
||||
" vint: -ProhibitAutocmdWithNoGroup
|
||||
|
||||
autocmd BufRead,BufNewFile *.rs setf rust
|
||||
autocmd BufRead,BufNewFile Cargo.toml if &filetype == "" | set filetype=cfg | endif
|
||||
autocmd BufRead,BufNewFile *.rs call s:set_rust_filetype()
|
||||
|
||||
if has('patch-8.0.613')
|
||||
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg
|
||||
endif
|
||||
|
||||
function! s:set_rust_filetype() abort
|
||||
if &filetype !=# 'rust'
|
||||
set filetype=rust
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
augroup end
|
||||
@@ -1197,6 +1302,13 @@ autocmd BufNewFile,BufRead *.slime set filetype=slime
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'smt2') == -1
|
||||
augroup filetypedetect
|
||||
" smt2, from smt2.vim in bohlender/vim-smt2
|
||||
autocmd BufRead,BufNewFile *.smt,*.smt2 set filetype=smt2
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'solidity') == -1
|
||||
augroup filetypedetect
|
||||
" solidity, from solidity.vim in tomlion/vim-solidity
|
||||
@@ -1213,6 +1325,13 @@ autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'svelte') == -1
|
||||
augroup filetypedetect
|
||||
" svelte, from svelte.vim in evanleck/vim-svelte
|
||||
au BufRead,BufNewFile *.svelte setfiletype svelte
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sxhkd') == -1
|
||||
augroup filetypedetect
|
||||
" sxhkd, from sxhkdrc.vim in baskerville/vim-sxhkdrc
|
||||
@@ -1241,10 +1360,12 @@ endif
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
|
||||
augroup filetypedetect
|
||||
" terraform, from terraform.vim in hashivim/vim-terraform
|
||||
au BufRead,BufNewFile *.tf setlocal filetype=terraform
|
||||
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
|
||||
au BufRead,BufNewFile *.tfstate setlocal filetype=json
|
||||
au BufRead,BufNewFile *.tfstate.backup setlocal filetype=json
|
||||
" By default, Vim associates .tf files with TinyFugue - tell it not to.
|
||||
autocmd! filetypedetect BufRead,BufNewFile *.tf
|
||||
autocmd BufRead,BufNewFile *.tf set filetype=terraform
|
||||
autocmd BufRead,BufNewFile *.tfvars set filetype=terraform
|
||||
autocmd BufRead,BufNewFile *.tfstate set filetype=json
|
||||
autocmd BufRead,BufNewFile *.tfstate.backup set filetype=json
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -1271,8 +1392,13 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
||||
augroup filetypedetect
|
||||
" tmux, from tmux.vim in keith/tmux.vim
|
||||
autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux
|
||||
" tmux, from tmux.vim in ericpruitt/tmux.vim:_ALL:/vim/
|
||||
" Language: tmux(1) configuration file
|
||||
" URL: https://github.com/ericpruitt/tmux.vim/
|
||||
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
|
||||
" Last Changed: 2017 Mar 10
|
||||
|
||||
autocmd BufNewFile,BufRead {.,}tmux.conf setfiletype tmux
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -1284,6 +1410,19 @@ autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,*/.cargo
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tptp') == -1
|
||||
augroup filetypedetect
|
||||
" tptp, from tptp.vim in c-cube/vim-tptp
|
||||
|
||||
au BufRead,BufNewFile *.p set filetype=tptp
|
||||
au BufRead,BufNewFile *.p set syntax=tptp
|
||||
au BufRead,BufNewFile *.tptp set filetype=tptp
|
||||
au BufRead,BufNewFile *.tptp set syntax=tptp
|
||||
au BufRead,BufNewFile *.ax set filetype=tptp
|
||||
au BufRead,BufNewFile *.ax set syntax=tptp
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
|
||||
augroup filetypedetect
|
||||
" twig, from twig.vim in lumiliet/vim-twig
|
||||
@@ -1298,11 +1437,15 @@ endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1
|
||||
augroup filetypedetect
|
||||
" typescript, from typescript.vim in leafgarland/typescript-vim
|
||||
" use `set filetype` to override default filetype=xml for *.ts files
|
||||
autocmd BufNewFile,BufRead *.ts set filetype=typescript
|
||||
" use `setfiletype` to not override any other plugins like ianks/vim-tsx
|
||||
autocmd BufNewFile,BufRead *.tsx setfiletype typescript
|
||||
" typescript, from tsx.vim in HerringtonDarkholme/yats.vim
|
||||
autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescript.tsx
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1
|
||||
augroup filetypedetect
|
||||
" typescript, from typescript.vim in HerringtonDarkholme/yats.vim
|
||||
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -1333,6 +1476,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
|
||||
" vifm, from vifm.vim in vifm/vifm.vim
|
||||
autocmd BufRead,BufNewFile vifmrc :set filetype=vifm
|
||||
autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm
|
||||
autocmd BufRead,BufNewFile *.vifm :set filetype=vifm
|
||||
augroup end
|
||||
endif
|
||||
|
||||
@@ -1350,3 +1494,25 @@ au BufNewFile,BufRead *.vue,*.wpy setf vue
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xdc') == -1
|
||||
augroup filetypedetect
|
||||
" xdc, from xdc.vim in amal-khailtash/vim-xdc-syntax
|
||||
" xdc
|
||||
autocmd BufNewFile,BufRead *.xdc setfiletype xdc
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zephir') == -1
|
||||
augroup filetypedetect
|
||||
" zephir, from zephir.vim in xwsoul/vim-zephir
|
||||
autocmd BufNewFile,BufReadPost *.zep set filetype=zephir
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1
|
||||
augroup filetypedetect
|
||||
" zig, from zig.vim in ziglang/zig.vim
|
||||
au BufRead,BufNewFile *.zig set filetype=zig
|
||||
augroup end
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dockerfile') !=
|
||||
finish
|
||||
endif
|
||||
|
||||
" Define comment string
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Enable automatic comment insertion
|
||||
setlocal formatoptions+=cro
|
||||
|
||||
function! DockerfileReplaceInstruction(original, replacement)
|
||||
let syn = synIDtrans(synID(line("."), col(".") - 1, 0))
|
||||
if syn != hlID("Comment") && syn != hlID("Constant") && strlen(getline(".")) == 0
|
||||
|
||||
38
ftplugin/csv.vim
Normal file
38
ftplugin/csv.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'csv') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Filetype plugin for editing CSV files. "{{{1
|
||||
" Author: Christian Brabandt <cb@256bit.org>
|
||||
" Version: 0.31
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=2830
|
||||
" License: VIM License
|
||||
" Last Change: Thu, 15 Jan 2015 21:05:10 +0100
|
||||
" Documentation: see :help ft-csv.txt
|
||||
" GetLatestVimScripts: 2830 30 :AutoInstall: csv.vim
|
||||
"
|
||||
" Some ideas are taken from the wiki http://vim.wikia.com/wiki/VimTip667
|
||||
" though, implementation differs.
|
||||
|
||||
" Plugin folklore "{{{1
|
||||
if v:version < 700 || exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Initialize Plugin "{{{2
|
||||
" useful for configuring how many lines to analyze,
|
||||
" set if you notice a slowdown
|
||||
let b:csv_start = get(g:, 'csv_start', 1)
|
||||
let b:csv_end = get(g:, 'csv_end', line('$'))
|
||||
let b:csv_result = ''
|
||||
|
||||
call csv#Init(b:csv_start, b:csv_end)
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" Vim Modeline " {{{2
|
||||
" vim: set foldmethod=marker et sw=0 sts=-1 ts=4:
|
||||
39
ftplugin/dhall.vim
Normal file
39
ftplugin/dhall.vim
Normal file
@@ -0,0 +1,39 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dhall') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('b:dhall_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:dhall_ftplugin = 1
|
||||
|
||||
setlocal commentstring=--\ %s
|
||||
|
||||
set smarttab
|
||||
|
||||
if exists('g:dhall_use_ctags')
|
||||
if g:dhall_use_ctags == 1
|
||||
augroup dhall
|
||||
autocmd BufWritePost *.dhall silent !ctags -R .
|
||||
augroup END
|
||||
endif
|
||||
endif
|
||||
|
||||
function! StripTrailingWhitespace()
|
||||
let myline=line('.')
|
||||
let mycolumn = col('.')
|
||||
exec 'silent %s/ *$//'
|
||||
call cursor(myline, mycolumn)
|
||||
endfunction
|
||||
|
||||
if exists('g:dhall_strip_whitespace')
|
||||
if g:dhall_strip_whitespace == 1
|
||||
augroup dhall
|
||||
au BufWritePre *.dhall silent! call StripTrailingWhitespace()
|
||||
augroup END
|
||||
endif
|
||||
endif
|
||||
|
||||
augroup dhall
|
||||
au BufNewFile,BufRead *.dhall setl shiftwidth=2
|
||||
augroup END
|
||||
9
ftplugin/docker-compose.vim
Normal file
9
ftplugin/docker-compose.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dockerfile') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Define comment string
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Enable automatic comment insertion
|
||||
setlocal formatoptions+=cro
|
||||
@@ -24,7 +24,10 @@ if !exists("b:eelixir_subtype")
|
||||
let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+')
|
||||
endif
|
||||
if b:eelixir_subtype == ''
|
||||
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
|
||||
let b:eelixir_subtype = matchstr(&filetype,'^leex\.\zs\w\+')
|
||||
endif
|
||||
if b:eelixir_subtype == ''
|
||||
let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.leex\|\.eelixir\)\+$','',''),'\.\zs\w\+$')
|
||||
endif
|
||||
if b:eelixir_subtype == 'ex'
|
||||
let b:eelixir_subtype = 'elixir'
|
||||
|
||||
@@ -32,7 +32,7 @@ let &l:path =
|
||||
\ &g:path
|
||||
\ ], ',')
|
||||
setlocal includeexpr=elixir#util#get_filename(v:fname)
|
||||
setlocal suffixesadd=.ex,.exs,.eex,.erl,.xrl,.yrl,.hrl
|
||||
setlocal suffixesadd=.ex,.exs,.eex,.leex,.erl,.xrl,.yrl,.hrl
|
||||
|
||||
let &l:define = 'def\(macro\|guard\|delegate\)\=p\='
|
||||
|
||||
|
||||
@@ -17,8 +17,10 @@ let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=:# commentstring=#\ %s
|
||||
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
|
||||
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q
|
||||
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<'
|
||||
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
|
||||
setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
|
||||
|
||||
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<'
|
||||
|
||||
if exists("g:no_gitcommit_commands") || v:version < 700
|
||||
finish
|
||||
|
||||
41
ftplugin/hcl.vim
Normal file
41
ftplugin/hcl.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hcl') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" File: ftplugin/hcl.vim
|
||||
" Author: BABAROT <b4b4r07@gmail.com>
|
||||
" Description: FileType Plugin for HCL
|
||||
" Last Change: Nob 05, 2015
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Add NERDCommenter delimiters
|
||||
|
||||
let s:delims = { 'left': '#' }
|
||||
if exists('g:NERDDelimiterMap')
|
||||
if !has_key(g:NERDDelimiterMap, 'hcl')
|
||||
let g:NERDDelimiterMap.hcl = s:delims
|
||||
endif
|
||||
elseif exists('g:NERDCustomDelimiters')
|
||||
if !has_key(g:NERDCustomDelimiters, 'hcl')
|
||||
let g:NERDCustomDelimiters.hcl = s:delims
|
||||
endif
|
||||
else
|
||||
let g:NERDCustomDelimiters = { 'hcl': s:delims }
|
||||
endif
|
||||
unlet s:delims
|
||||
|
||||
let b:undo_ftplugin = ""
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sw=4 ts=4:
|
||||
6
ftplugin/hive.vim
Normal file
6
ftplugin/hive.vim
Normal file
@@ -0,0 +1,6 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'hive') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal comments=:--
|
||||
setlocal commentstring=--\ %s
|
||||
9
ftplugin/ion.vim
Normal file
9
ftplugin/ion.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ion') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=#%s
|
||||
@@ -2,7 +2,7 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'kotlin') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
if exists('b:did_ftplugin') | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=://
|
||||
|
||||
61
ftplugin/lilypond.vim
Normal file
61
ftplugin/lilypond.vim
Normal file
@@ -0,0 +1,61 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'lilypond') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" LilyPond filetype plugin
|
||||
" Language: LilyPond (ft=ly)
|
||||
" Maintainer: Heikki Junes <hjunes@cc.hut.fi>
|
||||
" Last Change: 2010 Jul 26
|
||||
"
|
||||
" Installed As: vim/ftplugin/lilypond.vim
|
||||
" Uses Generated File: vim/syntax/lilypond-words.vim
|
||||
"
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal autoindent
|
||||
setlocal shiftwidth=2
|
||||
"
|
||||
" some handy key mappings
|
||||
"
|
||||
" <F4> save & make and play midi with timidity
|
||||
map <buffer> <F4> :w<Return>:se makeprg=lilypond\ \"%<\"<Return>:make<Return>:!timidity "%<.midi"<Return>
|
||||
"
|
||||
" <F5> save & make
|
||||
map <buffer> <F5> :w<Return>:se makeprg=lilypond\ \"%<\"<Return>:make<Return>
|
||||
"
|
||||
" <F6> view ps with ghostview
|
||||
map <buffer> <F6> :!gv --watch "%<.ps" &<Return>
|
||||
"
|
||||
" <F7> prev error
|
||||
map <buffer> <F7> :cp<Return>
|
||||
"
|
||||
" <F8> next error
|
||||
map <buffer> <F8> :cn<Return>
|
||||
"
|
||||
" <F9> make
|
||||
map <buffer> <F9> :w<Return>:se makeprg=make\ -k<Return>:make<Return>
|
||||
"
|
||||
" <F10> menu
|
||||
source $VIMRUNTIME/menu.vim
|
||||
setlocal wildmenu
|
||||
setlocal cpo-=<
|
||||
setlocal wcm=<C-Z>
|
||||
map <buffer> <F10> :emenu <C-Z>
|
||||
"
|
||||
" <F12> comment region
|
||||
map <buffer> <F12> :g!/%.*/normal 0i%<Return>
|
||||
"
|
||||
" <S-F12> remove comments in region
|
||||
map <buffer> <S-F12> :g/%.*/normal 0x<Return>
|
||||
"
|
||||
" Completions in Insert/Replace-mode with <Ctrl-N>
|
||||
setlocal dictionary-=$VIM/syntax/lilypond-words dictionary+=$VIM/syntax/lilypond-words
|
||||
setlocal complete-=k complete+=k
|
||||
"
|
||||
setlocal showmatch
|
||||
@@ -1,65 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'liquid') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: Liquid
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 May 21
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:liquid_default_subtype')
|
||||
let g:liquid_default_subtype = 'html'
|
||||
endif
|
||||
|
||||
if !exists('b:liquid_subtype')
|
||||
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
||||
let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+')
|
||||
if b:liquid_subtype == ''
|
||||
let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+')
|
||||
endif
|
||||
if b:liquid_subtype == ''
|
||||
let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$')
|
||||
endif
|
||||
if b:liquid_subtype == ''
|
||||
let b:liquid_subtype = g:liquid_default_subtype
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('b:liquid_subtype') && b:liquid_subtype != ''
|
||||
exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim'
|
||||
else
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if exists('b:undo_ftplugin')
|
||||
let b:undo_ftplugin .= '|'
|
||||
else
|
||||
let b:undo_ftplugin = ''
|
||||
endif
|
||||
if exists('b:browsefilter')
|
||||
let b:browsefilter = "\n".b:browsefilter
|
||||
else
|
||||
let b:browsefilter = ''
|
||||
endif
|
||||
if exists('b:match_words')
|
||||
let b:match_words .= ','
|
||||
elseif exists('loaded_matchit')
|
||||
let b:match_words = ''
|
||||
endif
|
||||
|
||||
if has('gui_win32')
|
||||
let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter
|
||||
endif
|
||||
|
||||
if exists('loaded_matchit')
|
||||
let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,<\(capture\|comment\|highlight\)\>:\<end\1\>'
|
||||
endif
|
||||
|
||||
setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
|
||||
|
||||
let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words'
|
||||
16
ftplugin/llvm.vim
Normal file
16
ftplugin/llvm.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'llvm') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: LLVM Assembly
|
||||
" Maintainer: The LLVM team, http://llvm.org/
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal softtabstop=2 shiftwidth=2
|
||||
setlocal expandtab
|
||||
setlocal comments+=:;
|
||||
@@ -25,6 +25,9 @@ if exists("loaded_matchit") && exists("b:match_words")
|
||||
\ . '\%({{\)\@<=/\s*\1\s*}}'
|
||||
endif
|
||||
|
||||
" Set template for comment
|
||||
setlocal commentstring={{!--\ %s\ --}}
|
||||
|
||||
if exists("g:mustache_abbreviations")
|
||||
inoremap <buffer> {{{ {{{}}}<left><left><left>
|
||||
inoremap <buffer> {{ {{}}<left><left>
|
||||
|
||||
@@ -12,11 +12,14 @@ if (exists("b:did_ftplugin"))
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
|
||||
setlocal
|
||||
\ comments=:#
|
||||
\ commentstring=#\ %s
|
||||
\ comments=:#
|
||||
\ commentstring=#\ %s
|
||||
\ iskeyword+=-
|
||||
|
||||
if get(g:, 'nix_recommended_style', 1)
|
||||
setlocal
|
||||
\ shiftwidth=2
|
||||
\ softtabstop=2
|
||||
\ expandtab
|
||||
\ iskeyword+=-
|
||||
\ expandtab
|
||||
endif
|
||||
|
||||
@@ -2,12 +2,18 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'plantuml') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
" Vim filetype plugin file
|
||||
" Language: PlantUML
|
||||
" Maintainer: Anders Thøgersen <first name at bladre dot dk>
|
||||
" License: VIM LICENSE
|
||||
|
||||
if exists('b:loaded_plantuml_plugin')
|
||||
finish
|
||||
endif
|
||||
let b:loaded_plantuml_plugin = 1
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
if !exists('g:plantuml_executable_script')
|
||||
let g:plantuml_executable_script='plantuml'
|
||||
@@ -21,10 +27,15 @@ if exists('loaded_matchit')
|
||||
\ ',\<rnote\>:\<endrnote\>' .
|
||||
\ ',\<hnote\>:\<endhnote\>' .
|
||||
\ ',\<title\>:\<endtitle\>' .
|
||||
\ ',\<\while\>:\<endwhile\>'
|
||||
\ ',\<\while\>:\<endwhile\>' .
|
||||
\ ',@startuml:@enduml' .
|
||||
\ ',@startwbs:@endwbs' .
|
||||
\ ',@startmindmap:@endmindmap'
|
||||
endif
|
||||
|
||||
let &l:makeprg=g:plantuml_executable_script . ' ' . fnameescape(expand('%'))
|
||||
if get(g:, 'plantuml_set_makeprg', 1)
|
||||
let &l:makeprg=g:plantuml_executable_script . ' %'
|
||||
endif
|
||||
|
||||
setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql
|
||||
|
||||
@@ -33,5 +44,5 @@ let b:endwise_words = 'loop,group,alt,note,legend'
|
||||
let b:endwise_pattern = '^\s*\zs\<\(loop\|group\|alt\|note\ze[^:]*$\|legend\)\>.*$'
|
||||
let b:endwise_syngroups = 'plantumlKeyword'
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
48
ftplugin/puppet_tagbar.vim
Normal file
48
ftplugin/puppet_tagbar.vim
Normal file
@@ -0,0 +1,48 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'puppet') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Puppet set up for Tagbar plugin
|
||||
" (https://github.com/majutsushi/tagbar).
|
||||
|
||||
if !exists(':Tagbar')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:tagbar_type_puppet = {
|
||||
\ 'ctagstype': 'puppet',
|
||||
\ 'kinds': [
|
||||
\ 'c:Classes',
|
||||
\ 's:Sites',
|
||||
\ 'n:Nodes',
|
||||
\ 'v:Variables',
|
||||
\ 'i:Includes',
|
||||
\ 'd:Definitions',
|
||||
\ 'r:Resources',
|
||||
\ 'f:Defaults',
|
||||
\ 't:Types',
|
||||
\ 'u:Functions',
|
||||
\],
|
||||
\}
|
||||
|
||||
if puppet#ctags#Type() == 'universal'
|
||||
" There no sense to split objects by colon
|
||||
let g:tagbar_type_puppet.sro = '__'
|
||||
let g:tagbar_type_puppet.kind2scope = {
|
||||
\ 'd': 'definition',
|
||||
\ 'c': 'class',
|
||||
\ 'r': 'resource',
|
||||
\ 'i': 'include',
|
||||
\ 'v': 'variable',
|
||||
\}
|
||||
let g:tagbar_type_puppet.scope2kind = {
|
||||
\ 'definition' : 'd',
|
||||
\ 'class' : 'c',
|
||||
\ 'resource' : 'r',
|
||||
\ 'include' : 'i',
|
||||
\ 'variable' : 'v',
|
||||
\}
|
||||
endif
|
||||
|
||||
let g:tagbar_type_puppet.deffile = puppet#ctags#OptionFile()
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'r-lang') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" ftplugin for R files
|
||||
"
|
||||
" Author: Iago Mosqueira <i.mosqueira@ic.ac.uk>
|
||||
" Author: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Author: Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: 2007 Nov 21
|
||||
" SVN: $Id: r.vim 75 2007-11-21 13:34:02Z ranke $
|
||||
"
|
||||
" Code written in vim is sent to R through a perl pipe
|
||||
" [funnel.pl, by Larry Clapp <vim@theclapp.org>], as individual lines,
|
||||
" blocks, or the whole file.
|
||||
|
||||
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||
" to its standard input (you can type R commands into the xterm)
|
||||
" as well as to code pasted from within vim.
|
||||
"
|
||||
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||
"
|
||||
" In insert mode, <M-Enter> sends the active line to R and moves to the next
|
||||
" line (write and process mode).
|
||||
"
|
||||
" Maps:
|
||||
" <F2> Start a listening R interpreter in new xterm
|
||||
" <F3> Start a listening R-devel interpreter in new xterm
|
||||
" <F4> Start a listening R --vanilla interpreter in new xterm
|
||||
" <F5> Run current file
|
||||
" <F9> Run line under cursor
|
||||
" r Run visual block
|
||||
" <M-Enter> Write and process
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Disable backup for .r-pipe
|
||||
setl backupskip=.*pipe
|
||||
|
||||
" Set tabstop so it is compatible with the emacs edited code. Personally, I
|
||||
" prefer shiftwidth=2, which I have in my .vimrc anyway
|
||||
set expandtab
|
||||
set shiftwidth=4
|
||||
set tabstop=8
|
||||
|
||||
" Start a listening R interpreter in new xterm
|
||||
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||
|
||||
" Start a listening R-devel interpreter in new xterm
|
||||
noremap <buffer> <F3> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R-devel && echo 'Interpreter has finished. Exiting. Goodbye.'"&<CR><CR>
|
||||
|
||||
" Start a listening R --vanilla interpreter in new xterm
|
||||
noremap <buffer> <F4> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R -vanilla && echo 'Interpreter has finished. Exiting. Goodbye.'"&<CR><CR>
|
||||
|
||||
" Send line under cursor to R
|
||||
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
|
||||
" Send visual selected block to R
|
||||
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||
|
||||
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||
|
||||
" Send current file to R
|
||||
noremap <buffer> <F5> :execute '1 ,' line("$") 'w >> ~/.r-pipe' <CR><CR>
|
||||
@@ -1,52 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'r-lang') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" ftplugin for R help files
|
||||
"
|
||||
" Author: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: 2007 Nov 21
|
||||
" SVN: $Id: rhelp.vim 75 2007-11-21 13:34:02Z ranke $
|
||||
"
|
||||
" Usage:
|
||||
"
|
||||
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||
" to its standard input (you can type R commands into the xterm)
|
||||
" as well as to code pasted from within vim.
|
||||
"
|
||||
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||
"
|
||||
" Add to filetypes.vim, if you don't use vim 7
|
||||
" au BufNewFile,BufRead *.Rd,*.rd setf rhelp
|
||||
"
|
||||
" Maps:
|
||||
" <F2> Start a listening R interpreter in new xterm
|
||||
" <F9> Run line under cursor
|
||||
" r Run visual block
|
||||
" <M-Enter> Write and process R code
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Set tabbing
|
||||
set expandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
|
||||
" Start a listening R interpreter in new xterm
|
||||
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||
|
||||
" Send line under cursor to R
|
||||
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
|
||||
" Send visual selected block to R
|
||||
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||
|
||||
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||
@@ -1,63 +0,0 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'r-lang') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" ftplugin for Sweave files containing both LaTeX and R code
|
||||
"
|
||||
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: 2007 Nov 21
|
||||
" SVN: $Id: rnoweb.vim 75 2007-11-21 13:34:02Z ranke $
|
||||
"
|
||||
" Usage:
|
||||
"
|
||||
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||
" to its standard input (you can type R commands into the xterm)
|
||||
" as well as to code pasted from within vim.
|
||||
"
|
||||
" A Makefile for producing R noweb files is in included in my Vim script
|
||||
" R.vim:
|
||||
" http://www.vim.org/scripts/script.php?script_id=1048
|
||||
" You can also look in my SVN repository under:
|
||||
" http://kri/viewcvs/*checkout*/Makefile.rnoweb?root=vim
|
||||
"
|
||||
"
|
||||
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||
"
|
||||
" Add to filetypes.vim, if you don't use vim 7
|
||||
" au BufNewFile,BufRead *.Rnw,*.rnw setf rnoweb
|
||||
" and/or
|
||||
" au BufNewFile,BufRead *.Snw,*.snw setf rnoweb
|
||||
"
|
||||
" Maps:
|
||||
" <F2> Start a listening R interpreter in new xterm
|
||||
" <F9> Run line under cursor
|
||||
" r Run visual block
|
||||
" <M-Enter> Write and process R code
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Disable backup for .r-pipe
|
||||
setl backupskip=.*pipe
|
||||
|
||||
" Set R friendly tabbing
|
||||
set expandtab
|
||||
set shiftwidth=2
|
||||
|
||||
" Start a listening R interpreter in new xterm
|
||||
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||
|
||||
" Send line under cursor to R
|
||||
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||
|
||||
" Send visual selected block to R
|
||||
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||
|
||||
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||
@@ -38,7 +38,7 @@ if exists("g:rst_style") && g:rst_style != 0
|
||||
setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
|
||||
endif
|
||||
|
||||
if has('patch-7.3.867') " Introduced the TextChanged event.
|
||||
if g:rst_fold_enabled != 0 && has('patch-7.3.867') " Introduced the TextChanged event.
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=RstFold#GetRstFold()
|
||||
setlocal foldtext=RstFold#GetRstFoldText()
|
||||
|
||||
@@ -27,13 +27,13 @@ if exists("loaded_matchit") && !exists("b:match_words")
|
||||
let b:match_ignorecase = 0
|
||||
|
||||
let b:match_words =
|
||||
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|=\@<!begin\)\>=\@!' .
|
||||
\ '{\|\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|=\@<!begin\)\>=\@!' .
|
||||
\ ':' .
|
||||
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
|
||||
\ ':' .
|
||||
\ '\%(^\|[^.\:@$=]\)\@<=\<end\:\@!\>' .
|
||||
\ '}\|\%(^\|[^.\:@$=]\)\@<=\<end\:\@!\>' .
|
||||
\ ',^=begin\>:^=end\>,' .
|
||||
\ ',{:},\[:\],(:)'
|
||||
\ ',\[:\],(:)'
|
||||
|
||||
let b:match_skip =
|
||||
\ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" .
|
||||
@@ -90,7 +90,7 @@ endfunction
|
||||
|
||||
function! s:build_path(path) abort
|
||||
let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',')
|
||||
if &g:path !~# '\v^\.%(,/%(usr|emx)/include)=,,$'
|
||||
if &g:path !~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$'
|
||||
let path = substitute(&g:path,',,$',',','') . ',' . path
|
||||
endif
|
||||
return path
|
||||
|
||||
@@ -39,7 +39,7 @@ if get(g:, 'rust_bang_comment_leader', 0)
|
||||
" leaders. I'm fairly sure that's a Vim bug.
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,://
|
||||
else
|
||||
setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
|
||||
setlocal comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
|
||||
endif
|
||||
setlocal commentstring=//%s
|
||||
setlocal formatoptions-=t formatoptions+=croqnl
|
||||
@@ -195,7 +195,7 @@ augroup END
|
||||
|
||||
setlocal matchpairs+=<:>
|
||||
" For matchit.vim (rustArrow stops `Fn() -> X` messing things up)
|
||||
let b:match_skip = 's:comment\|string\|rustArrow'
|
||||
let b:match_skip = 's:comment\|string\|rustCharacter\|rustArrow'
|
||||
|
||||
" vint: -ProhibitAbbreviationOption
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
@@ -5,7 +5,7 @@ endif
|
||||
"
|
||||
" Support for Tagbar -- https://github.com/majutsushi/tagbar
|
||||
"
|
||||
if !exists(':Tagbar')
|
||||
if !exists(':Tagbar') || rust#tags#IsUCtags()
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ setlocal commentstring=//\ %s
|
||||
|
||||
setlocal shiftwidth=2 softtabstop=2 expandtab
|
||||
|
||||
setlocal include='^\s*import'
|
||||
setlocal includeexpr='substitute(v:fname,"\\.","/","g")'
|
||||
setlocal include=^\\s*import
|
||||
setlocal includeexpr=substitute(v:fname,'\\.','/','g')
|
||||
|
||||
setlocal path+=src/main/scala,src/test/scala
|
||||
setlocal suffixesadd=.scala
|
||||
|
||||
29
ftplugin/smt2.vim
Normal file
29
ftplugin/smt2.vim
Normal file
@@ -0,0 +1,29 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'smt2') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+=-,:,#,',$
|
||||
|
||||
" If no command for invoking a solver is specified in ~/.vimrc, test if either
|
||||
" 'z3' or 'boolector' is accessible through $PATH (in that order)
|
||||
if !exists("g:smt2_solver_command")
|
||||
if executable("z3")
|
||||
let g:smt2_solver_command = "z3"
|
||||
elseif executable("boolector")
|
||||
let g:smt2_solver_command = "boolector"
|
||||
endif
|
||||
endif
|
||||
|
||||
" If no command line switch for printing the solver's version is specified in
|
||||
" ~/.vimrc, use '--version'
|
||||
if !exists("g:smt2_solver_version_switch")
|
||||
let g:smt2_solver_version_switch = "--version"
|
||||
endif
|
||||
|
||||
" Mappings
|
||||
nnoremap <silent> <buffer> <localleader>r :call smt2#RunSolver()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>R :call smt2#RunSolverAndShowResult()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>v :call smt2#PrintSolverVersion()<cr>
|
||||
|
||||
" Comment String
|
||||
setlocal commentstring=;%s
|
||||
16
ftplugin/tablegen.vim
Normal file
16
ftplugin/tablegen.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'llvm') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: LLVM TableGen
|
||||
" Maintainer: The LLVM team, http://llvm.org/
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal matchpairs+=<:>
|
||||
setlocal softtabstop=2 shiftwidth=2
|
||||
setlocal expandtab
|
||||
@@ -5,71 +5,61 @@ endif
|
||||
" terraform.vim - basic vim/terraform integration
|
||||
" Maintainer: HashiVim <https://github.com/hashivim>
|
||||
|
||||
set formatoptions-=t
|
||||
|
||||
if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform')
|
||||
if exists('b:did_ftplugin') || v:version < 700 || &compatible
|
||||
finish
|
||||
endif
|
||||
let g:loaded_terraform = 1
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if !exists("g:terraform_fmt_on_save")
|
||||
let g:terraform_fmt_on_save = 0
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
" j is a relatively recent addition; silence warnings when setting it.
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
silent! setlocal formatoptions+=j
|
||||
let b:undo_ftplugin = 'setlocal formatoptions<'
|
||||
|
||||
if !has('patch-7.4.1142')
|
||||
" Include hyphens as keyword characters so that a keyword appearing as
|
||||
" part of a longer name doesn't get partially highlighted.
|
||||
setlocal iskeyword+=-
|
||||
let b:undo_ftplugin .= ' iskeyword<'
|
||||
endif
|
||||
|
||||
function! s:commands(A, L, P)
|
||||
return join([
|
||||
\ "apply",
|
||||
\ "console",
|
||||
\ "destroy",
|
||||
\ "env",
|
||||
\ "fmt",
|
||||
\ "get",
|
||||
\ "graph",
|
||||
\ "import",
|
||||
\ "init",
|
||||
\ "output",
|
||||
\ "plan",
|
||||
\ "providers",
|
||||
\ "push",
|
||||
\ "refresh",
|
||||
\ "show",
|
||||
\ "taint",
|
||||
\ "untaint",
|
||||
\ "validate",
|
||||
\ "version",
|
||||
\ "workspace",
|
||||
\ "debug",
|
||||
\ "force-unlock",
|
||||
\ "state"
|
||||
\ ], "\n")
|
||||
endfunction
|
||||
if get(g:, 'terraform_fold_sections', 0)
|
||||
setlocal foldmethod=syntax
|
||||
let b:undo_ftplugin .= ' foldmethod<'
|
||||
endif
|
||||
|
||||
" Adapted from vim-hclfmt:
|
||||
" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim
|
||||
function! terraform#fmt()
|
||||
let l:curw = winsaveview()
|
||||
let l:tmpfile = tempname() . ".tf"
|
||||
call writefile(getline(1, "$"), l:tmpfile)
|
||||
let output = system("terraform fmt -write " . l:tmpfile)
|
||||
if v:shell_error == 0
|
||||
try | silent undojoin | catch | endtry
|
||||
call rename(l:tmpfile, resolve(expand("%")))
|
||||
silent edit!
|
||||
let &syntax = &syntax
|
||||
else
|
||||
echo output
|
||||
call delete(l:tmpfile)
|
||||
endif
|
||||
call winrestview(l:curw)
|
||||
endfunction
|
||||
" Set the commentstring
|
||||
setlocal commentstring=#%s
|
||||
let b:undo_ftplugin .= ' commentstring<'
|
||||
|
||||
augroup terraform
|
||||
autocmd!
|
||||
autocmd BufEnter *
|
||||
\ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color'
|
||||
autocmd BufEnter * command! -nargs=0 TerraformFmt call terraform#fmt()
|
||||
if get(g:, "terraform_fmt_on_save", 1)
|
||||
if get(g:, 'terraform_align', 0) && exists(':Tabularize')
|
||||
inoremap <buffer> <silent> = =<Esc>:call terraform#align()<CR>a
|
||||
let b:undo_ftplugin .= '|iunmap <buffer> ='
|
||||
endif
|
||||
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
if !executable('terraform')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
command! -nargs=+ -complete=customlist,terraform#commands -buffer Terraform execute '!terraform '.<q-args>. ' -no-color'
|
||||
command! -nargs=0 -buffer TerraformFmt call terraform#fmt()
|
||||
let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt'
|
||||
|
||||
if get(g:, 'terraform_fmt_on_save', 0)
|
||||
augroup vim.terraform.fmt
|
||||
autocmd!
|
||||
autocmd BufWritePre *.tf call terraform#fmt()
|
||||
autocmd BufWritePre *.tfvars call terraform#fmt()
|
||||
endif
|
||||
augroup END
|
||||
augroup END
|
||||
endif
|
||||
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
@@ -2,4 +2,15 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'tmux') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: tmux(1) configuration file
|
||||
" URL: https://github.com/ericpruitt/tmux.vim/
|
||||
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
|
||||
" Last Changed: 2017 Mar 10
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
15
ftplugin/tsx.vim
Normal file
15
ftplugin/tsx.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" modified from mxw/vim-jsx from html.vim
|
||||
if exists("loaded_matchit") && !exists('b:tsx_match_words')
|
||||
let b:match_ignorecase = 0
|
||||
let b:tsx_match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||
let b:match_words = exists('b:match_words')
|
||||
\ ? b:match_words . ',' . b:tsx_match_words
|
||||
\ : b:tsx_match_words
|
||||
endif
|
||||
|
||||
set suffixesadd+=.tsx
|
||||
@@ -2,6 +2,8 @@ if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'typescript') !=
|
||||
finish
|
||||
endif
|
||||
|
||||
" set Vi-incompatible, compiler and commentstring
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
@@ -17,9 +19,68 @@ setlocal commentstring=//\ %s
|
||||
" " and insert the comment leader when hitting <CR> or using "o".
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal suffixesadd+=.ts,.tsx
|
||||
|
||||
let b:undo_ftplugin = "setl fo< ofu< com< cms<"
|
||||
" setlocal foldmethod=syntax
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
function! TsIncludeExpr(file)
|
||||
if (filereadable(a:file))
|
||||
return l:file
|
||||
else
|
||||
let l:file2=substitute(a:file,'$','/index.ts','g')
|
||||
return l:file2
|
||||
endif
|
||||
endfunction
|
||||
|
||||
set path+=./node_modules/**,node_modules/**
|
||||
set include=import\_s.\\zs[^'\"]*\\ze
|
||||
set includeexpr=TsIncludeExpr(v:fname)
|
||||
set suffixesadd=.ts
|
||||
|
||||
"
|
||||
" TagBar
|
||||
"
|
||||
let g:tagbar_type_typescript = {
|
||||
\ 'ctagstype' : 'typescript',
|
||||
\ 'kinds' : [
|
||||
\ 'c:classes',
|
||||
\ 'a:abstract classes',
|
||||
\ 't:types',
|
||||
\ 'n:modules',
|
||||
\ 'f:functions',
|
||||
\ 'v:variables',
|
||||
\ 'l:varlambdas',
|
||||
\ 'm:members',
|
||||
\ 'i:interfaces',
|
||||
\ 'e:enums'
|
||||
\ ],
|
||||
\ 'sro' : '.',
|
||||
\ 'kind2scope' : {
|
||||
\ 'c' : 'classes',
|
||||
\ 'a' : 'abstract classes',
|
||||
\ 't' : 'types',
|
||||
\ 'f' : 'functions',
|
||||
\ 'v' : 'variables',
|
||||
\ 'l' : 'varlambdas',
|
||||
\ 'm' : 'members',
|
||||
\ 'i' : 'interfaces',
|
||||
\ 'e' : 'enums'
|
||||
\ },
|
||||
\ 'scope2kind' : {
|
||||
\ 'classes' : 'c',
|
||||
\ 'abstract classes' : 'a',
|
||||
\ 'types' : 't',
|
||||
\ 'functions' : 'f',
|
||||
\ 'variables' : 'v',
|
||||
\ 'varlambdas' : 'l',
|
||||
\ 'members' : 'm',
|
||||
\ 'interfaces' : 'i',
|
||||
\ 'enums' : 'e'
|
||||
\ }
|
||||
\ }
|
||||
|
||||
" In case you've updated/customized your ~/.ctags and prefer to use it.
|
||||
if get(g:, 'typescript_use_builtin_tagbar_defs', 1)
|
||||
let g:tagbar_type_typescript.deffile = expand('<sfile>:p:h:h') . '/ctags/typescript.ctags'
|
||||
endif
|
||||
|
||||
18
ftplugin/zig.vim
Normal file
18
ftplugin/zig.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'zig') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
setlocal suffixesadd=.zig
|
||||
setlocal commentstring=//\ %s
|
||||
setlocal makeprg=zig\ build
|
||||
@@ -52,13 +52,13 @@ if !exists('g:python_pep8_indent_searchpair_timeout')
|
||||
endif
|
||||
|
||||
let s:block_rules = {
|
||||
\ '^\s*elif\>': ['if', 'elif'],
|
||||
\ '^\s*except\>': ['try', 'except'],
|
||||
\ '^\s*finally\>': ['try', 'except', 'else']
|
||||
\ }
|
||||
\ '^\s*elif\>': [['if', 'elif'], ['else']],
|
||||
\ '^\s*except\>': [['try', 'except'], []],
|
||||
\ '^\s*finally\>': [['try', 'except', 'else'], []]
|
||||
\ }
|
||||
let s:block_rules_multiple = {
|
||||
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
|
||||
\ }
|
||||
\ '^\s*else\>': [['if', 'elif', 'for', 'try', 'except'], []]
|
||||
\ }
|
||||
" Pairs to look for when searching for opening parenthesis.
|
||||
" The value is the maximum offset in lines.
|
||||
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
|
||||
@@ -73,13 +73,15 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "\\vcomment|jedi\\S"'
|
||||
|
||||
let s:special_chars_syn_pattern = "\\vstring|comment|^pythonbytes%(contents)=$|pythonTodo|jedi\\S"
|
||||
|
||||
if !get(g:, 'python_pep8_indent_skip_concealed', 0) || !has('conceal')
|
||||
" Skip strings and comments. Return 1 for chars to skip.
|
||||
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||
" are inserted temporarily into the buffer.
|
||||
function! s:_skip_special_chars(line, col)
|
||||
return synIDattr(synID(a:line, a:col, 0), 'name')
|
||||
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
|
||||
\ =~? s:special_chars_syn_pattern
|
||||
endfunction
|
||||
else
|
||||
" Also ignore anything concealed.
|
||||
@@ -94,8 +96,8 @@ else
|
||||
|
||||
function! s:_skip_special_chars(line, col)
|
||||
return synIDattr(synID(a:line, a:col, 0), 'name')
|
||||
\ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"
|
||||
\ || s:is_concealed(a:line, a:col)
|
||||
\ =~? s:special_chars_syn_pattern
|
||||
\ || s:is_concealed(a:line, a:col)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
@@ -152,15 +154,23 @@ function! s:find_start_of_multiline_statement(lnum)
|
||||
endfunction
|
||||
|
||||
" Find possible indent(s) of the block starter that matches the current line.
|
||||
function! s:find_start_of_block(lnum, types, multiple)
|
||||
function! s:find_start_of_block(lnum, types, skip, multiple) abort
|
||||
let r = []
|
||||
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||
if !empty(a:skip)
|
||||
let re_skip = '\V\^\s\*\('.join(a:skip, '\|').'\)\>'
|
||||
else
|
||||
let re_skip = ''
|
||||
endif
|
||||
let lnum = a:lnum
|
||||
let last_indent = indent(lnum) + 1
|
||||
while lnum > 0 && last_indent > 0
|
||||
let indent = indent(lnum)
|
||||
if indent < last_indent
|
||||
if getline(lnum) =~# re
|
||||
let line = getline(lnum)
|
||||
if !empty(re_skip) && line =~# re_skip
|
||||
let last_indent = indent
|
||||
elseif line =~# re
|
||||
if !a:multiple
|
||||
return [indent]
|
||||
endif
|
||||
@@ -217,6 +227,11 @@ function! s:indent_like_opening_paren(lnum)
|
||||
let res = base
|
||||
else
|
||||
let res = base + s:sw()
|
||||
|
||||
" Special case for parenthesis.
|
||||
if text[paren_col-1] ==# '(' && getline(a:lnum) !~# '\v\)\s*:?\s*$'
|
||||
return res
|
||||
endif
|
||||
endif
|
||||
else
|
||||
" Indent to match position of opening paren.
|
||||
@@ -241,14 +256,16 @@ function! s:indent_like_block(lnum)
|
||||
let text = getline(a:lnum)
|
||||
for [multiple, block_rules] in [
|
||||
\ [0, s:block_rules],
|
||||
\ [1, s:block_rules_multiple]]
|
||||
for [line_re, blocks] in items(block_rules)
|
||||
\ [1, s:block_rules_multiple],
|
||||
\ ]
|
||||
for [line_re, blocks_ignore] in items(block_rules)
|
||||
if text !~# line_re
|
||||
continue
|
||||
endif
|
||||
|
||||
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
|
||||
if !len(indents)
|
||||
let [blocks, skip] = blocks_ignore
|
||||
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple)
|
||||
if empty(indents)
|
||||
return -1
|
||||
endif
|
||||
if len(indents) == 1
|
||||
|
||||
81
indent/d.vim
Normal file
81
indent/d.vim
Normal file
@@ -0,0 +1,81 @@
|
||||
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dlang') != -1
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim indent file for the D programming language (version 1.076 and 2.063).
|
||||
"
|
||||
" Language: D
|
||||
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
|
||||
" Last Change: 2014 January 19
|
||||
" Version: 0.26
|
||||
"
|
||||
" Please submit bugs/comments/suggestions to the github repo:
|
||||
" https://github.com/JesseKPhillips/d.vim
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal cindent
|
||||
setlocal indentkeys& indentkeys+=0=in indentkeys+=0=out indentkeys+=0=body
|
||||
setlocal indentexpr=GetDIndent()
|
||||
|
||||
if exists("*GetDIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! SkipBlanksAndComments(startline)
|
||||
let lnum = a:startline
|
||||
while lnum > 1
|
||||
let lnum = prevnonblank(lnum)
|
||||
if getline(lnum) =~ '[*+]/\s*$'
|
||||
while getline(lnum) !~ '/[*+]' && lnum > 1
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
if getline(lnum) =~ '^\s*/[*+]'
|
||||
let lnum = lnum - 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
elseif getline(lnum) =~ '\s*//'
|
||||
let lnum = lnum - 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
return lnum
|
||||
endfunction
|
||||
|
||||
function GetDIndent()
|
||||
let lnum = v:lnum
|
||||
let line = getline(lnum)
|
||||
let cind = cindent(lnum)
|
||||
|
||||
" Align contract blocks with function signature.
|
||||
if line =~ '^\s*\(body\|in\|out\)\>'
|
||||
" Skip in/out parameters.
|
||||
if getline(lnum - 1) =~ '[(,]\s*$'
|
||||
return cind
|
||||
endif
|
||||
" Find the end of the last block or the function signature.
|
||||
if line !~ '^\s*}' && getline(lnum - 1) !~ '('
|
||||
while lnum > 1 && getline(lnum - 1) !~ '[(}]'
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
endif
|
||||
let lnum = SkipBlanksAndComments(lnum)
|
||||
return cindent(lnum - 1)
|
||||
endif
|
||||
|
||||
" Align multiline array literals. e.g.:
|
||||
" auto a = [
|
||||
" [ 1, 2, 3 ],
|
||||
" [ 4, 5, 6 ],
|
||||
if line =~ '^\s*\[' && getline(lnum - 1) =~ '^\s*\['
|
||||
return indent(lnum - 1)
|
||||
endif
|
||||
|
||||
return cind
|
||||
endfunction
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user