mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
249 Commits
v4.10.2
...
ba82be40f4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba82be40f4 | ||
|
|
692e359ad9 | ||
|
|
bc8a81d359 | ||
|
|
38282d5838 | ||
|
|
36a2bf60ad | ||
|
|
db7bb8ba22 | ||
|
|
aae85fe8c2 | ||
|
|
55eed00f71 | ||
|
|
db3a87a50b | ||
|
|
8bb9203790 | ||
|
|
32d08013a6 | ||
|
|
0e1b191209 | ||
|
|
a4f98d2a9e | ||
|
|
83422e0a1f | ||
|
|
b77c5f1107 | ||
|
|
2c5af8f89d | ||
|
|
3a1fd1b41e | ||
|
|
b1704aba87 | ||
|
|
040e90bd02 | ||
|
|
c96947b1c6 | ||
|
|
f621f6c1ee | ||
|
|
cb80947143 | ||
|
|
87a26c5bf1 | ||
|
|
918610d427 | ||
|
|
3e49b1aefe | ||
|
|
82336eaa89 | ||
|
|
4d4aa5fe55 | ||
|
|
b147123070 | ||
|
|
7f98e949d4 | ||
|
|
ce31cd1d2f | ||
|
|
554a6ac757 | ||
|
|
c794f186c0 | ||
|
|
4f5388350b | ||
|
|
4899585281 | ||
|
|
4f997c5c82 | ||
|
|
c6f9e5b211 | ||
|
|
3e71cdad56 | ||
|
|
c4e50b4e9d | ||
|
|
839447bbf5 | ||
|
|
85a1c3d2d8 | ||
|
|
26095dda91 | ||
|
|
dec65bafca | ||
|
|
6e0702bd66 | ||
|
|
7c474e5c92 | ||
|
|
1a096f0901 | ||
|
|
4dd1f8f2be | ||
|
|
f05dea8dd7 | ||
|
|
e3ad29ce79 | ||
|
|
b0416720e7 | ||
|
|
643a6d0a13 | ||
|
|
f678aad210 | ||
|
|
af4d6aa3cf | ||
|
|
ff8c1d7674 | ||
|
|
27756b129b | ||
|
|
c312d30231 | ||
|
|
b99ce6173f | ||
|
|
af0eaee017 | ||
|
|
730dcb02ca | ||
|
|
48eb0fb1a8 | ||
|
|
0f9acbe2fc | ||
|
|
067e07e137 | ||
|
|
5de7022bcb | ||
|
|
67327ef831 | ||
|
|
7d0a1706ec | ||
|
|
8c28a9cfca | ||
|
|
9e45c07a8d | ||
|
|
3c5fca7621 | ||
|
|
eda351ca89 | ||
|
|
cc63193ce8 | ||
|
|
4c10562d2c | ||
|
|
22040ce638 | ||
|
|
7bde552a46 | ||
|
|
09f31c433a | ||
|
|
05b8bbc938 | ||
|
|
f3b646fd6f | ||
|
|
2ab0b0a56a | ||
|
|
37bc36ac42 | ||
|
|
a817560292 | ||
|
|
1f4236df3a | ||
|
|
7219196dba | ||
|
|
d6678a1b35 | ||
|
|
0626cc90a2 | ||
|
|
8af4f8e6c0 | ||
|
|
e5668602cc | ||
|
|
6783bd0df9 | ||
|
|
dc786b7641 | ||
|
|
3f9ce1c6cf | ||
|
|
44e79fc935 | ||
|
|
2fcb15afa0 | ||
|
|
1150adc4db | ||
|
|
47dcae9131 | ||
|
|
4b54ae9cd9 | ||
|
|
c5625ffedd | ||
|
|
45f2f94975 | ||
|
|
cec808bc19 | ||
|
|
95d82fdb66 | ||
|
|
73c5187177 | ||
|
|
ab0ff253f6 | ||
|
|
c228e993ad | ||
|
|
da18fe6851 | ||
|
|
4af1321588 | ||
|
|
cd76812402 | ||
|
|
ff35c02445 | ||
|
|
32f5e90737 | ||
|
|
d96f11bcd8 | ||
|
|
0738ad654d | ||
|
|
05e21a9e25 | ||
|
|
683286b3d7 | ||
|
|
740a60811c | ||
|
|
2838800832 | ||
|
|
ba3fe9e1ae | ||
|
|
45a7512dea | ||
|
|
81ada1101e | ||
|
|
48d0bc7556 | ||
|
|
cbde2571d4 | ||
|
|
d73c4d1562 | ||
|
|
20b31f5337 | ||
|
|
8e61708b45 | ||
|
|
3c148e9ef5 | ||
|
|
739102e06d | ||
|
|
f52f6b9519 | ||
|
|
b6654c85b2 | ||
|
|
e3609fed6b | ||
|
|
7324528984 | ||
|
|
0a2f2cc04d | ||
|
|
6422a5a479 | ||
|
|
113f9b8949 | ||
|
|
f828912a7f | ||
|
|
2522ad2029 | ||
|
|
50a9a7345f | ||
|
|
29ec69ffa0 | ||
|
|
6636144497 | ||
|
|
2a205569eb | ||
|
|
114f731483 | ||
|
|
4b8687ebca | ||
|
|
78f6c8f318 | ||
|
|
86bf33aa3b | ||
|
|
b64fcedd82 | ||
|
|
903793ac04 | ||
|
|
71a21a1044 | ||
|
|
1d7f0e4a7e | ||
|
|
ad2df97a64 | ||
|
|
fbeca0ed90 | ||
|
|
8c1ec94a3c | ||
|
|
5297baf285 | ||
|
|
5e2607d93f | ||
|
|
3d80a66e7b | ||
|
|
0980839568 | ||
|
|
4ab0bdd326 | ||
|
|
dbfcb6dca4 | ||
|
|
6208384bd4 | ||
|
|
225c408b02 | ||
|
|
71d9a2db9f | ||
|
|
233a817f05 | ||
|
|
c3e825027d | ||
|
|
3618414fad | ||
|
|
88cae16fca | ||
|
|
6d7f437b84 | ||
|
|
bb27d0efbf | ||
|
|
8a790ac7bf | ||
|
|
c9f2aa9ae0 | ||
|
|
1fc249bafd | ||
|
|
518d733369 | ||
|
|
0021384259 | ||
|
|
af3ebda710 | ||
|
|
6b663ec330 | ||
|
|
6b9625ecd5 | ||
|
|
3383046210 | ||
|
|
8f9e5ac70b | ||
|
|
23d7b0931d | ||
|
|
3ee6ab9d13 | ||
|
|
cd919c0039 | ||
|
|
3ac0dd5a80 | ||
|
|
e95c5f49aa | ||
|
|
ba11e0f1ad | ||
|
|
c45f0b8f64 | ||
|
|
bbee246aae | ||
|
|
3da600ac30 | ||
|
|
0d48ba9245 | ||
|
|
1993b9f68f | ||
|
|
bb3de8fa5e | ||
|
|
b3763a917a | ||
|
|
4bec20ec1a | ||
|
|
9f4e2b6834 | ||
|
|
619a7a854b | ||
|
|
3f79f795dc | ||
|
|
f084509520 | ||
|
|
214ecc1384 | ||
|
|
a96c420e14 | ||
|
|
bc9757916e | ||
|
|
c6fa4d2bf5 | ||
|
|
cbc4600333 | ||
|
|
32b097f67e | ||
|
|
04d110660e | ||
|
|
c0b866aac3 | ||
|
|
b4868c7ea7 | ||
|
|
d221139bd7 | ||
|
|
073e4d44be | ||
|
|
5bd9f16476 | ||
|
|
94ec9c38e7 | ||
|
|
bff55a54fa | ||
|
|
560024abe0 | ||
|
|
3ad297db5c | ||
|
|
5d7121d829 | ||
|
|
8b272d6e52 | ||
|
|
449bb88248 | ||
|
|
7036147860 | ||
|
|
a37e7e2939 | ||
|
|
c1aac2e279 | ||
|
|
543e8c917b | ||
|
|
2f133372bc | ||
|
|
539952f922 | ||
|
|
b5cc8fc336 | ||
|
|
1872af2d5e | ||
|
|
46b09b0d5b | ||
|
|
63f43f3b01 | ||
|
|
046a052f18 | ||
|
|
31409eaafb | ||
|
|
f431aee86e | ||
|
|
6a086b0c79 | ||
|
|
692db4dc29 | ||
|
|
417df69667 | ||
|
|
ae778bdb17 | ||
|
|
b7598ff0c5 | ||
|
|
312e95099d | ||
|
|
63369f98ef | ||
|
|
2116dd281b | ||
|
|
7ec499c19f | ||
|
|
33b86476b6 | ||
|
|
4f36a63813 | ||
|
|
d6479bbf0b | ||
|
|
d53d2189b9 | ||
|
|
a6a6aeab76 | ||
|
|
444e7f184d | ||
|
|
4c028b37bf | ||
|
|
9ff714cb6c | ||
|
|
e2bbed8acc | ||
|
|
6b4da27538 | ||
|
|
c284af58fa | ||
|
|
50aa05bd72 | ||
|
|
7e2d060f88 | ||
|
|
3a298c9759 | ||
|
|
d9ec600545 | ||
|
|
33f0964d53 | ||
|
|
92cb76e33a | ||
|
|
378dcb3878 | ||
|
|
6f0c50457f | ||
|
|
06548fe617 | ||
|
|
0118088e0a |
6
Makefile
6
Makefile
@@ -1,10 +1,10 @@
|
||||
.PHONY: all test dev
|
||||
.PHONY: build test dev
|
||||
|
||||
all:
|
||||
build:
|
||||
@ scripts/build
|
||||
|
||||
test:
|
||||
@ scripts/test
|
||||
|
||||
dev:
|
||||
@ echo "packages.yaml\nheuristics.yaml\nscripts/test\nscripts/build\nscripts/test_extensions.vim" | DEV=1 entr bash -c 'make && make test'
|
||||
@ find scripts autoload/polyglot ftdetect tests . -type f -maxdepth 1 | DEV=1 entr bash -c 'make'
|
||||
|
||||
436
README.md
436
README.md
@@ -1,30 +1,36 @@
|
||||

|
||||
This is my top-starred repository on Github, so I've decided to put this ad here:
|
||||
|
||||
 []()
|
||||
If you work for big corp and seek consulting, please visit following repository: https://github.com/sheerun/consultation
|
||||
|
||||
.
|
||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- Automatically detect indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth))
|
||||
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->598<!--/Package Count--> packages it consists of.
|
||||
- It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
|
||||
- Best syntax and indentation support (no other features). Hand-selected language packs.
|
||||
- Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled)
|
||||
|
||||
\*To be completely honest, optimized `ftdetect` script takes around `20ms` to load.
|
||||
\*To be completely honest, optimized `ftdetect` script takes around `10ms` to load.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim.
|
||||
2. Use this repository as submodule or package.
|
||||
|
||||
For example when using [Plug](https://github.com/junegunn/vim-plug):
|
||||
For example when using [Plug](https://github.com/junegunn/vim-plug) (which I recommend):
|
||||
|
||||
```vim
|
||||
set nocompatible
|
||||
|
||||
call plug#begin()
|
||||
|
||||
```
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
|
||||
@@ -32,216 +38,178 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
||||
You can also use Vim 8 built-in package manager:
|
||||
|
||||
```
|
||||
mkdir -p ~/.vim/pack/default/start
|
||||
git clone https://github.com/sheerun/vim-polyglot ~/.vim/pack/default/start/vim-polyglot
|
||||
git clone --depth 1 https://github.com/sheerun/vim-polyglot ~/.vim/pack/plugins/start/vim-polyglot
|
||||
```
|
||||
|
||||
NOTE: Not all features of individual language packs are available. We strip them from functionality slowing vim startup (for example we ignore `plugins` folder that is loaded regardless of file type, instead we prefer `ftplugin` which is loaded lazily).
|
||||
|
||||
If you need full functionality of any plugin, please use it directly with your plugin manager.
|
||||
|
||||
## Language packs
|
||||
|
||||
On top of all language packs from [vim repository](https://github.com/vim/vim/tree/master/runtime/syntax), vim-polyglot includes:
|
||||
|
||||
<!--Language Packs-->
|
||||
- [8th](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [a2ps](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [a65](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [aap](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [abap](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [abaqus](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [abc](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [abel](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [acedb](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl)
|
||||
- [ada](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [ahdl](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [aidl](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [alsaconf](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [aml](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [ampl](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl) (Syntax highlighting for asl and dsl files)
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim)
|
||||
- [ant](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [apache](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim)
|
||||
- [applescript](https://github.com/mityu/vim-applescript)
|
||||
- [aptconf](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [arch](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [arduino](https://github.com/sudar/vim-arduino-syntax)
|
||||
- [art](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [asciidoc](https://github.com/asciidoc/vim-asciidoc)
|
||||
- [asn](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [aspperl](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [aspvbs](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [atlas](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [autohotkey](https://github.com/hnamikaw/vim-autohotkey)
|
||||
- [autoit](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [automake](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [ave](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [awk](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [basic](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [blade](https://github.com/jwalton512/vim-blade)
|
||||
- [apiblueprint](https://github.com/kylef/apiblueprint.vim) (API Blueprint syntax highlighting for apib files)
|
||||
- [applescript](https://github.com/mityu/vim-applescript) (AppleScript syntax highlighting for applescript and scpt files)
|
||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (Processing syntax highlighting for pde and ino files)
|
||||
- [asciidoc](https://github.com/asciidoc/vim-asciidoc) (AsciiDoc syntax highlighting for asciidoc, adoc and asc files)
|
||||
- [autohotkey](https://github.com/hnamikaw/vim-autohotkey) (AutoHotkey syntax highlighting for ahk and ahkl files)
|
||||
- [bicep](https://github.com/carlsmedstad/vim-bicep) (Syntax highlighting for bicep files)
|
||||
- [blade](https://github.com/jwalton512/vim-blade) (Blade syntax highlighting for blade and blade.php files)
|
||||
- [brewfile](https://github.com/bfontaine/Brewfile.vim)
|
||||
- [bzl](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (C++ and C syntax highlighting for cpp, c++, cc, cp, cxx and 18 more files)
|
||||
- [caddyfile](https://github.com/isobit/vim-caddyfile)
|
||||
- [carp](https://github.com/hellerve/carp-vim)
|
||||
- [carp](https://github.com/hellerve/carp-vim) (Syntax highlighting for carp files)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script)
|
||||
- [cql](https://github.com/elubow/cql-vim)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim)
|
||||
- [crystal](https://github.com/rhysd/vim-crystal)
|
||||
- [csv](https://github.com/chrisbra/csv.vim)
|
||||
- [cucumber](https://github.com/tpope/vim-cucumber)
|
||||
- [cue](https://github.com/mgrabovsky/vim-cuesheet)
|
||||
- [dart](https://github.com/dart-lang/dart-vim-plugin)
|
||||
- [dhall](https://github.com/vmchale/dhall-vim)
|
||||
- [dlang](https://github.com/JesseKPhillips/d.vim)
|
||||
- [dockerfile](https://github.com/ekalinin/Dockerfile.vim)
|
||||
- [dosini](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [elf](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [elixir](https://github.com/elixir-lang/vim-elixir)
|
||||
- [elm](https://github.com/andys8/vim-elm-syntax)
|
||||
- [emberscript](https://github.com/yalesov/vim-ember-script)
|
||||
- [emblem](https://github.com/yalesov/vim-emblem)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime)
|
||||
- [fennel](https://github.com/bakpakin/fennel.vim)
|
||||
- [ferm](https://github.com/vim-scripts/ferm.vim)
|
||||
- [fish](https://github.com/georgewitteman/vim-fish)
|
||||
- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers)
|
||||
- [forth](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [fsharp](https://github.com/ionide/Ionide-vim)
|
||||
- [gdscript](https://github.com/calviken/vim-gdscript3)
|
||||
- [git](https://github.com/tpope/vim-git)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl)
|
||||
- [gmpl](https://github.com/maelvalais/gmpl.vim)
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting)
|
||||
- [go](https://github.com/fatih/vim-go)
|
||||
- [clojure](https://github.com/clojure-vim/clojure.vim) (Clojure syntax highlighting for clj, bb, boot, cl2, cljc and 6 more files)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (CMake syntax highlighting for cmake and cmake.in files)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (CoffeeScript and Literate CoffeeScript syntax highlighting for coffee, cake, cjsx, iced, coffeekup, cson, litcoffee and coffee.md files)
|
||||
- [cpp-modern](https://github.com/bfrg/vim-cpp-modern)
|
||||
- [cql](https://github.com/elubow/cql-vim) (Syntax highlighting for cql files)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (Syntax highlighting for cry, cyl, lcry and lcyl files)
|
||||
- [crystal](https://github.com/rhysd/vim-crystal) (Crystal and HTML+ECR syntax highlighting for cr and ecr files)
|
||||
- [csv](https://github.com/chrisbra/csv.vim) (CSV syntax highlighting for csv, tsv and tab files)
|
||||
- [cucumber](https://github.com/tpope/vim-cucumber) (Gherkin syntax highlighting for feature and story files)
|
||||
- [cue](https://github.com/mgrabovsky/vim-cuesheet) (Syntax highlighting for cue files)
|
||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (Dart syntax highlighting for dart and drt files)
|
||||
- [dhall](https://github.com/vmchale/dhall-vim) (Dhall syntax highlighting for dhall files)
|
||||
- [dlang](https://github.com/JesseKPhillips/d.vim) (D syntax highlighting for d, di, lst, dd, ddoc and sdl files)
|
||||
- [docker-compose](https://github.com/ekalinin/Dockerfile.vim)
|
||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (Elixir and HTML+EEX syntax highlighting for ex, exs, eex, html.heex, html.leex and leex files)
|
||||
- [elm](https://github.com/andys8/vim-elm-syntax) (Elm syntax highlighting for elm files)
|
||||
- [emberscript](https://github.com/yalesov/vim-ember-script) (EmberScript syntax highlighting for em and emberscript files)
|
||||
- [emblem](https://github.com/yalesov/vim-emblem) (Syntax highlighting for emblem and em files)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (Erlang syntax highlighting for erl, app.src, es, escript, hrl, xrl, yrl, app and yaws files)
|
||||
- [fennel](https://github.com/bakpakin/fennel.vim) (Syntax highlighting for fnl files)
|
||||
- [ferm](https://github.com/vim-scripts/ferm.vim) (Syntax highlighting for ferm files)
|
||||
- [fish](https://github.com/blankname/vim-fish) (fish syntax highlighting for fish files)
|
||||
- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers) (Syntax highlighting for fbs files)
|
||||
- [fsharp](https://github.com/ionide/Ionide-vim) (F# syntax highlighting for fs, fsi and fsx files)
|
||||
- [git](https://github.com/tpope/vim-git) (Git Config syntax highlighting for gitconfig files)
|
||||
- [gitignore](https://github.com/SirJson/fzf-gitignore)
|
||||
- [gleam](https://github.com/gleam-lang/gleam.vim) (Syntax highlighting for gleam files)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (GLSL syntax highlighting for glsl, fp, frag, frg, fs and 18 more files)
|
||||
- [gmpl](https://github.com/maelvalais/gmpl.vim) (Syntax highlighting for mod files)
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (Gnuplot syntax highlighting for gp, gnu, gnuplot, p, plot, plt and gpi files)
|
||||
- [go](https://github.com/fatih/vim-go) (Go syntax highlighting for go and tmpl files)
|
||||
- [gradle](https://github.com/tfnico/vim-gradle)
|
||||
- [graphql](https://github.com/jparise/vim-graphql)
|
||||
- [groovy](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [grub](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [haml](https://github.com/sheerun/vim-haml)
|
||||
- [handlebars](https://github.com/sheerun/vim-mustache-handlebars)
|
||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim)
|
||||
- [haxe](https://github.com/yaymukund/vim-haxe)
|
||||
- [hcl](https://github.com/b4b4r07/vim-hcl)
|
||||
- [graphql](https://github.com/jparise/vim-graphql) (GraphQL syntax highlighting for graphql, gql and graphqls files)
|
||||
- [haml](https://github.com/tpope/vim-haml) (Haml syntax highlighting for haml, haml.deface, hamlc and hamlbars files)
|
||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (Mustache and Handlebars syntax highlighting for mustache, hogan, hulk, hjs, handlebars, hbs, hdbs and hb files)
|
||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (HAProxy syntax highlighting)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (Haskell syntax highlighting for hs, hs-boot, hsc, bpk and hsig files)
|
||||
- [haxe](https://github.com/jdonaldson/vaxe) (Haxe and HXML syntax highlighting for hx, hxsl, hxml and hss files)
|
||||
- [helm](https://github.com/towolf/vim-helm)
|
||||
- [help](https://github.com/neovim/neovim/tree/master/runtime)
|
||||
- [hive](https://github.com/zebradil/hive.vim)
|
||||
- [hive](https://github.com/zebradil/hive.vim) (HiveQL syntax highlighting for q, hql and ql files)
|
||||
- [hjson](https://github.com/hjson/vim-hjson) (Syntax highlighting for hjson files)
|
||||
- [html5](https://github.com/othree/html5.vim)
|
||||
- [i3](https://github.com/mboughaba/i3config.vim)
|
||||
- [icalendar](https://github.com/chutzpah/icalendar.vim)
|
||||
- [idris2](https://github.com/edwinb/idris2-vim)
|
||||
- [idris](https://github.com/idris-hackers/idris-vim)
|
||||
- [ion](https://github.com/vmchale/ion-vim)
|
||||
- [icalendar](https://github.com/chutzpah/icalendar.vim) (Syntax highlighting for ics files)
|
||||
- [idris2](https://github.com/edwinb/idris2-vim) (Syntax highlighting for idr, ipkg and lidr files)
|
||||
- [idris](https://github.com/idris-hackers/idris-vim) (Idris syntax highlighting for idr and lidr files)
|
||||
- [ion](https://github.com/vmchale/ion-vim) (Syntax highlighting for ion files)
|
||||
- [javascript-sql](https://github.com/statico/vim-javascript-sql)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript)
|
||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax)
|
||||
- [jinja](https://github.com/lepture/vim-jinja)
|
||||
- [jq](https://github.com/vito-c/jq.vim)
|
||||
- [json5](https://github.com/GutenYe/json5.vim)
|
||||
- [json](https://github.com/elzr/vim-json)
|
||||
- [jsonnet](https://github.com/google/vim-jsonnet)
|
||||
- [jst](https://github.com/briancollins/vim-jst)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty)
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim)
|
||||
- [ledger](https://github.com/ledger/vim-ledger)
|
||||
- [less](https://github.com/groenewege/vim-less)
|
||||
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond)
|
||||
- [livescript](https://github.com/gkz/vim-ls)
|
||||
- [llvm](https://github.com/rhysd/vim-llvm)
|
||||
- [log](https://github.com/MTDL9/vim-log-highlighting)
|
||||
- [lua](https://github.com/tbastos/vim-lua)
|
||||
- [m4](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [mako](https://github.com/sophacles/vim-bundle-mako)
|
||||
- [markdown](https://github.com/plasticboy/vim-markdown)
|
||||
- [mathematica](https://github.com/voldikss/vim-mma)
|
||||
- [mdx](https://github.com/jxnblk/vim-mdx-js)
|
||||
- [meson](https://github.com/mesonbuild/meson/tree/master/data/syntax-highlighting/vim)
|
||||
- [moonscript](https://github.com/leafo/moonscript-vim)
|
||||
- [murphi](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [nginx](https://github.com/chr4/nginx.vim)
|
||||
- [nim](https://github.com/zah/nim.vim)
|
||||
- [nix](https://github.com/LnL7/vim-nix)
|
||||
- [objc](https://github.com/b4winckler/vim-objc)
|
||||
- [ocaml](https://github.com/rgrinberg/vim-ocaml)
|
||||
- [octave](https://github.com/McSinyx/vim-octave)
|
||||
- [odin](https://github.com/Tetralux/odin.vim)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl)
|
||||
- [perl](https://github.com/vim-perl/vim-perl)
|
||||
- [pgsql](https://github.com/lifepillar/pgsql.vim)
|
||||
- [php](https://github.com/StanAngeloff/php.vim)
|
||||
- [plantuml](https://github.com/aklt/plantuml-syntax)
|
||||
- [pony](https://github.com/jakwings/vim-pony)
|
||||
- [powershell](https://github.com/PProvost/vim-ps1)
|
||||
- [prolog](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [protobuf](https://github.com/uarun/vim-protobuf)
|
||||
- [pug](https://github.com/digitaltoad/vim-pug)
|
||||
- [puppet](https://github.com/rodjek/vim-puppet)
|
||||
- [purescript](https://github.com/purescript-contrib/purescript-vim)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript) (JavaScript syntax highlighting for js, bones, cjs, es, es6 and 20 more files)
|
||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (Syntax highlighting for jenkinsfile and Jenkinsfile files)
|
||||
- [jq](https://github.com/vito-c/jq.vim) (JSONiq syntax highlighting for jq files)
|
||||
- [json5](https://github.com/GutenYe/json5.vim) (JSON5 syntax highlighting for json5 files)
|
||||
- [json](https://github.com/elzr/vim-json) (JSON syntax highlighting for json, 4DForm, 4DProject, avsc, geojson and 15 more files)
|
||||
- [jsonc](https://github.com/neoclide/jsonc.vim) (Syntax highlighting for cjson and jsonc files)
|
||||
- [jsonnet](https://github.com/google/vim-jsonnet) (Jsonnet syntax highlighting for jsonnet and libsonnet files)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (EJS syntax highlighting for ejs, ect, ejs.t and jst files)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (Syntax highlighting for jsx files)
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (Julia syntax highlighting for jl files)
|
||||
- [just](https://github.com/NoahTheDuke/vim-just) (Syntax highlighting for just files)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim) (Kotlin syntax highlighting for kt, ktm and kts files)
|
||||
- [ledger](https://github.com/ledger/vim-ledger) (Syntax highlighting for ldg, ledger and journal files)
|
||||
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond/tree/main) (LilyPond syntax highlighting for ly and ily files)
|
||||
- [livescript](https://github.com/gkz/vim-ls) (LiveScript syntax highlighting for ls files)
|
||||
- [llvm](https://github.com/rhysd/vim-llvm) (LLVM syntax highlighting for ll and td files)
|
||||
- [log](https://github.com/MTDL9/vim-log-highlighting) (Syntax highlighting for log and LOG files)
|
||||
- [lua](https://github.com/tbastos/vim-lua) (Lua syntax highlighting for lua, fcgi, nse, p8, rbxs, rockspec and wlua files)
|
||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (Mako syntax highlighting for mako and mao files)
|
||||
- [markdown](https://github.com/plasticboy/vim-markdown) (Markdown syntax highlighting for md, livemd, markdown, mdown, mdwn and 6 more files)
|
||||
- [mathematica](https://github.com/voldikss/vim-mma) (Mathematica syntax highlighting for mathematica, cdf, m, ma, mt and 6 more files)
|
||||
- [mdx](https://github.com/jxnblk/vim-mdx-js) (Syntax highlighting for mdx files)
|
||||
- [mermaid](https://github.com/mracos/mermaid.vim/tree/main) (Syntax highlighting for mermaid, mm and mmd files)
|
||||
- [meson](https://github.com/mesonbuild/meson/tree/master/data/syntax-highlighting/vim) (Meson syntax highlighting for wrap files)
|
||||
- [mint](https://github.com/IrenejMarc/vim-mint) (Syntax highlighting for mint files)
|
||||
- [moonscript](https://github.com/leafo/moonscript-vim) (MoonScript syntax highlighting for moon files)
|
||||
- [nftables](https://github.com/nfnty/vim-nftables) (Syntax highlighting for nft files)
|
||||
- [nginx](https://github.com/chr4/nginx.vim) (Nginx syntax highlighting for nginx, nginxconf and vhost files)
|
||||
- [nim](https://github.com/zah/nim.vim) (Nim syntax highlighting for nim, nim.cfg, nimble, nimrod and nims files)
|
||||
- [nix](https://github.com/LnL7/vim-nix) (Nix syntax highlighting for nix files)
|
||||
- [objc](https://github.com/b4winckler/vim-objc) (Objective-C syntax highlighting for m and h files)
|
||||
- [ocaml](https://github.com/rgrinberg/vim-ocaml) (OCaml syntax highlighting for ml, eliom, eliomi, ml4, mli and 13 more files)
|
||||
- [octave](https://github.com/McSinyx/vim-octave) (Syntax highlighting for oct and m files)
|
||||
- [odin](https://github.com/Tetralux/odin.vim) (Odin syntax highlighting for odin files)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (OpenCL syntax highlighting for cl and opencl files)
|
||||
- [openscad](https://github.com/sirtaj/vim-openscad) (Syntax highlighting for scad files)
|
||||
- [org](https://github.com/axvr/org.vim) (Syntax highlighting for org files)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files)
|
||||
- [pest](https://github.com/pest-parser/pest.vim) (Syntax highlighting for pest files)
|
||||
- [pgsql](https://github.com/lifepillar/pgsql.vim) (PLpgSQL syntax highlighting for pgsql files)
|
||||
- [php](https://github.com/StanAngeloff/php.vim) (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 7 more files)
|
||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (PlantUML syntax highlighting for puml, iuml, plantuml, uml and pu files)
|
||||
- [pony](https://github.com/jakwings/vim-pony) (Pony syntax highlighting for pony files)
|
||||
- [powershell](https://github.com/PProvost/vim-ps1) (PowerShell syntax highlighting for ps1, psd1, psm1, pssc and ps1xml files)
|
||||
- [protobuf](https://github.com/uarun/vim-protobuf) (Protocol Buffer syntax highlighting for proto files)
|
||||
- [pug](https://github.com/digitaltoad/vim-pug) (Pug syntax highlighting for jade and pug files)
|
||||
- [puppet](https://github.com/rodjek/vim-puppet) (Puppet syntax highlighting for pp and epp files)
|
||||
- [purescript](https://github.com/purescript-contrib/purescript-vim) (PureScript syntax highlighting for purs files)
|
||||
- [python-compiler](https://github.com/aliev/vim-compiler-python)
|
||||
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent)
|
||||
- [python](https://github.com/vim-python/python-syntax)
|
||||
- [qmake](https://github.com/artoj/qmake-syntax-vim)
|
||||
- [qml](https://github.com/peterhoeg/vim-qml)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim)
|
||||
- [racket](https://github.com/wlangstroth/vim-racket)
|
||||
- [ragel](https://github.com/jneen/ragel.vim)
|
||||
- [raku](https://github.com/Raku/vim-raku)
|
||||
- [raml](https://github.com/IN3D/vim-raml)
|
||||
- [razor](https://github.com/adamclerk/vim-razor)
|
||||
- [reason](https://github.com/reasonml-editor/vim-reason-plus)
|
||||
- [requirements](https://github.com/raimon49/requirements.txt.vim)
|
||||
- [python](https://github.com/vim-python/python-syntax) (Python syntax highlighting for py, cgi, fcgi, gyp, gypi and 14 more files)
|
||||
- [qmake](https://github.com/artoj/qmake-syntax-vim) (QMake syntax highlighting for pro and pri files)
|
||||
- [qml](https://github.com/peterhoeg/vim-qml) (QML syntax highlighting for qml and qbs files)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (R syntax highlighting for r, rsx, s, S and rd files)
|
||||
- [racket](https://github.com/wlangstroth/vim-racket) (Racket syntax highlighting for rkt, rktd, rktl and scrbl files)
|
||||
- [ragel](https://github.com/jneen/ragel.vim) (Ragel syntax highlighting for rl files)
|
||||
- [raku](https://github.com/Raku/vim-raku) (Raku syntax highlighting for 6pl, 6pm, nqp, p6, p6l and 12 more files)
|
||||
- [raml](https://github.com/IN3D/vim-raml) (RAML syntax highlighting for raml files)
|
||||
- [razor](https://github.com/adamclerk/vim-razor) (HTML+Razor syntax highlighting for cshtml and razor files)
|
||||
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (Reason syntax highlighting for re and rei files)
|
||||
- [requirements](https://github.com/raimon49/requirements.txt.vim) (Syntax highlighting for pip files)
|
||||
- [rspec](https://github.com/keith/rspec.vim)
|
||||
- [rst](https://github.com/marshallward/vim-restructuredtext)
|
||||
- [ruby](https://github.com/vim-ruby/vim-ruby)
|
||||
- [rust](https://github.com/rust-lang/rust.vim)
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala)
|
||||
- [scss](https://github.com/cakebaker/scss-syntax.vim)
|
||||
- [sh](https://github.com/arzg/vim-sh)
|
||||
- [slim](https://github.com/slim-template/vim-slim)
|
||||
- [slime](https://github.com/slime-lang/vim-slime-syntax)
|
||||
- [smt2](https://github.com/bohlender/vim-smt2)
|
||||
- [solidity](https://github.com/tomlion/vim-solidity)
|
||||
- [stylus](https://github.com/wavded/vim-stylus)
|
||||
- [svelte](https://github.com/evanleck/vim-svelte/tree/main)
|
||||
- [rst](https://github.com/marshallward/vim-restructuredtext) (reStructuredText syntax highlighting for rst, rest, rest.txt and rst.txt files)
|
||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (Ruby and HTML+ERB syntax highlighting for rb, builder, eye, fcgi, gemspec and 26 more files)
|
||||
- [rust](https://github.com/rust-lang/rust.vim) (Rust syntax highlighting for rs and rs.in files)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (Scala syntax highlighting for scala, kojo and sc files)
|
||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (SCSS syntax highlighting for scss files)
|
||||
- [sh](https://github.com/arzg/vim-sh) (Shell syntax highlighting for sh, bash, bats, cgi, command and 8 more files)
|
||||
- [slim](https://github.com/slim-template/vim-slim) (Slim syntax highlighting for slim files)
|
||||
- [slime](https://github.com/slime-lang/vim-slime-syntax) (Syntax highlighting for slime files)
|
||||
- [smt2](https://github.com/bohlender/vim-smt2) (SMT syntax highlighting for smt2 and smt files)
|
||||
- [solidity](https://github.com/TovarishFin/vim-solidity) (Solidity syntax highlighting for sol files)
|
||||
- [stylus](https://github.com/wavded/vim-stylus) (Stylus syntax highlighting for styl and stylus files)
|
||||
- [svelte](https://github.com/leafOfTree/vim-svelte-plugin) (Svelte syntax highlighting for svelte files)
|
||||
- [svg-indent](https://github.com/jasonshell/vim-svg-indent)
|
||||
- [svg](https://github.com/vim-scripts/svg.vim)
|
||||
- [swift](https://github.com/keith/swift.vim)
|
||||
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc)
|
||||
- [systemd](https://github.com/wgwoods/vim-systemd-syntax)
|
||||
- [tads](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [terraform](https://github.com/hashivim/vim-terraform)
|
||||
- [textile](https://github.com/timcharper/textile.vim)
|
||||
- [thrift](https://github.com/solarnz/thrift.vim)
|
||||
- [svg](https://github.com/vim-scripts/svg.vim) (SVG syntax highlighting for svg files)
|
||||
- [sway](https://github.com/jamespeapen/swayconfig.vim) (Syntax highlighting for swayconfig and sway.config files)
|
||||
- [swift](https://github.com/keith/swift.vim) (Swift syntax highlighting for swift files)
|
||||
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (Syntax highlighting for sxhkdrc files)
|
||||
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (Syntax highlighting for automount, dnssd, link, mount, netdev and 9 more files)
|
||||
- [terraform](https://github.com/hashivim/vim-terraform) (HCL syntax highlighting for tf, tfvars, hcl, nomad and workflow files)
|
||||
- [textile](https://github.com/timcharper/textile.vim) (Textile syntax highlighting for textile files)
|
||||
- [thrift](https://github.com/solarnz/thrift.vim) (Thrift syntax highlighting for thrift files)
|
||||
- [tmux](https://github.com/ericpruitt/tmux.vim/tree/master/vim)
|
||||
- [toml](https://github.com/cespare/vim-toml)
|
||||
- [tptp](https://github.com/c-cube/vim-tptp)
|
||||
- [trasys](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [twig](https://github.com/lumiliet/vim-twig)
|
||||
- [typescript](https://github.com/HerringtonDarkholme/yats.vim)
|
||||
- [unison](https://github.com/unisonweb/unison/tree/trunk/editor-support/vim)
|
||||
- [v](https://github.com/ollykel/v-vim)
|
||||
- [vala](https://github.com/arrufat/vala.vim)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim)
|
||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin)
|
||||
- [velocity](https://github.com/lepture/vim-velocity)
|
||||
- [visual-basic](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [vmasm](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [vue](https://github.com/posva/vim-vue)
|
||||
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax)
|
||||
- [xml](https://github.com/amadeus/vim-xml)
|
||||
- [xsl](https://github.com/vim-scripts/XSLT-syntax)
|
||||
- [yaml](https://github.com/vim/vim/tree/df44a27b53586fccfc6a3aedc89061fdd9a515ff/runtime)
|
||||
- [yard](https://github.com/sheerun/vim-yardoc)
|
||||
- [zephir](https://github.com/xwsoul/vim-zephir)
|
||||
- [zig](https://github.com/ziglang/zig.vim)
|
||||
- [zinit](https://github.com/zinit-zsh/zplugin-vim-syntax)
|
||||
- [toml](https://github.com/cespare/vim-toml/tree/main) (TOML syntax highlighting for toml files)
|
||||
- [tptp](https://github.com/c-cube/vim-tptp) (Syntax highlighting for p, tptp and ax files)
|
||||
- [twig](https://github.com/lumiliet/vim-twig) (Twig syntax highlighting for twig and xml.twig files)
|
||||
- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (TypeScript and TSX syntax highlighting for ts, cts, mts and tsx files)
|
||||
- [unison](https://github.com/unisonweb/unison/tree/trunk/editor-support/vim) (Syntax highlighting for u and uu files)
|
||||
- [v](https://github.com/ollykel/v-vim) (V syntax highlighting for v, vv and vsh files)
|
||||
- [vala](https://github.com/arrufat/vala.vim) (Vala syntax highlighting for vala, vapi and valadoc files)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (Visual Basic .NET syntax highlighting for vb and vbhtml files)
|
||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (VCL syntax highlighting for vcl files)
|
||||
- [velocity](https://github.com/lepture/vim-velocity) (Syntax highlighting for vm files)
|
||||
- [vue](https://github.com/posva/vim-vue) (Vue syntax highlighting for vue and wpy files)
|
||||
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax) (Syntax highlighting for xdc files)
|
||||
- [xml](https://github.com/amadeus/vim-xml) (XML syntax highlighting for xml, adml, admx, ant, axaml and 97 more files)
|
||||
- [xsl](https://github.com/vim-scripts/XSLT-syntax) (XSLT syntax highlighting for xslt and xsl files)
|
||||
- [yard](https://github.com/noprompt/vim-yardoc)
|
||||
- [zephir](https://github.com/xwsoul/vim-zephir) (Zephir syntax highlighting for zep files)
|
||||
- [zig](https://github.com/ziglang/zig.vim) (Zig syntax highlighting for zir, zig and zir files)
|
||||
- [zinit](https://github.com/zdharma-continuum/zinit-vim-syntax/tree/main)
|
||||
<!--/Language Packs-->
|
||||
|
||||
## Updating
|
||||
@@ -250,17 +218,27 @@ You can either wait for new patch release with updates or run `make` by yourself
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Please make sure you have `syntax on` in your `.vimrc` (or use something like [sheerun/vimrc](https://github.com/sheerun/vimrc))
|
||||
Please make sure you have `set nocompatible` in your `.vimrc` (or use something like [sheerun/vimrc](https://github.com/sheerun/vimrc))
|
||||
|
||||
Individual language packs can be disabled by setting `g:polyglot_disabled` as follows:
|
||||
|
||||
**Please declare this variable before polyglot is loaded (at the top of .vimrc)**
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['css']
|
||||
let g:polyglot_disabled = ['markdown']
|
||||
```
|
||||
|
||||
*Please declare this variable before polyglot is loaded (at the top of .vimrc)*
|
||||
The list of available languages to disable is shown above.
|
||||
|
||||
Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are loaded lazily, on demand.
|
||||
If you wish to use filetype detection by Vim Polyglot but you'd like to use your own syntax-highlighting plugin, you can append `.plugin` to disabled entry, like below. Disabling Vim Polyglot filetype plugin won't disable native Vim filetype plugin.
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['markdown.plugin']
|
||||
```
|
||||
|
||||
Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are lazily loaded only when they are really needed.
|
||||
|
||||
## Autoindent
|
||||
|
||||
Vim Polyglot tries to automatically detect indentation settings (just like vim-sleuth). If this feature is not working for you for some reason, please file an issue and disable it temporarily with:
|
||||
|
||||
@@ -268,6 +246,52 @@ Vim Polyglot tries to automatically detect indentation settings (just like vim-s
|
||||
let g:polyglot_disabled = ['autoindent']
|
||||
```
|
||||
|
||||
## Reindent
|
||||
|
||||
If you want to disable reindenting of the current line in insert mode (see vim 'indentkeys') you can turn it off with:
|
||||
|
||||
```vim
|
||||
autocmd BufEnter * set indentexpr=
|
||||
```
|
||||
|
||||
This will not affect smart autoindenting when starting a new line.
|
||||
|
||||
|
||||
## Default settings
|
||||
|
||||
Vim Polyglot sets defaults of some settings that are relevant for good language support. You can disable them by:
|
||||
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['sensible']
|
||||
```
|
||||
|
||||
These defaults include:
|
||||
- Use utf-8 encoding by default
|
||||
- Automatically reload file if changed somewhere else
|
||||
- Disable existing swapfile warnings, instead just create multiple swapfiles
|
||||
- Don't create swapfiles in current directory, instead in data directory
|
||||
- Whitespace characters when using `:set list`
|
||||
- Delete comment character when joining commented lines
|
||||
- Search upwards for tags file(s) instead only locally
|
||||
- Fix issues with fish shell
|
||||
- Increase history size to 1000 items
|
||||
- Allow for up to 50 opened tabs on Vim start.
|
||||
- Reduce updatetime from 4000 to 300 to avoid issues with coc.nvim
|
||||
- Always save upper case variables to viminfo file
|
||||
- Don't save options in sessions and views
|
||||
- Allow color schemes to do bright colors without forcing bold
|
||||
- Load vim's built-in matchit plugin
|
||||
|
||||
## No ftdetect
|
||||
|
||||
If you want to use vim-polyglot plugins, but not ftdetect autocommands, the you can disable it as so:
|
||||
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['ftdetect']
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Language packs are periodically updated using automated `scripts/build` script.
|
||||
|
||||
71
after/compiler/tex.vim
Normal file
71
after/compiler/tex.vim
Normal file
@@ -0,0 +1,71 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/compiler/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim compiler file
|
||||
" Compiler: TeX
|
||||
" Maintainer: Artem Chuprina <ran@ran.pp.ru>
|
||||
" Last Change: 2012 Apr 30
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
" If makefile exists and we are not asked to ignore it, we use standard make
|
||||
" (do not redefine makeprg)
|
||||
if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') ||
|
||||
\(!filereadable('Makefile') && !filereadable('makefile'))
|
||||
" If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
|
||||
" otherwise the same for global variable with same name, else it will be
|
||||
" LaTeX
|
||||
if exists("b:tex_flavor")
|
||||
let current_compiler = b:tex_flavor
|
||||
elseif exists("g:tex_flavor")
|
||||
let current_compiler = g:tex_flavor
|
||||
else
|
||||
let current_compiler = "latex"
|
||||
endif
|
||||
let &l:makeprg=current_compiler.' -interaction=nonstopmode'
|
||||
else
|
||||
let current_compiler = 'make'
|
||||
endif
|
||||
|
||||
" Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
|
||||
" addition from Srinath Avadhanula <srinath@fastmail.fm>
|
||||
CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
|
||||
\%E!\ %m,
|
||||
\%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
|
||||
\%+W%.%#\ at\ lines\ %l--%*\\d,
|
||||
\%WLaTeX\ %.%#Warning:\ %m,
|
||||
\%Cl.%l\ %m,
|
||||
\%+C\ \ %m.,
|
||||
\%+C%.%#-%.%#,
|
||||
\%+C%.%#[]%.%#,
|
||||
\%+C[]%.%#,
|
||||
\%+C%.%#%[{}\\]%.%#,
|
||||
\%+C<%.%#>%.%#,
|
||||
\%C\ \ %m,
|
||||
\%-GSee\ the\ LaTeX%m,
|
||||
\%-GType\ \ H\ <return>%m,
|
||||
\%-G\ ...%.%#,
|
||||
\%-G%.%#\ (C)\ %.%#,
|
||||
\%-G(see\ the\ transcript%.%#),
|
||||
\%-G\\s%#,
|
||||
\%+O(%*[^()])%r,
|
||||
\%+O%*[^()](%*[^()])%r,
|
||||
\%+P(%f%r,
|
||||
\%+P\ %\\=(%f%r,
|
||||
\%+P%*[^()](%f%r,
|
||||
\%+P[%\\d%[^()]%#(%f%r,
|
||||
\%+Q)%r,
|
||||
\%+Q%*[^()])%r,
|
||||
\%+Q[%\\d%*[^()])%r
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
@@ -1,7 +1,7 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'haskell', 'after/ftplugin/cabal.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal comments=s1fl:{-,mb:-,ex:-},:--
|
||||
setlocal iskeyword+=-,.,*
|
||||
setlocal commentstring=--\ %s
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cjsx', 'after/ftplugin/coffee.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'haskell', 'after/ftplugin/haskell.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
|
||||
setlocal iskeyword+='
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris', 'after/ftplugin/idris.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+='
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris2') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris2', 'after/ftplugin/idris2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+='
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript', 'after/ftplugin/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: JavaScript
|
||||
@@ -12,5 +14,3 @@ if exists('b:undo_ftplugin')
|
||||
else
|
||||
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/javascript-2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftplugin file
|
||||
@@ -13,7 +15,7 @@ if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') =
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||
\ '<\@<=\([A-z0-9.]\+\):\(</\)\@<=\1'
|
||||
endif
|
||||
|
||||
" For andymass/vim-matchup plugin
|
||||
@@ -31,5 +33,3 @@ augroup jsx_comment
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.jsx
|
||||
|
||||
endif
|
||||
|
||||
11
after/ftplugin/just.vim
Normal file
11
after/ftplugin/just.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'just', 'after/ftplugin/just.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim ftplugin file
|
||||
" Language: Justfile
|
||||
" Maintainer: Noah Bogart <noah.bogart@hey.com>
|
||||
" URL: https://github.com/NoahTheDuke/vim-just.git
|
||||
" Last Change: 2021 May 19
|
||||
|
||||
setlocal iskeyword+=-
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'after/ftplugin/llvm.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2018 rhysd
|
||||
"
|
||||
@@ -327,7 +329,7 @@ function! s:extract_identifier(word) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
if a:word[1] == '"'
|
||||
if a:word[1] ==# '"'
|
||||
let idx = stridx(a:word, '"', 2)
|
||||
if idx == -1
|
||||
return ''
|
||||
@@ -341,7 +343,7 @@ function! s:extract_identifier(word) abort
|
||||
endif
|
||||
|
||||
if prefix ==# '#'
|
||||
return matchstr(a:word, '^#\d\+')
|
||||
return matchstr(a:word, '^#\d\+\>')
|
||||
endif
|
||||
|
||||
return ''
|
||||
@@ -476,12 +478,16 @@ function! s:run_lli(...) abort
|
||||
let tmpfile = tempname()
|
||||
call writefile(getline(1, '$'), tmpfile)
|
||||
let Cleanup = {ch -> filereadable(tmpfile) ? delete(tmpfile) : 0}
|
||||
try
|
||||
let bufnr = term_start([g:llvm_ext_lli_executable, tmpfile], {'close_cb': Cleanup, 'exit_cb': Cleanup})
|
||||
echo 'Run lli in termnal buffer(' . bufnr . ')'
|
||||
catch
|
||||
if filereadable(tmpfile)
|
||||
delete(tmpfile)
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
if !exists(':LLI')
|
||||
command! -buffer -nargs=? -bar -complete=file LLI call <SID>run_lli(<f-args>)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'puppet', 'after/ftplugin/puppet.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:puppet_align_hashes')
|
||||
let g:puppet_align_hashes = 1
|
||||
@@ -7,5 +9,3 @@ endif
|
||||
if g:puppet_align_hashes
|
||||
inoremap <buffer> <silent> => =><Esc>:call puppet#align#AlignHashrockets()<CR>$a
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
50
after/ftplugin/tex.vim
Normal file
50
after/ftplugin/tex.vim
Normal file
@@ -0,0 +1,50 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/ftplugin/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" LaTeX filetype plugin
|
||||
" Language: LaTeX (ft=tex)
|
||||
" Maintainer: Benji Fisher, Ph.D. <benji@member.AMS.org>
|
||||
" Version: 1.4
|
||||
" Last Change: Wed 19 Apr 2006
|
||||
" URL: http://www.vim.org/script.php?script_id=411
|
||||
|
||||
" Only do this when not done yet for this buffer.
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Start with plain TeX. This will also define b:did_ftplugin .
|
||||
source $VIMRUNTIME/ftplugin/plaintex.vim
|
||||
|
||||
" Avoid problems if running in 'compatible' mode.
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:undo_ftplugin .= "| setl inex<"
|
||||
|
||||
" Allow "[d" to be used to find a macro definition:
|
||||
" Recognize plain TeX \def as well as LaTeX \newcommand and \renewcommand .
|
||||
" I may as well add the AMS-LaTeX DeclareMathOperator as well.
|
||||
let &l:define .= '\|\\\(re\)\=new\(boolean\|command\|counter\|environment\|font'
|
||||
\ . '\|if\|length\|savebox\|theorem\(style\)\=\)\s*\*\=\s*{\='
|
||||
\ . '\|DeclareMathOperator\s*{\=\s*'
|
||||
|
||||
" Tell Vim how to recognize LaTeX \include{foo} and plain \input bar :
|
||||
let &l:include .= '\|\\include{'
|
||||
" On some file systems, "{" and "}" are included in 'isfname'. In case the
|
||||
" TeX file has \include{fname} (LaTeX only), strip everything except "fname".
|
||||
let &l:includeexpr = "substitute(v:fname, '^.\\{-}{\\|}.*', '', 'g')"
|
||||
|
||||
" The following lines enable the macros/matchit.vim plugin for
|
||||
" extended matching with the % key.
|
||||
" ftplugin/plaintex.vim already defines b:match_skip and b:match_ignorecase
|
||||
" and matches \(, \), \[, \], \{, and \} .
|
||||
if exists("loaded_matchit")
|
||||
let b:match_words .= ',\\begin\s*\({\a\+\*\=}\):\\end\s*\1'
|
||||
endif " exists("loaded_matchit")
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:sts=2:sw=2:
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" modified from html.vim
|
||||
" For matchit plugin
|
||||
@@ -28,5 +30,3 @@ augroup jsx_comment
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.tsx
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
9
after/indent/javascript-1.vim
Normal file
9
after/indent/javascript-1.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
46
after/indent/javascript-2.vim
Normal file
46
after/indent/javascript-2.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/indent/javascript-2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('*GetJavascriptGraphQLIndent') && !empty(&indentexpr)
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/graphql.vim
|
||||
|
||||
" Set the indentexpr with our own version that will call GetGraphQLIndent when
|
||||
" we're inside of a GraphQL string and otherwise defer to the base function.
|
||||
let b:indentexpr_base = &indentexpr
|
||||
setlocal indentexpr=GetJavascriptGraphQLIndent()
|
||||
|
||||
function GetJavascriptGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0, '') ==# 'graphqlTemplateString'
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
@@ -1,9 +1,3 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
" Polyglot metafile
|
||||
source <sfile>:h/javascript-1.vim
|
||||
source <sfile>:h/javascript-2.vim
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
@@ -29,5 +31,3 @@ endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'objc', 'after/indent/objc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim indent file
|
||||
" Language: Objective-C
|
||||
@@ -93,5 +95,3 @@ endfunction
|
||||
" Restore 'cpo' options
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
endif
|
||||
|
||||
46
after/indent/php.vim
Normal file
46
after/indent/php.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/indent/php.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('*GetPHPGraphQLIndent') && !empty(&indentexpr)
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/graphql.vim
|
||||
|
||||
" Set the indentexpr with our own version that will call GetGraphQLIndent when
|
||||
" we're inside of a GraphQL string and otherwise defer to the base function.
|
||||
let b:indentexpr_base = &indentexpr
|
||||
setlocal indentexpr=GetPHPGraphQLIndent()
|
||||
|
||||
function GetPHPGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0, '') ==# 'phpRegion' && count(l:stack, 'graphqlFold') > 0
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
427
after/indent/tex.vim
Normal file
427
after/indent/tex.vim
Normal file
@@ -0,0 +1,427 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/indent/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim indent file
|
||||
" Language: LaTeX
|
||||
" Maintainer: Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" Created: Sat, 16 Feb 2002 16:50:19 +0100
|
||||
" Version: 1.0.0
|
||||
" Please email me if you found something I can do. Comments, bug report and
|
||||
" feature request are welcome.
|
||||
|
||||
" Last Update: {{{
|
||||
" 25th Sep 2002, by LH :
|
||||
" (*) better support for the option
|
||||
" (*) use some regex instead of several '||'.
|
||||
" Oct 9th, 2003, by JT:
|
||||
" (*) don't change indentation of lines starting with '%'
|
||||
" 2005/06/15, Moshe Kaminsky <kaminsky AT math.huji.ac.il>
|
||||
" (*) New variables:
|
||||
" g:tex_items, g:tex_itemize_env, g:tex_noindent_env
|
||||
" 2011/3/6, by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Don't change indentation of lines starting with '%'
|
||||
" I don't see any code with '%' and it doesn't work properly
|
||||
" so I add some code.
|
||||
" (*) New features: Add smartindent-like indent for "{}" and "[]".
|
||||
" (*) New variables: g:tex_indent_brace
|
||||
" 2011/9/25, by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Bug fix: smartindent-like indent for "[]"
|
||||
" (*) New features: Align with "&".
|
||||
" (*) New variable: g:tex_indent_and.
|
||||
" 2011/10/23 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Bug fix: improve the smartindent-like indent for "{}" and
|
||||
" "[]".
|
||||
" 2012/02/27 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Bug fix: support default folding marker.
|
||||
" (*) Indent with "&" is not very handy. Make it not enable by
|
||||
" default.
|
||||
" 2012/03/06 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Modify "&" behavior and make it default again. Now "&"
|
||||
" won't align when there are more then one "&" in the previous
|
||||
" line.
|
||||
" (*) Add indent "\left(" and "\right)"
|
||||
" (*) Trust user when in "verbatim" and "lstlisting"
|
||||
" 2012/03/11 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Modify "&" so that only indent when current line start with
|
||||
" "&".
|
||||
" 2012/03/12 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Modify indentkeys.
|
||||
" 2012/03/18 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Add &cpo
|
||||
" 2013/05/02 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
|
||||
" for reporting this.
|
||||
" 2014/06/23 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Remove the feature g:tex_indent_and because it is buggy.
|
||||
" (*) If there is not any obvious indentation hints, we do not
|
||||
" alert our user's current indentation.
|
||||
" (*) g:tex_indent_brace now only works if the open brace is the
|
||||
" last character of that line.
|
||||
" 2014/08/03 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Indent current line if last line has larger indentation
|
||||
" 2016/11/08 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Fix problems for \[ and \]. Thanks Bruno for reporting.
|
||||
" 2017/04/30 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Fix a bug between g:tex_noindent_env and g:tex_indent_items
|
||||
" Now g:tex_noindent_env='document\|verbatim\|itemize' (Emacs
|
||||
" style) is supported. Thanks Miles Wheeler for reporting.
|
||||
" 2018/02/07 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Make indentation more smart in the normal mode
|
||||
" 2020/04/26 by Yichao Zhou <broken.zhou AT gmail.com>
|
||||
" (*) Fix a bug related to \[ & \]. Thanks Manuel Boni for
|
||||
" reporting.
|
||||
"
|
||||
" }}}
|
||||
|
||||
" Document: {{{
|
||||
"
|
||||
" For proper latex experience, please put
|
||||
" let g:tex_flavor = "latex"
|
||||
" into your vimrc.
|
||||
"
|
||||
" * g:tex_indent_brace
|
||||
"
|
||||
" If this variable is unset or non-zero, it will use smartindent-like style
|
||||
" for "{}" and "[]". Now this only works if the open brace is the last
|
||||
" character of that line.
|
||||
"
|
||||
" % Example 1
|
||||
" \usetikzlibrary{
|
||||
" external
|
||||
" }
|
||||
"
|
||||
" % Example 2
|
||||
" \tikzexternalize[
|
||||
" prefix=tikz]
|
||||
"
|
||||
" * g:tex_indent_items
|
||||
"
|
||||
" If this variable is set, item-environments are indented like Emacs does
|
||||
" it, i.e., continuation lines are indented with a shiftwidth.
|
||||
"
|
||||
" set unset
|
||||
" ------------------------------------------------------
|
||||
" \begin{itemize} \begin{itemize}
|
||||
" \item blablabla \item blablabla
|
||||
" bla bla bla bla bla bla
|
||||
" \item blablabla \item blablabla
|
||||
" bla bla bla bla bla bla
|
||||
" \end{itemize} \end{itemize}
|
||||
"
|
||||
"
|
||||
" * g:tex_items
|
||||
"
|
||||
" A list of tokens to be considered as commands for the beginning of an item
|
||||
" command. The tokens should be separated with '\|'. The initial '\' should
|
||||
" be escaped. The default is '\\bibitem\|\\item'.
|
||||
"
|
||||
" * g:tex_itemize_env
|
||||
"
|
||||
" A list of environment names, separated with '\|', where the items (item
|
||||
" commands matching g:tex_items) may appear. The default is
|
||||
" 'itemize\|description\|enumerate\|thebibliography'.
|
||||
"
|
||||
" * g:tex_noindent_env
|
||||
"
|
||||
" A list of environment names. separated with '\|', where no indentation is
|
||||
" required. The default is 'document\|verbatim'.
|
||||
" }}}
|
||||
|
||||
" Only define the function once
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Define global variable {{{
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
if !exists("g:tex_indent_items")
|
||||
let g:tex_indent_items = 1
|
||||
endif
|
||||
if !exists("g:tex_indent_brace")
|
||||
let g:tex_indent_brace = 1
|
||||
endif
|
||||
if !exists("g:tex_max_scan_line")
|
||||
let g:tex_max_scan_line = 60
|
||||
endif
|
||||
if g:tex_indent_items
|
||||
if !exists("g:tex_itemize_env")
|
||||
let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography'
|
||||
endif
|
||||
if !exists('g:tex_items')
|
||||
let g:tex_items = '\\bibitem\|\\item'
|
||||
endif
|
||||
else
|
||||
let g:tex_items = ''
|
||||
endif
|
||||
|
||||
if !exists("g:tex_noindent_env")
|
||||
let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
|
||||
endif "}}}
|
||||
|
||||
" VIM Setting " {{{
|
||||
setlocal autoindent
|
||||
setlocal nosmartindent
|
||||
setlocal indentexpr=GetTeXIndent()
|
||||
setlocal indentkeys&
|
||||
exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
|
||||
let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
|
||||
" }}}
|
||||
|
||||
function! GetTeXIndent() " {{{
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
let cnum = v:lnum
|
||||
|
||||
" Comment line is not what we need.
|
||||
while lnum != 0 && getline(lnum) =~ '^\s*%'
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
endwhile
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
|
||||
let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
|
||||
|
||||
let ccol = 1
|
||||
while cline[ccol] =~ '\s'
|
||||
let ccol += 1
|
||||
endwhile
|
||||
|
||||
" We are in verbatim, so do what our user what.
|
||||
if synIDattr(synID(v:lnum, ccol, 1), "name") == "texZone"
|
||||
if empty(cline)
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(v:lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let stay = 1
|
||||
|
||||
" New code for comment: retain the indent of current line
|
||||
if cline =~ '^\s*%'
|
||||
return indent(v:lnum)
|
||||
endif
|
||||
|
||||
" Add a 'shiftwidth' after beginning of environments.
|
||||
" Don't add it for \begin{document} and \begin{verbatim}
|
||||
" if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim'
|
||||
" LH modification : \begin does not always start a line
|
||||
" ZYC modification : \end after \begin won't cause wrong indent anymore
|
||||
if line =~ '\\begin{.*}'
|
||||
if line !~ g:tex_noindent_env
|
||||
let ind = ind + shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if g:tex_indent_items
|
||||
" Add another sw for item-environments
|
||||
if line =~ g:tex_itemize_env
|
||||
let ind = ind + shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if cline =~ '\\end{.*}'
|
||||
let retn = s:GetEndIndentation(v:lnum)
|
||||
if retn != -1
|
||||
return retn
|
||||
endif
|
||||
end
|
||||
" Subtract a 'shiftwidth' when an environment ends
|
||||
if cline =~ '\\end{.*}'
|
||||
\ && cline !~ g:tex_noindent_env
|
||||
\ && cline !~ '\\begin{.*}.*\\end{.*}'
|
||||
if g:tex_indent_items
|
||||
" Remove another sw for item-environments
|
||||
if cline =~ g:tex_itemize_env
|
||||
let ind = ind - shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let ind = ind - shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if g:tex_indent_brace
|
||||
if line =~ '[[{]$'
|
||||
let ind += shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, ccol)
|
||||
let ind -= shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if line !~ '^\s*\\\?[\]}]'
|
||||
for i in range(1, strlen(line)-1)
|
||||
let char = line[i]
|
||||
if char == ']' || char == '}'
|
||||
if s:CheckPairedIsLastCharacter(lnum, i)
|
||||
let ind -= shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endif
|
||||
|
||||
" Special treatment for 'item'
|
||||
" ----------------------------
|
||||
|
||||
if g:tex_indent_items
|
||||
" '\item' or '\bibitem' itself:
|
||||
if cline =~ g:tex_items
|
||||
let ind = ind - shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
" lines following to '\item' are indented once again:
|
||||
if line =~ g:tex_items
|
||||
let ind = ind + shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
if stay && mode() == 'i'
|
||||
" If there is no obvious indentation hint, and indentation is triggered
|
||||
" in insert mode, we trust our user.
|
||||
if empty(cline)
|
||||
return ind
|
||||
else
|
||||
return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)])
|
||||
endif
|
||||
else
|
||||
return ind
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:GetLastBeginIndentation(lnum) " {{{
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
if line =~ g:tex_noindent_env
|
||||
return indent(lnum)
|
||||
endif
|
||||
if line =~ g:tex_itemize_env
|
||||
return indent(lnum) + 2 * shiftwidth()
|
||||
endif
|
||||
return indent(lnum) + shiftwidth()
|
||||
endif
|
||||
endfor
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:GetEndIndentation(lnum) " {{{
|
||||
if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}'
|
||||
return -1
|
||||
endif
|
||||
|
||||
let min_indent = 100
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
return indent(lnum)
|
||||
endif
|
||||
if !empty(line)
|
||||
let min_indent = min([min_indent, indent(lnum)])
|
||||
endif
|
||||
endfor
|
||||
return min_indent - shiftwidth()
|
||||
endfunction
|
||||
|
||||
" Most of the code is from matchparen.vim
|
||||
function! s:CheckPairedIsLastCharacter(lnum, col) "{{{
|
||||
let c_lnum = a:lnum
|
||||
let c_col = a:col+1
|
||||
|
||||
let line = getline(c_lnum)
|
||||
if line[c_col-1] == '\'
|
||||
let c_col = c_col + 1
|
||||
endif
|
||||
let c = line[c_col-1]
|
||||
|
||||
let plist = split(&matchpairs, '.\zs[:,]')
|
||||
let i = index(plist, c)
|
||||
if i < 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Figure out the arguments for searchpairpos().
|
||||
if i % 2 == 0
|
||||
let s_flags = 'nW'
|
||||
let c2 = plist[i + 1]
|
||||
else
|
||||
let s_flags = 'nbW'
|
||||
let c2 = c
|
||||
let c = plist[i - 1]
|
||||
endif
|
||||
if c == '['
|
||||
let c = '\['
|
||||
let c2 = '\]'
|
||||
endif
|
||||
|
||||
" Find the match. When it was just before the cursor move it there for a
|
||||
" moment.
|
||||
let save_cursor = winsaveview()
|
||||
call cursor(c_lnum, c_col)
|
||||
|
||||
" When not in a string or comment ignore matches inside them.
|
||||
" We match "escape" for special items, such as lispEscapeSpecial.
|
||||
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
|
||||
execute 'if' s_skip '| let s_skip = 0 | endif'
|
||||
|
||||
let stopline = max([0, c_lnum - g:tex_max_scan_line])
|
||||
|
||||
" Limit the search time to 300 msec to avoid a hang on very long lines.
|
||||
" This fails when a timeout is not supported.
|
||||
try
|
||||
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100)
|
||||
catch /E118/
|
||||
endtry
|
||||
|
||||
call winrestview(save_cursor)
|
||||
|
||||
if m_lnum > 0
|
||||
let line = getline(m_lnum)
|
||||
return strlen(line) == m_col
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: set sw=4 textwidth=80:
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
@@ -36,5 +38,3 @@ endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
|
||||
46
after/indent/typescript.vim
Normal file
46
after/indent/typescript.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/indent/typescript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('*GetTypescriptGraphQLIndent') && !empty(&indentexpr)
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/graphql.vim
|
||||
|
||||
" Set the indentexpr with our own version that will call GetGraphQLIndent when
|
||||
" we're inside of a GraphQL string and otherwise defer to the base function.
|
||||
let b:indentexpr_base = &indentexpr
|
||||
setlocal indentexpr=GetTypescriptGraphQLIndent()
|
||||
|
||||
function GetTypescriptGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0, '') ==# 'graphqlTemplateString'
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
66
after/syntax/c.vim
Normal file
66
after/syntax/c.vim
Normal file
@@ -0,0 +1,66 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cpp-modern', 'after/syntax/c.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Vim syntax file
|
||||
" Language: C Additions
|
||||
" Original Author: Mikhail Wolfson <mywolfson@gmail.com>
|
||||
" Maintainer: bfrg <https://github.com/bfrg>
|
||||
" Website: https://github.com/bfrg/vim-cpp-modern
|
||||
" Last Change: Jul 24, 2021
|
||||
"
|
||||
" This syntax file is based on:
|
||||
" https://github.com/octol/vim-cpp-enhanced-highlight
|
||||
" ==============================================================================
|
||||
|
||||
|
||||
" Highlight additional keywords in the comments
|
||||
syn keyword cTodo contained BUG NOTE
|
||||
|
||||
|
||||
" Highlight function names
|
||||
if get(g:, 'cpp_function_highlight', 1)
|
||||
syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cParen,cCppParen
|
||||
hi def link cUserFunction Function
|
||||
endif
|
||||
|
||||
|
||||
" Highlight struct/class member variables
|
||||
if get(g:, 'cpp_member_highlight', 0)
|
||||
syn match cMemberAccess "\.\|->" nextgroup=cStructMember,cppTemplateKeyword
|
||||
syn match cStructMember "\<\h\w*\>\%((\|<\)\@!" contained
|
||||
syn cluster cParenGroup add=cStructMember
|
||||
syn cluster cPreProcGroup add=cStructMember
|
||||
syn cluster cMultiGroup add=cStructMember
|
||||
hi def link cStructMember Identifier
|
||||
|
||||
if &filetype ==# 'cpp'
|
||||
syn keyword cppTemplateKeyword template
|
||||
hi def link cppTemplateKeyword cppStructure
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
" Common ANSI-standard Names
|
||||
syn keyword cAnsiName
|
||||
\ PRId8 PRIi16 PRIo32 PRIu64 PRId16 PRIi32 PRIo64 PRIuLEAST8 PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR PRIdFAST64 PRIiMAX PRIoPTR PRIx8 PRIdMAX PRIiPTR PRIu8 PRIx16 PRIdPTR PRIo8 PRIu16 PRIx32 PRIi8 PRIo16 PRIu32 PRIx64 PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR PRIXMAX SCNiFAST8 SCNuLEAST8 PRIXPTR SCNiFAST16 SCNuLEAST16 STDC CX_LIMITED_RANGE STDC FENV_ACCESS STDC FP_CONTRACT
|
||||
\ errno environ and bitor not_eq xor and_eq compl or xor_eq bitand not or_eq
|
||||
|
||||
" Booleans
|
||||
syn keyword cBoolean true false TRUE FALSE
|
||||
|
||||
|
||||
" Default highlighting
|
||||
hi def link cBoolean Boolean
|
||||
hi def link cAnsiName Identifier
|
||||
|
||||
|
||||
" Highlight all standard C keywords as Statement
|
||||
" This is very similar to what other IDEs and editors do
|
||||
if get(g:, 'cpp_simple_highlight', 0)
|
||||
hi! def link cStorageClass Statement
|
||||
hi! def link cStructure Statement
|
||||
hi! def link cTypedef Statement
|
||||
hi! def link cLabel Statement
|
||||
endif
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cjsx') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cjsx', 'after/syntax/coffee.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax=b:current_syntax
|
||||
@@ -27,5 +29,3 @@ hi def link cjsxTagName Function
|
||||
hi def link cjsxEntity Statement
|
||||
hi def link cjsxEntityPunct Type
|
||||
hi def link cjsxAttribProperty Type
|
||||
|
||||
endif
|
||||
|
||||
223
after/syntax/cpp.vim
Normal file
223
after/syntax/cpp.vim
Normal file
@@ -0,0 +1,223 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cpp-modern', 'after/syntax/cpp.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Vim syntax file
|
||||
" Language: C++ (Standard library including C++11/14/17/20)
|
||||
" Original Author: Jon Haggblad <https://github.com/octol>
|
||||
" Maintainer: bfrg <https://github.com/bfrg>
|
||||
" Website: https://github.com/bfrg/vim-cpp-modern
|
||||
" Last Change: Sep 15, 2022
|
||||
"
|
||||
" This syntax file is based on:
|
||||
" https://github.com/octol/vim-cpp-enhanced-highlight
|
||||
" ==============================================================================
|
||||
|
||||
" C++ attributes {{{1
|
||||
if get(g:, 'cpp_attributes_highlight', 0)
|
||||
syntax region cppAttribute matchgroup=cppAttributeBrackets start='\[\[' end=']]' contains=cString
|
||||
hi def link cppAttribute Macro
|
||||
hi def link cppAttributeBrackets Identifier
|
||||
endif
|
||||
|
||||
|
||||
" Standard library {{{1
|
||||
syntax keyword cppSTLdefine
|
||||
\ MB_CUR_MAX MB_LEN_MAX WCHAR_MAX WCHAR_MIN WEOF __STDC_UTF_16__ __STDC_UTF_32__
|
||||
|
||||
syntax keyword cppSTLnamespace
|
||||
\ std experimental rel_ops
|
||||
|
||||
syntax keyword cppSTLconstant
|
||||
\ badbit digits digits10 eofbit failbit goodbit has_denorm has_denorm_loss has_infinity has_quiet_NaN has_signaling_NaN is_bounded is_exact is_iec559 is_integer is_modulo is_signed is_specialized max_exponent max_exponent10 min_exponent min_exponent10 npos radix round_style tinyness_before traps
|
||||
|
||||
syntax keyword cppSTLvariable
|
||||
\ cerr cin clog cout wcerr wcin wclog wcout nothrow
|
||||
|
||||
syntax keyword cppSTLexception
|
||||
\ bad_alloc bad_exception bad_typeid bad_cast domain_error exception failure invalid_argument length_error logic_error out_of_range overflow_error range_error runtime_error underflow_error
|
||||
|
||||
syntax keyword cppSTLios
|
||||
\ endl ends flush resetiosflags setbase setfill setiosflags setprecision setw ws
|
||||
|
||||
syntax keyword cppSTLios
|
||||
\ boolalpha dec defaultfloat fixed hex hexfloat internal left noboolalpha noshowbase noshowpoint noshowpos noskipws nounitbuf nouppercase oct right scientific showbase showpoint showpos skipws unitbuf uppercase
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ fmtflags iostate openmode Init allocator auto_ptr basic_filebuf basic_fstream basic_ifstream basic_ios basic_iostream basic_istream basic_istringstream basic_ofstream basic_ostream basic_ostringstream basic_streambuf basic_string basic_stringbuf basic_stringstream binary_compose binder1st binder2nd bitset char_traits char_type const_mem_fun1_t const_mem_fun_ref1_t const_mem_fun_ref_t const_mem_fun_t const_pointer const_reference container_type deque difference_type div_t event_callback filebuf first_type float_denorm_style float_round_style fpos fstream gslice_array ifstream imaxdiv_t indirect_array int_type ios ios_base iostream istream istringstream istrstream iterator_category iterator_traits key_compare key_type ldiv_t list lldiv_t map mapped_type mask_array mbstate_t mem_fun1_t mem_fun_ref1_t mem_fun_ref_t mem_fun_t multimap multiset nothrow_t numeric_limits off_type ofstream ostream ostringstream ostrstream pair pointer pointer_to_binary_function pointer_to_unary_function pos_type priority_queue queue reference second_type seekdir sequence_buffer set size_type slice_array stack state_type stream streambuf streamoff streampos streamsize string stringbuf stringstream strstream strstreambuf temporary_buffer test_type tm traits_type type_info u16string u32string unary_compose unary_negate valarray value_compare value_type vector wfilebuf wfstream wifstream wios wiostream wistream wistringstream wofstream wostream wostringstream wstreambuf wstreampos wstring wstringbuf wstringstream codecvt codecvt_base codecvt_byname collate collate_byname ctype ctype_base ctype_byname locale messages messages_base messages_byname money_base money_get money_put moneypunct moneypunct_byname num_get num_put numpunct numpunct_byname time_base time_get time_get_byname time_put time_put_byname binary_function binary_negate bit_and bit_not bit_or divides equal_to greater greater_equal less less_equal logical_and logical_not logical_or minus modulus multiplies negate not_equal_to plus unary_function unary_negate bidirectional_iterator_tag forward_iterator_tag input_iterator_tag output_iterator_tag random_access_iterator_tag
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ time_t sig_atomic_t wctrans_t wctype_t wint_t
|
||||
|
||||
syntax keyword cppSTLiterator
|
||||
\ back_insert_iterator bidirectional_iterator const_iterator const_reverse_iterator forward_iterator front_insert_iterator input_iterator insert_iterator istream_iterator istreambuf_iterator iterator ostream_iterator ostreambuf_iterator output_iterator random_access_iterator raw_storage_iterator reverse_bidirectional_iterator reverse_iterator
|
||||
|
||||
" Function templates that are called with template parameters
|
||||
syntax keyword cppSTLfunction
|
||||
\ use_facet has_facet get
|
||||
|
||||
" Some of these keywords can be highlighted as cppSTLios or cppSTLconstant
|
||||
" syntax keyword cppSTLconstant
|
||||
" \ adjustfield app ate basefield binary floatfield in out trunc boolalpha dec fixed hex internal left oct right scientific showbase showpoint showpos skipws unitbuf uppercase
|
||||
|
||||
|
||||
" C++11 extensions {{{1
|
||||
if !exists('cpp_no_cpp11')
|
||||
syntax keyword cppStatement nullptr
|
||||
syntax keyword cppType char16_t char32_t
|
||||
|
||||
syntax keyword cppSTLnamespace chrono this_thread
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ array atomic atomic_bool atomic_char atomic_flag atomic_int atomic_llong atomic_long atomic_schar atomic_short atomic_uchar atomic_uint atomic_ullong atomic_ulong atomic_ushort duration duration_values high_resolution_clock hours microseconds milliseconds minutes nanoseconds seconds steady_clock system_clock time_point treat_as_floating_point condition_variable exception_ptr nested_exception hash is_bind_expression is_placeholder reference_wrapper forward_list future packaged_task promise shared_future initializer_list codecvt_mode codecvt_utf16 codecvt_utf8 codecvt_utf8_utf16 wbuffer_convert wstring_convert allocator_traits allocator_type default_delete enable_shared_from_this is_always_equal owner_less pointer_safety pointer_traits propagate_on_container_copy_assignment propagate_on_container_move_assignment propagate_on_container_swap rebind_alloc rebind_traits shared_ptr unique_ptr uses_allocator void_pointer const_void_pointer weak_ptr condition_variable_any lock_guard mutex once_flag recursive_mutex recursive_timed_mutex timed_mutex unique_lock bernoulli_distribution binomial_distribution cauchy_distribution chi_squared_distribution default_random_engine discard_block_engine discrete_distribution exponential_distribution extreme_value_distribution fisher_f_distribution gamma_distribution geometric_distribution independent_bits_engine knuth_b linear_congruential_engine lognormal_distribution mersenne_twister_engine minstd_rand minstd_rand0 mt19937 mt19937_64 negative_binomial_distribution normal_distribution piecewise_constant_distribution piecewise_linear_distribution poisson_distribution random_device ranlux24 ranlux24_base ranlux48 ranlux48_base seed_seq shuffle_order_engine student_t_distribution subtract_with_carry_engine uniform_int_distribution uniform_real_distribution weibull_distribution atto centi deca deci exa femto giga hecto kilo mega micro milli nano peta pico ratio ratio_add ratio_divide ratio_equal ratio_greater ratio_greater_equal ratio_less ratio_less_equal ratio_multiply ratio_not_equal ratio_subtract tera yocto yotta zepto zetta basic_regex regex wregex match_results regex_traits sub_match syntax_option_type match_flag_type error_type scoped_allocator_adaptor outer_allocator_type inner_allocator_type error_code error_condition error_category is_error_code_enum is_error_condition_enum thread tuple tuple_size tuple_element type_index add_const add_cv add_lvalue_reference add_pointer add_rvalue_reference add_volatile aligned_storage aligned_union alignment_of common_type conditional decay enable_if extent false_type has_virtual_destructor integral_constant is_abstract is_arithmetic is_array is_assignable is_base_of is_class is_compound is_const is_constructible is_convertible is_copy_assignable is_copy_constructible is_default_constructible is_destructible is_empty is_enum is_floating_point is_function is_fundamental is_integral is_literal_type is_lvalue_reference is_member_function_pointer is_member_object_pointer is_member_pointer is_move_assignable is_move_constructible is_nothrow_assignable is_nothrow_constructible is_nothrow_copy_assignable is_nothrow_copy_constructible is_nothrow_default_constructible is_nothrow_destructible is_nothrow_move_assignable is_nothrow_move_constructible is_object is_pod is_pointer is_polymorphic is_reference is_rvalue_reference is_same is_scalar is_signed is_standard_layout is_trivial is_trivially_assignable is_trivially_constructible is_trivially_copy_assignable is_trivially_copy_constructible is_trivially_copyable is_trivially_default_constructible is_trivially_destructible is_trivially_move_assignable is_trivially_move_constructible is_union is_unsigned is_void is_volatile make_signed make_unsigned rank remove_all_extents remove_const remove_cv remove_extent remove_pointer remove_reference remove_volatile result_of true_type underlying_type hasher key_equal unordered_map unordered_multimap unordered_multiset unordered_set function
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ atomic_char16_t atomic_char32_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_int_fast8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_int_least8_t atomic_intmax_t atomic_intptr_t atomic_ptrdiff_t atomic_size_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t atomic_uint_fast8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_uint_least8_t atomic_uintmax_t atomic_uintptr_t atomic_wchar_t nullptr_t max_align_t allocator_arg_t adopt_lock_t defer_lock_t try_to_lock_t piecewise_construct_t
|
||||
|
||||
syntax keyword cppSTLconstant max_digits10
|
||||
|
||||
syntax keyword cppSTLvariable
|
||||
\ _1 _2 _3 _4 _5 _6 _7 _8 _9 defer_lock try_to_lock adopt_lock allocator_arg
|
||||
|
||||
syntax keyword cppSTLdefine
|
||||
\ math_errhandling FLT_EVAL_METHOD FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO HUGE_VALF HUGE_VALL INFINITY MATH_ERREXCEPT MATH_ERRNO NAN
|
||||
|
||||
syntax keyword cppSTLenum
|
||||
\ memory_order future_status future_errc launch io_errc cv_status errc
|
||||
|
||||
syntax keyword cppSTLfunction
|
||||
\ duration_cast time_point_cast mem_fn const_pointer_cast dynamic_pointer_cast static_pointer_cast allocate_shared make_shared isblank generate_canonical forward_as_tuple make_tuple tie tuple_cat declval forward move move_if_noexcept
|
||||
|
||||
syntax keyword cppSTLexception
|
||||
\ bad_function_call future_error regex_error system_error bad_weak_ptr bad_array_new_length
|
||||
|
||||
syntax keyword cppSTLiterator
|
||||
\ move_iterator regex_iterator regex_token_iterator const_local_iterator local_iterator
|
||||
|
||||
" Note: ignore is also a function
|
||||
syntax match cppSTLvariable "\<ignore\>(\@!"
|
||||
endif
|
||||
|
||||
|
||||
" C++14 extensions {{{1
|
||||
if !exists('cpp_no_cpp14')
|
||||
syntax keyword cppSTLnamespace literals chrono_literals string_literals complex_literals
|
||||
|
||||
syntax keyword cppSTLfunction make_unique
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ index_sequence index_sequence_for integer_sequence make_index_sequence make_integer_sequence shared_lock shared_timed_mutex is_null_pointer
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ tuple_element_t add_const_t add_cv_t add_lvalue_reference_t add_pointer_t add_rvalue_reference_t add_volatile_t aligned_storage_t aligned_union_t common_type_t conditional_t decay_t enable_if_t make_signed_t make_unsigned_t remove_all_extents_t remove_const_t remove_cv_t remove_extent_t remove_pointer_t remove_reference_t remove_volatile_t result_of_t underlying_type_t
|
||||
endif
|
||||
|
||||
|
||||
" C++17 extensions {{{1
|
||||
if !exists('cpp_no_cpp17')
|
||||
syntax keyword cppSTLnamespace filesystem execution string_view_literals
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ any byte is_execution_policy parallel_policy parallel_unsequenced_policy sequenced_policy directory_entry directory_iterator file_status file_time_type path recursive_directory_iterator space_info default_order default_searcher boyer_moore_searcher boyer_moore_horspool_searcher memory_resource monotonic_buffer_resource polymorphic_allocator pool_options synchronized_pool_resource unsynchronized_pool_resource scoped_lock optional shared_mutex basic_string_view string_view u16string_view u32string_view wstring_view bool_constant conjunction disjunction has_unique_object_representations invoke_result is_aggregate is_callable is_invocable is_invocable_r is_nothrow_invocable is_nothrow_invocable_r is_nothrow_swappable is_nothrow_swappable_with is_nowthrow_callable is_swappable is_swappable_with negation node_type insert_return_type in_place_tag monostate variant variant_size variant_alternative from_chars_result to_chars_result chars_format
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ invoke_result_t default_order_t nullopt_t void_t in_place_t in_place_type_t in_place_index_t variant_alternative_t
|
||||
|
||||
syntax keyword cppSTLexception
|
||||
\ bad_any_cast filesystem_error bad_optional_access bad_variant_access
|
||||
|
||||
syntax keyword cppSTLconstant
|
||||
\ is_always_lock_free seq par par_unseq copy_symlinks auto_format create_hard_links create_symlinks directories_only follow_directory_symlink generic_format group_all group_exec group_read group_write native_format others_all others_exec others_read others_write overwrite_existing owner_all owner_exec owner_read owner_write preferred_separator recursive set_gid set_uid skip_existing skip_permission_denied skip_symlinks sticky_bit update_existing hardware_destructive_interference_size hardware_constructive_interference_size tuple_size_v nullopt alignment_of_v rank_v extent_v variant_npos variant_size_v
|
||||
|
||||
syntax keyword cppSTLbool
|
||||
\ treat_as_floating_point_v is_execution_policy_v is_bind_expression_v is_placeholder_v is_error_code_enum_v is_error_condition_enum_v uses_allocator_v conjunction_v disjunction_v has_unique_object_representations_v has_virtual_destructor_v is_abstract_v is_aggregate_v is_arithmetic_v is_array_v is_assignable_v is_base_of_v is_callable_v is_class_v is_compound_v is_const_v is_constructible_v is_convertible_v is_copy_assignable_v is_copy_constructible_v is_default_constructible_v is_destructible_v is_empty_v is_enum_v is_floating_point_v is_function_v is_fundamental_v is_integral_v is_invocable_r_v is_invocable_v is_literal_type_v is_lvalue_reference_v is_member_function_pointer_v is_member_object_pointer_v is_member_pointer_v is_move_assignable_v is_move_constructible_v is_nothrow_assignable_v is_nothrow_constructible_v is_nothrow_copy_assignable_v is_nothrow_copy_constructible_v is_nothrow_default_constructible_v is_nothrow_destructible_v is_nothrow_invocable_r_v is_nothrow_invocable_v is_nothrow_move_assignable_v is_nothrow_move_constructible_v is_nothrow_swappable_v is_nothrow_swappable_with_v is_nowthrow_callable_v is_null_pointer_v is_object_v is_pod_v is_pointer_v is_polymorphic_v is_reference_v is_rvalue_reference_v is_same_v is_scalar_v is_signed_v is_standard_layout_v is_swappable_v is_swappable_with_v is_trivial_v is_trivially_assignable_v is_trivially_constructible_v is_trivially_copy_assignable_v is_trivially_copy_constructible_v is_trivially_copyable_v is_trivially_default_constructible_v is_trivially_destructible_v is_trivially_move_assignable_v is_trivially_move_constructible_v is_union_v is_unsigned_v is_void_v is_volatile_v negation_v
|
||||
|
||||
syntax keyword cppSTLfunction
|
||||
\ reinterpret_pointer_cast make_from_tuple make_optional any_cast
|
||||
|
||||
syntax keyword cppSTLenum
|
||||
\ copy_options directory_options file_type perm_options perms
|
||||
|
||||
" Note: There is std::filesystem::path::format and std::format() in <format>
|
||||
syntax match cppSTLenum "\<format\>(\@!"
|
||||
|
||||
" Note: these can be both member objects and methods
|
||||
syntax match cppSTLvariable "\<\%(capacity\|free\|available\)\>(\@!"
|
||||
|
||||
" Note: these keywords are very likely to coincide with user-defined variables
|
||||
" syntax keyword cppSTLconstant
|
||||
" \ all mask unknown replace add remove nofollow none not_found regular directory symlink block character fifo socket unknown
|
||||
endif
|
||||
|
||||
|
||||
" C++20 extensions {{{1
|
||||
if !exists('cpp_no_cpp20')
|
||||
syntax keyword cppSTLnamespace ranges views
|
||||
syntax keyword cppSTLconstant dynamic_extent
|
||||
syntax keyword cppSTLvariable default_sentinel unreachable_sentinel
|
||||
syntax keyword cppSTLexception format_error
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ atomic_ref endian weak_ordering strong_ordering partial_ordering weak_equality strong_equality common_comparison_category contract_violation coroutine_traits coroutine_handle noop_coroutine_handle noop_coroutine_promise suspend_never suspend_always remove_cvref is_bounded_array is_layout_compatible is_unbounded_array is_nothrow_convertible has_strong_structural_equality is_pointer_interconvertible_base_of unwrap_reference unwrap_ref_decay basic_common_reference common_reference dangling ref_view filter_view transform_view iota_view join_view empty_view single_view split_view common_view reverse_view view_interface span basic_syncbuf basic_osyncstream syncbuf wsyncbuf osyncstream wosyncstream jthread latch barrier stop_token stop_source stop_callback counting_semaphore binary_semaphore source_location compare_three_way_result contiguous_iterator_tag incrementable_traits indirectly_readable_traits move_sentinel common_iterator counted_iterator projected type_identity formatter basic_format_context basic_format_args basic_format_string basic_format_parse_context
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ common_comparison_category_t remove_cvref_t unwrap_reference_t unwrap_ref_decay_t common_reference_t iterator_t sentinel_t safe_iterator_t safe_subrange_t compare_three_way_result_t iter_value_t iter_reference_t iter_difference_t iter_rvalue_reference_t iter_common_reference_t default_sentinel_t unreachable_sentinel_t indirect_result_t type_identity_t format_context wformat_context format_args wformat_args format_string wformat_string format_parse_context wformat_parse_context
|
||||
|
||||
syntax keyword cppSTLfunction
|
||||
\ make_unique_default_init make_shared_default_init allocate_shared_default_init uses_allocator_construction_args make_obj_using_allocator is_corresponding_member subspan in_range is_pointer_interconvertible_with_class
|
||||
|
||||
syntax keyword cppSTLbool
|
||||
\ is_bounded_array_v is_layout_compatible_v is_unbounded_array_v is_nothrow_convertible_v has_strong_structural_equality_v is_pointer_interconvertible_base_of_v disable_sized_sentinel_for disable_sized_range enable_borrowed_range enable_view
|
||||
|
||||
syntax keyword cppSTLconcept
|
||||
\ assignable_from boolean common_reference_with common_with constructible_from convertible_to copy_constructible copyable default_constructible derived_from destructible equality_comparable equality_comparable_with equivalence_relation floating_point integral invocable movable move_constructible predicate regular regular_invocable relation same_as semiregular signed_integral strict_weak_order swappable swappable_with totally_ordered totally_ordered_with unsigned_integral default_initializable range sized_range view input_range output_range forward_range bidirectional_range random_access_range contiguous_range common_range viewable_range three_way_comparable three_way_comparable_with indirectly_readable indirectly_writable weakly_incrementable incrementable input_or_output_iterator sentinel_for sized_sentinel_for input_iterator output_iterator forward_iterator bidirectional_iterator random_access_iterator contiguous_iterator indirectly_unary_invocable indirectly_regular_unary_invocable indirect_unary_predicate indirect_binary_predicate indirect_equivalence_relation indirect_strict_weak_order indirectly_movable indirectly_movable_storable indirectly_copyable indirectly_copyable_storable indirectly_swappable indirectly_comparable permutable mergeable sortable
|
||||
endif
|
||||
|
||||
|
||||
" C++23 extensions {{{1
|
||||
if !exists('cpp_no_cpp23')
|
||||
syntax keyword cppSTLtype basic_stacktrace stacktrace_entry is_scoped_enum
|
||||
syntax keyword cppSTLtypedef stacktrace
|
||||
syntax keyword cppSTLbool is_scoped_enum_v
|
||||
syntax keyword cppSTLfunction invoke_r
|
||||
syntax keyword cppSTLtype expected unexpected unexpect_t bad_expected_access
|
||||
syntax keyword cppSTLvariable unexpect
|
||||
endif
|
||||
|
||||
|
||||
" Boost {{{1
|
||||
if !exists('cpp_no_boost')
|
||||
syntax keyword cppSTLnamespace boost
|
||||
syntax keyword cppSTLfunction lexical_cast
|
||||
endif
|
||||
" }}}
|
||||
|
||||
|
||||
" Default highlighting
|
||||
hi def link cppSTLbool Boolean
|
||||
hi def link cppStatement Statement
|
||||
hi def link cppSTLfunction Function
|
||||
hi def link cppSTLdefine Constant
|
||||
hi def link cppSTLconstant Constant
|
||||
hi def link cppSTLnamespace Constant
|
||||
hi def link cppSTLexception Type
|
||||
hi def link cppSTLiterator Type
|
||||
hi def link cppSTLtype Type
|
||||
hi def link cppSTLtypedef Typedef
|
||||
hi def link cppSTLenum Typedef
|
||||
hi def link cppSTLios Function
|
||||
hi def link cppSTLconcept Typedef
|
||||
hi def link cppSTLvariable Identifier
|
||||
|
||||
" The keywords {inline, virtual, explicit, export, override, final} are
|
||||
" standard C++ keywords and NOT types!
|
||||
hi! def link cppModifier Statement
|
||||
|
||||
|
||||
" Highlight all standard C++ keywords as Statement
|
||||
if get(g:, 'cpp_simple_highlight', 0)
|
||||
hi! def link cppStructure Statement
|
||||
hi! def link cppExceptions Statement
|
||||
hi! def link cppStorageClass Statement
|
||||
endif
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'dhall', 'after/syntax/haskell.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" store and remove current syntax value
|
||||
let old_syntax = b:current_syntax
|
||||
@@ -13,5 +15,3 @@ hi def link quasiQuote Underlined
|
||||
|
||||
" restore current syntax value
|
||||
let b:current_syntax = old_syntax
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scala') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'scala', 'after/syntax/help.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Extends standard help syntax with highlighting of Scala code.
|
||||
"
|
||||
@@ -14,5 +16,3 @@ if has('conceal')
|
||||
else
|
||||
syntax region rgnScala matchgroup=Ignore start='!sc!' end='!/sc!' contains=@ScalaCode
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'html5', 'after/syntax/html.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file
|
||||
" Language: HTML (version 5.1)
|
||||
@@ -12,5 +14,3 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
" https://github.com/w3c/html/issues/694
|
||||
syntax region htmlComment start=+<!--+ end=+-->+ contains=@Spell
|
||||
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris', 'after/syntax/idris.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" This script allows for unicode concealing of certain characters
|
||||
" For instance -> goes to →
|
||||
@@ -78,5 +80,3 @@ hi link idrNiceOperator Operator
|
||||
hi! link Conceal Operator
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris2') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris2', 'after/syntax/idris2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" This script allows for unicode concealing of certain characters
|
||||
" For instance -> goes to →
|
||||
@@ -78,5 +80,3 @@ hi link idrNiceOperator Operator
|
||||
hi! link Conceal Operator
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/javascript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,7 +29,11 @@ if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
@@ -36,22 +42,26 @@ let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
|
||||
|
||||
if graphql#has_syntax_group('jsTemplateExpression')
|
||||
" pangloss/vim-javascript
|
||||
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
|
||||
exec 'syntax region graphqlTemplateString matchgroup=jsTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend'
|
||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=jsTemplateExpression containedin=graphqlFold keepend
|
||||
|
||||
syntax region graphqlTemplateString matchgroup=jsTemplateString start=+`#\s\{,4\}\(gql\|graphql\)\>\s*$+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,jsTemplateExpression,jsSpecial extend
|
||||
|
||||
hi def link graphqlTemplateString jsTemplateString
|
||||
hi def link graphqlTaggedTemplate jsTaggedTemplate
|
||||
hi def link graphqlTemplateExpression jsTemplateExpression
|
||||
|
||||
syn cluster jsExpression add=graphqlTaggedTemplate
|
||||
syn cluster jsExpression add=graphqlTemplateString,graphqlTaggedTemplate
|
||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||
elseif graphql#has_syntax_group('javaScriptStringT')
|
||||
" runtime/syntax/javascript.vim
|
||||
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend'
|
||||
exec 'syntax region graphqlTemplateString matchgroup=javaScriptStringT start=+' . s:tags . '\@20<=`+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend'
|
||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=@javaScriptEmbededExpr containedin=graphqlFold keepend
|
||||
|
||||
syntax region graphqlTemplateString matchgroup=javaScriptStringT start=+`#\s\{,4\}\(gql\|graphql\)\>\s*$+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend
|
||||
|
||||
hi def link graphqlTemplateString javaScriptStringT
|
||||
hi def link graphqlTaggedTemplate javaScriptEmbed
|
||||
hi def link graphqlTemplateExpression javaScriptEmbed
|
||||
@@ -60,5 +70,3 @@ elseif graphql#has_syntax_group('javaScriptStringT')
|
||||
syn cluster javaScriptEmbededExpr add=graphqlTaggedTemplate
|
||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript-sql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript-sql', 'after/syntax/javascript/sql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim plugin
|
||||
" Language: JavaScript
|
||||
@@ -22,5 +24,3 @@ hi def link sqlTaggedTemplate jsTaggedTemplate
|
||||
|
||||
syn cluster jsExpression add=sqlTaggedTemplate
|
||||
syn cluster sqlTaggedTemplate add=sqlTemplateString
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/javascriptreact/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/javascript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
@@ -55,5 +57,3 @@ let b:current_syntax = 'javascript.jsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/jsx_pretty.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
|
||||
|
||||
@@ -138,7 +140,7 @@ exe 'syntax match jsxTagName
|
||||
" and
|
||||
" <tag id='sample'>
|
||||
" ~~~~~~~~
|
||||
syntax region jsxString start=+\z(["']\)+ skip=+\\\\\|\\\z1\|\\\n+ end=+\z1+ contained contains=@Spell
|
||||
syntax region jsxString start=+\z(["']\)+ skip=+\\\\\|\\\z1\|\\\n+ end=+\z1+ extend contained contains=@Spell
|
||||
|
||||
let s:tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
|
||||
let s:enable_tagged_jsx = !empty(s:tags)
|
||||
@@ -221,5 +223,3 @@ if s:vim_jsx_pretty_colorful_config == 1
|
||||
highlight def link jsArrowFuncArgs Type
|
||||
highlight def link jsFuncArgs Type
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'after/syntax/llvm.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2018 rhysd
|
||||
"
|
||||
@@ -22,5 +24,3 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
|
||||
syn keyword llvmKeyword attributes
|
||||
syn match llvmNoName /#\d\+\>/
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mdx') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'mdx', 'after/syntax/mdx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
" based on mxw/vim-jsx
|
||||
@@ -41,5 +43,3 @@ syn cluster jsExpression add=jsxRegion
|
||||
|
||||
" Allow jsxRegion to contain reserved words.
|
||||
syn cluster javascriptNoReserved add=jsxRegion
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'mathematica', 'after/syntax/mma.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"Vim conceal file
|
||||
" Language: Mathematica
|
||||
@@ -1442,5 +1444,3 @@ endif
|
||||
hi! link Conceal Normal
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'objc', 'after/syntax/objc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ARC type modifiers
|
||||
syn keyword objcTypeModifier __bridge __bridge_retained __bridge_transfer __autoreleasing __strong __weak __unsafe_unretained
|
||||
@@ -19,5 +21,3 @@ syn match objcDirective "@property\|@synthesize\|@dynamic\|@package"
|
||||
|
||||
" Highlight property attributes as if they were type modifiers
|
||||
hi def link objcPropertyAttribute objcTypeModifier
|
||||
|
||||
endif
|
||||
|
||||
42
after/syntax/php/graphql.vim
Normal file
42
after/syntax/php/graphql.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/php/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(gql\)\c\(\i*\)\)\2$" end="^\s*\z1\>" contained contains=@GraphQLSyntax,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
|
||||
syntax region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(gql\)\c\(\i*\)\)'$" end="^\s*\z1\>" contained contains=@GraphQLSyntax,@Spell keepend extend
|
||||
28
after/syntax/puppet.vim
Normal file
28
after/syntax/puppet.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'yard', 'after/syntax/puppet.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Puppet syntax extensions for highlighting YARD documentation.
|
||||
"
|
||||
" Author: Gabriel Filion <gabster@lelutin.ca>
|
||||
" URI: https://github.com/noprompt/vim-yardoc
|
||||
" Version: 0.0.1
|
||||
"
|
||||
" This file reuses the main yardoc syntax definitions and glues them together
|
||||
" with puppet syntax groups from vim-puppet
|
||||
|
||||
runtime! after/syntax/yardoc_support.vim
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Yard glue to puppet
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match puppetComment "\s*#.*$" contains=puppetTodo,@Spell,yardComment
|
||||
syn region puppetComment start="/\*" end="\*/" contains=puppetTodo,@Spell,yardComment extend fold keepend
|
||||
syn cluster puppetNotTop add=@yardTags,@yardDirectives,@yardTypes,@yardLists,@yardHashes
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tacking on Yard to puppet syntax classes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
hi def link yardComment puppetComment
|
||||
hi def link yardGenericTag puppetKeyword
|
||||
hi def link yardGenericDirective puppetKeyword
|
||||
@@ -1,4 +1,4 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'reason') == -1
|
||||
|
||||
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'reason', 'after/syntax/reason.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/reason/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,11 +29,14 @@ if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syntax region graphqlExtensionPoint matchgroup=Noise start=+\[%graphql\_s*{|+lc=10 end=+|}\_s*]+he=s+1 contains=@GraphQLSyntax keepend
|
||||
|
||||
endif
|
||||
syntax region graphqlExtensionPoint start=+\[%\(graphql\|relay\)+ end=+\]+ contains=graphqlExtensionPointS
|
||||
syntax region graphqlExtensionPointS matchgroup=String start=+{|+ end=+|}+ contains=@GraphQLSyntax contained
|
||||
|
||||
42
after/syntax/rescript/graphql.vim
Normal file
42
after/syntax/rescript/graphql.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/rescript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syntax region graphqlExtensionPoint start=+%\(graphql\|relay\)(+ end=+)+ contains=graphqlExtensionPointS
|
||||
syntax region graphqlExtensionPointS matchgroup=String start=+`+ end=+`+ contains=@GraphQLSyntax contained
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rspec') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rspec', 'after/syntax/rspec.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"
|
||||
" An rspec syntax file
|
||||
@@ -189,5 +191,3 @@ highlight link rspecMatchers Function
|
||||
highlight link rspecMessageExpectation Function
|
||||
|
||||
let b:current_syntax = 'rspec'
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,130 +1,28 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yard') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'yard', 'after/syntax/ruby.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Ruby syntax extensions for highlighting YARD documentation.
|
||||
"
|
||||
" Author: Joel Holdbrooks <https://github.com/noprompt>
|
||||
" URI: https://github.com/noprompt/vim-yardoc
|
||||
" Version: 0.0.1
|
||||
"
|
||||
" This file reuses the main yardoc syntax definitions and glues them together
|
||||
" with Vim's builtin ruby syntax groups
|
||||
|
||||
runtime! after/syntax/yardoc_support.vim
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tags
|
||||
" Yard glue to ruby
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericTag "@\h\+" contained
|
||||
syn match yardAbstract "@abstract" contained
|
||||
syn match yardApi "@api" contained
|
||||
syn match yardAttr "@attr" contained
|
||||
syn match yardAttrReader "@attr_reader" contained
|
||||
syn match yardAttrWriter "@attr_writer" contained
|
||||
syn match yardAuthor "@author" contained
|
||||
syn match yardDeprecated "@deprecated" contained
|
||||
syn match yardExample "@example" contained
|
||||
syn match yardNote "@note" contained
|
||||
syn match yardOption "@option" contained
|
||||
syn match yardOverload "@overload" contained
|
||||
syn match yardParam "@param" contained
|
||||
syn match yardPrivate "@private" contained
|
||||
syn match yardRaise "@raise" contained
|
||||
syn match yardReturn "@return" contained
|
||||
syn match yardSee "@see" contained
|
||||
syn match yardSince "@since" contained
|
||||
syn match yardTodo "@todo" contained
|
||||
syn match yardVersion "@version" contained
|
||||
syn match yardYield "@yield" contained
|
||||
syn match yardYieldParam "@yieldparam" contained
|
||||
syn match yardYieldReturn "@yieldreturn" contained
|
||||
syn cluster yardTags contains=yardGenericTag,yardAbstract,yardApi,yardAttr,yardAttrReader,yardAttrWriter,yardAuthor,yardDeprecated,yardExample,yardNote,yardOption,yardOverload,yardParam,yardPrivate,yardRaise,yardReturn,yardSee,yardSince,yardTodo,yardVersion,yardYield,yardYieldParam,yardYieldReturn
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Directives
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericDirective "@!\h\+" contained
|
||||
syn match yardAttribute "@!attribute" contained
|
||||
syn match yardEndGroup "@!endgroup" contained
|
||||
syn match yardGroup "@!group" contained
|
||||
syn match yardMacro "@!macro" contained
|
||||
syn match yardMethod "@!method" contained
|
||||
syn match yardParse "@!parse" contained
|
||||
syn match yardScope "@!scope" contained
|
||||
syn match yardVisibility "@!visibility" contained
|
||||
|
||||
syn cluster yardDirectives contains=yardGenericDirective,yardAttribute,yardEndGroup,yardGroup,yardMacro,yardMethod,yardParse,yardScope,yardVisibility
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Types, Lists, and Hashes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardDuckType "#\h\+" contained
|
||||
syn match yardType "[A-Z]\h\+" contained
|
||||
syn match yardLiteral "\(true\|false\|nil\|self\|void\)" contained
|
||||
syn match yardComma "," nextgroup=@yardTypes contained
|
||||
syn match yardArrow "=>" nextgroup=@yardTypes contained
|
||||
|
||||
syn region yardParametricType start="[A-Z]\+\h\+<" end=">" contains=yardType,yardOrderDependentList,yardComma skipwhite contained
|
||||
syn region yardOrderDependentList start="(" end=")" contains=@yardTypes,yardComma skipwhite contained
|
||||
syn region yardTypeList start="\[" end="]" contains=@yardTypes,yardOrderDependentList,@yardHashes skipwhite contained
|
||||
syn region yardHashAngle start="Hash<" end=">" contains=yardDuckType,yardType,yardLiteral,yardArrow,yardComma skipwhite contained
|
||||
syn region yardHashCurly start="Hash{" end="}" contains=@yardTypes,yardArrow,yardComma skipwhite contained
|
||||
|
||||
syn cluster yardTypes contains=yardDuckType,yardType,yardLiteral,yardParametricType
|
||||
syn cluster yardHashes contains=yardArrow,yardHashAngle,yardHashCurly
|
||||
syn cluster yardLists contains=yardComma,yardTypeList,yardOrderDependentList
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Yard
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardComment "#\s*@!\{,1}\h\+.*" contains=@yardTags,@yardDirectives,yardTypeList
|
||||
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell,yardComment
|
||||
syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
||||
syn cluster rubyNotTop add=@yardTags,@yardDirectives,@yardTypes,@yardLists,@yardHashes
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Links
|
||||
" Tacking on Yard to ruby syntax classes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
hi def link yardComment rubyComment
|
||||
" Tags
|
||||
hi def link yardGenericTag rubyKeyword
|
||||
hi def link yardAbstract yardGenericTag
|
||||
hi def link yardApi yardGenericTag
|
||||
hi def link yardAttr yardGenericTag
|
||||
hi def link yardAttrReader yardGenericTag
|
||||
hi def link yardAttrWriter yardGenericTag
|
||||
hi def link yardAuthor yardGenericTag
|
||||
hi def link yardDeprecated yardGenericTag
|
||||
hi def link yardExample yardGenericTag
|
||||
hi def link yardNote yardGenericTag
|
||||
hi def link yardOption yardGenericTag
|
||||
hi def link yardOverload yardGenericTag
|
||||
hi def link yardParam yardGenericTag
|
||||
hi def link yardPrivate yardGenericTag
|
||||
hi def link yardRaise yardGenericTag
|
||||
hi def link yardReturn yardGenericTag
|
||||
hi def link yardSee yardGenericTag
|
||||
hi def link yardSince yardGenericTag
|
||||
hi def link yardTodo yardGenericTag
|
||||
hi def link yardVersion yardGenericTag
|
||||
hi def link yield yardGenericTag
|
||||
hi def link yieldparam yardGenericTag
|
||||
hi def link yieldreturn yardGenericTag
|
||||
" Directives
|
||||
hi def link yardGenericDirective rubyKeyword
|
||||
hi def link yardAttribute yardGenericDirective
|
||||
hi def link yardEndGroup yardGenericDirective
|
||||
hi def link yardGroup yardGenericDirective
|
||||
hi def link yardMacro yardGenericDirective
|
||||
hi def link yardMethod yardGenericDirective
|
||||
hi def link yardParse yardGenericDirective
|
||||
hi def link yardScope yardGenericDirective
|
||||
hi def link yardVisibility yardGenericDirective
|
||||
" Types
|
||||
hi def link yardComma yardComment
|
||||
hi def link yardType yardComment
|
||||
hi def link yardDuckType yardComment
|
||||
hi def link yardLiteral yardComment
|
||||
" Lists
|
||||
hi def link yardTypeList yardComment
|
||||
hi def link yardParametricType yardComment
|
||||
" Hashes
|
||||
hi def link yardArrow yardComment
|
||||
hi def link yardHashAngle yardComment
|
||||
hi def link yardHashCurly yardComment
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rust', 'after/syntax/rust.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -41,5 +43,3 @@ if !get(g:, 'rust_conceal_mod_path', 0)
|
||||
endif
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
||||
endif
|
||||
|
||||
1344
after/syntax/tex.vim
Normal file
1344
after/syntax/tex.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
@@ -59,5 +61,3 @@ let b:current_syntax = 'typescript.tsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/typescript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,23 +29,34 @@ if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
let s:tags = '\%(' . join(graphql#javascript_tags(), '\|') . '\)'
|
||||
|
||||
exec 'syntax region graphqlTemplateString start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend'
|
||||
exec 'syntax region graphqlTemplateString matchgroup=typescriptTemplate start=+' . s:tags . '\@20<=`+ skip=+\\`+ end=+`+ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend'
|
||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
|
||||
" Support expression interpolation ((${...})) inside template strings.
|
||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=typescriptTemplateSubstitution containedin=graphqlFold keepend
|
||||
|
||||
" support #graphql , #gql comment strings
|
||||
syntax region graphqlTemplateString
|
||||
\ start=+`\(#\s\{,4\}\(gql\|graphql\)\)\@=+
|
||||
\ skip=+\\\\\|\\`+
|
||||
\ end=+`+me=s-1
|
||||
\ containedin=typescriptTemplate
|
||||
\ contained
|
||||
\ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend
|
||||
|
||||
hi def link graphqlTemplateString typescriptTemplate
|
||||
hi def link graphqlTemplateExpression typescriptTemplateSubstitution
|
||||
|
||||
syn cluster typescriptExpression add=graphqlTaggedTemplate
|
||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/typescriptreact/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/typescript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/vue/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/javascript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
128
after/syntax/yardoc_support.vim
Normal file
128
after/syntax/yardoc_support.vim
Normal file
@@ -0,0 +1,128 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'yard', 'after/syntax/yardoc_support.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Generic syntax extensions for highlighting YARD documentation.
|
||||
"
|
||||
" Author: Joel Holdbrooks <https://github.com/noprompt>
|
||||
" URI: https://github.com/noprompt/vim-yardoc
|
||||
" Version: 0.0.1
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tags
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericTag "@\h\+" contained
|
||||
syn match yardAbstract "@abstract" contained
|
||||
syn match yardApi "@api" contained
|
||||
syn match yardAttr "@attr" contained
|
||||
syn match yardAttrReader "@attr_reader" contained
|
||||
syn match yardAttrWriter "@attr_writer" contained
|
||||
syn match yardAuthor "@author" contained
|
||||
syn match yardDeprecated "@deprecated" contained
|
||||
syn match yardExample "@example" contained
|
||||
syn match yardNote "@note" contained
|
||||
syn match yardOption "@option" contained
|
||||
syn match yardOverload "@overload" contained
|
||||
syn match yardParam "@param" contained
|
||||
syn match yardParamName /@param \h\+/hs=s+7 contained contains=yardParam
|
||||
syn match yardPrivate "@private" contained
|
||||
syn match yardRaise "@raise" contained
|
||||
syn match yardReturn "@return" contained
|
||||
syn match yardSee "@see" contained
|
||||
syn match yardSince "@since" contained
|
||||
syn match yardTodo "@todo" contained
|
||||
syn match yardVersion "@version" contained
|
||||
syn match yardYield "@yield" contained
|
||||
syn match yardYieldParam "@yieldparam" contained
|
||||
syn match yardYieldReturn "@yieldreturn" contained
|
||||
syn cluster yardTags contains=yardGenericTag,yardAbstract,yardApi,yardAttr,yardAttrReader,yardAttrWriter,yardAuthor,yardDeprecated,yardExample,yardNote,yardOption,yardOverload,yardParam,yardParamName,yardPrivate,yardRaise,yardReturn,yardSee,yardSince,yardTodo,yardVersion,yardYield,yardYieldParam,yardYieldReturn
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Directives
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericDirective "@!\h\+" contained
|
||||
syn match yardAttribute "@!attribute" contained
|
||||
syn match yardEndGroup "@!endgroup" contained
|
||||
syn match yardGroup "@!group" contained
|
||||
syn match yardMacro "@!macro" contained
|
||||
syn match yardMethod "@!method" contained
|
||||
syn match yardParse "@!parse" contained
|
||||
syn match yardScope "@!scope" contained
|
||||
syn match yardVisibility "@!visibility" contained
|
||||
|
||||
syn cluster yardDirectives contains=yardGenericDirective,yardAttribute,yardEndGroup,yardGroup,yardMacro,yardMethod,yardParse,yardScope,yardVisibility
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Types, Lists, and Hashes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardDuckType "#\h\+" contained
|
||||
syn match yardType "[A-Z]\h\+" contained
|
||||
syn match yardLiteral "\(true\|false\|nil\|self\|void\)" contained
|
||||
syn match yardComma "," nextgroup=@yardTypes contained
|
||||
syn match yardArrow "=>" nextgroup=@yardTypes contained
|
||||
|
||||
syn region yardParametricType start="[A-Z]\+\h\+<" end=">" contains=yardType,yardOrderDependentList,yardComma skipwhite contained
|
||||
syn region yardOrderDependentList start="(" end=")" contains=@yardTypes,yardComma skipwhite contained
|
||||
syn region yardTypeList start="\[" end="]" contains=@yardTypes,yardOrderDependentList,@yardHashes skipwhite contained
|
||||
syn region yardHashAngle start="Hash<" end=">" contains=yardDuckType,yardType,yardLiteral,yardArrow,yardComma skipwhite contained
|
||||
syn region yardHashCurly start="Hash{" end="}" contains=@yardTypes,yardArrow,yardComma skipwhite contained
|
||||
|
||||
syn cluster yardTypes contains=yardDuckType,yardType,yardLiteral,yardParametricType
|
||||
syn cluster yardHashes contains=yardArrow,yardHashAngle,yardHashCurly
|
||||
syn cluster yardLists contains=yardComma,yardTypeList,yardOrderDependentList
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Yard
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardComment "#\s*@!\{,1}\h\+.*" contains=@yardTags,@yardDirectives,yardTypeList
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Links
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" @note The links to language syntax classes is done in each language syntax
|
||||
" script.
|
||||
"
|
||||
" Tags
|
||||
hi def link yardAbstract yardGenericTag
|
||||
hi def link yardApi yardGenericTag
|
||||
hi def link yardAttr yardGenericTag
|
||||
hi def link yardAttrReader yardGenericTag
|
||||
hi def link yardAttrWriter yardGenericTag
|
||||
hi def link yardAuthor yardGenericTag
|
||||
hi def link yardDeprecated yardGenericTag
|
||||
hi def link yardExample yardGenericTag
|
||||
hi def link yardNote yardGenericTag
|
||||
hi def link yardOption yardGenericTag
|
||||
hi def link yardOverload yardGenericTag
|
||||
hi def link yardParam yardGenericTag
|
||||
hi def link yardPrivate yardGenericTag
|
||||
hi def link yardRaise yardGenericTag
|
||||
hi def link yardReturn yardGenericTag
|
||||
hi def link yardSee yardGenericTag
|
||||
hi def link yardSince yardGenericTag
|
||||
hi def link yardTodo yardGenericTag
|
||||
hi def link yardVersion yardGenericTag
|
||||
hi def link yardYield yardGenericTag
|
||||
hi def link yardYieldParam yardGenericTag
|
||||
hi def link yardYieldReturn yardGenericTag
|
||||
" Directives
|
||||
hi def link yardAttribute yardGenericDirective
|
||||
hi def link yardEndGroup yardGenericDirective
|
||||
hi def link yardGroup yardGenericDirective
|
||||
hi def link yardMacro yardGenericDirective
|
||||
hi def link yardMethod yardGenericDirective
|
||||
hi def link yardParse yardGenericDirective
|
||||
hi def link yardScope yardGenericDirective
|
||||
hi def link yardVisibility yardGenericDirective
|
||||
" Types
|
||||
hi def link yardComma yardComment
|
||||
hi def link yardType yardComment
|
||||
hi def link yardDuckType yardComment
|
||||
hi def link yardLiteral yardComment
|
||||
" Lists
|
||||
hi def link yardTypeList yardComment
|
||||
hi def link yardParametricType yardComment
|
||||
" Hashes
|
||||
hi def link yardArrow yardComment
|
||||
hi def link yardHashAngle yardComment
|
||||
hi def link yardHashCurly yardComment
|
||||
@@ -1,6 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zinit') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'zinit', 'after/syntax/zsh.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2019 Sebastian Gniazdowski
|
||||
" Copyright (c) 2021 Joakim Gottzén
|
||||
"
|
||||
" Syntax highlighting for Zinit commands in any file of type `zsh'.
|
||||
" It adds definitions for the Zinit syntax to the ones from the
|
||||
@@ -8,119 +11,163 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zinit') == -1
|
||||
|
||||
" Main Zinit command.
|
||||
" Should be the only TOP rule for the whole syntax.
|
||||
syntax match ZinitCommand /\<zinit\>\s/me=e-1
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSubCommands,ZinitPluginSubCommands,ZinitSnippetSubCommands
|
||||
\ contains=ZinitSubCommands,ZinitPluginSubCommands,ZinitSnippetSubCommands
|
||||
syn match ZinitCommand '\(^\|\s\)zinit\s'ms=e-5,me=e-1 skipwhite
|
||||
\ nextgroup=ZinitCommand,ZinitIceCommand,ZinitPluginCommand,ZinitSnippetCommand,ZinitForCommand,ZinitContinue,ZinitIceWithParam,ZinitIce
|
||||
|
||||
" TODO: add options for e.g. light
|
||||
syntax match ZinitSubCommands /\s\<\%(ice\|compinit\|env-whitelist\|cdreplay\|cdclear\|update\)\>\s/ms=s+1,me=e-1
|
||||
\ contained
|
||||
syn match ZinitCommand '\s\%(help\|man\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(unload\)\>'ms=s+1 skipwhite contained " load,light and snippet are handled elsewhere
|
||||
syn match ZinitCommand '\s\%(clist\|completions\|cdisable\|cenable\|creinstall\|cuninstall\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(csearch\|compinit\|cclear\|cdlist\|cdreplay\|cdclear\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(dtrace\|dstart\|dstop\|dunload\|dreport\|dclear\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(times\|zstatus\|report\|loaded\|list\|ls\|status\|recently\|bindkeys\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(compile\|uncompile\|compiled\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(self-update\|update\|delete\|cd\|edit\|glance\|stress\|changes\|create\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(srv\|recall\|env-whitelist\|module\|add-fpath\|fpath\|run\)\>'ms=s+1 skipwhite contained
|
||||
|
||||
syntax match ZinitPluginSubCommands /\s\<\%(light\|load\)\>\s/ms=s+1,me=e-1
|
||||
\ skipwhite nextgroup=ZinitPlugin1,ZinitPlugin2,ZinitPlugin3
|
||||
\ contains=ZinitPlugin1,ZinitPlugin2,ZinitPlugin3
|
||||
syn match ZinitIceCommand '\sice\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitIce,ZinitIceWithParam
|
||||
|
||||
syntax match ZinitSnippetSubCommands /\s\<\%(snippet\)\>\s/ms=s+1,me=e-1
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetShorthands1,ZinitSnippetShorthands2
|
||||
\ contains=ZinitSnippetShorthands1,ZinitSnippetShorthands2
|
||||
syn match ZinitPluginCommand '\s\%(light\|load\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitPlugin,ZinitContinue
|
||||
|
||||
" "user/plugin"
|
||||
syntax match ZinitPlugin1 /\s["]\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)["]/ms=s+1,hs=s+2,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn match ZinitSnippetCommand '\s\%(snippet\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitSnippet,ZinitContinue
|
||||
|
||||
" 'user/plugin'
|
||||
syntax match ZinitPlugin2 /\s[']\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)[']/ms=s+1,hs=s+2,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn match ZinitForCommand '\sfor\s'ms=s+1,me=e-1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
" user/plugin
|
||||
syntax match ZinitPlugin3 /\s\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)/ms=s+1,me=e+2
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn cluster ZinitLine contains=ZinitIce,ZinitIceWithParam,ZinitPlugin,ZinitSnippet,ZinitForCommand
|
||||
|
||||
" OMZ:: or PZT::
|
||||
" TODO: 'OMZ:: or 'PZT::
|
||||
syntax match ZinitSnippetShorthands1 /\s\<\%(\%(OMZ\|PZT\)\>::\|\)/hs=s+1,he=e-2
|
||||
\ contained
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetUrl1,ZinitSnippetUrl2
|
||||
\ contains=ZinitSnippetUrl1,ZinitSnippetUrl2
|
||||
syn match ZinitContinue '\s\\\s*$'ms=s+1,me=s+2 skipwhite contained skipnl
|
||||
\ nextgroup=@ZinitLine
|
||||
|
||||
" "OMZ:: or "PZT::
|
||||
syntax match ZinitSnippetShorthands2 /\s["]\%(\%(OMZ\|PZT\)\>::\|\)/hs=s+2,he=e-2
|
||||
\ contained
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetUrl3,ZinitSnippetUrl4
|
||||
\ contains=ZinitSnippetUrl3,ZinitSnippetUrl4
|
||||
" user/plugin or @user/plugin
|
||||
syn match ZinitPlugin '\s@\?\<[a-zA-Z0-9][a-zA-Z0-9_\-]*\/[a-zA-Z0-9_\-\.]\+\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
syntax match ZinitSnippetUrl3 /\<\%(http:\/\/\|https:\/\/\|ftp:\/\/\|\$HOME\|\/\)[!-_]\+\%(\/[!-_]\+\)*\/\?["]/he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" shorthands
|
||||
syn match ZinitSnippet '\s\%(OMZ[LPT]\?\|PZT[M]\?\)::[a-zA-Z0-9_\-\.\/]\+\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" url
|
||||
syn match ZinitSnippet '\s\%(http[s]\?\|ftp\):\/\/[[:alnum:]%\/_#.-]*\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" "$VAR" local path
|
||||
syn match ZinitSnippet +\s"\$\<[a-zA-Z0-9_]\+[^"]*"+ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" "${VAR}" local path
|
||||
syn match ZinitSnippet +\s"\${\<[a-zA-Z0-9_]\+}[^"]*"+ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
" TODO: Fix ZinitTrailingWhiteSpace not matching
|
||||
syntax match ZinitSnippetUrl4 /\%(\%(OMZ\|PZT\)::\)[!-_]\+\%(\/[!-_]\+\)*\/\?["]/hs=s+5,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" ices which takes a param enclosed in "
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(proto\|from\|ver\|bpick\|depth\|cloneopts\|pullopts\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(pick\|src\|multisrc\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wait\|load\|unload\|if\|has\|subscribe\|on-update-of\|trigger-load\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(mv\|cp\|atclone\|atpull\|atinit\|atload\|atdelete\|make\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(as\|id-as\|compile\|nocompile\|service\|bindmap\|wrap-track\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(extract\|subst\|autoload\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wrap\|ps-on-unload\|ps-on-update\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
|
||||
" http://… or https://… or ftp://… or $HOME/… or /…
|
||||
" TODO: Fix $HOME/… and /… not matching
|
||||
syntax match ZinitSnippetUrl1 /\<\%(http:\/\/\|https:\/\/\|ftp:\/\/\|\$HOME\|\/\)[!-_]\+\%(\/[!-_]\+\)*\/\?/
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" zinit packages
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
|
||||
" TODO: Fix ZinitTrailingWhiteSpace not matching
|
||||
syntax match ZinitSnippetUrl2 /\<\%(\%(OMZ\|PZT\)::\)[!-_]\+\%(\/[!-_]\+\)*\/\?/hs=s+5
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" added by the existing annexes
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(fbin\|lbin\|sbin\|gem\|node\|pip\|fmod\|fsrc\|ferc\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(dl\|patch\|submods\|cargo\|dlink\|dlink0\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
|
||||
syntax match ZinitTrailingWhiteSpace /[[:space:]]\+$/ contained
|
||||
syn match ZinitIceDoubleQuoteParam +[^"]*+ contained
|
||||
|
||||
" TODO: differentiate the no-value ices
|
||||
" TODO: use contained
|
||||
syntax match ZinitIceSubCommand /\sice\s/ms=s+1,me=e-1 nextgroup=ZinitIceModifiers
|
||||
syntax match ZinitIceModifiers /\s\<\%(svn\|proto\|from\|teleid\|bindmap\|cloneopts\|id-as\|depth\|if\|wait\|load\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(unload\|blockf\|on-update-of\|subscribe\|pick\|bpick\|src\|as\|ver\|silent\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(lucid\|notify\|mv\|cp\|atinit\|atclone\|atload\|atpull\|nocd\|run-atpull\|has\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(cloneonly\|make\|service\|trackbinds\|multisrc\|compile\|nocompile\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(nocompletions\|reset-prompt\|wrap-track\|reset\|aliases\|sh\|bash\|ksh\|csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(\\!sh\|!sh\|\\!bash\|!bash\|\\!ksh\|!ksh\|\\!csh\|!csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(blockf\|silent\|lucid\|trackbinds\|cloneonly\|nocd\|run-atpull\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(\|sh\|\!sh\|bash\|\!bash\|ksh\|\!ksh\|csh\|\!csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(nocompletions\|svn\|aliases\|trigger-load\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(light-mode\|is-snippet\|countdown\|ps-on-unload\|ps-on-update\)\>/ms=s+1
|
||||
" ices that takes a param enclosed in '
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(proto\|from\|ver\|bpick\|depth\|cloneopts\|pullopts\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(pick\|src\|multisrc\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wait\|load\|unload\|if\|has\|subscribe\|on-update-of\|trigger-load\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(mv\|cp\|atclone\|atpull\|atinit\|atload\|atdelete\|make\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(as\|id-as\|compile\|nocompile\|service\|bindmap\|wrap-track\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(extract\|subst\|autoload\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wrap\|ps-on-unload\|ps-on-update\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
|
||||
" Include also ices added by the existing annexes
|
||||
syntax match ZinitIceModifiers /\s\<\%(test\|zman\|submod\|dl\|patch\|fbin\|sbin\|fsrc\|ferc\|fmod\|gem\|node\|rustup\|cargo\)\>/ms=s+1
|
||||
" zinit packages
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
|
||||
" Additional Zsh and Zinit functions
|
||||
syntax match ZshAndZinitFunctions /\<\%(compdef\|compinit\|zpcdreplay\|zpcdclear\|zpcompinit\|zpcompdef\)\>/
|
||||
" added by the existing annexes
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(fbin\|lbin\|sbin\|gem\|node\|pip\|fmod\|fsrc\|ferc\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(dl\|patch\|submods\|cargo\|dlink\|dlink0\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
|
||||
" Link
|
||||
highlight def link ZshAndZinitFunctions Keyword
|
||||
highlight def link ZinitCommand Statement
|
||||
highlight def link ZinitSubCommands Title
|
||||
highlight def link ZinitPluginSubCommands Title
|
||||
highlight def link ZinitSnippetSubCommands Title
|
||||
highlight def link ZinitIceModifiers Type
|
||||
highlight def link ZinitSnippetShorthands1 Keyword
|
||||
highlight def link ZinitSnippetShorthands2 Keyword
|
||||
highlight def link ZinitPlugin1 Macro
|
||||
highlight def link ZinitPlugin2 Macro
|
||||
highlight def link ZinitPlugin3 Macro
|
||||
highlight def link ZinitSnippetUrl1 Macro
|
||||
highlight def link ZinitSnippetUrl2 Macro
|
||||
highlight def link ZinitSnippetUrl3 Macro
|
||||
highlight def link ZinitSnippetUrl4 Macro
|
||||
highlight def link ZinitTrailingWhiteSpace Error
|
||||
syn match ZinitIceSingleQuoteParam +[^']*+ contained
|
||||
|
||||
" ices that doens't take a param
|
||||
syn match ZinitIce '\s\%(teleid\|svn\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(wait\|cloneonly\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(silent\|lucid\|notify\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(blockf\|nocompletions\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(run-atpull\|nocd\|make\|countdown\|reset\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s!\?\%(sh\|bash\|ksh\|csh\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(id-as\|nocompile\|reset-prompt\|trackbinds\|aliases\|light-mode\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
syn match ZinitIce '\s\%(is-snippet\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
|
||||
" ices that doens't take a param, from zinit packages
|
||||
syn match ZinitIce '\s\%(pack\|git\|null\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
|
||||
" ices that doens't take a param, added by the existing annexes
|
||||
syn match ZinitIce '\s\%(notest\|rustup\|default-ice\|skip\|debug\)\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
|
||||
" additional Zsh and zinit functions
|
||||
syn match ZshAndZinitFunctions '\<\%(compdef\|compinit\|zpcdreplay\|zpcdclear\|zpcompinit\|zpcompdef\)\>'
|
||||
|
||||
" highlights
|
||||
hi def link ZinitCommand Statement
|
||||
hi def link ZinitCommand Title
|
||||
hi def link ZinitIceCommand Title
|
||||
hi def link ZinitPluginCommand Title
|
||||
hi def link ZinitSnippetCommand Title
|
||||
hi def link ZinitForCommand zshRepeat
|
||||
hi def link ZinitContinue Normal
|
||||
hi def link ZinitPlugin Macro
|
||||
hi def link ZinitSnippet Macro
|
||||
hi def link ZinitIce Type
|
||||
hi def link ZinitIceDoubleQuoteParam Special
|
||||
hi def link ZinitIceSingleQuoteParam Special
|
||||
hi def link ZshAndZinitFunctions Keyword
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/LaTeXtoUnicode.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Support for LaTex-to-Unicode conversion as in the Julia REPL "
|
||||
@@ -10,28 +12,14 @@ function! s:L2U_Setup()
|
||||
|
||||
" Keep track of whether LaTeX-to-Unicode is activated
|
||||
" (used when filetype changes)
|
||||
if !has_key(b:, "l2u_enabled")
|
||||
let b:l2u_enabled = 0
|
||||
endif
|
||||
if !has_key(b:, "l2u_autodetect_enable")
|
||||
let b:l2u_autodetect_enable = 1
|
||||
endif
|
||||
let b:l2u_enabled = get(b:, "l2u_enabled", 0)
|
||||
let b:l2u_autodetect_enable = get(b:, "l2u_autodetect_enable", 1)
|
||||
|
||||
" Did we install the L2U tab mappings?
|
||||
if !has_key(b:, "l2u_tab_set")
|
||||
let b:l2u_tab_set = 0
|
||||
endif
|
||||
if !has_key(b:, "l2u_cmdtab_set")
|
||||
let b:l2u_cmdtab_set = 0
|
||||
endif
|
||||
if !has_key(b:, "l2u_keymap_set")
|
||||
let b:l2u_keymap_set = 0
|
||||
endif
|
||||
|
||||
" Did we activate the L2U as-you-type substitutions?
|
||||
if !has_key(b:, "l2u_autosub_set")
|
||||
let b:l2u_autosub_set = 0
|
||||
endif
|
||||
" Did we install the L2U tab/as-you-type/keymap... mappings?
|
||||
let b:l2u_tab_set = get(b:, "l2u_tab_set", 0)
|
||||
let b:l2u_cmdtab_set = get(b:, "l2u_cmdtab_set", 0)
|
||||
let b:l2u_autosub_set = get(b:, "l2u_autosub_set", 0)
|
||||
let b:l2u_keymap_set = get(b:, "l2u_keymap_set", 0)
|
||||
|
||||
" Following are some flags used to pass information between the function which
|
||||
" attempts the LaTeX-to-Unicode completion and the fallback function
|
||||
@@ -40,10 +28,6 @@ function! s:L2U_Setup()
|
||||
let b:l2u_found_completion = 0
|
||||
" Is the cursor just after a single backslash
|
||||
let b:l2u_singlebslash = 0
|
||||
" Backup value of the completeopt settings
|
||||
" (since we temporarily add the 'longest' setting while
|
||||
" attempting LaTeX-to-Unicode)
|
||||
let b:l2u_backup_commpleteopt = &completeopt
|
||||
" Are we in the middle of a L2U tab completion?
|
||||
let b:l2u_tab_completing = 0
|
||||
" Are we calling the tab fallback?
|
||||
@@ -66,7 +50,7 @@ function! s:L2U_SetupGlobal()
|
||||
call s:L2U_deprecated_options()
|
||||
|
||||
if v:version < 704
|
||||
let g:latex_to_unicode_tab = 0
|
||||
let g:latex_to_unicode_tab = "off"
|
||||
let g:latex_to_unicode_auto = 0
|
||||
endif
|
||||
|
||||
@@ -79,17 +63,16 @@ function! s:L2U_SetupGlobal()
|
||||
let g:latex_to_unicode_suggestions = 0
|
||||
endif
|
||||
|
||||
" A hack to forcibly get out of completion mode: feed
|
||||
" this string with feedkeys()
|
||||
if has("win32") || has("win64")
|
||||
let s:l2u_esc_sequence = "\u0006"
|
||||
else
|
||||
let s:l2u_esc_sequence = "\u0091\b"
|
||||
end
|
||||
" Forcibly get out of completion mode: feed
|
||||
" this string with feedkeys(s:l2u_esc_sequence, 'n')
|
||||
let s:l2u_esc_sequence = " \b"
|
||||
|
||||
" Trigger for the previous mapping of <Tab>
|
||||
let s:l2u_fallback_trigger = "\u0091L2UFallbackTab"
|
||||
|
||||
" Trigger for the previous mapping of <CR>
|
||||
let s:l2u_fallback_trigger_cr = "\u0091L2UFallbackCR"
|
||||
|
||||
endfunction
|
||||
|
||||
" Each time the filetype changes, we may need to enable or
|
||||
@@ -159,6 +142,14 @@ function! s:L2U_deprecated_options()
|
||||
exec "let g:" . new . " = g:" . old
|
||||
endif
|
||||
endfor
|
||||
|
||||
if has_key(g:, "latex_to_unicode_tab")
|
||||
if g:latex_to_unicode_tab is# 1
|
||||
let g:latex_to_unicode_tab = "on"
|
||||
elseif g:latex_to_unicode_tab is# 0
|
||||
let g:latex_to_unicode_tab = "off"
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:L2U_file_type_regex(ft)
|
||||
@@ -197,7 +188,7 @@ function! s:L2U_ismatch()
|
||||
if col0 == -1
|
||||
return 0
|
||||
endif
|
||||
let base = l[col0 : col1-1]
|
||||
let base = l[col0:col1-2]
|
||||
return has_key(g:l2u_symbols_dict, base)
|
||||
endfunction
|
||||
|
||||
@@ -237,22 +228,29 @@ function! s:L2U_longest_common_prefix(partmatches)
|
||||
return common
|
||||
endfunction
|
||||
|
||||
" Omnicompletion function. Besides the usual two-stage omnifunc behaviour,
|
||||
" Completion function. Besides the usual two-stage completefunc behaviour,
|
||||
" it has the following peculiar features:
|
||||
" *) keeps track of the previous completion attempt
|
||||
" *) sets some info to be used by the fallback function
|
||||
" *) either returns a list of completions if a partial match is found, or a
|
||||
" Unicode char if an exact match is found
|
||||
" *) forces its way out of completion mode through a hack in some cases
|
||||
function! LaTeXtoUnicode#omnifunc(findstart, base)
|
||||
function! LaTeXtoUnicode#completefunc(findstart, base)
|
||||
if a:findstart
|
||||
" first stage
|
||||
" avoid infinite loop if the fallback happens to call omnicompletion
|
||||
" avoid infinite loop if the fallback happens to call completion
|
||||
if b:l2u_in_fallback
|
||||
let b:l2u_in_fallback = 0
|
||||
return -3
|
||||
endif
|
||||
let b:l2u_in_fallback = 0
|
||||
" make sure that the options are still set
|
||||
" (it may happen that <C-X><C-U> itself triggers the fallback before
|
||||
" restarting, thus reseetting them; this happens when the prompt is
|
||||
" waiting for ^U^N^P during a partial completion)
|
||||
call s:L2U_SetCompleteopt()
|
||||
" setup the cleanup/fallback operations when we're done
|
||||
call s:L2U_InsertCompleteDoneAutocommand()
|
||||
call s:L2U_InsertInsertLeaveAutocommand()
|
||||
" set info for the callback
|
||||
let b:l2u_found_completion = 1
|
||||
" analyse current line
|
||||
@@ -338,72 +336,98 @@ function! LaTeXtoUnicode#PutLiteral(k)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! LaTeXtoUnicode#PutLiteralCR()
|
||||
call feedkeys('
|
||||
', 'ni')
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Function which saves the current insert-mode mapping of a key sequence `s`
|
||||
" <Tab> mapping into the Fallback trigger)
|
||||
" and associates it with another key sequence `k` (e.g. stores the current
|
||||
" <Tab> mapping into the Fallback trigger).
|
||||
" It returns the previous maparg dictionary, so that the previous mapping can
|
||||
" be reinstated if needed.
|
||||
function! s:L2U_SetFallbackMapping(s, k)
|
||||
if empty(mmdict)
|
||||
let mmdict = maparg(a:s, 'i', 0, 1)
|
||||
if empty(mmdict) || !has_key(mmdict, "rhs")
|
||||
return
|
||||
exe 'inoremap <buffer> ' . a:k . ' ' . a:s
|
||||
return mmdict
|
||||
endif
|
||||
let rhs = mmdict["rhs"]
|
||||
return
|
||||
if rhs =~# '^<Plug>L2U'
|
||||
return mmdict
|
||||
endif
|
||||
if mmdict["silent"]
|
||||
let pre = pre . '<silent>'
|
||||
endif
|
||||
if mmdict["expr"]
|
||||
let pre = pre . '<expr>'
|
||||
endif
|
||||
let pre = '<buffer>'
|
||||
let pre = pre . (mmdict["silent"] ? '<silent>' : '')
|
||||
let pre = pre . (mmdict["expr"] ? '<expr>' : '')
|
||||
if mmdict["noremap"]
|
||||
let cmd = 'inoremap '
|
||||
else
|
||||
let cmd = 'imap '
|
||||
" general solution.
|
||||
if mmdict["expr"]
|
||||
" This is a nasty hack used to prevent infinite recursion. It's not a
|
||||
" general solution. Also, it doesn't work with <CR> since that stops
|
||||
" parsing of the <C-R>=... expression, so we need to special-case it.
|
||||
" Also, if the original mapping was intended to be recursive, this
|
||||
" will break it.
|
||||
if a:s != "<CR>"
|
||||
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
|
||||
else
|
||||
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteralCR()\<CR>", 'g')
|
||||
endif
|
||||
" Make the mapping silent even if it wasn't originally
|
||||
if !mmdict["silent"]
|
||||
let pre = pre . '<silent>'
|
||||
endif
|
||||
endif
|
||||
exe cmd . pre . ' ' . a:k . ' ' . rhs
|
||||
return mmdict
|
||||
endfunction
|
||||
|
||||
" Reinstate a mapping from the maparg dict returned by SetFallbackMapping
|
||||
" (only if buffer-local, since otherwise it should still be available)
|
||||
function! s:L2U_ReinstateMapping(mmdict)
|
||||
if empty(a:mmdict) || !a:mmdict["buffer"]
|
||||
return ''
|
||||
endif
|
||||
let lhs = a:mmdict["lhs"]
|
||||
let rhs = a:mmdict["rhs"]
|
||||
if rhs =~# '^<Plug>L2U'
|
||||
return ''
|
||||
endif
|
||||
let pre = '<buffer>'
|
||||
let pre = pre . (a:mmdict["silent"] ? '<silent>' : '')
|
||||
let pre = pre . (a:mmdict["expr"] ? '<expr>' : '')
|
||||
let cmd = a:mmdict["noremap"] ? 'inoremap ' : 'imap '
|
||||
exe cmd . pre . ' ' . lhs . ' ' . rhs
|
||||
endfunction
|
||||
|
||||
" This is the function which is mapped to <Tab>
|
||||
function! LaTeXtoUnicode#Tab()
|
||||
" the <Tab> is passed through to the fallback mapping if the completion
|
||||
" isn't an exact match before the cursor when suggestions are disabled
|
||||
if pumvisible() && !b:l2u_tab_completing && (get(g:, "latex_to_unicode_suggestions", 1) || !s:L2U_ismatch())
|
||||
" menu is present, and it hasn't been raised by the L2U tab, and there
|
||||
" isn't an exact match before the cursor
|
||||
if pumvisible() && !b:l2u_tab_completing && !s:L2U_ismatch()
|
||||
call feedkeys(s:l2u_fallback_trigger)
|
||||
return ''
|
||||
endif
|
||||
" ensure that we start completion with some reasonable options
|
||||
call s:L2U_SetCompleteopt()
|
||||
" reset the in_fallback info
|
||||
let b:l2u_in_fallback = 0
|
||||
" temporary change to completeopt to use the `longest` setting, which is
|
||||
" probably the only one which makes sense given that the goal of the
|
||||
" completion is to substitute the final string
|
||||
let b:l2u_backup_commpleteopt = &completeopt
|
||||
set completeopt+=longest
|
||||
set completeopt-=noinsert
|
||||
" invoke omnicompletion; failure to perform LaTeX-to-Unicode completion is
|
||||
let b:l2u_tab_completing = 1
|
||||
" invoke completion; failure to perform LaTeX-to-Unicode completion is
|
||||
call feedkeys("\<C-X>\<C-O>", 'n')
|
||||
" handled by the CompleteDone autocommand.
|
||||
call feedkeys("\<C-X>\<C-U>", 'n')
|
||||
return ""
|
||||
endfunction
|
||||
|
||||
" This function is called at every CompleteDone event, and is meant to handle
|
||||
" the failures of LaTeX-to-Unicode completion by calling a fallback
|
||||
function! LaTeXtoUnicode#FallbackCallback()
|
||||
call s:L2U_RemoveCompleteDoneAutocommand()
|
||||
call s:L2U_RestoreCompleteopt()
|
||||
if !b:l2u_tab_completing
|
||||
" completion was not initiated by L2U, nothing to do
|
||||
else
|
||||
" completion was initiated by L2U, restore completeopt
|
||||
let &completeopt = b:l2u_backup_commpleteopt
|
||||
return
|
||||
endif
|
||||
" at this point L2U tab completion is over
|
||||
@@ -465,9 +489,70 @@ function! LaTeXtoUnicode#CmdTab(trigger)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:L2U_SetCompleteopt()
|
||||
" temporary change completeopt to use settings which make sense
|
||||
" for L2U
|
||||
let backup_new = 0
|
||||
if !exists('b:l2u_backup_completeopt')
|
||||
let b:l2u_backup_completeopt = &completeopt
|
||||
let backup_new = 1
|
||||
endif
|
||||
noautocmd set completeopt+=longest
|
||||
noautocmd set completeopt-=noinsert
|
||||
noautocmd set completeopt-=noselect
|
||||
noautocmd set completeopt-=menuone
|
||||
if backup_new
|
||||
let b:l2u_modified_completeopt = &completeopt
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:L2U_RestoreCompleteopt()
|
||||
" restore completeopt, but only if nothing else has
|
||||
" messed with it in the meanwhile
|
||||
if exists('b:l2u_backup_completeopt')
|
||||
if exists('b:l2u_modified_completeopt')
|
||||
if &completeopt ==# b:l2u_modified_completeopt
|
||||
noautocmd let &completeopt = b:l2u_backup_completeopt
|
||||
endif
|
||||
unlet b:l2u_modified_completeopt
|
||||
endif
|
||||
unlet b:l2u_backup_completeopt
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:L2U_InsertCompleteDoneAutocommand()
|
||||
augroup L2UCompleteDone
|
||||
autocmd! * <buffer>
|
||||
" Every time a L2U completion finishes, the fallback may be invoked
|
||||
autocmd CompleteDone <buffer> call LaTeXtoUnicode#FallbackCallback()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:L2U_RemoveCompleteDoneAutocommand()
|
||||
augroup L2UCompleteDone
|
||||
autocmd! * <buffer>
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function s:L2U_InsertLeaveClenup()
|
||||
call s:L2U_ResetLastCompletionInfo()
|
||||
augroup L2UInsertLeave
|
||||
autocmd! * <buffer>
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:L2U_InsertInsertLeaveAutocommand()
|
||||
augroup L2UInsertLeave
|
||||
autocmd! * <buffer>
|
||||
autocmd InsertLeave <buffer> call s:L2U_InsertLeaveClenup()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
" Setup the L2U tab mapping
|
||||
if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled
|
||||
function! s:L2U_SetTab(wait_insert_enter)
|
||||
let opt_do_cmdtab = index(["on", "command", "cmd"], get(g:, "latex_to_unicode_tab", "on")) != -1
|
||||
let opt_do_instab = index(["on", "insert", "ins"], get(g:, "latex_to_unicode_tab", "on")) != -1
|
||||
if !b:l2u_cmdtab_set && opt_do_cmdtab && b:l2u_enabled
|
||||
let b:l2u_cmdtab_keys = get(g:, "latex_to_unicode_cmd_mapping", ['<Tab>','<S-Tab>'])
|
||||
if type(b:l2u_cmdtab_keys) != type([]) " avoid using v:t_list for backward compatibility
|
||||
@@ -485,26 +570,20 @@ function! s:L2U_SetTab(wait_insert_enter)
|
||||
" g:did_insert_enter is set from an autocommand in ftdetect
|
||||
if a:wait_insert_enter && !get(g:, "did_insert_enter", 0)
|
||||
return
|
||||
if !get(g:, "latex_to_unicode_tab", 1) || !b:l2u_enabled
|
||||
endif
|
||||
if !opt_do_instab || !b:l2u_enabled
|
||||
return
|
||||
endif
|
||||
" Backup the previous omnifunc (the check is probably not really needed)
|
||||
if get(b:, "prev_omnifunc", "") != "LaTeXtoUnicode#omnifunc"
|
||||
let b:prev_omnifunc = &omnifunc
|
||||
|
||||
" Backup the previous completefunc (the check is probably not really needed)
|
||||
if get(b:, "l2u_prev_completefunc", "") != "LaTeXtoUnicode#completefunc"
|
||||
let b:l2u_prev_completefunc = &completefunc
|
||||
setlocal omnifunc=LaTeXtoUnicode#omnifunc
|
||||
endif
|
||||
setlocal completefunc=LaTeXtoUnicode#completefunc
|
||||
call s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
|
||||
|
||||
let b:l2u_prev_map_tab = s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
|
||||
imap <buffer> <Tab> <Plug>L2UTab
|
||||
inoremap <buffer><expr> <Plug>L2UTab LaTeXtoUnicode#Tab()
|
||||
augroup L2UTab
|
||||
autocmd! * <buffer>
|
||||
" Every time a completion finishes, the fallback may be invoked
|
||||
autocmd CompleteDone <buffer> call LaTeXtoUnicode#FallbackCallback()
|
||||
augroup END
|
||||
|
||||
|
||||
let b:l2u_tab_set = 1
|
||||
endfunction
|
||||
@@ -519,28 +598,37 @@ function! s:L2U_UnsetTab()
|
||||
endif
|
||||
if !b:l2u_tab_set
|
||||
return
|
||||
exec "setlocal omnifunc=" . get(b:, "prev_omnifunc", "")
|
||||
endif
|
||||
exec "setlocal completefunc=" . get(b:, "l2u_prev_completefunc", "")
|
||||
iunmap <buffer> <Tab>
|
||||
call s:L2U_SetFallbackMapping(s:l2u_fallback_trigger, '<Tab>')
|
||||
if empty(maparg("<Tab>", "i"))
|
||||
call s:L2U_ReinstateMapping(b:l2u_prev_map_tab)
|
||||
endif
|
||||
iunmap <buffer> <Plug>L2UTab
|
||||
augroup L2UTab
|
||||
autocmd! * <buffer>
|
||||
augroup END
|
||||
exe 'iunmap <buffer> ' . s:l2u_fallback_trigger
|
||||
let b:l2u_tab_set = 0
|
||||
endfunction
|
||||
|
||||
" Function which looks for viable LaTeX-to-Unicode supstitutions as you type
|
||||
function! LaTeXtoUnicode#AutoSub(...)
|
||||
" avoid recursive calls
|
||||
if get(b:, "l2u_in_autosub", 0)
|
||||
return ''
|
||||
endif
|
||||
let vc = a:0 == 0 ? v:char : a:1
|
||||
" for some reason function keys seem to be passed as characters 149 (F1-F12)
|
||||
" or 186 (F13-F37, these are entered with shift/ctrl). In such cases, we
|
||||
" can't really do any better than giving up.
|
||||
if char2nr(vc) == 149 || char2nr(vc) == 186
|
||||
return ''
|
||||
endif
|
||||
let b:l2u_in_autosub = 1
|
||||
let col1 = col('.')
|
||||
let lnum = line('.')
|
||||
if col1 == 1
|
||||
call feedkeys(a:2, 'n')
|
||||
if a:0 > 1
|
||||
call feedkeys(a:2, 'mi')
|
||||
endif
|
||||
let b:l2u_in_autosub = 0
|
||||
return ''
|
||||
endif
|
||||
@@ -548,21 +636,31 @@ function! LaTeXtoUnicode#AutoSub(...)
|
||||
let l = getline(lnum)[0 : col1-1-bs] . v:char
|
||||
let col0 = match(l, '\\\%([_^]\?[A-Za-z]\+\%' . col1 . 'c\%([^A-Za-z]\|$\)\|[_^]\%([0-9()=+-]\)\%' . col1 .'c\%(.\|$\)\)')
|
||||
if col0 == -1
|
||||
call feedkeys(a:2, 'n')
|
||||
if a:0 > 1
|
||||
call feedkeys(a:2, 'mi')
|
||||
endif
|
||||
let b:l2u_in_autosub = 0
|
||||
return ''
|
||||
let base = l[col0 : -1-bs]
|
||||
endif
|
||||
let base = l[col0 : col1-1-bs]
|
||||
let unicode = get(g:l2u_symbols_dict, base, '')
|
||||
if empty(unicode)
|
||||
call feedkeys(a:2, 'n')
|
||||
if a:0 > 1
|
||||
call feedkeys(a:2, 'mi')
|
||||
endif
|
||||
let b:l2u_in_autosub = 0
|
||||
return ''
|
||||
call feedkeys("\<C-G>u", 'n')
|
||||
call feedkeys(repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence, 'nt')
|
||||
call feedkeys("\<C-G>u", 'n')
|
||||
endif
|
||||
|
||||
" perform the substitution, wrapping it in undo breakpoints so that
|
||||
" we can revert it as a whole
|
||||
" at the end, reset the l2u_in_autosub variable without leaving insert mode
|
||||
" the 'i' mode is the only one that works correctly when executing macros
|
||||
" the 'n' mode is to avoid user-defined mappings of \b, <C-G> and <C-\><C-O>
|
||||
call feedkeys("\<C-G>u" .
|
||||
\ repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence .
|
||||
\ "\<C-G>u" .
|
||||
\ "\<C-\>\<C-O>:let b:l2u_in_autosub = 0\<CR>",
|
||||
\ 'ni')
|
||||
return ''
|
||||
endfunction
|
||||
@@ -581,8 +679,10 @@ function! s:L2U_SetAutoSub(wait_insert_enter)
|
||||
endif
|
||||
" Viable substitutions are searched at every character insertion via the
|
||||
" autocmd InsertCharPre. The <Enter> key does not seem to be catched in
|
||||
" this way though, so we use a mapping for that case.
|
||||
|
||||
let b:l2u_prev_map_cr = s:L2U_SetFallbackMapping('<CR>', s:l2u_fallback_trigger_cr)
|
||||
inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "\<CR>")
|
||||
imap <buffer> <CR> <Plug>L2UAutoSub
|
||||
exec 'inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "' . s:l2u_fallback_trigger_cr . '")'
|
||||
|
||||
augroup L2UAutoSub
|
||||
@@ -599,7 +699,11 @@ function! s:L2U_UnsetAutoSub()
|
||||
return
|
||||
endif
|
||||
|
||||
iunmap <buffer> <CR>
|
||||
if empty(maparg("<CR>", "i"))
|
||||
call s:L2U_ReinstateMapping(b:l2u_prev_map_cr)
|
||||
endif
|
||||
iunmap <buffer> <Plug>L2UAutoSub
|
||||
exe 'iunmap <buffer> ' . s:l2u_fallback_trigger_cr
|
||||
augroup L2UAutoSub
|
||||
autocmd! * <buffer>
|
||||
@@ -652,5 +756,3 @@ function! LaTeXtoUnicode#Toggle()
|
||||
echo "LaTeX-to-Unicode enabled"
|
||||
endif
|
||||
return ''
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rst', 'autoload/RstFold.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Author: Antony Lee <anntzer.lee@gmail.com>
|
||||
" Description: Helper functions for reStructuredText syntax folding
|
||||
@@ -62,5 +64,3 @@ function RstFold#GetRstFoldText()
|
||||
let text = thisline =~ '^\([=`:.''"~^_*+#-]\)\1\+$' ? getline(v:foldstart + 1) : thisline
|
||||
return indent . text
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ada') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'ada', 'autoload/ada.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Description: Perform Ada specific completion & tagging.
|
||||
@@ -69,13 +71,13 @@ if exists ('g:ada_with_gnat_project_files')
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Section: add standart exception {{{2
|
||||
" Section: add standard exception {{{2
|
||||
"
|
||||
for Item in ['Constraint_Error', 'Program_Error', 'Storage_Error', 'Tasking_Error', 'Status_Error', 'Mode_Error', 'Name_Error', 'Use_Error', 'Device_Error', 'End_Error', 'Data_Error', 'Layout_Error', 'Length_Error', 'Pattern_Error', 'Index_Error', 'Translation_Error', 'Time_Error', 'Argument_Error', 'Tag_Error', 'Picture_Error', 'Terminator_Error', 'Conversion_Error', 'Pointer_Error', 'Dereference_Error', 'Update_Error']
|
||||
let g:ada#Keywords += [{
|
||||
\ 'word': Item,
|
||||
\ 'menu': 'exception',
|
||||
\ 'info': 'Ada standart exception.',
|
||||
\ 'info': 'Ada standard exception.',
|
||||
\ 'kind': 'x',
|
||||
\ 'icase': 1}]
|
||||
endfor
|
||||
@@ -212,7 +214,7 @@ function ada#Word (...)
|
||||
let l:Line = substitute (getline (l:Line_Nr), g:ada#Comment, '', '' )
|
||||
|
||||
" Cope with tag searching for items in comments; if we are, don't loop
|
||||
" backards looking for previous lines
|
||||
" backwards looking for previous lines
|
||||
if l:Column_Nr > strlen(l:Line)
|
||||
" We were in a comment
|
||||
let l:Line = getline(l:Line_Nr)
|
||||
@@ -637,5 +639,3 @@ finish " 1}}}
|
||||
"------------------------------------------------------------------------------
|
||||
" vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
|
||||
" vim: foldmethod=marker
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rust', 'autoload/cargo.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! cargo#Load()
|
||||
" Utility call to get this script loaded, for debugging
|
||||
@@ -147,5 +149,3 @@ function! cargo#runtarget(args)
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rust', 'autoload/cargo/quickfix.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! cargo#quickfix#CmdPre() abort
|
||||
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo' &&
|
||||
@@ -27,5 +29,3 @@ function! cargo#quickfix#CmdPost() abort
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
||||
endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
autoload/coc/source/requirements.vim
Normal file
24
autoload/coc/source/requirements.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/coc/source/requirements.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
function! coc#source#requirements#init() abort
|
||||
return {
|
||||
\ 'shortcut': 'pip',
|
||||
\ 'priority': 9,
|
||||
\ 'filetypes': ['requirements'],
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
"
|
||||
" Completion pip option and PYPI package names.
|
||||
" Note: completion PYPI package names need install pip-cache from PYPI,
|
||||
" and run `pip-cache update` first to generate cache.
|
||||
function! coc#source#requirements#complete(opt, cb) abort
|
||||
call a:cb(g:requirements#items)
|
||||
endfunction
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'coffee-script', 'autoload/coffee.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <mick@kochm.co>
|
||||
@@ -54,5 +56,3 @@ function! coffee#CoffeeSetUpErrorFormat()
|
||||
\%f:%l:%c:\ error:\ %m,
|
||||
\%-G%.%#
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'crystal', 'autoload/crystal/indent.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Variables {{{1
|
||||
" =========
|
||||
@@ -94,7 +96,7 @@ lockvar g:crystal#indent#block_regex
|
||||
" Regex that defines the beginning of a hanging expression.
|
||||
let g:crystal#indent#hanging_assignment_regex =
|
||||
\ '\%('.g:crystal#indent#operator_regex.'\s*\)\@<=' .
|
||||
\ '\.\@1<!\<\%(if\||unless\|case\|begin\)\>'
|
||||
\ '\.\@1<!\<\%(if\||unless\|case\|begin\|select\)\>'
|
||||
lockvar g:crystal#indent#hanging_assignment_regex
|
||||
|
||||
" Regex that defines the start-match for the 'end' keyword.
|
||||
@@ -105,7 +107,7 @@ let g:crystal#indent#end_start_regex =
|
||||
\ '\%(\<\%(private\|protected\)\s\+\)\=' .
|
||||
\ '\%(\<\%(abstract\s\+\)\=\%(class\|struct\)\>\|\<\%(def\|module\|macro\|lib\|enum\|annotation\)\>\)' .
|
||||
\ '\|' .
|
||||
\ '\<\%(if\|unless\|while\|until\|case\|begin\|union\)\>' .
|
||||
\ '\<\%(if\|unless\|while\|until\|case\|begin\|union\|select\)\>' .
|
||||
\ '\)' .
|
||||
\ '\|' .
|
||||
\ g:crystal#indent#hanging_assignment_regex .
|
||||
@@ -1041,4 +1043,3 @@ endfunction
|
||||
" }}}1
|
||||
|
||||
" vim:sw=2 sts=2 ts=8 fdm=marker et:
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'crystal', 'autoload/crystal_lang.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:V = vital#crystal#new()
|
||||
let s:P = s:V.import('Process')
|
||||
@@ -363,5 +365,3 @@ function! crystal_lang#expand(file, pos, ...) abort
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 sts=2 et:
|
||||
|
||||
endif
|
||||
|
||||
132
autoload/csv.vim
132
autoload/csv.vim
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'csv') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'csv', 'autoload/csv.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Filetype plugin for editing CSV files. "{{{1
|
||||
" Author: Christian Brabandt <cb@256bit.org>
|
||||
@@ -12,7 +14,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'csv') == -1
|
||||
" Some ideas are taken from the wiki http://vim.wikia.com/wiki/VimTip667
|
||||
" though, implementation differs.
|
||||
|
||||
let s:csv_numeric_sort = v:version > 704 || v:version == 704 && has("patch341")
|
||||
let s:csv_numeric_sort = v:version > 704 || v:version == 704 && has("patch951")
|
||||
if !s:csv_numeric_sort "{{{2
|
||||
fu! csv#CSVSortValues(i1, i2) "{{{3
|
||||
return (a:i1+0) == (a:i2+0) ? 0 : (a:i1+0) > (a:i2+0) ? 1 : -1
|
||||
@@ -75,9 +77,13 @@ fu! csv#Init(start, end, ...) "{{{3
|
||||
endif
|
||||
|
||||
if empty(b:delimiter) && !exists("b:csv_fixed_width")
|
||||
if !exists("g:csv_default_delim")
|
||||
call csv#Warn("No delimiter found. See :h csv-delimiter to set it manually!")
|
||||
" Use a sane default as delimiter:
|
||||
let b:delimiter = ','
|
||||
else
|
||||
let b:delimiter = g:csv_default_delim
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:del='\%(' . b:delimiter . '\|$\)'
|
||||
@@ -216,6 +222,15 @@ fu! csv#LocalSettings(type) "{{{3
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#RemoveAutoHighlight() "{{{3
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au! CursorMoved <buffer=".bufnr('').">"
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
HiColumn!
|
||||
endfu
|
||||
|
||||
fu! csv#DoAutoCommands() "{{{3
|
||||
" Highlight column, on which the cursor is
|
||||
if exists("g:csv_highlight_column") && g:csv_highlight_column =~? 'y'
|
||||
@@ -227,12 +242,7 @@ fu! csv#DoAutoCommands() "{{{3
|
||||
" Set highlighting for column, on which the cursor is currently
|
||||
HiColumn
|
||||
else
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au! CursorMoved <buffer=".bufnr('').">"
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
HiColumn!
|
||||
call csv#RemoveAutoHighlight()
|
||||
endif
|
||||
" undo autocommand:
|
||||
let b:undo_ftplugin .= '| exe "sil! au! CSV_HI'.bufnr('').' CursorMoved <buffer> "'
|
||||
@@ -533,7 +543,7 @@ fu! csv#WColumn(...) "{{{3
|
||||
let temp=getpos('.')[2]
|
||||
let j=1
|
||||
let ret = 1
|
||||
for i in sort(b:csv_fixed_width_cols, s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
for i in sort(b:csv_fixed_width_cols, s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
if temp >= i
|
||||
let ret = j
|
||||
endif
|
||||
@@ -543,6 +553,9 @@ fu! csv#WColumn(...) "{{{3
|
||||
call setpos('.',_cur)
|
||||
return ret
|
||||
endfu
|
||||
fu! csv#ValidComment() "{{{3
|
||||
return b:csv_cmt != ['', ''] && !empty(b:csv_cmt[0])
|
||||
endfu
|
||||
fu! csv#MaxColumns(...) "{{{3
|
||||
let this_col = exists("a:1")
|
||||
"return maximum number of columns in first 10 lines
|
||||
@@ -555,8 +568,10 @@ fu! csv#MaxColumns(...) "{{{3
|
||||
endif
|
||||
|
||||
" Filter comments out
|
||||
if csv#ValidComment()
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(l, 'v:val !~ pat')
|
||||
endif
|
||||
if !empty(l) || this_col
|
||||
break
|
||||
else
|
||||
@@ -600,8 +615,10 @@ fu! csv#ColWidth(colnr, row, silent) "{{{3
|
||||
endif
|
||||
endif
|
||||
let b:csv_list=getline(skipfirst+1,last)
|
||||
if csv#ValidComment()
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(b:csv_list, 'v:val !~ pat')
|
||||
endif
|
||||
call filter(b:csv_list, '!empty(v:val)')
|
||||
call map(b:csv_list, 'split(v:val, b:col.''\zs'')')
|
||||
endif
|
||||
@@ -763,8 +780,7 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" row for the row for which to calculate the width
|
||||
let b:col_width=[]
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
let vts_save=&vts
|
||||
set vts=
|
||||
setlocal vts=
|
||||
endif
|
||||
try
|
||||
if exists("b:csv_headerline")
|
||||
@@ -784,9 +800,6 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" delete buffer content in variable b:csv_list,
|
||||
" this was only necessary for calculating the max width
|
||||
unlet! b:csv_list s:columnize_count s:decimal_column
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
let &vts=vts_save
|
||||
endif
|
||||
endfu
|
||||
fu! csv#Columnize(field) "{{{3
|
||||
" Internal function, not called from external,
|
||||
@@ -813,8 +826,8 @@ fu! csv#Columnize(field) "{{{3
|
||||
let colnr = s:columnize_count % s:max_cols
|
||||
let width = get(b:col_width, colnr, 20)
|
||||
let align = 'r'
|
||||
if exists('b:csv_arrange_align')
|
||||
let align=b:csv_arrange_align
|
||||
if exists('b:csv_arrange_align') || exists('g:csv_arrange_align')
|
||||
let align=get(b:, 'csv_arrange_align', g:csv_arrange_align)
|
||||
let indx=match(align, '\*')
|
||||
if indx > 0
|
||||
let align = align[0:(indx-1)]. repeat(align[indx-1], len(b:col_width)-indx)
|
||||
@@ -892,7 +905,7 @@ fu! csv#Columnize(field) "{{{3
|
||||
return result
|
||||
else
|
||||
" right align
|
||||
return printf("%*S", width+1 , a:field)
|
||||
return printf("%*S", width , a:field)
|
||||
endif
|
||||
endfun
|
||||
fu! csv#GetColPat(colnr, zs_flag) "{{{3
|
||||
@@ -906,21 +919,26 @@ fu! csv#GetColPat(colnr, zs_flag) "{{{3
|
||||
let pat='\%' . b:csv_fixed_width_cols[-1] . 'v.*'
|
||||
else
|
||||
let pat='\%' . b:csv_fixed_width_cols[(a:colnr - 1)] .
|
||||
\ 'c.\{-}\%' . b:csv_fixed_width_cols[a:colnr] . 'v'
|
||||
\ 'c.*\%<' . (b:csv_fixed_width_cols[a:colnr] + 1) . 'v'
|
||||
endif
|
||||
endif
|
||||
elseif !exists("b:csv_fixed_width_cols")
|
||||
let pat=b:col
|
||||
else
|
||||
let pat='\%' . b:csv_fixed_width_cols[0] . 'v.\{-}' .
|
||||
let pat='\%' . b:csv_fixed_width_cols[0] . 'v.*' .
|
||||
\ (len(b:csv_fixed_width_cols) > 1 ?
|
||||
\ '\%' . b:csv_fixed_width_cols[1] . 'v' :
|
||||
\ '\%<' . (b:csv_fixed_width_cols[1] + 1) . 'v' :
|
||||
\ '')
|
||||
endif
|
||||
return pat . (a:zs_flag ? '\zs' : '')
|
||||
endfu
|
||||
fu! csv#SetupAutoCmd(window,bufnr) "{{{3
|
||||
" Setup QuitPre autocommand to quit cleanly
|
||||
if a:bufnr == 0
|
||||
" something went wrong,
|
||||
" how can this happen?
|
||||
return
|
||||
endif
|
||||
aug CSV_QuitPre
|
||||
au!
|
||||
exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")"
|
||||
@@ -1011,7 +1029,7 @@ fu! csv#SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
" disable airline
|
||||
let w:airline_disabled = 1
|
||||
let win = winnr()
|
||||
setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted
|
||||
setl scrollbind buftype=nofile bufhidden=wipe noswapfile nobuflisted
|
||||
noa wincmd p
|
||||
let b:csv_SplitWindow = win
|
||||
aug CSV_Preview
|
||||
@@ -1109,7 +1127,12 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
|
||||
let pat=csv#GetColPat(1, 0)
|
||||
else
|
||||
" Move backwards
|
||||
if cpos == 1 && (exists("a:1") && a:1)
|
||||
" H move to previous line
|
||||
let pat=csv#GetColPat(maxcol, 0)
|
||||
else
|
||||
let pat='\%1v'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
@@ -1143,10 +1166,14 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
|
||||
" of a field.
|
||||
let epos = getpos('.')
|
||||
if getline('.')[col('.')-1] == ' '
|
||||
if !exists("b:csv_fixed_width_cols")
|
||||
call search('\S', 'W', line('.'))
|
||||
if getpos('.')[2] > spos
|
||||
call setpos('.', epos)
|
||||
endif
|
||||
elseif cpos > b:csv_fixed_width_cols[colnr]
|
||||
call search('\%'. b:csv_fixed_width_cols[colnr]. 'v', 'W', line('.'))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
@@ -1189,7 +1216,7 @@ endfun
|
||||
fu! csv#Sort(bang, line1, line2, colnr) range "{{{3
|
||||
" :Sort command
|
||||
let wsv = winsaveview()
|
||||
let flag = matchstr(a:colnr, '[nixo]')
|
||||
let flag = matchstr(a:colnr, '[nixof]')
|
||||
call csv#CheckHeaderLine()
|
||||
let line1 = a:line1
|
||||
let line2 = a:line2
|
||||
@@ -1240,8 +1267,10 @@ fu! csv#CopyCol(reg, col, cnt) "{{{3
|
||||
endfor
|
||||
endif
|
||||
" Filter comments out
|
||||
if csv#ValidComment()
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(a, 'v:val !~ pat')
|
||||
endif
|
||||
|
||||
if !exists("b:csv_fixed_width_cols")
|
||||
call map(a, 'split(v:val, ''^'' . b:col . ''\zs'')[col-1:cnt_cols]')
|
||||
@@ -1282,10 +1311,9 @@ fu! csv#MoveColumn(start, stop, ...) range "{{{3
|
||||
endif
|
||||
|
||||
" Swap line by line, instead of reading the whole range into memory
|
||||
|
||||
for i in range(a:start, a:stop)
|
||||
let content = getline(i)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt != ['',''] && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" skip comments
|
||||
continue
|
||||
endif
|
||||
@@ -1353,13 +1381,9 @@ fu! csv#DupColumn(start, stop, ...) range "{{{3
|
||||
" skipping comment lines (we could do it with a single :s statement,
|
||||
" but that would fail for the first and last column.
|
||||
|
||||
let commentpat = '\%(\%>'.(a:start-1).'l\V'.
|
||||
\ escape(b:csv_cmt[0], '\\').'\m\)'. '\&\%(\%<'.
|
||||
\ (a:stop+1). 'l\V'. escape(b:csv_cmt[0], '\\'). '\m\)'
|
||||
|
||||
for i in range(a:start, a:stop)
|
||||
let content = getline(i)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" skip comments
|
||||
continue
|
||||
endif
|
||||
@@ -1423,10 +1447,12 @@ fu! csv#AddColumn(start, stop, ...) range "{{{3
|
||||
" skipping comment lines (we could do it with a single :s statement,
|
||||
" but that would fail for the first and last column.
|
||||
|
||||
if b:csv_cmt != ['','']
|
||||
let commentpat = '\%(\%>'.(a:start-1).'l\V'.
|
||||
\ escape(b:csv_cmt[0], '\\').'\m\)'. '\&\%(\%<'.
|
||||
\ (a:stop+1). 'l\V'. escape(b:csv_cmt[0], '\\'). '\m\)'
|
||||
if search(commentpat)
|
||||
endif
|
||||
if !empty(commentpat) && search(commentpat)
|
||||
for i in range(a:start, a:stop)
|
||||
let content = getline(i)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
@@ -1605,7 +1631,7 @@ fu! csv#MaxColumn(list) "{{{3
|
||||
endtry
|
||||
call add(result, str2float(nr))
|
||||
endfor
|
||||
let result = sort(result, s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
let result = sort(result, s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
let ind = len(result) > 9 ? 9 : len(result)
|
||||
if has_key(get(s:, 'additional', {}), 'distinct') && s:additional['distinct']
|
||||
if exists("*uniq")
|
||||
@@ -1666,7 +1692,7 @@ fu! csv#DoForEachColumn(start, stop, bang) range "{{{3
|
||||
endif
|
||||
let t = g:csv_convert
|
||||
let line = getline(item)
|
||||
if line =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt!=['',''] && line =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" Filter comments out
|
||||
call add(result, line)
|
||||
continue
|
||||
@@ -1730,7 +1756,7 @@ fu! csv#FoldValue(lnum, filter) "{{{3
|
||||
for item in values(a:filter)
|
||||
" always fold comments away
|
||||
let content = getline(a:lnum)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt != ['',''] && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
return 1
|
||||
elseif eval('content' . (item.match ? '!~' : '=~') . 'item.pat')
|
||||
let result += 1
|
||||
@@ -1892,7 +1918,7 @@ fu! csv#GetColumn(line, col, strip) "{{{3
|
||||
" Return Column content at a:line, a:col
|
||||
let a=getline(a:line)
|
||||
" Filter comments out
|
||||
if a =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && a =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
return ''
|
||||
endif
|
||||
|
||||
@@ -1973,7 +1999,7 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
let res[item]+=1
|
||||
endfor
|
||||
|
||||
let max_items = reverse(sort(values(res), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues'))
|
||||
let max_items = reverse(sort(values(res), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues'))
|
||||
" What about the minimum 5 items?
|
||||
let count_items = keys(res)
|
||||
if len(max_items) > topn
|
||||
@@ -1983,7 +2009,6 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
endif
|
||||
|
||||
let title="Nr\tCount\t % \tValue"
|
||||
endif
|
||||
echohl Title
|
||||
echo printf("%s", title)
|
||||
echohl Normal
|
||||
@@ -2052,6 +2077,7 @@ fu! csv#InitCSVFixedWidth() "{{{3
|
||||
endif
|
||||
" Turn off syntax highlighting
|
||||
syn clear
|
||||
call csv#RemoveAutoHighlight()
|
||||
let max_line = line('$') > 10 ? 10 : line('$')
|
||||
let t = getline(1, max_line)
|
||||
let max_len = max(map(t, 'len(split(v:val, ''\zs''))'))
|
||||
@@ -2113,8 +2139,8 @@ fu! csv#InitCSVFixedWidth() "{{{3
|
||||
endw
|
||||
let b:csv_fixed_width_cols=[]
|
||||
let tcc=0
|
||||
let b:csv_fixed_width_cols = sort(keys(Dict), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
let b:csv_fixed_width = join(sort(keys(Dict), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues'), ',')
|
||||
let b:csv_fixed_width_cols = sort(keys(Dict), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
let b:csv_fixed_width = join(sort(keys(Dict), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues'), ',')
|
||||
call csv#Init(1, line('$'))
|
||||
|
||||
let &l:cc=_cc
|
||||
@@ -2194,7 +2220,15 @@ fu! csv#CSVMappings() "{{{3
|
||||
call csv#Map('nnoremap', 'W', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
call csv#Map('nnoremap', '<C-Right>', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
call csv#Map('nnoremap', 'L', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
try
|
||||
if get(g:, 'csv_bind_B', 0) == 1
|
||||
call csv#Map('nnoremap', 'B', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
|
||||
else
|
||||
call csv#Map('nnoremap', 'E', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
|
||||
endif
|
||||
catch
|
||||
call csv#Map('nnoremap', 'E', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
|
||||
endtry
|
||||
call csv#Map('nnoremap', '<C-Left>', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
|
||||
call csv#Map('nnoremap', 'H', ':<C-U>call csv#MoveCol(-1, line("."), 1)<CR>')
|
||||
call csv#Map('nnoremap', 'K', ':<C-U>call csv#MoveCol(0, line(".")-v:count1)<CR>')
|
||||
@@ -2305,7 +2339,7 @@ fu! csv#CommandDefinitions() "{{{3
|
||||
call csv#LocalCmd("NewDelimiter", ':call csv#NewDelimiter(<q-args>, 1, line(''$''))',
|
||||
\ '-nargs=1')
|
||||
call csv#LocalCmd("Duplicates", ':call csv#CheckDuplicates(<q-args>)',
|
||||
\ '-nargs=1 -complete=custom,csv#CompleteColumnNr')
|
||||
\ '-nargs=? -complete=custom,csv#CompleteColumnNr')
|
||||
call csv#LocalCmd('Transpose', ':call csv#Transpose(<line1>, <line2>)',
|
||||
\ '-range=%')
|
||||
call csv#LocalCmd('CSVTabularize', ':call csv#Tabularize(<bang>0,<line1>,<line2>)',
|
||||
@@ -2418,7 +2452,7 @@ fu! csv#NewDelimiter(newdelimiter, firstl, lastl) "{{{3
|
||||
let line=a:firstl
|
||||
while line <= a:lastl
|
||||
" Don't change delimiter for comments
|
||||
if getline(line) =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && getline(line) =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
let line+=1
|
||||
continue
|
||||
endif
|
||||
@@ -2463,7 +2497,7 @@ fu! csv#DuplicateRows(columnlist) "{{{3
|
||||
let i = 1
|
||||
let content = getline(line)
|
||||
" Skip comments
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
continue
|
||||
endif
|
||||
let cols = split(content, b:col. '\zs')
|
||||
@@ -2493,12 +2527,16 @@ fu! csv#CompleteColumnNr(A,L,P) "{{{3
|
||||
return join(range(1,csv#MaxColumns()), "\n")
|
||||
endfu
|
||||
fu! csv#CheckDuplicates(list) "{{{3
|
||||
if empty(a:list)
|
||||
let list=[csv#WColumn()]
|
||||
else
|
||||
let string = a:list
|
||||
if string =~ '\d\s\?-\s\?\d'
|
||||
let string = substitute(string, '\(\d\+\)\s\?-\s\?\(\d\+\)',
|
||||
\ '\=join(range(submatch(1),submatch(2)), ",")', '')
|
||||
endif
|
||||
let list=split(string, ',')
|
||||
endif
|
||||
call csv#DuplicateRows(list)
|
||||
endfu
|
||||
fu! csv#Transpose(line1, line2) "{{{3
|
||||
@@ -2515,7 +2553,11 @@ fu! csv#Transpose(line1, line2) "{{{3
|
||||
let TrailingDelim = getline(1) =~ b:delimiter.'$'
|
||||
endif
|
||||
|
||||
if b:csv_cmt != ['','']
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
else
|
||||
let pat = ''
|
||||
endif
|
||||
|
||||
try
|
||||
let columns = csv#MaxColumns(a:line1)
|
||||
@@ -2527,7 +2569,7 @@ fu! csv#Transpose(line1, line2) "{{{3
|
||||
let matrix = []
|
||||
for line in range(a:line1, a:line2)
|
||||
" Filter comments out
|
||||
if getline(line) =~ pat
|
||||
if !empty(pat) && getline(line) =~ pat
|
||||
continue
|
||||
endif
|
||||
let r = []
|
||||
@@ -2683,7 +2725,7 @@ fu! csv#Tabularize(bang, first, last) "{{{3
|
||||
if getline(a:first)[-1:] isnot? b:delimiter
|
||||
let b:col_width[-1] += 1
|
||||
endif
|
||||
let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val)'), s:td.cros). s:td.ecol
|
||||
let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val-1)'), s:td.cros). s:td.ecol
|
||||
|
||||
call csv#NewDelimiter(s:td.vbar, 1, line('$'))
|
||||
"exe printf('sil %d,%ds/%s/%s/ge', a:first, (a:last+adjust_last),
|
||||
@@ -3016,11 +3058,13 @@ fu! csv#SumCSVRow(line, nr) "{{{3
|
||||
endif
|
||||
let line=getline(ln)
|
||||
" Filter comments out
|
||||
if csv#ValidComment()
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if line =~ pat
|
||||
call csv#Warn("Invalid count specified")
|
||||
return
|
||||
endif
|
||||
endif
|
||||
let func='csv#SumColumn'
|
||||
let cells=split(line, b:col.'\zs')
|
||||
let cells=csv#GetCells(cells)
|
||||
@@ -3192,5 +3236,3 @@ endfun
|
||||
|
||||
" Vim Modeline " {{{2
|
||||
" vim: set foldmethod=marker et sw=0 sts=-1 ts=4:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'dart', 'autoload/dart.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
function! s:error(text) abort
|
||||
@@ -29,9 +31,9 @@ endfunction
|
||||
|
||||
function! dart#fmt(...) abort
|
||||
let l:dartfmt = s:FindDartFmt()
|
||||
if type(l:dartfmt) != type('') | return | endif
|
||||
if empty(l:dartfmt) | return | endif
|
||||
let buffer_content = getline(1, '$')
|
||||
let l:cmd = [l:dartfmt, '--stdin-name', shellescape(expand('%'))]
|
||||
let l:cmd = extend(l:dartfmt, ['--stdin-name', shellescape(expand('%'))])
|
||||
if exists('g:dartfmt_options')
|
||||
call extend(l:cmd, g:dartfmt_options)
|
||||
endif
|
||||
@@ -62,33 +64,37 @@ function! dart#fmt(...) abort
|
||||
endfunction
|
||||
|
||||
function! s:FindDartFmt() abort
|
||||
if executable('dartfmt') | return 'dartfmt' | endif
|
||||
if executable('dart')
|
||||
let l:version_text = system('dart --version')
|
||||
let l:match = matchlist(l:version_text,
|
||||
\ '\vDart SDK version: (\d+)\.(\d+)\.\d+.*')
|
||||
if empty(l:match)
|
||||
call s:error('Unable to determine dart version')
|
||||
return []
|
||||
endif
|
||||
let l:major = l:match[1]
|
||||
let l:minor = l:match[2]
|
||||
if l:major > 2 || l:major == 2 && l:minor >= 14
|
||||
return ['dart', 'format']
|
||||
endif
|
||||
endif
|
||||
" Legacy fallback for Dart SDK pre 2.14
|
||||
if executable('dartfmt') | return ['dartfmt'] | endif
|
||||
if executable('flutter')
|
||||
let l:flutter_cmd = resolve(exepath('flutter'))
|
||||
let l:bin = fnamemodify(l:flutter_cmd, ':h')
|
||||
let l:dartfmt = l:bin.'/cache/dart-sdk/bin/dartfmt'
|
||||
if executable(l:dartfmt) | return l:dartfmt | endif
|
||||
if executable(l:dartfmt) | return [l:dartfmt] | endif
|
||||
endif
|
||||
call s:error('Cannot find a `dartfmt` command')
|
||||
endfunction
|
||||
|
||||
function! dart#analyzer(q_args) abort
|
||||
call s:error('DartAnalyzer support has been removed. '.
|
||||
\'If this broke your workflow please comment on '.
|
||||
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||
endfunction
|
||||
|
||||
function! dart#tojs(q_args) abort
|
||||
call s:error('Dart2JS support has been removed. '.
|
||||
\'If this broke your workflow please comment on '.
|
||||
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||
return []
|
||||
endfunction
|
||||
|
||||
" Finds the path to `uri`.
|
||||
"
|
||||
" If the file is a package: uri, looks for a .packages file to resolve the path.
|
||||
" If the path cannot be resolved, or is not a package: uri, returns the
|
||||
" original.
|
||||
" If the file is a package: uri, looks for a package_config.json or .packages
|
||||
" file to resolve the path. If the path cannot be resolved, or is not a
|
||||
" package: uri, returns the original.
|
||||
function! dart#resolveUri(uri) abort
|
||||
if a:uri !~# 'package:'
|
||||
return a:uri
|
||||
@@ -96,7 +102,7 @@ function! dart#resolveUri(uri) abort
|
||||
let package_name = substitute(a:uri, 'package:\(\w\+\)\/.*', '\1', '')
|
||||
let [found, package_map] = s:PackageMap()
|
||||
if !found
|
||||
call s:error('cannot find .packages file')
|
||||
call s:error('cannot find .packages or package_config.json file')
|
||||
return a:uri
|
||||
endif
|
||||
if !has_key(package_map, package_name)
|
||||
@@ -110,14 +116,38 @@ function! dart#resolveUri(uri) abort
|
||||
\ '')
|
||||
endfunction
|
||||
|
||||
" A map from package name to lib directory parse from a '.packages' file.
|
||||
" A map from package name to lib directory parse from a 'package_config.json'
|
||||
" or '.packages' file.
|
||||
"
|
||||
" Returns [found, package_map]
|
||||
function! s:PackageMap() abort
|
||||
let [found, dot_packages] = s:DotPackagesFile()
|
||||
if !found
|
||||
let [found, package_config] = s:FindFile('.dart_tool/package_config.json')
|
||||
if found
|
||||
let dart_tool_dir = fnamemodify(package_config, ':p:h')
|
||||
let content = join(readfile(package_config), "\n")
|
||||
let packages_dict = json_decode(content)
|
||||
if packages_dict['configVersion'] != '2'
|
||||
s:error('Unsupported version of package_config.json')
|
||||
return [v:false, {}]
|
||||
endif
|
||||
let map = {}
|
||||
for package in packages_dict['packages']
|
||||
let name = package['name']
|
||||
let uri = package['rootUri']
|
||||
let package_uri = package['packageUri']
|
||||
if uri =~# 'file:/'
|
||||
let uri = substitute(uri, 'file://', '', '')
|
||||
let lib_dir = resolve(uri.'/'.package_uri)
|
||||
else
|
||||
let lib_dir = resolve(dart_tool_dir.'/'.uri.'/'.package_uri)
|
||||
endif
|
||||
let map[name] = lib_dir
|
||||
endfor
|
||||
return [v:true, map]
|
||||
endif
|
||||
|
||||
let [found, dot_packages] = s:FindFile('.packages')
|
||||
if found
|
||||
let dot_packages_dir = fnamemodify(dot_packages, ':p:h')
|
||||
let lines = readfile(dot_packages)
|
||||
let map = {}
|
||||
@@ -141,6 +171,8 @@ function! s:PackageMap() abort
|
||||
let map[package] = lib_dir
|
||||
endfor
|
||||
return [v:true, map]
|
||||
endif
|
||||
return [v:false, {}]
|
||||
endfunction
|
||||
|
||||
" Toggle whether dartfmt is run on save or not.
|
||||
@@ -152,17 +184,17 @@ function! dart#ToggleFormatOnSave() abort
|
||||
let g:dart_format_on_save = 1
|
||||
endfunction
|
||||
|
||||
" Finds a file name '.packages' in the cwd, or in any directory above the open
|
||||
" Finds a file named [a:path] in the cwd, or in any directory above the open
|
||||
" file.
|
||||
"
|
||||
" Returns [found, file].
|
||||
function! s:DotPackagesFile() abort
|
||||
if filereadable('.packages')
|
||||
return [v:true, '.packages']
|
||||
" Returns [found, file]
|
||||
function! s:FindFile(path) abort
|
||||
if filereadable(a:path)
|
||||
return [v:true, a:path]
|
||||
endif
|
||||
let dir_path = expand('%:p:h')
|
||||
while v:true
|
||||
let file_path = dir_path.'/.packages'
|
||||
let file_path = dir_path.'/'.a:path
|
||||
if filereadable(file_path)
|
||||
return [v:true, file_path]
|
||||
endif
|
||||
@@ -183,5 +215,3 @@ function! dart#setModifiable() abort
|
||||
setlocal nomodifiable
|
||||
endif
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'elixir', 'autoload/db/adapter/ecto.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:path = expand('<sfile>:h')
|
||||
let s:cmd = join(['mix', 'run', '--no-start', '--no-compile', shellescape(s:path.'/get_repos.exs')])
|
||||
@@ -20,5 +22,3 @@ endfunction
|
||||
function! db#adapter#ecto#complete_opaque(url) abort
|
||||
return map(s:repo_list(), 'v:val[0]')
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'crystal', 'autoload/ecrystal.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:ecrystal_extensions = {
|
||||
\ 'cr': 'crystal',
|
||||
@@ -32,5 +34,3 @@ function! ecrystal#SetSubtype() abort
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 sts=2 et:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'elixir', 'autoload/elixir/indent.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:elixir_indent_max_lookbehind")
|
||||
let g:elixir_indent_max_lookbehind = 30
|
||||
@@ -22,6 +24,7 @@ function! elixir#indent#indent(lnum)
|
||||
call cursor(lnum, 0)
|
||||
|
||||
let handlers = [
|
||||
\'inside_embedded_view',
|
||||
\'top_of_file',
|
||||
\'starts_with_string_continuation',
|
||||
\'following_trailing_binary_operator',
|
||||
@@ -67,6 +70,17 @@ function! s:prev_starts_with(context, expr)
|
||||
return s:_starts_with(a:context.prev_nb_text, a:expr, a:context.prev_nb_lnum)
|
||||
endfunction
|
||||
|
||||
function! s:in_embedded_view()
|
||||
let groups = map(synstack(line('.'), col('.')), "synIDattr(v:val, 'name')")
|
||||
for group in ['elixirPhoenixESigil', 'elixirLiveViewSigil', 'elixirSurfaceSigil']
|
||||
if index(groups, group) >= 0
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" Returns 0 or 1 based on whether or not the text starts with the given
|
||||
" expression and is not a string or comment
|
||||
function! s:_starts_with(text, expr, lnum)
|
||||
@@ -106,7 +120,7 @@ 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 s:syntax_name(a:line, a:col) =~ '\%(String\|Comment\)'
|
||||
return s:syntax_name(a:line, a:col) =~ '\%(String\|Comment\|CharList\)'
|
||||
endfunction
|
||||
|
||||
function! s:syntax_name(line, col)
|
||||
@@ -147,7 +161,7 @@ function! s:find_last_pos(lnum, text, match)
|
||||
let peek_match = match(peek, a:match)
|
||||
if peek_match == ss_match + 1
|
||||
let syng = synIDattr(synID(a:lnum, c + ss_match, 1), 'name')
|
||||
if syng !~ '\%(String\|Comment\)'
|
||||
if syng !~ '\%(String\|Comment\|CharList\)'
|
||||
return c + ss_match
|
||||
end
|
||||
end
|
||||
@@ -158,6 +172,104 @@ function! s:find_last_pos(lnum, text, match)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_inside_embedded_view(context)
|
||||
if !s:in_embedded_view()
|
||||
return -1
|
||||
endif
|
||||
|
||||
" Multi-line Surface data delimiters
|
||||
let pair_lnum = searchpair('{{', '', '}}', 'bW', "line('.') == ".a:context.lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
if pair_lnum
|
||||
if a:context.text =~ '}}$'
|
||||
return indent(pair_lnum)
|
||||
elseif a:context.text =~ '}}*>$'
|
||||
return -1
|
||||
elseif s:prev_ends_with(a:context, '[\|%{')
|
||||
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||
elseif a:context.prev_nb_text =~ ',$'
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
else
|
||||
return indent(pair_lnum) + s:sw()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Multi-line opening tag -- >, />, or %> are on a different line that their opening <
|
||||
let pair_lnum = searchpair('^\s\+<.*[^>]$', '', '^[^<]*[/%}]\?>$', 'bW', "line('.') == ".a:context.lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
if pair_lnum
|
||||
if a:context.text =~ '^\s\+\%\(>\|\/>\|%>\|}}>\)$'
|
||||
call s:debug("current line is a lone >, />, or %>")
|
||||
return indent(pair_lnum)
|
||||
elseif a:context.text =~ '\%\(>\|\/>\|%>\|}}>\)$'
|
||||
call s:debug("current line ends in >, />, or %>")
|
||||
if s:prev_ends_with(a:context, ',')
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
else
|
||||
call s:debug("in the body of a multi-line opening tag")
|
||||
return indent(pair_lnum) + s:sw()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Special cases
|
||||
if s:prev_ends_with(a:context, '^[^<]*do\s%>')
|
||||
call s:debug("prev line closes a multi-line do block")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif a:context.prev_nb_text =~ 'do\s*%>$'
|
||||
call s:debug("prev line opens a do block")
|
||||
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||
elseif a:context.text =~ '^\s\+<\/[a-zA-Z0-9\.\-_]\+>\|<% end %>'
|
||||
call s:debug("a single closing tag")
|
||||
if a:context.prev_nb_text =~ '^\s\+<[^%\/]*[^/]>.*<\/[a-zA-Z0-9\.\-_]\+>$'
|
||||
call s:debug("opening and closing tags are on the same line")
|
||||
return indent(a:context.prev_nb_lnum) - s:sw()
|
||||
elseif a:context.prev_nb_text =~ '^\s\+<[^%\/]*[^/]>\|\s\+>'
|
||||
call s:debug("prev line is opening html tag or single >")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif s:prev_ends_with(a:context, '^[^<]*\%\(do\s\)\@<!%>')
|
||||
call s:debug("prev line closes a multi-line eex tag")
|
||||
return indent(a:context.prev_nb_lnum) - 2 * s:sw()
|
||||
else
|
||||
return indent(a:context.prev_nb_lnum) - s:sw()
|
||||
endif
|
||||
elseif a:context.text =~ '^\s*<%\s*\%(end\|else\|catch\|rescue\)\>.*%>'
|
||||
call s:debug("eex middle or closing eex tag")
|
||||
return indent(a:context.prev_nb_lnum) - s:sw()
|
||||
elseif a:context.prev_nb_text =~ '\s*<\/\|<% end %>$'
|
||||
call s:debug("prev is closing tag")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif a:context.prev_nb_text =~ '^\s\+<[^%\/]*[^/]>.*<\/[a-zA-Z0-9\.\-_]\+>$'
|
||||
call s:debug("opening and closing tags are on the same line")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif s:prev_ends_with(a:context, '\s\+\/>')
|
||||
call s:debug("prev ends with a single \>")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif s:prev_ends_with(a:context, '^[^<]*\/>')
|
||||
call s:debug("prev line is closing a multi-line self-closing tag")
|
||||
return indent(a:context.prev_nb_lnum) - s:sw()
|
||||
elseif s:prev_ends_with(a:context, '^\s\+<.*\/>')
|
||||
call s:debug("prev line is closing self-closing tag")
|
||||
return indent(a:context.prev_nb_lnum)
|
||||
elseif a:context.prev_nb_text =~ '^\s\+%\?>$'
|
||||
call s:debug("prev line is a single > or %>")
|
||||
return indent(a:context.prev_nb_lnum) + s:sw()
|
||||
endif
|
||||
|
||||
" Simple HTML (ie, opening tag is not split across lines)
|
||||
let pair_lnum = searchpair('^\s\+<[^%\/].*[^\/>]>$', '', '^\s\+<\/\w\+>$', 'bW', "line('.') == ".a:context.lnum." || s:is_string_or_comment(line('.'), col('.'))", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
if pair_lnum
|
||||
call s:debug("simple HTML")
|
||||
if a:context.text =~ '^\s\+<\/\w\+>$'
|
||||
return indent(pair_lnum)
|
||||
else
|
||||
return indent(pair_lnum) + s:sw()
|
||||
endif
|
||||
endif
|
||||
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! elixir#indent#handle_top_of_file(context)
|
||||
if a:context.prev_nb_lnum == 0
|
||||
return 0
|
||||
@@ -167,7 +279,7 @@ function! elixir#indent#handle_top_of_file(context)
|
||||
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\)$'
|
||||
if s:syntax_name(a:context.lnum, a:context.first_nb_char_idx) =~ '\(String\|Comment\|CharList\)$'
|
||||
return -2
|
||||
else
|
||||
return -1
|
||||
@@ -276,12 +388,14 @@ function! elixir#indent#handle_inside_block(context)
|
||||
" hack - handle do: better
|
||||
let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
let block_start_lnum = block_info[0]
|
||||
call s:debug("block_start_lnum=" . block_start_lnum)
|
||||
let block_start_col = block_info[1]
|
||||
if block_start_lnum != 0 || block_start_col != 0
|
||||
let block_text = getline(block_start_lnum)
|
||||
let block_start_char = block_text[block_start_col - 1]
|
||||
call s:debug("block_start_char=" . block_start_char)
|
||||
|
||||
let never_match = '\(a\)\@=b'
|
||||
let never_match = ''
|
||||
let config = {
|
||||
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
@@ -293,17 +407,25 @@ function! elixir#indent#handle_inside_block(context)
|
||||
\'(': {'aligned_clauses': ')', 'pattern_match_clauses': never_match}
|
||||
\}
|
||||
|
||||
" if `with` clause...
|
||||
if block_start_char == 'w'
|
||||
call s:debug("testing s:handle_with")
|
||||
return s:handle_with(block_start_lnum, block_start_col, a:context)
|
||||
else
|
||||
let block_config = config[block_start_char]
|
||||
" if aligned clause (closing tag/`else` clause/etc...) then indent this
|
||||
" at the same level as the block open tag (e.g. `if`/`case`/etc...)
|
||||
if s:starts_with(a:context, block_config.aligned_clauses)
|
||||
call s:debug("clause")
|
||||
return indent(block_start_lnum)
|
||||
else
|
||||
if block_config.pattern_match_clauses == never_match
|
||||
let relative_lnum = block_start_lnum
|
||||
else
|
||||
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
|
||||
call s:debug("clause_lum=" . clause_lnum)
|
||||
let relative_lnum = max([clause_lnum, block_start_lnum])
|
||||
end
|
||||
call s:debug("pattern matching relative to lnum " . relative_lnum)
|
||||
return s:do_handle_pattern_match_block(relative_lnum, a:context)
|
||||
endif
|
||||
@@ -361,5 +483,3 @@ function! elixir#indent#handle_inside_generic_block(context)
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'elixir', 'autoload/elixir/util.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! elixir#util#get_filename(word) abort
|
||||
let word = a:word
|
||||
@@ -24,5 +26,3 @@ function! elixir#util#get_filename(word) abort
|
||||
|
||||
return word
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,43 +1,111 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'fish', 'autoload/fish.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:IsString(lnum, col)
|
||||
" Returns "true" if syntax item at the given position is part of fishString.
|
||||
let l:stack = map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")')
|
||||
return len(filter(l:stack, 'v:val ==# "fishString"'))
|
||||
endfunction
|
||||
|
||||
function! s:IsContinuedLine(lnum)
|
||||
" Returns "true" if the given line is a continued line.
|
||||
return getline(a:lnum - 1) =~ '\v\\$'
|
||||
endfunction
|
||||
|
||||
function! s:FindPrevLnum(lnum)
|
||||
" Starting on the given line, search backwards for a line that is not
|
||||
" empty, not part of a string and not a continued line.
|
||||
if a:lnum < 1 || a:lnum > line('$')
|
||||
" First line or wrong value, follow prevnonblank() behaviour and
|
||||
" return zero.
|
||||
return 0
|
||||
endif
|
||||
let l:lnum = prevnonblank(a:lnum)
|
||||
while l:lnum > 0 && ( s:IsContinuedLine(l:lnum) || s:IsString(l:lnum, 1) )
|
||||
let l:lnum = prevnonblank(l:lnum - 1)
|
||||
endwhile
|
||||
return l:lnum
|
||||
endfunction
|
||||
|
||||
function! s:IsSwitch(lnum)
|
||||
" Returns "true" if the given line is part of a switch block.
|
||||
let l:lnum = a:lnum
|
||||
let l:line = getline(l:lnum)
|
||||
let l:in_block = 0
|
||||
let l:stop_pat = '\v^\s*%(if|else|while|for|begin)>'
|
||||
let l:block_start_pat = '\v^\s*%(if|while|for|switch|begin)>'
|
||||
while l:lnum > 0
|
||||
let l:lnum = prevnonblank(l:lnum - 1)
|
||||
let l:line = getline(l:lnum)
|
||||
if l:line =~# '\v^\s*end>'
|
||||
let l:in_block += 1
|
||||
elseif l:in_block && l:line =~# l:block_start_pat
|
||||
let l:in_block -= 1
|
||||
elseif !l:in_block && l:line =~# l:stop_pat
|
||||
return 0
|
||||
elseif !l:in_block && l:line =~# '\v^\s*switch>'
|
||||
return 1
|
||||
endif
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! fish#Indent()
|
||||
let l:prevlnum = prevnonblank(v:lnum - 1)
|
||||
if l:prevlnum ==# 0
|
||||
return 0
|
||||
endif
|
||||
let l:prevline = getline(l:prevlnum)
|
||||
let l:line = getline(v:lnum)
|
||||
if s:IsString(v:lnum, 1)
|
||||
return indent(v:lnum)
|
||||
endif
|
||||
" shiftwidth can be misleading in recent versions, use shiftwidth() if
|
||||
" it is available.
|
||||
if exists('*shiftwidth')
|
||||
let l:shiftwidth = shiftwidth()
|
||||
let l:previndent = indent(l:prevlnum)
|
||||
let l:indent = l:previndent
|
||||
if l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|switch|case)>'
|
||||
let l:indent += l:shiftwidth
|
||||
endif
|
||||
if l:line =~# '\v^\s*end>'
|
||||
let l:indent -= l:shiftwidth
|
||||
" If we're inside a case, dedent twice because it ends the switch.
|
||||
if l:prevline =~# '\v^\s*case>'
|
||||
" Previous line starts the case.
|
||||
let l:indent -= l:shiftwidth
|
||||
else
|
||||
" Scan back to a dedented line to find whether we're in a case.
|
||||
let l:i = l:prevlnum
|
||||
while l:i >= 1 && indent(l:i) >= l:previndent
|
||||
let l:i = prevnonblank(l:i - 1)
|
||||
endwhile
|
||||
if indent(l:i) < l:previndent && getline(l:i) =~# '\v^\s*case>'
|
||||
let l:indent -= l:shiftwidth
|
||||
let l:shiftwidth = &shiftwidth
|
||||
endif
|
||||
endif
|
||||
elseif l:line =~# '\v^\s*else>'
|
||||
let l:indent -= l:shiftwidth
|
||||
elseif l:prevline !~# '\v^\s*switch>' && l:line =~# '\v^\s*case>'
|
||||
let l:indent -= l:shiftwidth
|
||||
endif
|
||||
if l:indent < 0
|
||||
let l:prevlnum = s:FindPrevLnum(v:lnum - 1)
|
||||
if l:prevlnum == 0
|
||||
return 0
|
||||
endif
|
||||
return l:indent
|
||||
let l:shift = 0
|
||||
let l:prevline = getline(l:prevlnum)
|
||||
let l:previndent = indent(l:prevlnum)
|
||||
if s:IsContinuedLine(v:lnum)
|
||||
let l:previndent = indent(v:lnum - 1)
|
||||
if s:IsContinuedLine(v:lnum - 1)
|
||||
return l:previndent
|
||||
elseif exists('g:fish_indent_cont')
|
||||
return l:previndent + g:fish_indent_cont
|
||||
elseif exists('g:indent_cont')
|
||||
return l:previndent + g:indent_cont
|
||||
else
|
||||
return l:previndent + l:shiftwidth
|
||||
endif
|
||||
endif
|
||||
if l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case|switch)>'
|
||||
" First line inside a block, increase by one.
|
||||
let l:shift += 1
|
||||
endif
|
||||
if l:line =~# '\v^\s*%(end|case|else)>'
|
||||
" "end", "case" or "else", decrease by one.
|
||||
let l:shift -= 1
|
||||
endif
|
||||
if l:line =~# '\v^\s*<case>' && l:prevline =~# '\v<switch>'
|
||||
" "case" following "switch", increase by one.
|
||||
let l:shift += 1
|
||||
endif
|
||||
if l:line =~# '\v\s*end>' && s:IsSwitch(v:lnum)
|
||||
" "end" ends switch block, decrease by one more so it matches
|
||||
" the indentation of "switch".
|
||||
let l:shift -= 1
|
||||
endif
|
||||
if l:prevline =~# '\v^\s*%(if|while|for|else|switch|end)>.*<begin>'
|
||||
" "begin" after start of block, increase by one.
|
||||
let l:shift += 1
|
||||
endif
|
||||
let l:indent = l:previndent + l:shift * l:shiftwidth
|
||||
" Only return zero or positive numbers.
|
||||
return l:indent < 0 ? 0 : l:indent
|
||||
endfunction
|
||||
|
||||
function! fish#Format()
|
||||
@@ -47,6 +115,8 @@ function! fish#Format()
|
||||
let l:command = v:lnum.','.(v:lnum+v:count-1).'!fish_indent'
|
||||
echo l:command
|
||||
execute l:command
|
||||
" Fix indentation and replace tabs with spaces if necessary.
|
||||
normal! '[=']
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -85,5 +155,3 @@ endfunction
|
||||
function! fish#errorformat()
|
||||
return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s'
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
45
autoload/freebasic.vim
Normal file
45
autoload/freebasic.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'freebasic', 'autoload/freebasic.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: FreeBASIC
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2021 Mar 16
|
||||
|
||||
" Dialects can be one of fb, qb, fblite, or deprecated
|
||||
" Precedence is forcelang > #lang > lang
|
||||
function! freebasic#GetDialect() abort
|
||||
if exists("g:freebasic_forcelang")
|
||||
return g:freebasic_forcelang
|
||||
endif
|
||||
|
||||
if exists("g:freebasic_lang")
|
||||
let dialect = g:freebasic_lang
|
||||
else
|
||||
let dialect = "fb"
|
||||
endif
|
||||
|
||||
" override with #lang directive or metacommand
|
||||
|
||||
let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
|
||||
let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
|
||||
|
||||
let save_cursor = getcurpos()
|
||||
call cursor(1, 1)
|
||||
let lnum = search(pat, 'n', '', '', skip)
|
||||
call setpos('.', save_cursor)
|
||||
|
||||
if lnum
|
||||
let word = matchlist(getline(lnum), pat)[1]
|
||||
if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
|
||||
let dialect = word
|
||||
else
|
||||
echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
return dialect
|
||||
endfunction
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
||||
@@ -1,7 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'fsharp', 'autoload/fsharp.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim autoload functions
|
||||
|
||||
if exists('g:loaded_autoload_fsharp')
|
||||
finish
|
||||
endif
|
||||
@@ -10,6 +11,15 @@ let g:loaded_autoload_fsharp = 1
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
" basic setups
|
||||
|
||||
let s:script_root_dir = expand('<sfile>:p:h') . "/../"
|
||||
|
||||
if has('nvim-0.5')
|
||||
lua ionide = require("ionide")
|
||||
endif
|
||||
|
||||
function! s:prompt(msg)
|
||||
let height = &cmdheight
|
||||
if height < 2
|
||||
@@ -19,6 +29,9 @@ function! s:prompt(msg)
|
||||
let &cmdheight = height
|
||||
endfunction
|
||||
|
||||
|
||||
" FSAC payload interfaces
|
||||
|
||||
function! s:PlainNotification(content)
|
||||
return { 'Content': a:content }
|
||||
endfunction
|
||||
@@ -78,8 +91,24 @@ function! s:FsdnRequest(query)
|
||||
return { 'Query': a:query }
|
||||
endfunction
|
||||
|
||||
|
||||
" LSP functions
|
||||
|
||||
function! s:call(method, params, cont)
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#Call(a:method, a:params, a:cont)
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
let key = fsharp#register_callback(a:cont)
|
||||
call luaeval('ionide.call(_A[1], _A[2], _A[3])', [a:method, a:params, key])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:notify(method, params)
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#Notify(a:method, a:params)
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
call luaeval('ionide.notify(_A[1], _A[2])', [a:method, a:params])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:signature(filePath, line, character, cont)
|
||||
@@ -119,6 +148,9 @@ function! s:documentationSymbol(xmlSig, assembly, cont)
|
||||
return s:call('fsharp/documentationSymbol', s:DocumentationForSymbolRequest(a:xmlSig, a:assembly), a:cont)
|
||||
endfunction
|
||||
|
||||
|
||||
" FSAC configuration
|
||||
|
||||
" FSharpConfigDto from https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete/LspHelpers.fs
|
||||
"
|
||||
" * The following options seems not working with workspace/didChangeConfiguration
|
||||
@@ -151,14 +183,14 @@ let s:config_keys_camel =
|
||||
\ {'key': 'EnableAnalyzers', 'default': 0},
|
||||
\ {'key': 'AnalyzersPath'},
|
||||
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'replaceCodeLens', 'prefix': '//'}},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'never', 'prefix': ''}},
|
||||
\ {'key': 'UseSdkScripts', 'default': 1},
|
||||
\ {'key': 'dotNetRoot'},
|
||||
\ {'key': 'fsiExtraParameters', 'default': []},
|
||||
\ ]
|
||||
let s:config_keys = []
|
||||
|
||||
function! fsharp#toSnakeCase(str)
|
||||
function! s:toSnakeCase(str)
|
||||
let sn = substitute(a:str, '\(\<\u\l\+\|\l\+\)\(\u\)', '\l\1_\l\2', 'g')
|
||||
if sn == a:str | return tolower(a:str) | endif
|
||||
return sn
|
||||
@@ -168,7 +200,7 @@ function! s:buildConfigKeys()
|
||||
if len(s:config_keys) == 0
|
||||
for key_camel in s:config_keys_camel
|
||||
let key = {}
|
||||
let key.snake = fsharp#toSnakeCase(key_camel.key)
|
||||
let key.snake = s:toSnakeCase(key_camel.key)
|
||||
let key.camel = key_camel.key
|
||||
if has_key(key_camel, 'default')
|
||||
let key.default = key_camel.default
|
||||
@@ -178,7 +210,7 @@ function! s:buildConfigKeys()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! g:fsharp#getServerConfig()
|
||||
function! fsharp#getServerConfig()
|
||||
let fsharp = {}
|
||||
call s:buildConfigKeys()
|
||||
for key in s:config_keys
|
||||
@@ -194,54 +226,205 @@ function! g:fsharp#getServerConfig()
|
||||
return fsharp
|
||||
endfunction
|
||||
|
||||
function! g:fsharp#updateServerConfig()
|
||||
function! fsharp#updateServerConfig()
|
||||
let fsharp = fsharp#getServerConfig()
|
||||
let settings = {'settings': {'FSharp': fsharp}}
|
||||
call LanguageClient#Notify('workspace/didChangeConfiguration', settings)
|
||||
call s:notify('workspace/didChangeConfiguration', settings)
|
||||
endfunction
|
||||
|
||||
function! s:findWorkspace(dir, cont)
|
||||
let s:cont_findWorkspace = a:cont
|
||||
function! s:callback_findWorkspace(result)
|
||||
let result = a:result
|
||||
let content = json_decode(result.result.content)
|
||||
if len(content.Data.Found) < 1
|
||||
return []
|
||||
function! fsharp#loadConfig()
|
||||
if exists('s:config_is_loaded')
|
||||
return
|
||||
endif
|
||||
let workspace = { 'Type': 'none' }
|
||||
for found in content.Data.Found
|
||||
if workspace.Type == 'none'
|
||||
let workspace = found
|
||||
elseif found.Type == 'solution'
|
||||
if workspace.Type == 'project'
|
||||
let workspace = found
|
||||
|
||||
if !exists('g:fsharp#fsautocomplete_command')
|
||||
let g:fsharp#fsautocomplete_command = ['fsautocomplete', '--background-service-enabled']
|
||||
endif
|
||||
if !exists('g:fsharp#use_recommended_server_config')
|
||||
let g:fsharp#use_recommended_server_config = 1
|
||||
endif
|
||||
call fsharp#getServerConfig()
|
||||
if !exists('g:fsharp#automatic_workspace_init')
|
||||
let g:fsharp#automatic_workspace_init = 1
|
||||
endif
|
||||
if !exists('g:fsharp#automatic_reload_workspace')
|
||||
let g:fsharp#automatic_reload_workspace = 1
|
||||
endif
|
||||
if !exists('g:fsharp#show_signature_on_cursor_move')
|
||||
let g:fsharp#show_signature_on_cursor_move = 0
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_command')
|
||||
let g:fsharp#fsi_command = "dotnet fsi"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_keymap')
|
||||
let g:fsharp#fsi_keymap = "vscode"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_window_command')
|
||||
let g:fsharp#fsi_window_command = "botright 10new"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_focus_on_send')
|
||||
let g:fsharp#fsi_focus_on_send = 0
|
||||
endif
|
||||
if !exists('g:fsharp#backend')
|
||||
if has('nvim-0.5')
|
||||
if exists('g:LanguageClient_loaded')
|
||||
let g:fsharp#backend = "languageclient-neovim"
|
||||
else
|
||||
let curLen = len(workspace.Data.Items)
|
||||
let newLen = len(found.Data.Items)
|
||||
if newLen > curLen
|
||||
let workspace = found
|
||||
let g:fsharp#backend = "nvim"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if workspace.Type == 'solution'
|
||||
call s:cont_findWorkspace([workspace.Data.Path])
|
||||
else
|
||||
call s:cont_findWorkspace(workspace.Data.Fsprojs)
|
||||
let g:fsharp#backend = "languageclient-neovim"
|
||||
endif
|
||||
endfunction
|
||||
call s:workspacePeek(a:dir, g:fsharp#workspace_mode_peek_deep_level, g:fsharp#exclude_project_directories, function("s:callback_findWorkspace"))
|
||||
endif
|
||||
|
||||
" backend configuration
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
let $DOTNET_ROLL_FORWARD='LatestMajor'
|
||||
if !exists('g:LanguageClient_serverCommands')
|
||||
let g:LanguageClient_serverCommands = {}
|
||||
endif
|
||||
if !has_key(g:LanguageClient_serverCommands, 'fsharp')
|
||||
let g:LanguageClient_serverCommands.fsharp = {
|
||||
\ 'name': 'fsautocomplete',
|
||||
\ 'command': g:fsharp#fsautocomplete_command,
|
||||
\ 'initializationOptions': {},
|
||||
\}
|
||||
if g:fsharp#automatic_workspace_init
|
||||
let g:LanguageClient_serverCommands.fsharp.initializationOptions = {
|
||||
\ 'AutomaticWorkspaceInit': v:true,
|
||||
\}
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists('g:LanguageClient_rootMarkers')
|
||||
let g:LanguageClient_rootMarkers = {}
|
||||
endif
|
||||
if !has_key(g:LanguageClient_rootMarkers, 'fsharp')
|
||||
let g:LanguageClient_rootMarkers.fsharp = ['*.sln', '*.fsproj', '.git']
|
||||
endif
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
if !exists('g:fsharp#lsp_auto_setup')
|
||||
let g:fsharp#lsp_auto_setup = 1
|
||||
endif
|
||||
if !exists('g:fsharp#lsp_recommended_colorscheme')
|
||||
let g:fsharp#lsp_recommended_colorscheme = 1
|
||||
endif
|
||||
if !exists('g:fsharp#lsp_codelens')
|
||||
let g:fsharp#lsp_codelens = 1
|
||||
endif
|
||||
|
||||
else
|
||||
if g:fsharp#backend != 'disable'
|
||||
echoerr "[FSAC] Invalid backend: " . g:fsharp#backend
|
||||
endif
|
||||
endif
|
||||
|
||||
" FSI keymaps
|
||||
if g:fsharp#fsi_keymap == "vscode"
|
||||
if has('nvim')
|
||||
let g:fsharp#fsi_keymap_send = "<M-cr>"
|
||||
let g:fsharp#fsi_keymap_toggle = "<M-@>"
|
||||
else
|
||||
let g:fsharp#fsi_keymap_send = "<esc><cr>"
|
||||
let g:fsharp#fsi_keymap_toggle = "<esc>@"
|
||||
endif
|
||||
elseif g:fsharp#fsi_keymap == "vim-fsharp"
|
||||
let g:fsharp#fsi_keymap_send = "<leader>i"
|
||||
let g:fsharp#fsi_keymap_toggle = "<leader>e"
|
||||
elseif g:fsharp#fsi_keymap == "custom"
|
||||
let g:fsharp#fsi_keymap = "none"
|
||||
if !exists('g:fsharp#fsi_keymap_send')
|
||||
echoerr "g:fsharp#fsi_keymap_send is not set"
|
||||
elseif !exists('g:fsharp#fsi_keymap_toggle')
|
||||
echoerr "g:fsharp#fsi_keymap_toggle is not set"
|
||||
else
|
||||
let g:fsharp#fsi_keymap = "custom"
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:config_is_loaded = 1
|
||||
endfunction
|
||||
|
||||
|
||||
" handlers for notifications
|
||||
|
||||
let s:handlers = {
|
||||
\ 'fsharp/notifyWorkspace': 'fsharp#handle_notifyWorkspace',
|
||||
\ }
|
||||
|
||||
function! s:registerAutocmds()
|
||||
if g:fsharp#backend == 'nvim' && g:fsharp#lsp_codelens
|
||||
augroup FSharp_AutoRefreshCodeLens
|
||||
autocmd!
|
||||
autocmd CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
|
||||
augroup END
|
||||
endif
|
||||
if g:fsharp#backend != 'disable'
|
||||
augroup FSharp_OnCursorMove
|
||||
autocmd!
|
||||
autocmd CursorMoved *.fs,*.fsi,*.fsx call fsharp#OnCursorMove()
|
||||
augroup END
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#initialize()
|
||||
echom '[FSAC] Initialized'
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient_registerHandlers(s:handlers)
|
||||
endif
|
||||
call fsharp#updateServerConfig()
|
||||
call s:registerAutocmds()
|
||||
endfunction
|
||||
|
||||
|
||||
" nvim-lsp specific functions
|
||||
|
||||
" handlers are picked up by ionide.setup()
|
||||
function! fsharp#get_handlers()
|
||||
return s:handlers
|
||||
endfunction
|
||||
|
||||
let s:callbacks = {}
|
||||
|
||||
function! fsharp#register_callback(fn)
|
||||
if g:fsharp#backend != 'nvim'
|
||||
return -1
|
||||
endif
|
||||
let rnd = reltimestr(reltime())
|
||||
let s:callbacks[rnd] = a:fn
|
||||
return rnd
|
||||
endfunction
|
||||
|
||||
function! fsharp#resolve_callback(key, arg)
|
||||
if g:fsharp#backend != 'nvim'
|
||||
return
|
||||
endif
|
||||
if has_key(s:callbacks, a:key)
|
||||
let Callback = s:callbacks[a:key]
|
||||
call Callback(a:arg)
|
||||
call remove(s:callbacks, a:key)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" .NET/F# specific operations
|
||||
|
||||
let s:workspace = []
|
||||
|
||||
function! fsharp#handle_notifyWorkspace(payload) abort
|
||||
let content = json_decode(a:payload.content)
|
||||
if content.Kind == 'projectLoading'
|
||||
echom "[FSAC] Loading" content.Data.Project
|
||||
let s:workspace = uniq(sort(add(s:workspace, content.Data.Project)))
|
||||
elseif content.Kind == 'workspaceLoad' && content.Data.Status == 'finished'
|
||||
echom printf("[FSAC] Workspace loaded (%d project(s))", len(s:workspace))
|
||||
call fsharp#updateServerConfig()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:load(arg)
|
||||
let s:loading_workspace = a:arg
|
||||
function! s:callback_load(_)
|
||||
echo "[FSAC] Workspace loaded: " . join(s:loading_workspace, ', ')
|
||||
let s:workspace = s:workspace + s:loading_workspace
|
||||
endfunction
|
||||
call s:workspaceLoad(a:arg, function("s:callback_load"))
|
||||
call s:workspaceLoad(a:arg, v:null)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadProject(...)
|
||||
@@ -252,23 +435,15 @@ function! fsharp#loadProject(...)
|
||||
call s:load(prjs)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadWorkspaceAuto()
|
||||
if &ft == 'fsharp'
|
||||
call fsharp#updateServerConfig()
|
||||
if g:fsharp#automatic_workspace_init
|
||||
echom "[FSAC] Loading workspace..."
|
||||
let bufferDirectory = fnamemodify(resolve(expand('%:p')), ':h')
|
||||
call s:findWorkspace(bufferDirectory, function("s:load"))
|
||||
endif
|
||||
endif
|
||||
function! fsharp#showLoadedProjects()
|
||||
for proj in s:workspace
|
||||
echo "-" proj
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! fsharp#reloadProjects()
|
||||
if len(s:workspace) > 0
|
||||
function! s:callback_reloadProjects(_)
|
||||
call s:prompt("[FSAC] Workspace reloaded.")
|
||||
endfunction
|
||||
call s:workspaceLoad(s:workspace, function("s:callback_reloadProjects"))
|
||||
call s:workspaceLoad(s:workspace, v:null)
|
||||
else
|
||||
echom "[FSAC] Workspace is empty"
|
||||
endif
|
||||
@@ -286,7 +461,7 @@ function! fsharp#showSignature()
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
echom substitute(content.Data, '\n\+$', ' ', 'g')
|
||||
echo substitute(content.Data, '\n\+$', ' ', 'g')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@@ -300,8 +475,25 @@ function! fsharp#OnCursorMove()
|
||||
endfunction
|
||||
|
||||
function! fsharp#showF1Help()
|
||||
let result = s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1)
|
||||
echo result
|
||||
function! s:callback_showF1Help(result)
|
||||
let result = a:result
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
let url = 'https://docs.microsoft.com/en-us/dotnet/api/' . substitute(content.Data, '#ctor', '-ctor', 'g')
|
||||
echo url
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
call s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showF1Help"))
|
||||
endfunction
|
||||
|
||||
function! s:hover()
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#textDocument_hover()
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
lua vim.lsp.buf.hover()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#showTooltip()
|
||||
@@ -310,7 +502,7 @@ function! fsharp#showTooltip()
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
call LanguageClient#textDocument_hover()
|
||||
call s:hover()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@@ -318,36 +510,8 @@ function! fsharp#showTooltip()
|
||||
call s:signature(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showTooltip"))
|
||||
endfunction
|
||||
|
||||
let s:script_root_dir = expand('<sfile>:p:h') . "/../"
|
||||
let s:fsac = fnamemodify(s:script_root_dir . "fsac/fsautocomplete.dll", ":p")
|
||||
let g:fsharp#languageserver_command =
|
||||
\ ['dotnet', s:fsac,
|
||||
\ '--background-service-enabled'
|
||||
\ ]
|
||||
|
||||
function! s:download(branch)
|
||||
echom "[FSAC] Downloading FSAC. This may take a while..."
|
||||
let zip = s:script_root_dir . "fsac.zip"
|
||||
call system(
|
||||
\ 'curl -fLo ' . zip . ' --create-dirs ' .
|
||||
\ '"https://ci.appveyor.com/api/projects/fsautocomplete/fsautocomplete/artifacts/bin/pkgs/fsautocomplete.netcore.zip?branch=' . a:branch . '"'
|
||||
\ )
|
||||
if v:shell_error == 0
|
||||
call system('unzip -o -d ' . s:script_root_dir . "/fsac " . zip)
|
||||
echom "[FSAC] Updated FsAutoComplete to version " . a:branch . ""
|
||||
else
|
||||
echom "[FSAC] Failed to update FsAutoComplete"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#updateFSAC(...)
|
||||
if len(a:000) == 0
|
||||
let branch = "master"
|
||||
else
|
||||
let branch = a:000[0]
|
||||
endif
|
||||
call s:download(branch)
|
||||
endfunction
|
||||
" FSI integration
|
||||
|
||||
let s:fsi_buffer = -1
|
||||
let s:fsi_job = -1
|
||||
@@ -377,7 +541,6 @@ endfunction
|
||||
function! fsharp#openFsi(returnFocus)
|
||||
if bufwinid(s:fsi_buffer) <= 0
|
||||
let fsi_command = s:get_fsi_command()
|
||||
" Neovim
|
||||
if exists('*termopen') || exists('*term_start')
|
||||
let current_win = win_getid()
|
||||
execute g:fsharp#fsi_window_command
|
||||
@@ -421,7 +584,7 @@ function! fsharp#openFsi(returnFocus)
|
||||
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
|
||||
return s:fsi_buffer
|
||||
else
|
||||
echom "[FSAC] Your Vim does not support terminal".
|
||||
echom "[FSAC] Your (neo)vim does not support terminal".
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
@@ -465,10 +628,10 @@ function! fsharp#sendFsi(text)
|
||||
if fsharp#openFsi(!g:fsharp#fsi_focus_on_send) > 0
|
||||
" Neovim
|
||||
if has('nvim')
|
||||
call chansend(s:fsi_job, a:text . ";;". "\n")
|
||||
call chansend(s:fsi_job, a:text . "\n" . ";;". "\n")
|
||||
" Vim 8
|
||||
else
|
||||
call term_sendkeys(s:fsi_buffer, a:text . ";;" . "\<cr>")
|
||||
call term_sendkeys(s:fsi_buffer, a:text . "\<cr>" . ";;" . "\<cr>")
|
||||
call term_wait(s:fsi_buffer)
|
||||
endif
|
||||
endif
|
||||
@@ -513,5 +676,3 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=4 et sts=4
|
||||
|
||||
endif
|
||||
|
||||
41
autoload/fzf_gitignore.vim
Normal file
41
autoload/fzf_gitignore.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'gitignore', 'autoload/fzf_gitignore.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
|
||||
" Use of this source code is governed by an MIT license that can be
|
||||
" found in the LICENSE file.
|
||||
|
||||
function! s:template_sink(templates) abort
|
||||
try
|
||||
let l:lines = _fzf_gitignore_create(a:templates)
|
||||
catch /^Vim(\(let\|return\)):/
|
||||
return
|
||||
endtry
|
||||
|
||||
new
|
||||
setlocal filetype=gitignore
|
||||
|
||||
call setline(1, l:lines)
|
||||
|
||||
$-2,$delete _
|
||||
normal! gg
|
||||
endfunction
|
||||
|
||||
function! fzf_gitignore#run() abort
|
||||
try
|
||||
let l:opts = {
|
||||
\ 'source': _fzf_gitignore_get_all_templates(),
|
||||
\ 'sink*': function('s:template_sink'),
|
||||
\ 'options': '-m --prompt="Template> " --header="gitignore.io"'
|
||||
\ }
|
||||
catch /^Vim(\(let\|return\)):/
|
||||
return
|
||||
endtry
|
||||
|
||||
call fzf#run(fzf#wrap(l:opts))
|
||||
endfunction
|
||||
|
||||
" vim: ts=2 et sw=2
|
||||
@@ -1,13 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'go', 'autoload/go/config.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#config#AutodetectGopath() abort
|
||||
return get(g:, 'go_autodetect_gopath', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#ListTypeCommands() abort
|
||||
return get(g:, 'go_list_type_commands', {})
|
||||
endfunction
|
||||
@@ -217,6 +215,14 @@ function! go#config#DebugWindows() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugSubstitutePaths() abort
|
||||
return get(g:, 'go_debug_substitute_paths', [])
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugPreserveLayout() abort
|
||||
return get(g:, 'go_debug_preserve_layout', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugAddress() abort
|
||||
return get(g:, 'go_debug_address', '127.0.0.1:8181')
|
||||
endfunction
|
||||
@@ -265,20 +271,31 @@ function! go#config#SetTemplateAutocreate(value) abort
|
||||
let g:go_template_autocreate = a:value
|
||||
endfunction
|
||||
|
||||
let s:default_metalinter = 'staticcheck'
|
||||
function! go#config#MetalinterCommand() abort
|
||||
return get(g:, "go_metalinter_command", "golangci-lint")
|
||||
return get(g:, 'go_metalinter_command', s:default_metalinter)
|
||||
endfunction
|
||||
|
||||
function! go#config#MetalinterAutosaveEnabled() abort
|
||||
return get(g:, "go_metalinter_autosave_enabled", ["govet", "golint"])
|
||||
let l:default = []
|
||||
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
|
||||
let l:default = ['govet', 'revive']
|
||||
endif
|
||||
|
||||
return get(g:, 'go_metalinter_autosave_enabled', l:default)
|
||||
endfunction
|
||||
|
||||
function! go#config#MetalinterEnabled() abort
|
||||
return get(g:, "go_metalinter_enabled", ["vet", "golint", "errcheck"])
|
||||
let l:default = []
|
||||
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
|
||||
let l:default = ['vet', 'revive', 'errcheck']
|
||||
endif
|
||||
|
||||
return get(g:, 'go_metalinter_enabled', l:default)
|
||||
endfunction
|
||||
|
||||
function! go#config#GolintBin() abort
|
||||
return get(g:, "go_golint_bin", "golint")
|
||||
return get(g:, "go_golint_bin", "revive")
|
||||
endfunction
|
||||
|
||||
function! go#config#ErrcheckBin() abort
|
||||
@@ -302,7 +319,7 @@ function! go#config#FmtAutosave() abort
|
||||
endfunction
|
||||
|
||||
function! go#config#ImportsAutosave() abort
|
||||
return get(g:, 'go_imports_autosave', 0)
|
||||
return get(g:, 'go_imports_autosave', 1)
|
||||
endfunction
|
||||
|
||||
function! go#config#SetFmtAutosave(value) abort
|
||||
@@ -346,11 +363,11 @@ function! go#config#DeclsMode() abort
|
||||
endfunction
|
||||
|
||||
function! go#config#FmtCommand() abort
|
||||
return get(g:, "go_fmt_command", "gofmt")
|
||||
return get(g:, "go_fmt_command", go#config#GoplsEnabled() ? 'gopls' : 'gofmt')
|
||||
endfunction
|
||||
|
||||
function! go#config#ImportsMode() abort
|
||||
return get(g:, "go_imports_mode", "goimports")
|
||||
return get(g:, "go_imports_mode", go#config#GoplsEnabled() ? 'gopls' : 'goimports')
|
||||
endfunction
|
||||
|
||||
function! go#config#FmtOptions() abort
|
||||
@@ -375,7 +392,7 @@ function! go#config#RenameCommand() abort
|
||||
endfunction
|
||||
|
||||
function! go#config#GorenameBin() abort
|
||||
return get(g:, "go_gorename_bin", "gopls")
|
||||
return get(g:, "go_gorename_bin", 'gopls')
|
||||
endfunction
|
||||
|
||||
function! go#config#GorenamePrefill() abort
|
||||
@@ -514,7 +531,7 @@ function! go#config#ReferrersMode() abort
|
||||
endfunction
|
||||
|
||||
function! go#config#ImplementsMode() abort
|
||||
return get(g:, 'go_implements_mode', 'guru')
|
||||
return get(g:, 'go_implements_mode', 'gopls')
|
||||
endfunction
|
||||
|
||||
function! go#config#GoplsCompleteUnimported() abort
|
||||
@@ -564,14 +581,48 @@ function! go#config#GoplsEnabled() abort
|
||||
return get(g:, 'go_gopls_enabled', 1)
|
||||
endfunction
|
||||
|
||||
" TODO(bc): remove support for g:go_diagnostics_enabled;
|
||||
" g:go_diagnostics_level is the replacement.
|
||||
function! go#config#DiagnosticsEnabled() abort
|
||||
return get(g:, 'go_diagnostics_enabled', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#DiagnosticsLevel() abort
|
||||
let l:default = 0
|
||||
if has_key(g:, 'go_diagnostics_enabled') && g:go_diagnostics_enabled
|
||||
let l:default = 2
|
||||
endif
|
||||
|
||||
return get(g:, 'go_diagnostics_level', l:default)
|
||||
endfunction
|
||||
|
||||
function! go#config#GoplsOptions() abort
|
||||
return get(g:, 'go_gopls_options', ['-remote=auto'])
|
||||
endfunction
|
||||
|
||||
function! go#config#FillStructMode() abort
|
||||
return get(g:, 'go_fillstruct_mode', 'fillstruct')
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugMappings() abort
|
||||
let l:default = {
|
||||
\ '(go-debug-continue)': {'key': '<F5>'},
|
||||
\ '(go-debug-print)': {'key': '<F6>'},
|
||||
\ '(go-debug-breakpoint)': {'key': '<F9>'},
|
||||
\ '(go-debug-next)': {'key': '<F10>'},
|
||||
\ '(go-debug-step)': {'key': '<F11>'},
|
||||
\ '(go-debug-halt)': {'key': '<F8>'},
|
||||
\ }
|
||||
|
||||
let l:user = deepcopy(get(g:, 'go_debug_mappings', {}))
|
||||
|
||||
return extend(l:user, l:default, 'keep')
|
||||
endfunction
|
||||
|
||||
function! go#config#DocBalloon() abort
|
||||
return get(g:, 'go_doc_balloon', 0)
|
||||
endfunction
|
||||
|
||||
" Set the default value. A value of "1" is a shortcut for this, for
|
||||
" compatibility reasons.
|
||||
if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
|
||||
@@ -583,5 +634,3 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'autoload/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -35,5 +37,3 @@ endfunction
|
||||
function! graphql#javascript_tags() abort
|
||||
return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
20
autoload/hcl.vim
Normal file
20
autoload/hcl.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'terraform', 'autoload/hcl.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
function! hcl#align() abort
|
||||
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
|
||||
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'html5', 'autoload/htmlcomplete.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim completion script
|
||||
" Language: HTML and XHTML
|
||||
@@ -841,5 +843,3 @@ function! htmlcomplete#CheckDoctype() " {{{
|
||||
endfunction
|
||||
" }}}
|
||||
" vim:set foldmethod=marker:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsonnet', 'autoload/jsonnet.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -125,5 +127,3 @@ function! jsonnet#Format()
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'autoload/jsx_pretty/comment.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! jsx_pretty#comment#update_commentstring(original)
|
||||
let line = getline(".")
|
||||
@@ -37,5 +39,3 @@ function! s:syn_contains(lnum, cnum, syn_name)
|
||||
let syn_names = map(stack, 'synIDattr(v:val, "name")')
|
||||
return index(syn_names, a:syn_name) >= 0
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'autoload/jsx_pretty/indent.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('*shiftwidth')
|
||||
function! s:sw()
|
||||
@@ -302,5 +304,3 @@ function! jsx_pretty#indent#get(js_indent)
|
||||
|
||||
return a:js_indent()
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! julia#set_syntax_version(jvers)
|
||||
echo "The julia#set_syntax_version function is deprecated"
|
||||
@@ -165,5 +167,3 @@ function! julia#gotodefinition()
|
||||
return
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia/doc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" path to the julia binary to communicate with
|
||||
if has('win32') || has('win64')
|
||||
@@ -37,7 +39,7 @@ let s:NODOCPATTERN = '\C\VNo documentation found.'
|
||||
function! julia#doc#lookup(keyword, ...) abort
|
||||
let juliapath = get(a:000, 0, g:julia#doc#juliapath)
|
||||
let keyword = escape(a:keyword, '"\')
|
||||
let cmd = printf('%s -E "@doc %s"', juliapath, keyword)
|
||||
let cmd = printf('%s --compile=min --optimize=0 -E "@doc %s"', juliapath, keyword)
|
||||
return systemlist(cmd)
|
||||
endfunction
|
||||
|
||||
@@ -95,7 +97,7 @@ function! s:write_to_preview_window(content, ftype, buffername)
|
||||
else
|
||||
" We couldn't make it to the preview window, so as a fallback we dump the
|
||||
" contents in the status area.
|
||||
execute printf("echo '%s'", join(a:content, "\n"))
|
||||
echo join(a:content, "\n")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -238,9 +240,7 @@ endfunction
|
||||
function! s:likely(str) abort
|
||||
" escape twice
|
||||
let str = escape(escape(a:str, '"\'), '"\')
|
||||
let cmd = printf('%s -E "%s(\"%s\")"', g:julia#doc#juliapath, s:REPL_SEARCH, str)
|
||||
let cmd = printf('%s --compile=min --optimize=0 -E "%s(\"%s\")"', g:julia#doc#juliapath, s:REPL_SEARCH, str)
|
||||
let output = systemlist(cmd)
|
||||
return split(matchstr(output[0], '\C^search: \zs.*'))
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia_blocks.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Facilities for moving around Julia blocks (e.g. if/end, function/end etc.)
|
||||
" (AKA a collection of horrible hacks)
|
||||
@@ -337,7 +339,7 @@ function! s:on_begin()
|
||||
let [l,c] = [line('.'), col('.')]
|
||||
normal! ^
|
||||
let patt = '\%<'.(c+1).'c\(' . b:julia_begin_keywordsm . '\)\%>'.(c-1).'c'
|
||||
let n = search(patt, 'Wnc', l)
|
||||
let n = search('\C' . patt, 'Wnc', l)
|
||||
call cursor(l, c)
|
||||
return n > 0
|
||||
endfunction
|
||||
@@ -348,15 +350,15 @@ function! s:matchit()
|
||||
endfunction
|
||||
|
||||
function! s:move_before_begin()
|
||||
call search(b:julia_begin_keywordsm, 'Wbc')
|
||||
call search('\C' . b:julia_begin_keywordsm, 'Wbc')
|
||||
normal! h
|
||||
endfunction
|
||||
|
||||
function! s:cycle_until_end()
|
||||
let pos = getpos('.')
|
||||
while !s:on_end()
|
||||
call s:matchit()
|
||||
let c = 0
|
||||
while !s:on_end()
|
||||
let pos = getpos('.')
|
||||
call s:matchit()
|
||||
if getpos('.') == pos || c > 1000
|
||||
" shouldn't happen, but let's avoid infinite loops anyway
|
||||
return 0
|
||||
@@ -380,7 +382,7 @@ function! s:moveto_block_delim(toend, backwards, ...)
|
||||
normal! bh
|
||||
endif
|
||||
while 1
|
||||
let searchret = search(pattern, flags)
|
||||
let searchret = search('\C' . pattern, flags)
|
||||
if !searchret
|
||||
return ret
|
||||
endif
|
||||
@@ -471,7 +473,7 @@ function! s:moveto_currentblock_end()
|
||||
normal! b
|
||||
endif
|
||||
|
||||
let ret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
|
||||
let ret = searchpair('\C' . b:julia_begin_keywordsm, '', '\C' . b:julia_end_keywords, flags, b:match_skip)
|
||||
if ret <= 0
|
||||
return s:abort()
|
||||
endif
|
||||
@@ -677,7 +679,7 @@ function! s:find_block(current_mode)
|
||||
normal! l
|
||||
normal! b
|
||||
endif
|
||||
let searchret = searchpair(b:julia_begin_keywordsm, '', b:julia_end_keywords, flags, b:match_skip)
|
||||
let searchret = searchpair('\C' . b:julia_begin_keywordsm, '', '\C' . b:julia_end_keywords, flags, b:match_skip)
|
||||
if searchret <= 0
|
||||
if !b:jlblk_did_select
|
||||
return s:abort()
|
||||
@@ -698,7 +700,7 @@ function! s:find_block(current_mode)
|
||||
endfunction
|
||||
|
||||
function! s:repeated_find(ai_mode)
|
||||
let repeat = b:jlblk_count + (a:ai_mode == 'i' && v:count1 > 1 ? 1 : 0)
|
||||
let repeat = b:jlblk_count + (a:ai_mode == 'i' && b:jlblk_count > 1 ? 1 : 0)
|
||||
for c in range(repeat)
|
||||
let current_mode = (c < repeat - 1 ? 'a' : a:ai_mode)
|
||||
let ret_find_block = s:find_block(current_mode)
|
||||
@@ -732,8 +734,8 @@ function! julia_blocks#select_a(...)
|
||||
|
||||
let b:jlblk_doing_select = 1
|
||||
|
||||
" CursorMove is only triggered if end_pos
|
||||
" end_pos is different than the staring position;
|
||||
" CursorMoved is only triggered if end_pos
|
||||
" is different than the staring position;
|
||||
" so when starting from the 'd' in 'end' we need to
|
||||
" force it
|
||||
if current_pos == end_pos
|
||||
@@ -744,6 +746,39 @@ function! julia_blocks#select_a(...)
|
||||
return [start_pos, end_pos]
|
||||
endfunction
|
||||
|
||||
let s:bracketBlocks = '\<julia\%(\%(\%(Printf\)\?Par\|SqBra\%(Idx\)\?\|CurBra\)Block\|ParBlockInRange\|StringVars\%(Par\|SqBra\|CurBra\)\|Dollar\%(Par\|SqBra\)\|QuotedParBlockS\?\)\>'
|
||||
let s:codeBlocks = '\<julia\%(Conditional\|While\|For\|Begin\|Function\|Macro\|Quote\|\%(Mutable\)\?Struct\|Let\|Do\|Exception\|Abstract\|Primitive\)Block\>'
|
||||
|
||||
function s:is_in_brackets(lnum, c)
|
||||
let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
|
||||
for i in range(len(stack)-1, 0, -1)
|
||||
if stack[i] =~# s:bracketBlocks
|
||||
return 1
|
||||
elseif stack[i] =~# s:codeBlocks
|
||||
return 0
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:seek_bracket_end()
|
||||
let [lnum, c] = [line('.'), col('.')]
|
||||
if !s:is_in_brackets(lnum, c)
|
||||
return
|
||||
endif
|
||||
while c > 0 && s:is_in_brackets(lnum, c)
|
||||
let c -= 1
|
||||
endwhile
|
||||
let c += 1
|
||||
if !s:is_in_brackets(lnum, c)
|
||||
echoerr "this is a bug, please report it"
|
||||
return
|
||||
end
|
||||
call cursor(lnum, c)
|
||||
call s:matchit()
|
||||
return
|
||||
endfunction
|
||||
|
||||
function! julia_blocks#select_i()
|
||||
call s:get_save_pos(!b:jlblk_did_select)
|
||||
let current_pos = getpos('.')
|
||||
@@ -757,19 +792,32 @@ function! julia_blocks#select_i()
|
||||
return s:abort()
|
||||
endif
|
||||
|
||||
call setpos('.', end_pos)
|
||||
|
||||
let b:jlblk_doing_select = 1
|
||||
|
||||
let start_pos[1] += 1
|
||||
call setpos('.', start_pos)
|
||||
normal! ^
|
||||
normal! $
|
||||
call s:seek_bracket_end()
|
||||
let l = getline('.')
|
||||
while col('.') < len(l) && l[col('.'):] =~# '^\s*;'
|
||||
normal! l
|
||||
endwhile
|
||||
if col('.') == len(l) || l[col('.')] =~# '\s'
|
||||
normal! W
|
||||
else
|
||||
normal! l
|
||||
endif
|
||||
let start_pos = getpos('.')
|
||||
let end_pos[1] -= 1
|
||||
let end_pos[2] = len(getline(end_pos[1]))
|
||||
|
||||
" CursorMove is only triggered if end_pos
|
||||
" end_pos is different than the staring position;
|
||||
call setpos('.', end_pos)
|
||||
if end_pos[2] > 1 && getline('.')[end_pos[2]-2] =~# '\S'
|
||||
normal! h
|
||||
else
|
||||
normal! gE
|
||||
endif
|
||||
let end_pos = getpos('.')
|
||||
|
||||
" CursorMoved is only triggered if end_pos
|
||||
" is different than the staring position;
|
||||
" so when starting from the 'd' in 'end' we need to
|
||||
" force it
|
||||
if current_pos == end_pos
|
||||
@@ -794,5 +842,3 @@ function! s:cursor_moved(...)
|
||||
let b:jlblk_did_select = b:jlblk_doing_select
|
||||
let b:jlblk_doing_select = 0
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia_latex_symbols.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
|
||||
" The symbols are based on Julia version 1.5.0-DEV.67
|
||||
" The symbols are based on Julia version 1.9.0-DEV.16
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -265,7 +267,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\^c': 'ᶜ',
|
||||
\ '\^f': 'ᶠ',
|
||||
\ '\^iota': 'ᶥ',
|
||||
\ '\^Phi': 'ᶲ',
|
||||
\ '\^ltphi': 'ᶲ',
|
||||
\ '\^z': 'ᶻ',
|
||||
\ '\^theta': 'ᶿ',
|
||||
\ '\enspace': ' ',
|
||||
@@ -279,8 +281,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\lq': '‘',
|
||||
\ '\rq': '’',
|
||||
\ '\reapos': '‛',
|
||||
\ '\quotedblleft': '“',
|
||||
\ '\quotedblright': '”',
|
||||
\ '\ldq': '“',
|
||||
\ '\rdq': '”',
|
||||
\ '\dagger': '†',
|
||||
\ '\ddagger': '‡',
|
||||
\ '\bullet': '•',
|
||||
@@ -372,10 +374,12 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\scrH': 'ℋ',
|
||||
\ '\frakH': 'ℌ',
|
||||
\ '\bbH': 'ℍ',
|
||||
\ '\ith': 'ℎ',
|
||||
\ '\planck': 'ℎ',
|
||||
\ '\hslash': 'ℏ',
|
||||
\ '\scrI': 'ℐ',
|
||||
\ '\Im': 'ℑ',
|
||||
\ '\frakI': 'ℑ',
|
||||
\ '\scrL': 'ℒ',
|
||||
\ '\ell': 'ℓ',
|
||||
\ '\bbN': 'ℕ',
|
||||
@@ -385,6 +389,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bbQ': 'ℚ',
|
||||
\ '\scrR': 'ℛ',
|
||||
\ '\Re': 'ℜ',
|
||||
\ '\frakR': 'ℜ',
|
||||
\ '\bbR': 'ℝ',
|
||||
\ '\xrat': '℞',
|
||||
\ '\trademark': '™',
|
||||
@@ -757,7 +762,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\veebar': '⊻',
|
||||
\ '\xor': '⊻',
|
||||
\ '\barwedge': '⊼',
|
||||
\ '\nand': '⊼',
|
||||
\ '\barvee': '⊽',
|
||||
\ '\nor': '⊽',
|
||||
\ '\rightanglearc': '⊾',
|
||||
\ '\varlrtriangle': '⊿',
|
||||
\ '\bigwedge': '⋀',
|
||||
@@ -1007,6 +1014,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\astrosun': '☉',
|
||||
\ '\:phone:': '☎',
|
||||
\ '\:ballot_box_with_check:': '☑',
|
||||
\ '\:umbrella_with_rain_drops:': '☔',
|
||||
\ '\:umbrella:': '☔',
|
||||
\ '\:coffee:': '☕',
|
||||
\ '\:point_up:': '☝',
|
||||
@@ -1095,6 +1103,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:soccer:': '⚽',
|
||||
\ '\:baseball:': '⚾',
|
||||
\ '\:snowman:': '⛄',
|
||||
\ '\:snowman_without_snow:': '⛄',
|
||||
\ '\:partly_sunny:': '⛅',
|
||||
\ '\:ophiuchus:': '⛎',
|
||||
\ '\:no_entry:': '⛔',
|
||||
@@ -1350,8 +1359,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\intcup': '⨚',
|
||||
\ '\upint': '⨛',
|
||||
\ '\lowint': '⨜',
|
||||
\ '\Join': '⨝',
|
||||
\ '\join': '⨝',
|
||||
\ '\bbsemi': '⨟',
|
||||
\ '\ringplus': '⨢',
|
||||
\ '\plushat': '⨣',
|
||||
\ '\simplus': '⨤',
|
||||
@@ -1539,6 +1548,11 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\forksnot': '⫝',
|
||||
\ '\dashV': '⫣',
|
||||
\ '\Dashv': '⫤',
|
||||
\ '\Top': '⫪',
|
||||
\ '\downvDash': '⫪',
|
||||
\ '\upvDash': '⫫',
|
||||
\ '\Bot': '⫫',
|
||||
\ '\indep': '⫫',
|
||||
\ '\interleave': '⫴',
|
||||
\ '\tdcol': '⫶',
|
||||
\ '\lllnest': '⫷',
|
||||
@@ -1623,6 +1637,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:part_alternation_mark:': '〽',
|
||||
\ '\:congratulations:': '㊗',
|
||||
\ '\:secret:': '㊙',
|
||||
\ '\^uparrow': 'ꜛ',
|
||||
\ '\^downarrow': 'ꜜ',
|
||||
\ '\^!': 'ꜝ',
|
||||
\ '\bfA': '𝐀',
|
||||
\ '\bfB': '𝐁',
|
||||
\ '\bfC': '𝐂',
|
||||
@@ -2307,7 +2324,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfbeta': '𝛃',
|
||||
\ '\bfgamma': '𝛄',
|
||||
\ '\bfdelta': '𝛅',
|
||||
\ '\bfepsilon': '𝛆',
|
||||
\ '\bfvarepsilon': '𝛆',
|
||||
\ '\bfzeta': '𝛇',
|
||||
\ '\bfeta': '𝛈',
|
||||
\ '\bftheta': '𝛉',
|
||||
@@ -2329,7 +2346,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfpsi': '𝛙',
|
||||
\ '\bfomega': '𝛚',
|
||||
\ '\bfpartial': '𝛛',
|
||||
\ '\bfvarepsilon': '𝛜',
|
||||
\ '\bfepsilon': '𝛜',
|
||||
\ '\bfvartheta': '𝛝',
|
||||
\ '\bfvarkappa': '𝛞',
|
||||
\ '\bfphi': '𝛟',
|
||||
@@ -2365,7 +2382,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\itbeta': '𝛽',
|
||||
\ '\itgamma': '𝛾',
|
||||
\ '\itdelta': '𝛿',
|
||||
\ '\itepsilon': '𝜀',
|
||||
\ '\itvarepsilon': '𝜀',
|
||||
\ '\itzeta': '𝜁',
|
||||
\ '\iteta': '𝜂',
|
||||
\ '\ittheta': '𝜃',
|
||||
@@ -2382,15 +2399,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\itsigma': '𝜎',
|
||||
\ '\ittau': '𝜏',
|
||||
\ '\itupsilon': '𝜐',
|
||||
\ '\itphi': '𝜑',
|
||||
\ '\itvarphi': '𝜑',
|
||||
\ '\itchi': '𝜒',
|
||||
\ '\itpsi': '𝜓',
|
||||
\ '\itomega': '𝜔',
|
||||
\ '\itpartial': '𝜕',
|
||||
\ '\itvarepsilon': '𝜖',
|
||||
\ '\itepsilon': '𝜖',
|
||||
\ '\itvartheta': '𝜗',
|
||||
\ '\itvarkappa': '𝜘',
|
||||
\ '\itvarphi': '𝜙',
|
||||
\ '\itphi': '𝜙',
|
||||
\ '\itvarrho': '𝜚',
|
||||
\ '\itvarpi': '𝜛',
|
||||
\ '\biAlpha': '𝜜',
|
||||
@@ -2423,7 +2440,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bibeta': '𝜷',
|
||||
\ '\bigamma': '𝜸',
|
||||
\ '\bidelta': '𝜹',
|
||||
\ '\biepsilon': '𝜺',
|
||||
\ '\bivarepsilon': '𝜺',
|
||||
\ '\bizeta': '𝜻',
|
||||
\ '\bieta': '𝜼',
|
||||
\ '\bitheta': '𝜽',
|
||||
@@ -2440,15 +2457,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisigma': '𝝈',
|
||||
\ '\bitau': '𝝉',
|
||||
\ '\biupsilon': '𝝊',
|
||||
\ '\biphi': '𝝋',
|
||||
\ '\bivarphi': '𝝋',
|
||||
\ '\bichi': '𝝌',
|
||||
\ '\bipsi': '𝝍',
|
||||
\ '\biomega': '𝝎',
|
||||
\ '\bipartial': '𝝏',
|
||||
\ '\bivarepsilon': '𝝐',
|
||||
\ '\biepsilon': '𝝐',
|
||||
\ '\bivartheta': '𝝑',
|
||||
\ '\bivarkappa': '𝝒',
|
||||
\ '\bivarphi': '𝝓',
|
||||
\ '\biphi': '𝝓',
|
||||
\ '\bivarrho': '𝝔',
|
||||
\ '\bivarpi': '𝝕',
|
||||
\ '\bsansAlpha': '𝝖',
|
||||
@@ -2481,7 +2498,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bsansbeta': '𝝱',
|
||||
\ '\bsansgamma': '𝝲',
|
||||
\ '\bsansdelta': '𝝳',
|
||||
\ '\bsansepsilon': '𝝴',
|
||||
\ '\bsansvarepsilon': '𝝴',
|
||||
\ '\bsanszeta': '𝝵',
|
||||
\ '\bsanseta': '𝝶',
|
||||
\ '\bsanstheta': '𝝷',
|
||||
@@ -2498,15 +2515,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bsanssigma': '𝞂',
|
||||
\ '\bsanstau': '𝞃',
|
||||
\ '\bsansupsilon': '𝞄',
|
||||
\ '\bsansphi': '𝞅',
|
||||
\ '\bsansvarphi': '𝞅',
|
||||
\ '\bsanschi': '𝞆',
|
||||
\ '\bsanspsi': '𝞇',
|
||||
\ '\bsansomega': '𝞈',
|
||||
\ '\bsanspartial': '𝞉',
|
||||
\ '\bsansvarepsilon': '𝞊',
|
||||
\ '\bsansepsilon': '𝞊',
|
||||
\ '\bsansvartheta': '𝞋',
|
||||
\ '\bsansvarkappa': '𝞌',
|
||||
\ '\bsansvarphi': '𝞍',
|
||||
\ '\bsansphi': '𝞍',
|
||||
\ '\bsansvarrho': '𝞎',
|
||||
\ '\bsansvarpi': '𝞏',
|
||||
\ '\bisansAlpha': '𝞐',
|
||||
@@ -2539,7 +2556,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisansbeta': '𝞫',
|
||||
\ '\bisansgamma': '𝞬',
|
||||
\ '\bisansdelta': '𝞭',
|
||||
\ '\bisansepsilon': '𝞮',
|
||||
\ '\bisansvarepsilon': '𝞮',
|
||||
\ '\bisanszeta': '𝞯',
|
||||
\ '\bisanseta': '𝞰',
|
||||
\ '\bisanstheta': '𝞱',
|
||||
@@ -2556,15 +2573,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisanssigma': '𝞼',
|
||||
\ '\bisanstau': '𝞽',
|
||||
\ '\bisansupsilon': '𝞾',
|
||||
\ '\bisansphi': '𝞿',
|
||||
\ '\bisansvarphi': '𝞿',
|
||||
\ '\bisanschi': '𝟀',
|
||||
\ '\bisanspsi': '𝟁',
|
||||
\ '\bisansomega': '𝟂',
|
||||
\ '\bisanspartial': '𝟃',
|
||||
\ '\bisansvarepsilon': '𝟄',
|
||||
\ '\bisansepsilon': '𝟄',
|
||||
\ '\bisansvartheta': '𝟅',
|
||||
\ '\bisansvarkappa': '𝟆',
|
||||
\ '\bisansvarphi': '𝟇',
|
||||
\ '\bisansphi': '𝟇',
|
||||
\ '\bisansvarrho': '𝟈',
|
||||
\ '\bisansvarpi': '𝟉',
|
||||
\ '\bfDigamma': '𝟊',
|
||||
@@ -2684,6 +2701,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:sun_with_face:': '🌞',
|
||||
\ '\:star2:': '🌟',
|
||||
\ '\:stars:': '🌠',
|
||||
\ '\:hotdog:': '🌭',
|
||||
\ '\:taco:': '🌮',
|
||||
\ '\:burrito:': '🌯',
|
||||
\ '\:chestnut:': '🌰',
|
||||
\ '\:seedling:': '🌱',
|
||||
\ '\:evergreen_tree:': '🌲',
|
||||
@@ -2750,7 +2770,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:cake:': '🍰',
|
||||
\ '\:bento:': '🍱',
|
||||
\ '\:stew:': '🍲',
|
||||
\ '\:egg:': '🍳',
|
||||
\ '\:fried_egg:': '🍳',
|
||||
\ '\:fork_and_knife:': '🍴',
|
||||
\ '\:tea:': '🍵',
|
||||
\ '\:sake:': '🍶',
|
||||
@@ -2760,6 +2780,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:beer:': '🍺',
|
||||
\ '\:beers:': '🍻',
|
||||
\ '\:baby_bottle:': '🍼',
|
||||
\ '\:champagne:': '🍾',
|
||||
\ '\:popcorn:': '🍿',
|
||||
\ '\:ribbon:': '🎀',
|
||||
\ '\:gift:': '🎁',
|
||||
\ '\:birthday:': '🎂',
|
||||
@@ -2817,11 +2839,17 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:snowboarder:': '🏂',
|
||||
\ '\:runner:': '🏃',
|
||||
\ '\:surfer:': '🏄',
|
||||
\ '\:sports_medal:': '🏅',
|
||||
\ '\:trophy:': '🏆',
|
||||
\ '\:horse_racing:': '🏇',
|
||||
\ '\:football:': '🏈',
|
||||
\ '\:rugby_football:': '🏉',
|
||||
\ '\:swimmer:': '🏊',
|
||||
\ '\:cricket_bat_and_ball:': '🏏',
|
||||
\ '\:volleyball:': '🏐',
|
||||
\ '\:field_hockey_stick_and_ball:': '🏑',
|
||||
\ '\:ice_hockey_stick_and_puck:': '🏒',
|
||||
\ '\:table_tennis_paddle_and_ball:': '🏓',
|
||||
\ '\:house:': '🏠',
|
||||
\ '\:house_with_garden:': '🏡',
|
||||
\ '\:office:': '🏢',
|
||||
@@ -2839,6 +2867,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:izakaya_lantern:': '🏮',
|
||||
\ '\:japanese_castle:': '🏯',
|
||||
\ '\:european_castle:': '🏰',
|
||||
\ '\:waving_black_flag:': '🏴',
|
||||
\ '\:badminton_racquet_and_shuttlecock:': '🏸',
|
||||
\ '\:bow_and_arrow:': '🏹',
|
||||
\ '\:amphora:': '🏺',
|
||||
\ '\:skin-tone-2:': '🏻',
|
||||
\ '\:skin-tone-3:': '🏼',
|
||||
\ '\:skin-tone-4:': '🏽',
|
||||
@@ -2874,7 +2906,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:bug:': '🐛',
|
||||
\ '\:ant:': '🐜',
|
||||
\ '\:bee:': '🐝',
|
||||
\ '\:beetle:': '🐞',
|
||||
\ '\:ladybug:': '🐞',
|
||||
\ '\:fish:': '🐟',
|
||||
\ '\:tropical_fish:': '🐠',
|
||||
\ '\:blowfish:': '🐡',
|
||||
@@ -2950,6 +2982,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:woman:': '👩',
|
||||
\ '\:family:': '👪',
|
||||
\ '\:couple:': '👫',
|
||||
\ '\:man_and_woman_holding_hands:': '👫',
|
||||
\ '\:two_men_holding_hands:': '👬',
|
||||
\ '\:two_women_holding_hands:': '👭',
|
||||
\ '\:cop:': '👮',
|
||||
@@ -3068,6 +3101,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:pager:': '📟',
|
||||
\ '\:fax:': '📠',
|
||||
\ '\:satellite:': '📡',
|
||||
\ '\:satellite_antenna:': '📡',
|
||||
\ '\:loudspeaker:': '📢',
|
||||
\ '\:mega:': '📣',
|
||||
\ '\:outbox_tray:': '📤',
|
||||
@@ -3090,10 +3124,12 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:no_mobile_phones:': '📵',
|
||||
\ '\:signal_strength:': '📶',
|
||||
\ '\:camera:': '📷',
|
||||
\ '\:camera_with_flash:': '📸',
|
||||
\ '\:video_camera:': '📹',
|
||||
\ '\:tv:': '📺',
|
||||
\ '\:radio:': '📻',
|
||||
\ '\:vhs:': '📼',
|
||||
\ '\:prayer_beads:': '📿',
|
||||
\ '\:twisted_rightwards_arrows:': '🔀',
|
||||
\ '\:repeat:': '🔁',
|
||||
\ '\:repeat_one:': '🔂',
|
||||
@@ -3156,6 +3192,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:small_red_triangle_down:': '🔻',
|
||||
\ '\:arrow_up_small:': '🔼',
|
||||
\ '\:arrow_down_small:': '🔽',
|
||||
\ '\:kaaba:': '🕋',
|
||||
\ '\:mosque:': '🕌',
|
||||
\ '\:synagogue:': '🕍',
|
||||
\ '\:menorah_with_nine_branches:': '🕎',
|
||||
\ '\:clock1:': '🕐',
|
||||
\ '\:clock2:': '🕑',
|
||||
\ '\:clock3:': '🕒',
|
||||
@@ -3180,6 +3220,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:clock1030:': '🕥',
|
||||
\ '\:clock1130:': '🕦',
|
||||
\ '\:clock1230:': '🕧',
|
||||
\ '\:man_dancing:': '🕺',
|
||||
\ '\:middle_finger:': '🖕',
|
||||
\ '\:spock-hand:': '🖖',
|
||||
\ '\:black_heart:': '🖤',
|
||||
\ '\:mount_fuji:': '🗻',
|
||||
\ '\:tokyo_tower:': '🗼',
|
||||
\ '\:statue_of_liberty:': '🗽',
|
||||
@@ -3250,6 +3294,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:pouting_cat:': '😾',
|
||||
\ '\:crying_cat_face:': '😿',
|
||||
\ '\:scream_cat:': '🙀',
|
||||
\ '\:slightly_frowning_face:': '🙁',
|
||||
\ '\:slightly_smiling_face:': '🙂',
|
||||
\ '\:upside_down_face:': '🙃',
|
||||
\ '\:face_with_rolling_eyes:': '🙄',
|
||||
\ '\:no_good:': '🙅',
|
||||
\ '\:ok_woman:': '🙆',
|
||||
\ '\:bow:': '🙇',
|
||||
@@ -3330,7 +3378,328 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:passport_control:': '🛂',
|
||||
\ '\:customs:': '🛃',
|
||||
\ '\:baggage_claim:': '🛄',
|
||||
\ '\:left_luggage:': '🛅'}
|
||||
\ '\:left_luggage:': '🛅',
|
||||
\ '\:sleeping_accommodation:': '🛌',
|
||||
\ '\:place_of_worship:': '🛐',
|
||||
\ '\:octagonal_sign:': '🛑',
|
||||
\ '\:shopping_trolley:': '🛒',
|
||||
\ '\:hindu_temple:': '🛕',
|
||||
\ '\:hut:': '🛖',
|
||||
\ '\:elevator:': '🛗',
|
||||
\ '\:airplane_departure:': '🛫',
|
||||
\ '\:airplane_arriving:': '🛬',
|
||||
\ '\:scooter:': '🛴',
|
||||
\ '\:motor_scooter:': '🛵',
|
||||
\ '\:canoe:': '🛶',
|
||||
\ '\:sled:': '🛷',
|
||||
\ '\:flying_saucer:': '🛸',
|
||||
\ '\:skateboard:': '🛹',
|
||||
\ '\:auto_rickshaw:': '🛺',
|
||||
\ '\:pickup_truck:': '🛻',
|
||||
\ '\:roller_skate:': '🛼',
|
||||
\ '\:large_orange_circle:': '🟠',
|
||||
\ '\:large_yellow_circle:': '🟡',
|
||||
\ '\:large_green_circle:': '🟢',
|
||||
\ '\:large_purple_circle:': '🟣',
|
||||
\ '\:large_brown_circle:': '🟤',
|
||||
\ '\:large_red_square:': '🟥',
|
||||
\ '\:large_blue_square:': '🟦',
|
||||
\ '\:large_orange_square:': '🟧',
|
||||
\ '\:large_yellow_square:': '🟨',
|
||||
\ '\:large_green_square:': '🟩',
|
||||
\ '\:large_purple_square:': '🟪',
|
||||
\ '\:large_brown_square:': '🟫',
|
||||
\ '\:pinched_fingers:': '🤌',
|
||||
\ '\:white_heart:': '🤍',
|
||||
\ '\:brown_heart:': '🤎',
|
||||
\ '\:pinching_hand:': '🤏',
|
||||
\ '\:zipper_mouth_face:': '🤐',
|
||||
\ '\:money_mouth_face:': '🤑',
|
||||
\ '\:face_with_thermometer:': '🤒',
|
||||
\ '\:nerd_face:': '🤓',
|
||||
\ '\:thinking_face:': '🤔',
|
||||
\ '\:face_with_head_bandage:': '🤕',
|
||||
\ '\:robot_face:': '🤖',
|
||||
\ '\:hugging_face:': '🤗',
|
||||
\ '\:the_horns:': '🤘',
|
||||
\ '\:call_me_hand:': '🤙',
|
||||
\ '\:raised_back_of_hand:': '🤚',
|
||||
\ '\:left-facing_fist:': '🤛',
|
||||
\ '\:right-facing_fist:': '🤜',
|
||||
\ '\:handshake:': '🤝',
|
||||
\ '\:crossed_fingers:': '🤞',
|
||||
\ '\:i_love_you_hand_sign:': '🤟',
|
||||
\ '\:face_with_cowboy_hat:': '🤠',
|
||||
\ '\:clown_face:': '🤡',
|
||||
\ '\:nauseated_face:': '🤢',
|
||||
\ '\:rolling_on_the_floor_laughing:': '🤣',
|
||||
\ '\:drooling_face:': '🤤',
|
||||
\ '\:lying_face:': '🤥',
|
||||
\ '\:face_palm:': '🤦',
|
||||
\ '\:sneezing_face:': '🤧',
|
||||
\ '\:face_with_raised_eyebrow:': '🤨',
|
||||
\ '\:star-struck:': '🤩',
|
||||
\ '\:zany_face:': '🤪',
|
||||
\ '\:shushing_face:': '🤫',
|
||||
\ '\:face_with_symbols_on_mouth:': '🤬',
|
||||
\ '\:face_with_hand_over_mouth:': '🤭',
|
||||
\ '\:face_vomiting:': '🤮',
|
||||
\ '\:exploding_head:': '🤯',
|
||||
\ '\:pregnant_woman:': '🤰',
|
||||
\ '\:breast-feeding:': '🤱',
|
||||
\ '\:palms_up_together:': '🤲',
|
||||
\ '\:selfie:': '🤳',
|
||||
\ '\:prince:': '🤴',
|
||||
\ '\:person_in_tuxedo:': '🤵',
|
||||
\ '\:mrs_claus:': '🤶',
|
||||
\ '\:shrug:': '🤷',
|
||||
\ '\:person_doing_cartwheel:': '🤸',
|
||||
\ '\:juggling:': '🤹',
|
||||
\ '\:fencer:': '🤺',
|
||||
\ '\:wrestlers:': '🤼',
|
||||
\ '\:water_polo:': '🤽',
|
||||
\ '\:handball:': '🤾',
|
||||
\ '\:diving_mask:': '🤿',
|
||||
\ '\:wilted_flower:': '🥀',
|
||||
\ '\:drum_with_drumsticks:': '🥁',
|
||||
\ '\:clinking_glasses:': '🥂',
|
||||
\ '\:tumbler_glass:': '🥃',
|
||||
\ '\:spoon:': '🥄',
|
||||
\ '\:goal_net:': '🥅',
|
||||
\ '\:first_place_medal:': '🥇',
|
||||
\ '\:second_place_medal:': '🥈',
|
||||
\ '\:third_place_medal:': '🥉',
|
||||
\ '\:boxing_glove:': '🥊',
|
||||
\ '\:martial_arts_uniform:': '🥋',
|
||||
\ '\:curling_stone:': '🥌',
|
||||
\ '\:lacrosse:': '🥍',
|
||||
\ '\:softball:': '🥎',
|
||||
\ '\:flying_disc:': '🥏',
|
||||
\ '\:croissant:': '🥐',
|
||||
\ '\:avocado:': '🥑',
|
||||
\ '\:cucumber:': '🥒',
|
||||
\ '\:bacon:': '🥓',
|
||||
\ '\:potato:': '🥔',
|
||||
\ '\:carrot:': '🥕',
|
||||
\ '\:baguette_bread:': '🥖',
|
||||
\ '\:green_salad:': '🥗',
|
||||
\ '\:shallow_pan_of_food:': '🥘',
|
||||
\ '\:stuffed_flatbread:': '🥙',
|
||||
\ '\:egg:': '🥚',
|
||||
\ '\:glass_of_milk:': '🥛',
|
||||
\ '\:peanuts:': '🥜',
|
||||
\ '\:kiwifruit:': '🥝',
|
||||
\ '\:pancakes:': '🥞',
|
||||
\ '\:dumpling:': '🥟',
|
||||
\ '\:fortune_cookie:': '🥠',
|
||||
\ '\:takeout_box:': '🥡',
|
||||
\ '\:chopsticks:': '🥢',
|
||||
\ '\:bowl_with_spoon:': '🥣',
|
||||
\ '\:cup_with_straw:': '🥤',
|
||||
\ '\:coconut:': '🥥',
|
||||
\ '\:broccoli:': '🥦',
|
||||
\ '\:pie:': '🥧',
|
||||
\ '\:pretzel:': '🥨',
|
||||
\ '\:cut_of_meat:': '🥩',
|
||||
\ '\:sandwich:': '🥪',
|
||||
\ '\:canned_food:': '🥫',
|
||||
\ '\:leafy_green:': '🥬',
|
||||
\ '\:mango:': '🥭',
|
||||
\ '\:moon_cake:': '🥮',
|
||||
\ '\:bagel:': '🥯',
|
||||
\ '\:smiling_face_with_3_hearts:': '🥰',
|
||||
\ '\:yawning_face:': '🥱',
|
||||
\ '\:smiling_face_with_tear:': '🥲',
|
||||
\ '\:partying_face:': '🥳',
|
||||
\ '\:woozy_face:': '🥴',
|
||||
\ '\:hot_face:': '🥵',
|
||||
\ '\:cold_face:': '🥶',
|
||||
\ '\:ninja:': '🥷',
|
||||
\ '\:disguised_face:': '🥸',
|
||||
\ '\:pleading_face:': '🥺',
|
||||
\ '\:sari:': '🥻',
|
||||
\ '\:lab_coat:': '🥼',
|
||||
\ '\:goggles:': '🥽',
|
||||
\ '\:hiking_boot:': '🥾',
|
||||
\ '\:womans_flat_shoe:': '🥿',
|
||||
\ '\:crab:': '🦀',
|
||||
\ '\:lion_face:': '🦁',
|
||||
\ '\:scorpion:': '🦂',
|
||||
\ '\:turkey:': '🦃',
|
||||
\ '\:unicorn_face:': '🦄',
|
||||
\ '\:eagle:': '🦅',
|
||||
\ '\:duck:': '🦆',
|
||||
\ '\:bat:': '🦇',
|
||||
\ '\:shark:': '🦈',
|
||||
\ '\:owl:': '🦉',
|
||||
\ '\:fox_face:': '🦊',
|
||||
\ '\:butterfly:': '🦋',
|
||||
\ '\:deer:': '🦌',
|
||||
\ '\:gorilla:': '🦍',
|
||||
\ '\:lizard:': '🦎',
|
||||
\ '\:rhinoceros:': '🦏',
|
||||
\ '\:shrimp:': '🦐',
|
||||
\ '\:squid:': '🦑',
|
||||
\ '\:giraffe_face:': '🦒',
|
||||
\ '\:zebra_face:': '🦓',
|
||||
\ '\:hedgehog:': '🦔',
|
||||
\ '\:sauropod:': '🦕',
|
||||
\ '\:t-rex:': '🦖',
|
||||
\ '\:cricket:': '🦗',
|
||||
\ '\:kangaroo:': '🦘',
|
||||
\ '\:llama:': '🦙',
|
||||
\ '\:peacock:': '🦚',
|
||||
\ '\:hippopotamus:': '🦛',
|
||||
\ '\:parrot:': '🦜',
|
||||
\ '\:raccoon:': '🦝',
|
||||
\ '\:lobster:': '🦞',
|
||||
\ '\:mosquito:': '🦟',
|
||||
\ '\:microbe:': '🦠',
|
||||
\ '\:badger:': '🦡',
|
||||
\ '\:swan:': '🦢',
|
||||
\ '\:mammoth:': '🦣',
|
||||
\ '\:dodo:': '🦤',
|
||||
\ '\:sloth:': '🦥',
|
||||
\ '\:otter:': '🦦',
|
||||
\ '\:orangutan:': '🦧',
|
||||
\ '\:skunk:': '🦨',
|
||||
\ '\:flamingo:': '🦩',
|
||||
\ '\:oyster:': '🦪',
|
||||
\ '\:beaver:': '🦫',
|
||||
\ '\:bison:': '🦬',
|
||||
\ '\:seal:': '🦭',
|
||||
\ '\:guide_dog:': '🦮',
|
||||
\ '\:probing_cane:': '🦯',
|
||||
\ '\:bone:': '🦴',
|
||||
\ '\:leg:': '🦵',
|
||||
\ '\:foot:': '🦶',
|
||||
\ '\:tooth:': '🦷',
|
||||
\ '\:superhero:': '🦸',
|
||||
\ '\:supervillain:': '🦹',
|
||||
\ '\:safety_vest:': '🦺',
|
||||
\ '\:ear_with_hearing_aid:': '🦻',
|
||||
\ '\:motorized_wheelchair:': '🦼',
|
||||
\ '\:manual_wheelchair:': '🦽',
|
||||
\ '\:mechanical_arm:': '🦾',
|
||||
\ '\:mechanical_leg:': '🦿',
|
||||
\ '\:cheese_wedge:': '🧀',
|
||||
\ '\:cupcake:': '🧁',
|
||||
\ '\:salt:': '🧂',
|
||||
\ '\:beverage_box:': '🧃',
|
||||
\ '\:garlic:': '🧄',
|
||||
\ '\:onion:': '🧅',
|
||||
\ '\:falafel:': '🧆',
|
||||
\ '\:waffle:': '🧇',
|
||||
\ '\:butter:': '🧈',
|
||||
\ '\:mate_drink:': '🧉',
|
||||
\ '\:ice_cube:': '🧊',
|
||||
\ '\:bubble_tea:': '🧋',
|
||||
\ '\:standing_person:': '🧍',
|
||||
\ '\:kneeling_person:': '🧎',
|
||||
\ '\:deaf_person:': '🧏',
|
||||
\ '\:face_with_monocle:': '🧐',
|
||||
\ '\:adult:': '🧑',
|
||||
\ '\:child:': '🧒',
|
||||
\ '\:older_adult:': '🧓',
|
||||
\ '\:bearded_person:': '🧔',
|
||||
\ '\:person_with_headscarf:': '🧕',
|
||||
\ '\:person_in_steamy_room:': '🧖',
|
||||
\ '\:person_climbing:': '🧗',
|
||||
\ '\:person_in_lotus_position:': '🧘',
|
||||
\ '\:mage:': '🧙',
|
||||
\ '\:fairy:': '🧚',
|
||||
\ '\:vampire:': '🧛',
|
||||
\ '\:merperson:': '🧜',
|
||||
\ '\:elf:': '🧝',
|
||||
\ '\:genie:': '🧞',
|
||||
\ '\:zombie:': '🧟',
|
||||
\ '\:brain:': '🧠',
|
||||
\ '\:orange_heart:': '🧡',
|
||||
\ '\:billed_cap:': '🧢',
|
||||
\ '\:scarf:': '🧣',
|
||||
\ '\:gloves:': '🧤',
|
||||
\ '\:coat:': '🧥',
|
||||
\ '\:socks:': '🧦',
|
||||
\ '\:red_envelope:': '🧧',
|
||||
\ '\:firecracker:': '🧨',
|
||||
\ '\:jigsaw:': '🧩',
|
||||
\ '\:test_tube:': '🧪',
|
||||
\ '\:petri_dish:': '🧫',
|
||||
\ '\:dna:': '🧬',
|
||||
\ '\:compass:': '🧭',
|
||||
\ '\:abacus:': '🧮',
|
||||
\ '\:fire_extinguisher:': '🧯',
|
||||
\ '\:toolbox:': '🧰',
|
||||
\ '\:bricks:': '🧱',
|
||||
\ '\:magnet:': '🧲',
|
||||
\ '\:luggage:': '🧳',
|
||||
\ '\:lotion_bottle:': '🧴',
|
||||
\ '\:thread:': '🧵',
|
||||
\ '\:yarn:': '🧶',
|
||||
\ '\:safety_pin:': '🧷',
|
||||
\ '\:teddy_bear:': '🧸',
|
||||
\ '\:broom:': '🧹',
|
||||
\ '\:basket:': '🧺',
|
||||
\ '\:roll_of_paper:': '🧻',
|
||||
\ '\:soap:': '🧼',
|
||||
\ '\:sponge:': '🧽',
|
||||
\ '\:receipt:': '🧾',
|
||||
\ '\:nazar_amulet:': '🧿',
|
||||
\ '\:ballet_shoes:': '🩰',
|
||||
\ '\:one-piece_swimsuit:': '🩱',
|
||||
\ '\:briefs:': '🩲',
|
||||
\ '\:shorts:': '🩳',
|
||||
\ '\:thong_sandal:': '🩴',
|
||||
\ '\:drop_of_blood:': '🩸',
|
||||
\ '\:adhesive_bandage:': '🩹',
|
||||
\ '\:stethoscope:': '🩺',
|
||||
\ '\:yo-yo:': '🪀',
|
||||
\ '\:kite:': '🪁',
|
||||
\ '\:parachute:': '🪂',
|
||||
\ '\:boomerang:': '🪃',
|
||||
\ '\:magic_wand:': '🪄',
|
||||
\ '\:pinata:': '🪅',
|
||||
\ '\:nesting_dolls:': '🪆',
|
||||
\ '\:ringed_planet:': '🪐',
|
||||
\ '\:chair:': '🪑',
|
||||
\ '\:razor:': '🪒',
|
||||
\ '\:axe:': '🪓',
|
||||
\ '\:diya_lamp:': '🪔',
|
||||
\ '\:banjo:': '🪕',
|
||||
\ '\:military_helmet:': '🪖',
|
||||
\ '\:accordion:': '🪗',
|
||||
\ '\:long_drum:': '🪘',
|
||||
\ '\:coin:': '🪙',
|
||||
\ '\:carpentry_saw:': '🪚',
|
||||
\ '\:screwdriver:': '🪛',
|
||||
\ '\:ladder:': '🪜',
|
||||
\ '\:hook:': '🪝',
|
||||
\ '\:mirror:': '🪞',
|
||||
\ '\:window:': '🪟',
|
||||
\ '\:plunger:': '🪠',
|
||||
\ '\:sewing_needle:': '🪡',
|
||||
\ '\:knot:': '🪢',
|
||||
\ '\:bucket:': '🪣',
|
||||
\ '\:mouse_trap:': '🪤',
|
||||
\ '\:toothbrush:': '🪥',
|
||||
\ '\:headstone:': '🪦',
|
||||
\ '\:placard:': '🪧',
|
||||
\ '\:rock:': '🪨',
|
||||
\ '\:fly:': '🪰',
|
||||
\ '\:worm:': '🪱',
|
||||
\ '\:beetle:': '🪲',
|
||||
\ '\:cockroach:': '🪳',
|
||||
\ '\:potted_plant:': '🪴',
|
||||
\ '\:wood:': '🪵',
|
||||
\ '\:feather:': '🪶',
|
||||
\ '\:anatomical_heart:': '🫀',
|
||||
\ '\:lungs:': '🫁',
|
||||
\ '\:people_hugging:': '🫂',
|
||||
\ '\:blueberries:': '🫐',
|
||||
\ '\:bell_pepper:': '🫑',
|
||||
\ '\:olive:': '🫒',
|
||||
\ '\:flatbread:': '🫓',
|
||||
\ '\:tamale:': '🫔',
|
||||
\ '\:fondue:': '🫕',
|
||||
\ '\:teapot:': '🫖'}
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ledger') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'ledger', 'autoload/ledger.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
" vim:ts=2:sw=2:sts=2:foldmethod=marker
|
||||
@@ -23,7 +25,7 @@ function! ledger#transaction_state_toggle(lnum, ...) abort
|
||||
endf
|
||||
|
||||
function! ledger#transaction_state_set(lnum, char) abort
|
||||
" modifies or sets the state of the transaction at the cursor,
|
||||
" modifies or sets the state of the transaction at the given line no.,
|
||||
" removing the state altogether if a:char is empty
|
||||
let trans = s:transaction.from_lnum(a:lnum)
|
||||
if empty(trans) || has_key(trans, 'expr')
|
||||
@@ -77,6 +79,69 @@ function! ledger#transaction_date_set(lnum, type, ...) abort
|
||||
call setline(trans['head'], trans.format_head())
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_get(lnum) abort
|
||||
" safe view / position
|
||||
let view = winsaveview()
|
||||
call cursor(a:lnum, 0)
|
||||
|
||||
let line = getline('.')
|
||||
if line[0] !~# '[ \t]'
|
||||
" not a post
|
||||
let state = ''
|
||||
else
|
||||
let m = matchlist(line, '^[ \t]\+\([*?!]\)')
|
||||
if len(m) > 1
|
||||
let state = m[1]
|
||||
else
|
||||
let state = ' '
|
||||
endif
|
||||
endif
|
||||
|
||||
call winrestview(view)
|
||||
return state
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_toggle(lnum, ...) abort
|
||||
if a:0 == 1
|
||||
let chars = a:1
|
||||
else
|
||||
let chars = ' *'
|
||||
endif
|
||||
|
||||
let old = ledger#transaction_post_state_get(a:lnum)
|
||||
if old ==# ''
|
||||
" not a post, probably at the first line of transaction
|
||||
call ledger#transaction_state_toggle(a:lnum, chars)
|
||||
return
|
||||
endif
|
||||
let i = stridx(chars, old) + 1
|
||||
let new = chars[i >= len(chars) ? 0 : i]
|
||||
|
||||
call ledger#transaction_post_state_set(a:lnum, new)
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_set(lnum, char) abort
|
||||
let state = ledger#transaction_post_state_get(a:lnum)
|
||||
if state ==# ''
|
||||
" not a post, probably at the first line of transaction
|
||||
call ledger#transaction_state_set(a:lnum, a:char)
|
||||
return
|
||||
elseif state == a:char || (state ==# ' ' && a:char ==# '')
|
||||
return
|
||||
endif
|
||||
|
||||
let line = getline(a:lnum)
|
||||
if a:char =~# '^\s*$'
|
||||
let newline = substitute(line, '\V' . state . '\m[ \t]', '', '')
|
||||
elseif state ==# ' '
|
||||
let m = matchlist(line, '^\([ \t]\+\)\(.*\)')
|
||||
let newline = m[1] . a:char . ' ' . m[2]
|
||||
else
|
||||
let newline = substitute(line, '\V' . state, a:char, '')
|
||||
endif
|
||||
call setline(a:lnum, newline)
|
||||
endf
|
||||
|
||||
" == get transactions ==
|
||||
|
||||
function! ledger#transaction_from_lnum(lnum) abort
|
||||
@@ -176,8 +241,10 @@ function! s:transaction.from_lnum(lnum) abort dict "{{{2
|
||||
endf "}}}
|
||||
|
||||
function! s:transaction.set_state(char) abort dict "{{{2
|
||||
if has_key(self, 'state') && a:char =~# '^\s*$'
|
||||
if a:char =~# '^\s*$'
|
||||
if has_key(self, 'state')
|
||||
call remove(self, 'state')
|
||||
endif
|
||||
else
|
||||
let self['state'] = a:char
|
||||
endif
|
||||
@@ -390,10 +457,20 @@ endf
|
||||
|
||||
" Return character position of decimal separator (multibyte safe)
|
||||
function! s:decimalpos(expr) abort
|
||||
let pos = match(a:expr, '\V' . g:ledger_decimal_sep)
|
||||
" Remove trailing comments
|
||||
let l:expr = substitute(a:expr, '\v +;.*$', '', '')
|
||||
" Find first or last possible decimal separator candidate
|
||||
if g:ledger_align_last
|
||||
let pos = matchend(l:expr, '\v.*[' . g:ledger_decimal_sep . ']')
|
||||
if pos > 0
|
||||
let pos = strchars(a:expr[:pos]) + 1
|
||||
endif
|
||||
else
|
||||
let pos = match(l:expr, '\v[' . g:ledger_decimal_sep . ']')
|
||||
if pos > 0
|
||||
let pos = strchars(a:expr[:pos]) - 1
|
||||
endif
|
||||
end
|
||||
return pos
|
||||
endf
|
||||
|
||||
@@ -424,7 +501,9 @@ function! ledger#align_commodity() abort
|
||||
" Remove everything after the account name (including spaces):
|
||||
call setline('.', substitute(l:line, '\m^\s\+[^[:space:]].\{-}\zs\(\t\| \).*$', '', ''))
|
||||
let pos = -1
|
||||
if g:ledger_decimal_sep !=# ''
|
||||
if g:ledger_align_commodity == 1
|
||||
let pos = 0
|
||||
elseif g:ledger_decimal_sep !=# ''
|
||||
" Find the position of the first decimal separator:
|
||||
let pos = s:decimalpos(rhs)
|
||||
endif
|
||||
@@ -433,7 +512,7 @@ function! ledger#align_commodity() abort
|
||||
let pos = matchend(rhs, '\m\d[^[:space:]]*')
|
||||
endif
|
||||
" Go to the column that allows us to align the decimal separator at g:ledger_align_at:
|
||||
if pos > 0
|
||||
if pos >= 0
|
||||
call s:goto_col(g:ledger_align_at - pos - 1, 2)
|
||||
else
|
||||
call s:goto_col(g:ledger_align_at - strdisplaywidth(rhs) - 2, 2)
|
||||
@@ -442,6 +521,19 @@ function! ledger#align_commodity() abort
|
||||
endif
|
||||
endf
|
||||
|
||||
" Align the commodity on the entire buffer
|
||||
function! ledger#align_commodity_buffer() abort
|
||||
" Store the viewport position
|
||||
let view = winsaveview()
|
||||
|
||||
" Call ledger#align_commodity for every line
|
||||
%call ledger#align_commodity()
|
||||
|
||||
" Restore the viewport position
|
||||
call winrestview(view)
|
||||
unlet view
|
||||
endf
|
||||
|
||||
" Align the amount under the cursor and append/prepend the default currency.
|
||||
function! ledger#align_amount_at_cursor() abort
|
||||
" Select and cut text:
|
||||
@@ -462,6 +554,10 @@ function! ledger#align_amount_at_cursor() abort
|
||||
endif
|
||||
endf
|
||||
|
||||
function! ledger#align_formatexpr(lnum, count) abort
|
||||
execute a:lnum . ',' . (a:lnum + a:count - 1) . 'call ledger#align_commodity()'
|
||||
endfunction
|
||||
|
||||
" Report generation {{{1
|
||||
|
||||
" Helper functions and variables {{{2
|
||||
@@ -650,8 +746,6 @@ function! ledger#register(file, args) abort
|
||||
endf
|
||||
|
||||
" Reconcile the given account.
|
||||
" This function accepts a file path as a third optional argument.
|
||||
" The default is to use the value of g:ledger_main.
|
||||
"
|
||||
" Parameters:
|
||||
" file The file to be processed
|
||||
@@ -740,5 +834,3 @@ function! ledger#show_balance(file, ...) abort
|
||||
endif
|
||||
endf
|
||||
" }}}
|
||||
|
||||
endif
|
||||
|
||||
114
autoload/nim.vim
114
autoload/nim.vim
@@ -1,9 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'nim', 'autoload/nim.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:nim_log = []
|
||||
let s:plugin_path = escape(expand('<sfile>:p:h'), '\')
|
||||
|
||||
if !exists("g:nim_caas_enabled")
|
||||
if !exists('g:nim_caas_enabled')
|
||||
let g:nim_caas_enabled = 0
|
||||
endif
|
||||
|
||||
@@ -11,27 +13,25 @@ if !executable('nim')
|
||||
echoerr "the Nim compiler must be in your system's PATH"
|
||||
endif
|
||||
|
||||
if has("python3")
|
||||
exe 'py3file ' . fnameescape(s:plugin_path) . '/nim_vim.py'
|
||||
elseif has("python")
|
||||
exe 'pyfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
|
||||
if has('pythonx')
|
||||
exe 'pyxfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
|
||||
endif
|
||||
|
||||
fun! nim#init()
|
||||
let cmd = printf("nim --dump.format:json --verbosity:0 dump %s", s:CurrentNimFile())
|
||||
fun! nim#init() abort
|
||||
let cmd = printf('nim --dump.format:json --verbosity:0 dump %s', s:CurrentNimFile())
|
||||
let raw_dumpdata = system(cmd)
|
||||
if !v:shell_error && expand("%:e") == "nim"
|
||||
if !v:shell_error && expand('%:e') ==# 'nim'
|
||||
let false = 0 " Needed for eval of json
|
||||
let true = 1 " Needed for eval of json
|
||||
let dumpdata = eval(substitute(raw_dumpdata, "\n", "", "g"))
|
||||
let dumpdata = json_decode(raw_dumpdata)
|
||||
|
||||
let b:nim_project_root = dumpdata['project_path']
|
||||
let b:nim_defined_symbols = dumpdata['defined_symbols']
|
||||
let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1
|
||||
|
||||
for path in dumpdata['lib_paths']
|
||||
if finddir(path) == path
|
||||
let &l:path = path . "," . &l:path
|
||||
if finddir(path) ==# path
|
||||
let &l:path = path . ',' . &l:path
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
@@ -39,7 +39,7 @@ fun! nim#init()
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! s:UpdateNimLog()
|
||||
fun! s:UpdateNimLog() abort
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=hide
|
||||
setlocal noswapfile
|
||||
@@ -56,32 +56,32 @@ endf
|
||||
augroup NimVim
|
||||
au!
|
||||
au BufEnter log://nim call s:UpdateNimLog()
|
||||
if has("python3") || has("python")
|
||||
" au QuitPre * :py nimTerminateAll()
|
||||
au VimLeavePre * :py nimTerminateAll()
|
||||
if has('pythonx')
|
||||
" au QuitPre * :pyx nimTerminateAll()
|
||||
au VimLeavePre * :pyx nimTerminateAll()
|
||||
endif
|
||||
augroup END
|
||||
|
||||
command! NimLog :e log://nim
|
||||
|
||||
command! NimTerminateService
|
||||
\ :exe printf("py nimTerminateService('%s')", b:nim_project_root)
|
||||
\ :exe printf("pyx nimTerminateService('%s')", b:nim_project_root)
|
||||
|
||||
command! NimRestartService
|
||||
\ :exe printf("py nimRestartService('%s')", b:nim_project_root)
|
||||
\ :exe printf("pyx nimRestartService('%s')", b:nim_project_root)
|
||||
|
||||
fun! s:CurrentNimFile()
|
||||
fun! s:CurrentNimFile() abort
|
||||
let save_cur = getpos('.')
|
||||
call cursor(0, 0, 0)
|
||||
|
||||
let PATTERN = "\\v^\\#\\s*included from \\zs.*\\ze"
|
||||
let l = search(PATTERN, "n")
|
||||
let PATTERN = '\v^\#\s*included from \zs.*\ze'
|
||||
let l = search(PATTERN, 'n')
|
||||
|
||||
if l != 0
|
||||
let f = matchstr(getline(l), PATTERN)
|
||||
let l:to_check = expand('%:h') . "/" . f
|
||||
let l:to_check = expand('%:h') . '/' . f
|
||||
else
|
||||
let l:to_check = expand("%")
|
||||
let l:to_check = expand('%')
|
||||
endif
|
||||
|
||||
call setpos('.', save_cur)
|
||||
@@ -108,42 +108,42 @@ let g:nim_symbol_types = {
|
||||
\ 'skEnumField': 'v',
|
||||
\ }
|
||||
|
||||
fun! NimExec(op)
|
||||
let isDirty = getbufvar(bufnr('%'), "&modified")
|
||||
fun! NimExec(op) abort
|
||||
let isDirty = getbufvar(bufnr('%'), '&modified')
|
||||
if isDirty
|
||||
let tmp = tempname() . bufname("%") . "_dirty.nim"
|
||||
silent! exe ":w " . tmp
|
||||
let tmp = tempname() . bufname('%') . '_dirty.nim'
|
||||
silent! exe ':w ' . tmp
|
||||
|
||||
let cmd = printf("idetools %s --trackDirty:\"%s,%s,%d,%d\" \"%s\"",
|
||||
let cmd = printf('idetools %s --trackDirty:"%s,%s,%d,%d" "%s"',
|
||||
\ a:op, tmp, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())
|
||||
else
|
||||
let cmd = printf("idetools %s --track:\"%s,%d,%d\" \"%s\"",
|
||||
let cmd = printf('idetools %s --track:"%s,%d,%d" "%s"',
|
||||
\ a:op, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())
|
||||
endif
|
||||
|
||||
if b:nim_caas_enabled
|
||||
exe printf("py nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd)
|
||||
let output = l:py_res
|
||||
exe printf("pyx nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd)
|
||||
let output = get(l:, 'py_res', '')
|
||||
else
|
||||
let output = system("nim " . cmd)
|
||||
let output = system('nim ' . cmd)
|
||||
endif
|
||||
|
||||
call add(g:nim_log, "nim " . cmd . "\n" . output)
|
||||
call add(g:nim_log, 'nim ' . cmd . "\n" . output)
|
||||
return output
|
||||
endf
|
||||
|
||||
fun! NimExecAsync(op, Handler)
|
||||
fun! NimExecAsync(op, Handler) abort
|
||||
let result = NimExec(a:op)
|
||||
call a:Handler(result)
|
||||
endf
|
||||
|
||||
fun! NimComplete(findstart, base)
|
||||
if b:nim_caas_enabled == 0
|
||||
fun! NimComplete(findstart, base) abort
|
||||
if b:nim_caas_enabled ==# 0
|
||||
return -1
|
||||
endif
|
||||
|
||||
if a:findstart
|
||||
if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment'
|
||||
if synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name') ==# 'Comment'
|
||||
return -1
|
||||
endif
|
||||
let line = getline('.')
|
||||
@@ -154,10 +154,10 @@ fun! NimComplete(findstart, base)
|
||||
return start
|
||||
else
|
||||
let result = []
|
||||
let sugOut = NimExec("--suggest")
|
||||
let sugOut = NimExec('--suggest')
|
||||
for line in split(sugOut, '\n')
|
||||
let lineData = split(line, '\t')
|
||||
if len(lineData) > 0 && lineData[0] == "sug"
|
||||
if len(lineData) > 0 && lineData[0] ==# 'sug'
|
||||
let word = split(lineData[2], '\.')[-1]
|
||||
if a:base ==? '' || word =~# '^' . a:base
|
||||
let kind = get(g:nim_symbol_types, lineData[1], '')
|
||||
@@ -170,7 +170,7 @@ fun! NimComplete(findstart, base)
|
||||
endif
|
||||
endf
|
||||
|
||||
if !exists("g:neocomplcache_omni_patterns")
|
||||
if !exists('g:neocomplcache_omni_patterns')
|
||||
let g:neocomplcache_omni_patterns = {}
|
||||
endif
|
||||
let g:neocomplcache_omni_patterns['nim'] = '[^. *\t]\.\w*'
|
||||
@@ -182,7 +182,7 @@ let g:neocomplete#sources#omni#input_patterns['nim'] = '[^. *\t]\.\w*'
|
||||
|
||||
let g:nim_completion_callbacks = {}
|
||||
|
||||
fun! NimAsyncCmdComplete(cmd, output)
|
||||
fun! NimAsyncCmdComplete(cmd, output) abort
|
||||
call add(g:nim_log, a:output)
|
||||
echom g:nim_completion_callbacks
|
||||
if has_key(g:nim_completion_callbacks, a:cmd)
|
||||
@@ -190,55 +190,55 @@ fun! NimAsyncCmdComplete(cmd, output)
|
||||
call Callback(a:output)
|
||||
" remove(g:nim_completion_callbacks, a:cmd)
|
||||
else
|
||||
echom "ERROR, Unknown Command: " . a:cmd
|
||||
echom 'ERROR, Unknown Command: ' . a:cmd
|
||||
endif
|
||||
return 1
|
||||
endf
|
||||
|
||||
fun! GotoDefinition_nim_ready(def_output)
|
||||
fun! GotoDefinition_nim_ready(def_output) abort
|
||||
if v:shell_error
|
||||
echo "nim was unable to locate the definition. exit code: " . v:shell_error
|
||||
echo 'nim was unable to locate the definition. exit code: ' . v:shell_error
|
||||
" echoerr a:def_output
|
||||
return 0
|
||||
endif
|
||||
|
||||
let rawDef = matchstr(a:def_output, 'def\t\([^\n]*\)')
|
||||
if rawDef == ""
|
||||
echo "the current cursor position does not match any definitions"
|
||||
if rawDef == ''
|
||||
echo 'the current cursor position does not match any definitions'
|
||||
return 0
|
||||
endif
|
||||
|
||||
let defBits = split(rawDef, '\t')
|
||||
let file = defBits[4]
|
||||
let line = defBits[5]
|
||||
exe printf("e +%d %s", line, file)
|
||||
let column = defBits[6]
|
||||
exe printf('e +%d %s', line, file)
|
||||
call cursor(line, column + 1)
|
||||
return 1
|
||||
endf
|
||||
|
||||
fun! GotoDefinition_nim()
|
||||
call NimExecAsync("--def", function("GotoDefinition_nim_ready"))
|
||||
fun! GotoDefinition_nim() abort
|
||||
call NimExecAsync('--def', function('GotoDefinition_nim_ready'))
|
||||
endf
|
||||
|
||||
fun! FindReferences_nim()
|
||||
setloclist()
|
||||
fun! FindReferences_nim() abort
|
||||
"setloclist()
|
||||
endf
|
||||
|
||||
" Syntastic syntax checking
|
||||
fun! SyntaxCheckers_nim_nim_GetLocList()
|
||||
fun! SyntaxCheckers_nim_nim_GetLocList() abort
|
||||
let makeprg = 'nim check --hints:off --listfullpaths ' . s:CurrentNimFile()
|
||||
let errorformat = &errorformat
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endf
|
||||
|
||||
function! SyntaxCheckers_nim_nim_IsAvailable()
|
||||
return executable("nim")
|
||||
function! SyntaxCheckers_nim_nim_IsAvailable() abort
|
||||
return executable('nim')
|
||||
endfunction
|
||||
|
||||
if exists("g:SyntasticRegistry")
|
||||
if exists('g:SyntasticRegistry')
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'nim',
|
||||
\ 'name': 'nim'})
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
30
autoload/org.vim
Normal file
30
autoload/org.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'autoload/org.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Helper functions for org.vim
|
||||
"
|
||||
" Maintainer: Alex Vear <alex@vear.uk>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: autoload/org.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-04
|
||||
|
||||
" Fallback chain for options. Buffer local --> Global --> default.
|
||||
function org#option(name, default) abort
|
||||
return get(b:, a:name, get(g:, a:name, a:default))
|
||||
endfunction
|
||||
|
||||
" Emacs-like fold text.
|
||||
function org#fold_text() abort
|
||||
return getline(v:foldstart) . '...'
|
||||
endfunction
|
||||
|
||||
" Check fold depth of a line.
|
||||
function org#fold_expr()
|
||||
let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
|
||||
if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# '\m^o\(rg\|utline\)Heading'
|
||||
return ">" . l:depth
|
||||
endif
|
||||
return "="
|
||||
endfunction
|
||||
@@ -1,386 +0,0 @@
|
||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" We need it because scripts.vim in vim uses "set ft=" which cannot be
|
||||
" overridden with setf (and we can't use set ft= so our scripts.vim work)
|
||||
func! s:Setf(ft)
|
||||
if &filetype !~# '<'.a:ft.'>'
|
||||
let &filetype = a:ft
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func! polyglot#Shebang()
|
||||
" Try to detect filetype from shebang
|
||||
let ft = polyglot#ShebangFiletype()
|
||||
if ft != ""
|
||||
call s:Setf(ft)
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunc
|
||||
|
||||
let s:interpreters = {
|
||||
\ 'osascript': 'applescript',
|
||||
\ 'tcc': 'c',
|
||||
\ 'coffee': 'coffee',
|
||||
\ 'crystal': 'crystal',
|
||||
\ 'dart': 'dart',
|
||||
\ 'elixir': 'elixir',
|
||||
\ 'escript': 'erlang',
|
||||
\ 'fish': 'fish',
|
||||
\ 'gnuplot': 'gnuplot',
|
||||
\ 'groovy': 'groovy',
|
||||
\ 'runhaskell': 'haskell',
|
||||
\ 'chakra': 'javascript',
|
||||
\ 'd8': 'javascript',
|
||||
\ 'gjs': 'javascript',
|
||||
\ 'js': 'javascript',
|
||||
\ 'node': 'javascript',
|
||||
\ 'nodejs': 'javascript',
|
||||
\ 'qjs': 'javascript',
|
||||
\ 'rhino': 'javascript',
|
||||
\ 'v8': 'javascript',
|
||||
\ 'v8-shell': 'javascript',
|
||||
\ 'julia': 'julia',
|
||||
\ 'lua': 'lua',
|
||||
\ 'moon': 'moon',
|
||||
\ 'ocaml': 'ocaml',
|
||||
\ 'ocamlrun': 'ocaml',
|
||||
\ 'ocamlscript': 'ocaml',
|
||||
\ 'cperl': 'perl',
|
||||
\ 'perl': 'perl',
|
||||
\ 'php': 'php',
|
||||
\ 'swipl': 'prolog',
|
||||
\ 'yap': 'prolog',
|
||||
\ 'pwsh': 'ps1',
|
||||
\ 'python': 'python',
|
||||
\ 'python2': 'python',
|
||||
\ 'python3': 'python',
|
||||
\ 'qmake': 'qmake',
|
||||
\ 'Rscript': 'r',
|
||||
\ 'racket': 'racket',
|
||||
\ 'perl6': 'raku',
|
||||
\ 'raku': 'raku',
|
||||
\ 'rakudo': 'raku',
|
||||
\ 'ruby': 'ruby',
|
||||
\ 'macruby': 'ruby',
|
||||
\ 'rake': 'ruby',
|
||||
\ 'jruby': 'ruby',
|
||||
\ 'rbx': 'ruby',
|
||||
\ 'scala': 'scala',
|
||||
\ 'ash': 'sh',
|
||||
\ 'bash': 'sh',
|
||||
\ 'dash': 'sh',
|
||||
\ 'ksh': 'sh',
|
||||
\ 'mksh': 'sh',
|
||||
\ 'pdksh': 'sh',
|
||||
\ 'rc': 'sh',
|
||||
\ 'sh': 'sh',
|
||||
\ 'zsh': 'sh',
|
||||
\ 'boolector': 'smt2',
|
||||
\ 'cvc4': 'smt2',
|
||||
\ 'mathsat5': 'smt2',
|
||||
\ 'opensmt': 'smt2',
|
||||
\ 'smtinterpol': 'smt2',
|
||||
\ 'smt-rat': 'smt2',
|
||||
\ 'stp': 'smt2',
|
||||
\ 'verit': 'smt2',
|
||||
\ 'yices2': 'smt2',
|
||||
\ 'z3': 'smt2',
|
||||
\ 'deno': 'typescript',
|
||||
\ 'ts-node': 'typescript',
|
||||
\ }
|
||||
|
||||
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
|
||||
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
|
||||
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
|
||||
|
||||
func! polyglot#ShebangFiletype()
|
||||
let l:line1 = getline(1)
|
||||
|
||||
if l:line1 !~# "^#!"
|
||||
return
|
||||
endif
|
||||
|
||||
let l:pathrest = matchlist(l:line1, s:r_hashbang)
|
||||
|
||||
if len(l:pathrest) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let [_, l:path, l:rest; __] = l:pathrest
|
||||
|
||||
let l:script = split(l:path, "/")[-1]
|
||||
|
||||
if l:script == "env"
|
||||
let l:argspath = matchlist(l:rest, s:r_env)
|
||||
if len(l:argspath) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let l:script = l:argspath[1]
|
||||
endif
|
||||
|
||||
if has_key(s:interpreters, l:script)
|
||||
return s:interpreters[l:script]
|
||||
endif
|
||||
|
||||
for interpreter in keys(s:interpreters)
|
||||
if l:script =~# '^' . interpreter
|
||||
return s:interpreters[interpreter]
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectInpFiletype()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\*'
|
||||
call s:Setf('abaqus') | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 500]))
|
||||
let line = getline(lnum)
|
||||
if line =~? '^header surface data'
|
||||
call s:Setf('trasys') | return
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectAsaFiletype()
|
||||
if exists("g:filetype_asa")
|
||||
call s:Setf(g:filetype_asa) | return
|
||||
endif
|
||||
call s:Setf('aspvbs') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectAspFiletype()
|
||||
if exists("g:filetype_asp")
|
||||
call s:Setf(g:filetype_asp) | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 3]))
|
||||
let line = getline(lnum)
|
||||
if line =~? 'perlscript'
|
||||
call s:Setf('aspperl') | return
|
||||
endif
|
||||
endfor
|
||||
call s:Setf('aspvbs') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectHFiletype()
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
if exists("g:c_syntax_for_h")
|
||||
call s:Setf('objc') | return
|
||||
endif
|
||||
call s:Setf('objcpp') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:c_syntax_for_h")
|
||||
call s:Setf('c') | return
|
||||
endif
|
||||
if exists("g:ch_syntax_for_h")
|
||||
call s:Setf('ch') | return
|
||||
endif
|
||||
call s:Setf('cpp') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectMFiletype()
|
||||
let saw_comment = 0
|
||||
for lnum in range(1, min([line("$"), 100]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*/\*'
|
||||
let saw_comment = 1
|
||||
endif
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
call s:Setf('objc') | return
|
||||
endif
|
||||
if line =~# '^\s*%'
|
||||
call s:Setf('octave') | return
|
||||
endif
|
||||
if line =~# '^\s*(\*'
|
||||
call s:Setf('mma') | return
|
||||
endif
|
||||
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
|
||||
call s:Setf('murphi') | return
|
||||
endif
|
||||
endfor
|
||||
if saw_comment
|
||||
call s:Setf('objc') | return
|
||||
endif
|
||||
if exists("g:filetype_m")
|
||||
call s:Setf(g:filetype_m) | return
|
||||
endif
|
||||
call s:Setf('octave') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectFsFiletype()
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\(: \|new-device\)'
|
||||
call s:Setf('forth') | return
|
||||
endif
|
||||
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
|
||||
call s:Setf('fsharp') | return
|
||||
endif
|
||||
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
||||
call s:Setf('glsl') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_fs")
|
||||
call s:Setf(g:filetype_fs) | return
|
||||
endif
|
||||
call s:Setf('forth') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectReFiletype()
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
|
||||
call s:Setf('cpp') | return
|
||||
endif
|
||||
call s:Setf('reason') | return
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectIdrFiletype()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*--.*[Ii]dris \=1'
|
||||
call s:Setf('idris') | return
|
||||
endif
|
||||
if line =~# '^\s*--.*[Ii]dris \=2'
|
||||
call s:Setf('idris2') | return
|
||||
endif
|
||||
endfor
|
||||
for lnum in range(1, min([line("$"), 30]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^pkgs =.*'
|
||||
call s:Setf('idris') | return
|
||||
endif
|
||||
if line =~# '^depends =.*'
|
||||
call s:Setf('idris2') | return
|
||||
endif
|
||||
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
|
||||
call s:Setf('idris') | return
|
||||
endif
|
||||
if line =~# '^%language PostfixProjections'
|
||||
call s:Setf('idris2') | return
|
||||
endif
|
||||
if line =~# '^%access .*'
|
||||
call s:Setf('idris') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_idr")
|
||||
call s:Setf(g:filetype_idr) | return
|
||||
endif
|
||||
call s:Setf('idris2') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectLidrFiletype()
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^>\s*--.*[Ii]dris \=1'
|
||||
call s:Setf('lidris') | return
|
||||
endif
|
||||
endfor
|
||||
call s:Setf('lidris2') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectBasFiletype()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
||||
call s:Setf('vb') | return
|
||||
endif
|
||||
endfor
|
||||
call s:Setf('basic') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectPmFiletype()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# 'XPM2'
|
||||
call s:Setf('xpm2') | return
|
||||
endif
|
||||
if line =~# 'XPM'
|
||||
call s:Setf('xpm') | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
call s:Setf('raku') | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
call s:Setf('perl') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_pm")
|
||||
call s:Setf(g:filetype_pm) | return
|
||||
endif
|
||||
call s:Setf('perl') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectPlFiletype()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
|
||||
call s:Setf('prolog') | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
call s:Setf('raku') | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
call s:Setf('perl') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_pl")
|
||||
call s:Setf(g:filetype_pl) | return
|
||||
endif
|
||||
call s:Setf('perl') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectTFiletype()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\.'
|
||||
call s:Setf('nroff') | return
|
||||
endif
|
||||
endfor
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
call s:Setf('raku') | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
call s:Setf('perl') | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_t")
|
||||
call s:Setf(g:filetype_t) | return
|
||||
endif
|
||||
call s:Setf('perl') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectTt2Filetype()
|
||||
for lnum in range(1, min([line("$"), 3]))
|
||||
let line = getline(lnum)
|
||||
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
|
||||
call s:Setf('tt2html') | return
|
||||
endif
|
||||
endfor
|
||||
call s:Setf('tt2') | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectHtmlFiletype()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\(%\|<[%&].*>\)'
|
||||
call s:Setf('mason') | return
|
||||
endif
|
||||
call s:Setf('html') | return
|
||||
endfunc
|
||||
|
||||
" Restore 'cpoptions'
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
338
autoload/polyglot/detect.vim
Normal file
338
autoload/polyglot/detect.vim
Normal file
@@ -0,0 +1,338 @@
|
||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
func! polyglot#detect#Inp(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\*'
|
||||
set ft=abaqus | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 500]))
|
||||
let line = getline(lnum)
|
||||
if line =~? '^header surface data'
|
||||
set ft=trasys | return
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Asa(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
if exists("g:filetype_asa")
|
||||
let &ft = g:filetype_asa | return
|
||||
endif
|
||||
set ft=aspvbs | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Asp(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
if exists("g:filetype_asp")
|
||||
let &ft = g:filetype_asp | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 3]))
|
||||
let line = getline(lnum)
|
||||
if line =~? 'perlscript'
|
||||
set ft=aspperl | return
|
||||
endif
|
||||
endfor
|
||||
set ft=aspvbs | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#H(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
if exists('g:c_syntax_for_h')
|
||||
set ft=objc | return
|
||||
endif
|
||||
set ft=objcpp | return
|
||||
endif
|
||||
endfor
|
||||
if exists('g:c_syntax_for_h')
|
||||
set ft=c | return
|
||||
endif
|
||||
if exists('g:ch_syntax_for_h')
|
||||
set ft=ch | return
|
||||
endif
|
||||
set ft=cpp | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#M(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
let saw_comment = 0
|
||||
for lnum in range(1, min([line("$"), 100]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*/\*'
|
||||
let saw_comment = 1
|
||||
endif
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
set ft=objc | return
|
||||
endif
|
||||
if line =~# '^\s*%'
|
||||
if !has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=octave | return
|
||||
endif
|
||||
endif
|
||||
if line =~# '^\s*%'
|
||||
if has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=matlab | return
|
||||
endif
|
||||
endif
|
||||
if line =~# '^\s*(\*'
|
||||
set ft=mma | return
|
||||
endif
|
||||
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
|
||||
set ft=murphi | return
|
||||
endif
|
||||
endfor
|
||||
if saw_comment
|
||||
set ft=objc | return
|
||||
endif
|
||||
if exists("g:filetype_m")
|
||||
let &ft = g:filetype_m | return
|
||||
endif
|
||||
if !has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=octave | return
|
||||
endif
|
||||
if has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=matlab | return
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Fs(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\(: \|new-device\)'
|
||||
set ft=forth | return
|
||||
endif
|
||||
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
|
||||
set ft=fsharp | return
|
||||
endif
|
||||
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
||||
set ft=glsl | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_fs")
|
||||
let &ft = g:filetype_fs | return
|
||||
endif
|
||||
set ft=forth | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Frag(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
||||
set ft=glsl | return
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Re(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
|
||||
set ft=cpp | return
|
||||
endif
|
||||
set ft=reason | return
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Idr(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*--.*[Ii]dris \=1'
|
||||
set ft=idris | return
|
||||
endif
|
||||
if line =~# '^\s*--.*[Ii]dris \=2'
|
||||
set ft=idris2 | return
|
||||
endif
|
||||
endfor
|
||||
for lnum in range(1, min([line("$"), 30]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^pkgs =.*'
|
||||
set ft=idris | return
|
||||
endif
|
||||
if line =~# '^depends =.*'
|
||||
set ft=idris2 | return
|
||||
endif
|
||||
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
|
||||
set ft=idris | return
|
||||
endif
|
||||
if line =~# '^%language PostfixProjections'
|
||||
set ft=idris2 | return
|
||||
endif
|
||||
if line =~# '^%access .*'
|
||||
set ft=idris | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_idr")
|
||||
let &ft = g:filetype_idr | return
|
||||
endif
|
||||
set ft=idris2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Lidr(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^>\s*--.*[Ii]dris \=1'
|
||||
set ft=lidris | return
|
||||
endif
|
||||
endfor
|
||||
set ft=lidris2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Bas(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
||||
set ft=vb | return
|
||||
endif
|
||||
endfor
|
||||
set ft=basic | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Pm(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# 'XPM2'
|
||||
set ft=xpm2 | return
|
||||
endif
|
||||
if line =~# 'XPM'
|
||||
set ft=xpm | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
set ft=raku | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
set ft=perl | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_pm")
|
||||
let &ft = g:filetype_pm | return
|
||||
endif
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Pl(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
|
||||
set ft=prolog | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
set ft=raku | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
set ft=perl | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_pl")
|
||||
let &ft = g:filetype_pl | return
|
||||
endif
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#T(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\.'
|
||||
set ft=nroff | return
|
||||
endif
|
||||
endfor
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||
set ft=raku | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||
set ft=perl | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:filetype_t")
|
||||
let &ft = g:filetype_t | return
|
||||
endif
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Tt2(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 3]))
|
||||
let line = getline(lnum)
|
||||
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
|
||||
set ft=tt2html | return
|
||||
endif
|
||||
endfor
|
||||
set ft=tt2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Html(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\(%\|<[%&].*>\)'
|
||||
set ft=mason | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\|load\)\(\<\|\>\)\|{#\s\+'
|
||||
set ft=htmldjango | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
||||
set ft=xhtml | return
|
||||
endif
|
||||
endfor
|
||||
set ft=html | return
|
||||
endfunc
|
||||
|
||||
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user