mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
334 Commits
v4.5.2
...
777b00c628
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
777b00c628 | ||
|
|
f5393cfee0 | ||
|
|
692e359ad9 | ||
|
|
a126d20c24 | ||
|
|
158ffef943 | ||
|
|
2a41a13242 | ||
|
|
41ef24676a | ||
|
|
eeb517c330 | ||
|
|
4dda82ad99 | ||
|
|
01d1375124 | ||
|
|
55a8775570 | ||
|
|
df71259406 | ||
|
|
4d25ca6d81 | ||
|
|
e58c5db4e6 | ||
|
|
0c238d2206 | ||
|
|
56b56c9907 | ||
|
|
e813ced93e | ||
|
|
bc8a81d359 | ||
|
|
38282d5838 | ||
|
|
36a2bf60ad | ||
|
|
db7bb8ba22 | ||
|
|
aae85fe8c2 | ||
|
|
55eed00f71 | ||
|
|
db3a87a50b | ||
|
|
8bb9203790 | ||
|
|
32d08013a6 | ||
|
|
0e1b191209 | ||
|
|
a4f98d2a9e | ||
|
|
83422e0a1f | ||
|
|
b77c5f1107 | ||
|
|
2c5af8f89d | ||
|
|
3a1fd1b41e | ||
|
|
b1704aba87 | ||
|
|
040e90bd02 | ||
|
|
c96947b1c6 | ||
|
|
f621f6c1ee | ||
|
|
cb80947143 | ||
|
|
87a26c5bf1 | ||
|
|
918610d427 | ||
|
|
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 | ||
|
|
17c2b630e1 | ||
|
|
271679272c | ||
|
|
d43d269bed | ||
|
|
4314841aa4 | ||
|
|
5308fab3e9 | ||
|
|
c842cbcb59 | ||
|
|
314621a395 | ||
|
|
ca8818e8ed | ||
|
|
947e6853aa | ||
|
|
05ff14bfda | ||
|
|
9243367ba3 | ||
|
|
1eed30b2af | ||
|
|
be092d6f43 | ||
|
|
fb7cf8a9ab | ||
|
|
19a69cf77d | ||
|
|
4f7a4036eb | ||
|
|
0ff5d451b0 | ||
|
|
49840b1893 | ||
|
|
2dc954d6fa | ||
|
|
2369cd5d22 | ||
|
|
46affb6153 | ||
|
|
a4cc3f64f9 | ||
|
|
2fe310256e | ||
|
|
2e1a980632 | ||
|
|
cecfb5dd10 | ||
|
|
a4a9481d37 | ||
|
|
5e5d127eb8 | ||
|
|
002573265a | ||
|
|
a4b91124a8 | ||
|
|
46040f3ffd | ||
|
|
48254ec7ad | ||
|
|
cd2fded0e0 | ||
|
|
255345bf95 | ||
|
|
3169f80169 | ||
|
|
e9b3bcd5e1 | ||
|
|
d9ee362537 | ||
|
|
57badea2dc | ||
|
|
3baafd5c33 | ||
|
|
b0124dc880 | ||
|
|
99166bd51f | ||
|
|
48b4f233c5 | ||
|
|
556ba05cee | ||
|
|
262960fa22 | ||
|
|
b2640b5b76 | ||
|
|
c30ba66d22 | ||
|
|
4df00e6574 | ||
|
|
48f59577c8 | ||
|
|
96179c95ba | ||
|
|
520389bbfd | ||
|
|
7123e97498 | ||
|
|
63119f09d1 | ||
|
|
f2ef4cedec | ||
|
|
45c1923f43 | ||
|
|
8dd0474feb | ||
|
|
e166f741ef | ||
|
|
d4fcef1aa8 | ||
|
|
7972e8eea1 | ||
|
|
6ed481e463 | ||
|
|
c1e1870a3d | ||
|
|
f0d6ecff07 | ||
|
|
15e5df246e | ||
|
|
94ababe91f | ||
|
|
080b8cdc60 | ||
|
|
e47af23f64 | ||
|
|
8f5134aef8 | ||
|
|
be8d039e02 | ||
|
|
38ce8e9cb6 | ||
|
|
55ad5a982a | ||
|
|
b2055afaa7 | ||
|
|
63a175357a | ||
|
|
25db54573a | ||
|
|
d1bfe50419 |
12
.github/ISSUE_TEMPLATE/add-language.md
vendored
12
.github/ISSUE_TEMPLATE/add-language.md
vendored
@@ -2,17 +2,23 @@
|
||||
name: Add language
|
||||
about: Add support for new language
|
||||
title: ''
|
||||
labels: ''
|
||||
labels: 'enhancement'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- vim-polyglot accepts only lightweight, maintained github-hosted vim plugins -->
|
||||
**What is the name of this language in Linguist?**
|
||||
|
||||
<!-- https://github.com/github/linguist/blob/master/lib/linguist/languages.yml -->
|
||||
|
||||
**Link to GitHub repository of Vim plugin**
|
||||
|
||||
**GitHub repository url**
|
||||
|
||||
|
||||
**Is this plugin well maintained?**
|
||||
|
||||
|
||||
|
||||
**Is this plugin lightweight? (no advanced functionality, just indent and syntax support)**
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Add support for language
|
||||
about: ''
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -14,8 +14,8 @@ jobs:
|
||||
run: |
|
||||
sudo add-apt-repository ppa:jonathonf/vim -y
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -y vim
|
||||
sudo apt-get install -y vim expect
|
||||
vim --version
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
run: scripts/test
|
||||
run: make test
|
||||
|
||||
10
Makefile
Normal file
10
Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
.PHONY: build test dev
|
||||
|
||||
build:
|
||||
@ scripts/build
|
||||
|
||||
test:
|
||||
@ scripts/test
|
||||
|
||||
dev:
|
||||
@ find scripts autoload/polyglot ftdetect tests . -type f -maxdepth 1 | DEV=1 entr bash -c 'make'
|
||||
433
README.md
433
README.md
@@ -1,29 +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
|
||||
|
||||

|
||||
|
||||
A collection of language packs for Vim.
|
||||
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->156<!--/Package Count--> packages it consists of.
|
||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||
- 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 `19ms` 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.
|
||||
@@ -31,197 +38,265 @@ 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-->
|
||||
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl) (syntax)
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim) (syntax, indent, ftplugin)
|
||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim) (syntax, ctags)
|
||||
- [applescript](https://github.com/mityu/vim-applescript) (syntax, indent)
|
||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent)
|
||||
- [asciidoc](https://github.com/asciidoc/vim-asciidoc) (syntax)
|
||||
- [autohotkey](https://github.com/hnamikaw/vim-autohotkey) (indent)
|
||||
- [blade](https://github.com/jwalton512/vim-blade) (syntax, indent, ftplugin)
|
||||
- [brewfile](https://github.com/bfontaine/Brewfile.vim) (syntax)
|
||||
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (syntax)
|
||||
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
|
||||
- [carp](https://github.com/hellerve/carp-vim) (syntax)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, compiler, indent, autoload, ftplugin)
|
||||
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
||||
- [crystal](https://github.com/rhysd/vim-crystal) (syntax, indent, autoload, ftplugin)
|
||||
- [csv](https://github.com/chrisbra/csv.vim) (syntax, autoload, ftplugin)
|
||||
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin)
|
||||
- [cue](https://github.com/mgrabovsky/vim-cuesheet) (syntax)
|
||||
- [dart](https://github.com/dart-lang/dart-vim-plugin) (syntax, indent, autoload, ftplugin)
|
||||
- [dhall](https://github.com/vmchale/dhall-vim) (syntax, ftplugin)
|
||||
- [dlang](https://github.com/JesseKPhillips/d.vim) (syntax, indent)
|
||||
- [dockerfile](https://github.com/ekalinin/Dockerfile.vim) (syntax, indent, ftplugin)
|
||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [elm](https://github.com/andys8/vim-elm-syntax) (syntax, indent)
|
||||
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
|
||||
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
|
||||
- [fennel](https://github.com/bakpakin/fennel.vim) (syntax, indent, ftplugin)
|
||||
- [ferm](https://github.com/vim-scripts/ferm.vim) (syntax)
|
||||
- [fish](https://github.com/georgewitteman/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers) (syntax)
|
||||
- [fsharp](https://github.com/ionide/Ionide-vim) (syntax, indent)
|
||||
- [gdscript](https://github.com/calviken/vim-gdscript3) (syntax, indent)
|
||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
|
||||
- [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax)
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (syntax)
|
||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent)
|
||||
- [gradle](https://github.com/tfnico/vim-gradle) (compiler)
|
||||
- [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, autoload, ftplugin, after)
|
||||
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
|
||||
- [handlebars](https://github.com/sheerun/vim-mustache-handlebars) (syntax, indent, ftplugin)
|
||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
|
||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
|
||||
- [hcl](https://github.com/b4b4r07/vim-hcl) (syntax, indent, ftplugin)
|
||||
- [helm](https://github.com/towolf/vim-helm) (syntax)
|
||||
- [hive](https://github.com/zebradil/hive.vim) (syntax, ftplugin)
|
||||
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
|
||||
- [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin)
|
||||
- [icalendar](https://github.com/chutzpah/icalendar.vim) (syntax)
|
||||
- [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin)
|
||||
- [ion](https://github.com/vmchale/ion-vim) (syntax, ftplugin)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
|
||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
|
||||
- [jinja](https://github.com/lepture/vim-jinja) (syntax, indent)
|
||||
- [jq](https://github.com/vito-c/jq.vim) (syntax, ftplugin)
|
||||
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
|
||||
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
|
||||
- [jsonnet](https://github.com/google/vim-jsonnet) (syntax, autoload, ftplugin)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (autoload, after)
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim) (syntax, indent, ftplugin)
|
||||
- [ledger](https://github.com/ledger/vim-ledger) (syntax, compiler, indent)
|
||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin)
|
||||
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond) (syntax, indent, compiler, ftplugin)
|
||||
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
|
||||
- [llvm](https://github.com/rhysd/vim-llvm) (syntax, indent, ftplugin)
|
||||
- [log](https://github.com/MTDL9/vim-log-highlighting) (syntax)
|
||||
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
|
||||
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
|
||||
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent, ftplugin)
|
||||
- [mathematica](https://github.com/voldikss/vim-mma) (syntax, ftplugin)
|
||||
- [mdx](https://github.com/jxnblk/vim-mdx-js) (syntax)
|
||||
- [meson](https://github.com/mesonbuild/meson) (syntax, indent, ftplugin)
|
||||
- [moonscript](https://github.com/leafo/moonscript-vim) (syntax, indent, ftplugin)
|
||||
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, compiler, ftplugin)
|
||||
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
||||
- [ocaml](https://github.com/rgrinberg/vim-ocaml) (syntax, indent, compiler, ftplugin)
|
||||
- [octave](https://github.com/McSinyx/vim-octave) (syntax, indent)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||
- [pgsql](https://github.com/lifepillar/pgsql.vim) (syntax, indent)
|
||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (syntax, indent, ftplugin)
|
||||
- [pony](https://github.com/jakwings/vim-pony) (syntax, indent, autoload, ftplugin)
|
||||
- [powershell](https://github.com/PProvost/vim-ps1) (syntax, indent, compiler, ftplugin)
|
||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, indent)
|
||||
- [pug](https://github.com/digitaltoad/vim-pug) (syntax, indent, ftplugin)
|
||||
- [puppet](https://github.com/rodjek/vim-puppet) (syntax, indent, autoload, ftplugin, ctags)
|
||||
- [purescript](https://github.com/purescript-contrib/purescript-vim) (syntax, indent, ftplugin)
|
||||
- [python-compiler](https://github.com/aliev/vim-compiler-python) (compiler, autoload)
|
||||
- [python-indent](https://github.com/Vimjas/vim-python-pep8-indent) (indent)
|
||||
- [python](https://github.com/vim-python/python-syntax) (syntax)
|
||||
- [qmake](https://github.com/artoj/qmake-syntax-vim) (syntax)
|
||||
- [qml](https://github.com/peterhoeg/vim-qml) (syntax, indent, ftplugin)
|
||||
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax)
|
||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, ftplugin)
|
||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||
- [raku](https://github.com/Raku/vim-raku) (syntax, indent, ftplugin)
|
||||
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
||||
- [razor](https://github.com/adamclerk/vim-razor) (syntax, indent, ftplugin)
|
||||
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
|
||||
- [requirements](https://github.com/raimon49/requirements.txt.vim) (syntax, autoload)
|
||||
- [rspec](https://github.com/keith/rspec.vim) (syntax)
|
||||
- [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, indent, autoload, ftplugin)
|
||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ctags)
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ctags)
|
||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, indent, ftplugin)
|
||||
- [sh](https://github.com/arzg/vim-sh) (syntax)
|
||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
||||
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
|
||||
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
|
||||
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
|
||||
- [sql](https://github.com/shmup/vim-sql-syntax) (syntax)
|
||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
|
||||
- [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent, ftplugin)
|
||||
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
|
||||
- [svg](https://github.com/vim-scripts/svg.vim) (syntax)
|
||||
- [swift](https://github.com/keith/swift.vim) (syntax, indent, compiler, ftplugin, ctags)
|
||||
- [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (syntax)
|
||||
- [systemd](https://github.com/wgwoods/vim-systemd-syntax) (syntax, ftplugin)
|
||||
- [terraform](https://github.com/hashivim/vim-terraform) (syntax, indent, autoload, ftplugin)
|
||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
|
||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
|
||||
- [tmux](https://github.com/ericpruitt/tmux.vim) (syntax, ftplugin)
|
||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
|
||||
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
|
||||
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
|
||||
- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (syntax, indent, compiler, ftplugin, ctags)
|
||||
- [unison](https://github.com/unisonweb/unison) (syntax)
|
||||
- [v](https://github.com/ollykel/v-vim) (syntax, indent, ftplugin)
|
||||
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent, ftplugin)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
|
||||
- [velocity](https://github.com/lepture/vim-velocity) (syntax, indent)
|
||||
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
|
||||
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
|
||||
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax) (syntax)
|
||||
- [xml](https://github.com/amadeus/vim-xml) (syntax)
|
||||
- [xsl](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
|
||||
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
|
||||
- [zephir](https://github.com/xwsoul/vim-zephir) (syntax)
|
||||
- [zig](https://github.com/ziglang/zig.vim) (syntax, indent, autoload, ftplugin)
|
||||
- [zinit](https://github.com/zinit-zsh/zplugin-vim-syntax) (syntax)
|
||||
- [acpiasl](https://github.com/martinlroth/vim-acpi-asl) (Syntax highlighting for asl and dsl files)
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim)
|
||||
- [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)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (C++ and C syntax highlighting for cpp, c++, cc, cp, cppm and 20 more files)
|
||||
- [caddyfile](https://github.com/isobit/vim-caddyfile)
|
||||
- [carp](https://github.com/hellerve/carp-vim) (Syntax highlighting for carp files)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx)
|
||||
- [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, app.src, es, escript, hrl, xrl, yrl 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 19 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) (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) (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)
|
||||
- [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) (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/tree/main) (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 13 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/wsdjeg/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) (Python syntax highlighting for py, cgi, fcgi, gyp, gypi and 13 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) (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) (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/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 99 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
|
||||
|
||||
You can either wait for new patch release with updates or run the `scripts/build` script by yourself.
|
||||
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`, otherwise syntax files are not loaded at all.
|
||||
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:
|
||||
|
||||
```viml
|
||||
" ~/.vimrc, declare this variable before polyglot is loaded
|
||||
let g:polyglot_disabled = ['css']
|
||||
**Please declare this variable before polyglot is loaded (at the top of .vimrc)**
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['markdown']
|
||||
```
|
||||
|
||||
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.
|
||||
The list of available languages to disable is shown above.
|
||||
|
||||
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:
|
||||
|
||||
```vim
|
||||
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.
|
||||
|
||||
Feel free to add your language to `packages.yaml`, and send pull-request. Please don't run `scripts/build` and include that in your PR, send just changes to `packages.yaml` and `build` script if really necessary. You can run `scripts/test` to run rough tests.
|
||||
Feel free to add your language to `packages.yaml` + `heuristics.yaml`, and send pull-request. You can run `make test` to run rough tests. And `make dev` for easy development.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
5
after/ftplugin/idris2.vim
Normal file
5
after/ftplugin/idris2.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris2', 'after/ftplugin/idris2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+='
|
||||
16
after/ftplugin/javascript-1.vim
Normal file
16
after/ftplugin/javascript-1.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript', 'after/ftplugin/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: JavaScript
|
||||
" Maintainer: vim-javascript community
|
||||
" URL: https://github.com/pangloss/vim-javascript
|
||||
|
||||
setlocal iskeyword+=$ suffixesadd+=.js
|
||||
|
||||
if exists('b:undo_ftplugin')
|
||||
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
|
||||
else
|
||||
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||
endif
|
||||
9
after/ftplugin/javascript-2.vim
Normal file
9
after/ftplugin/javascript-2.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
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
|
||||
@@ -1,51 +1,3 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: JavaScript
|
||||
" Maintainer: vim-javascript community
|
||||
" URL: https://github.com/pangloss/vim-javascript
|
||||
|
||||
setlocal iskeyword+=$ suffixesadd+=.js
|
||||
|
||||
if exists('b:undo_ftplugin')
|
||||
let b:undo_ftplugin .= ' | setlocal iskeyword< suffixesadd<'
|
||||
else
|
||||
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||
endif
|
||||
|
||||
endif
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftplugin file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMEllon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" modified from html.vim
|
||||
" For matchit plugin
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||
endif
|
||||
|
||||
" For andymass/vim-matchup plugin
|
||||
if exists("loaded_matchup")
|
||||
setlocal matchpairs=(:),{:},[:],<:>
|
||||
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||
let b:match_skip = 's:comment\|string'
|
||||
endif
|
||||
|
||||
let b:jsx_pretty_old_cms = &l:commentstring
|
||||
|
||||
augroup jsx_comment
|
||||
autocmd! CursorMoved <buffer>
|
||||
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms)
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.jsx
|
||||
|
||||
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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
source <sfile>:h/javascript.vim
|
||||
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
35
after/ftplugin/jsx.vim
Normal file
35
after/ftplugin/jsx.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftplugin file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMEllon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" modified from html.vim
|
||||
" For matchit plugin
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([A-z0-9.]\+\):\(</\)\@<=\1'
|
||||
endif
|
||||
|
||||
" For andymass/vim-matchup plugin
|
||||
if exists("loaded_matchup")
|
||||
setlocal matchpairs=(:),{:},[:],<:>
|
||||
let b:match_words = '<\@<=\([^/][^ \t>]*\)\g{hlend}[^>]*\%(/\@<!>\|$\):<\@<=/\1>'
|
||||
let b:match_skip = 's:comment\|string'
|
||||
endif
|
||||
|
||||
let b:jsx_pretty_old_cms = &l:commentstring
|
||||
|
||||
augroup jsx_comment
|
||||
autocmd! CursorMoved <buffer>
|
||||
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms)
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.jsx
|
||||
@@ -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}
|
||||
let bufnr = term_start([g:llvm_ext_lli_executable, tmpfile], {'close_cb': Cleanup, 'exit_cb': Cleanup})
|
||||
echo 'Run lli in termnal buffer(' . bufnr . ')'
|
||||
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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Yaml
|
||||
" Author: Henrique Barcelos
|
||||
" Date: 2014-10-08
|
||||
" URL: https://github.com/hjpbarcelos
|
||||
setlocal autoindent sw=2 ts=2 expandtab
|
||||
" vim:set sw=2:
|
||||
|
||||
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) 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,33 +1,3 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
if exists('b:did_indent')
|
||||
let s:did_indent = b:did_indent
|
||||
unlet b:did_indent
|
||||
endif
|
||||
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists('s:did_indent')
|
||||
let b:did_indent = s:did_indent
|
||||
endif
|
||||
|
||||
setlocal indentexpr=GetJsxIndent()
|
||||
setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
|
||||
|
||||
function! GetJsxIndent()
|
||||
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
|
||||
endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
" 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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
source <sfile>:h/javascript.vim
|
||||
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
33
after/indent/jsx.vim
Normal file
33
after/indent/jsx.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
if exists('b:did_indent')
|
||||
let s:did_indent = b:did_indent
|
||||
unlet b:did_indent
|
||||
endif
|
||||
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists('s:did_indent')
|
||||
let b:did_indent = s:did_indent
|
||||
endif
|
||||
|
||||
setlocal indentexpr=GetJsxIndent()
|
||||
setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
|
||||
|
||||
function! GetJsxIndent()
|
||||
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
|
||||
endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
@@ -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) 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
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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) 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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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
|
||||
|
||||
@@ -1,321 +1,66 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cpp-modern', 'after/syntax/c.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Vim syntax file
|
||||
" Language: C Additions
|
||||
" Maintainer: Jon Haggblad <jon@haeggblad.com>
|
||||
" Contributor: Mikhail Wolfson <mywolfson@gmail.com>
|
||||
" URL: http://www.haeggblad.com
|
||||
" Last Change: 6 Sep 2014
|
||||
" Version: 0.3
|
||||
" Changelog:
|
||||
" 0.3 - integration of aftersyntaxc.vim
|
||||
" 0.2 - Cleanup
|
||||
" 0.1 - initial version.
|
||||
" 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
|
||||
"
|
||||
" Syntax highlighting for functions in C.
|
||||
"
|
||||
" Based on:
|
||||
" http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim
|
||||
" This syntax file is based on:
|
||||
" https://github.com/octol/vim-cpp-enhanced-highlight
|
||||
" ==============================================================================
|
||||
|
||||
" -----------------------------------------------------------------------------
|
||||
" Highlight function names.
|
||||
" -----------------------------------------------------------------------------
|
||||
if !exists('g:cpp_no_function_highlight')
|
||||
syn match cCustomParen transparent "(" contains=cParen contains=cCppParen
|
||||
syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
|
||||
hi def link cCustomFunc Function
|
||||
|
||||
" 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 member variable names.
|
||||
" -----------------------------------------------------------------------------
|
||||
if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
||||
syn match cCustomDot "\." contained
|
||||
syn match cCustomPtr "->" contained
|
||||
syn match cCustomMemVar "\(\.\|->\)\h\w*" contains=cCustomDot,cCustomPtr
|
||||
hi def link cCustomMemVar Function
|
||||
|
||||
" 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
|
||||
|
||||
" -----------------------------------------------------------------------------
|
||||
" Highlight POSIX functions.
|
||||
" -----------------------------------------------------------------------------
|
||||
if exists('g:cpp_posix_standard') && g:cpp_posix_standard
|
||||
syn keyword cPOSIXFunction socket accept bind connect getsockname
|
||||
syn keyword cPOSIXFunction listen recv recvfrom recvmsg
|
||||
syn keyword cPOSIXFunction send sendto sendmsg setsockopt socketpair
|
||||
syn keyword cPOSIXFunction htonl htons ntohl ntohs
|
||||
syn keyword cPOSIXFunction inet_ntop inet_pton getaddrinfo
|
||||
syn keyword cPOSIXFunction poll select pselect
|
||||
hi def link cPOSIXFunction Function
|
||||
endif
|
||||
|
||||
" -----------------------------------------------------------------------------
|
||||
" Source: aftersyntaxc.vim
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
" Common ANSI-standard functions
|
||||
syn keyword cAnsiFunction MULU_ DIVU_ MODU_ MUL_ DIV_ MOD_
|
||||
syn keyword cAnsiFunction main typeof
|
||||
syn keyword cAnsiFunction open close read write lseek dup dup2
|
||||
syn keyword cAnsiFunction fcntl ioctl
|
||||
syn keyword cAnsiFunction wctrans towctrans towupper
|
||||
syn keyword cAnsiFunction towlower wctype iswctype
|
||||
syn keyword cAnsiFunction iswxdigit iswupper iswspace
|
||||
syn keyword cAnsiFunction iswpunct iswprint iswlower
|
||||
syn keyword cAnsiFunction iswgraph iswdigit iswcntrl
|
||||
syn keyword cAnsiFunction iswalpha iswalnum wcsrtombs
|
||||
syn keyword cAnsiFunction mbsrtowcs wcrtomb mbrtowc
|
||||
syn keyword cAnsiFunction mbrlen mbsinit wctob
|
||||
syn keyword cAnsiFunction btowc wcsfxtime wcsftime
|
||||
syn keyword cAnsiFunction wmemset wmemmove wmemcpy
|
||||
syn keyword cAnsiFunction wmemcmp wmemchr wcstok
|
||||
syn keyword cAnsiFunction wcsstr wcsspn wcsrchr
|
||||
syn keyword cAnsiFunction wcspbrk wcslen wcscspn
|
||||
syn keyword cAnsiFunction wcschr wcsxfrm wcsncmp
|
||||
syn keyword cAnsiFunction wcscoll wcscmp wcsncat
|
||||
syn keyword cAnsiFunction wcscat wcsncpy wcscpy
|
||||
syn keyword cAnsiFunction wcstoull wcstoul wcstoll
|
||||
syn keyword cAnsiFunction wcstol wcstold wcstof
|
||||
syn keyword cAnsiFunction wcstod ungetwc putwchar
|
||||
syn keyword cAnsiFunction putwc getwchar getwc
|
||||
syn keyword cAnsiFunction fwide fputws fputwc
|
||||
syn keyword cAnsiFunction fgetws fgetwc wscanf
|
||||
syn keyword cAnsiFunction wprintf vwscanf vwprintf
|
||||
syn keyword cAnsiFunction vswscanf vswprintf vfwscanf
|
||||
syn keyword cAnsiFunction vfwprintf swscanf swprintf
|
||||
syn keyword cAnsiFunction fwscanf fwprintf zonetime
|
||||
syn keyword cAnsiFunction strfxtime strftime localtime
|
||||
syn keyword cAnsiFunction gmtime ctime asctime
|
||||
syn keyword cAnsiFunction time mkxtime mktime
|
||||
syn keyword cAnsiFunction difftime clock strlen
|
||||
syn keyword cAnsiFunction strerror memset strtok
|
||||
syn keyword cAnsiFunction strstr strspn strrchr
|
||||
syn keyword cAnsiFunction strpbrk strcspn strchr
|
||||
syn keyword cAnsiFunction memchr strxfrm strncmp
|
||||
syn keyword cAnsiFunction strcoll strcmp memcmp
|
||||
syn keyword cAnsiFunction strncat strcat strncpy
|
||||
syn keyword cAnsiFunction strcpy memmove memcpy
|
||||
syn keyword cAnsiFunction wcstombs mbstowcs wctomb
|
||||
syn keyword cAnsiFunction mbtowc mblen lldiv
|
||||
syn keyword cAnsiFunction ldiv div llabs
|
||||
syn keyword cAnsiFunction labs abs qsort
|
||||
"syn keyword cAnsiFunction bsearch system getenv
|
||||
syn keyword cAnsiFunction bsearch getenv
|
||||
syn keyword cAnsiFunction exit atexit abort
|
||||
syn keyword cAnsiFunction realloc malloc free
|
||||
syn keyword cAnsiFunction calloc srand rand
|
||||
syn keyword cAnsiFunction strtoull strtoul strtoll
|
||||
syn keyword cAnsiFunction strtol strtold strtof
|
||||
syn keyword cAnsiFunction strtod atoll atol
|
||||
syn keyword cAnsiFunction atoi atof perror
|
||||
syn keyword cAnsiFunction ferror feof clearerr
|
||||
syn keyword cAnsiFunction rewind ftell fsetpos
|
||||
syn keyword cAnsiFunction fseek fgetpos fwrite
|
||||
syn keyword cAnsiFunction fread ungetc puts
|
||||
syn keyword cAnsiFunction putchar putc gets
|
||||
syn keyword cAnsiFunction getchar getc fputs
|
||||
syn keyword cAnsiFunction fputc fgets fgetc
|
||||
syn keyword cAnsiFunction vsscanf vsprintf vsnprintf
|
||||
syn keyword cAnsiFunction vscanf vprintf vfscanf
|
||||
syn keyword cAnsiFunction vfprintf sscanf sprintf
|
||||
syn keyword cAnsiFunction snprintf scanf printf
|
||||
syn keyword cAnsiFunction fscanf fprintf setvbuf
|
||||
syn keyword cAnsiFunction setbuf freopen fopen
|
||||
syn keyword cAnsiFunction fflush fclose tmpnam
|
||||
syn keyword cAnsiFunction tmpfile rename remove
|
||||
syn keyword cAnsiFunction offsetof va_start va_end
|
||||
syn keyword cAnsiFunction va_copy va_arg raise signal
|
||||
syn keyword cAnsiFunction longjmp setjmp isunordered
|
||||
syn keyword cAnsiFunction islessgreater islessequal isless
|
||||
syn keyword cAnsiFunction isgreaterequal isgreater fmal
|
||||
syn keyword cAnsiFunction fmaf fma fminl
|
||||
syn keyword cAnsiFunction fminf fmin fmaxl
|
||||
syn keyword cAnsiFunction fmaxf fmax fdiml
|
||||
syn keyword cAnsiFunction fdimf fdim nextafterxl
|
||||
syn keyword cAnsiFunction nextafterxf nextafterx nextafterl
|
||||
syn keyword cAnsiFunction nextafterf nextafter nanl
|
||||
syn keyword cAnsiFunction nanf nan copysignl
|
||||
syn keyword cAnsiFunction copysignf copysign remquol
|
||||
syn keyword cAnsiFunction remquof remquo remainderl
|
||||
syn keyword cAnsiFunction remainderf remainder fmodl
|
||||
syn keyword cAnsiFunction fmodf fmod truncl
|
||||
syn keyword cAnsiFunction truncf trunc llroundl
|
||||
syn keyword cAnsiFunction llroundf llround lroundl
|
||||
syn keyword cAnsiFunction lroundf lround roundl
|
||||
syn keyword cAnsiFunction roundf round llrintl
|
||||
syn keyword cAnsiFunction llrintf llrint lrintl
|
||||
syn keyword cAnsiFunction lrintf lrint rintl
|
||||
syn keyword cAnsiFunction rintf rint nearbyintl
|
||||
syn keyword cAnsiFunction nearbyintf nearbyint floorl
|
||||
syn keyword cAnsiFunction floorf floor ceill
|
||||
syn keyword cAnsiFunction ceilf ceil tgammal
|
||||
syn keyword cAnsiFunction tgammaf tgamma lgammal
|
||||
syn keyword cAnsiFunction lgammaf lgamma erfcl
|
||||
syn keyword cAnsiFunction erfcf erfc erfl
|
||||
syn keyword cAnsiFunction erff erf sqrtl
|
||||
syn keyword cAnsiFunction sqrtf sqrt powl
|
||||
syn keyword cAnsiFunction powf pow hypotl
|
||||
syn keyword cAnsiFunction hypotf hypot fabsl
|
||||
syn keyword cAnsiFunction fabsf fabs cbrtl
|
||||
syn keyword cAnsiFunction cbrtf cbrt scalblnl
|
||||
syn keyword cAnsiFunction scalblnf scalbln scalbnl
|
||||
syn keyword cAnsiFunction scalbnf scalbn modfl
|
||||
syn keyword cAnsiFunction modff modf logbl
|
||||
syn keyword cAnsiFunction logbf logb log2l
|
||||
syn keyword cAnsiFunction log2f log2 log1pl
|
||||
syn keyword cAnsiFunction log1pf log1p log10l
|
||||
syn keyword cAnsiFunction log10f log10 logl
|
||||
syn keyword cAnsiFunction logf log ldexpl
|
||||
syn keyword cAnsiFunction ldexpf ldexp ilogbl
|
||||
syn keyword cAnsiFunction ilogbf ilogb frexpl
|
||||
syn keyword cAnsiFunction frexpf frexp expm1l
|
||||
syn keyword cAnsiFunction expm1f expm1 exp2l
|
||||
syn keyword cAnsiFunction exp2f exp2 expl
|
||||
syn keyword cAnsiFunction expf exp tanhl
|
||||
syn keyword cAnsiFunction tanhf tanh sinhl
|
||||
syn keyword cAnsiFunction sinhf sinh coshl
|
||||
syn keyword cAnsiFunction coshf cosh atanhl
|
||||
syn keyword cAnsiFunction atanhf atanh asinhl
|
||||
syn keyword cAnsiFunction asinhf asinh acoshl
|
||||
syn keyword cAnsiFunction acoshf acosh tanl
|
||||
syn keyword cAnsiFunction tanf tan sinl
|
||||
syn keyword cAnsiFunction sinf sin cosl
|
||||
syn keyword cAnsiFunction cosf cos atan2l
|
||||
syn keyword cAnsiFunction atan2f atan2 atanl
|
||||
syn keyword cAnsiFunction atanf atan asinl
|
||||
syn keyword cAnsiFunction asinf asin acosl
|
||||
syn keyword cAnsiFunction acosf acos signbit
|
||||
syn keyword cAnsiFunction isnormal isnan isinf
|
||||
syn keyword cAnsiFunction isfinite fpclassify localeconv
|
||||
syn keyword cAnsiFunction setlocale wcstoumax wcstoimax
|
||||
syn keyword cAnsiFunction strtoumax strtoimax feupdateenv
|
||||
syn keyword cAnsiFunction fesetenv feholdexcept fegetenv
|
||||
syn keyword cAnsiFunction fesetround fegetround fetestexcept
|
||||
syn keyword cAnsiFunction fesetexceptflag feraiseexcept fegetexceptflag
|
||||
syn keyword cAnsiFunction feclearexcept toupper tolower
|
||||
syn keyword cAnsiFunction isxdigit isupper isspace
|
||||
syn keyword cAnsiFunction ispunct isprint islower
|
||||
syn keyword cAnsiFunction isgraph isdigit iscntrl
|
||||
syn keyword cAnsiFunction isalpha isalnum creall
|
||||
syn keyword cAnsiFunction crealf creal cprojl
|
||||
syn keyword cAnsiFunction cprojf cproj conjl
|
||||
syn keyword cAnsiFunction conjf conj cimagl
|
||||
syn keyword cAnsiFunction cimagf cimag cargl
|
||||
syn keyword cAnsiFunction cargf carg csqrtl
|
||||
syn keyword cAnsiFunction csqrtf csqrt cpowl
|
||||
syn keyword cAnsiFunction cpowf cpow cabsl
|
||||
syn keyword cAnsiFunction cabsf cabs clogl
|
||||
syn keyword cAnsiFunction clogf clog cexpl
|
||||
syn keyword cAnsiFunction cexpf cexp ctanhl
|
||||
syn keyword cAnsiFunction ctanhf ctanh csinhl
|
||||
syn keyword cAnsiFunction csinhf csinh ccoshl
|
||||
syn keyword cAnsiFunction ccoshf ccosh catanhl
|
||||
syn keyword cAnsiFunction catanhf catanh casinhl
|
||||
syn keyword cAnsiFunction casinhf casinh cacoshl
|
||||
syn keyword cAnsiFunction cacoshf cacosh ctanl
|
||||
syn keyword cAnsiFunction ctanf ctan csinl
|
||||
syn keyword cAnsiFunction csinf csin ccosl
|
||||
syn keyword cAnsiFunction ccosf ccos catanl
|
||||
syn keyword cAnsiFunction catanf catan casinl
|
||||
syn keyword cAnsiFunction casinf casin cacosl
|
||||
syn keyword cAnsiFunction cacosf cacos assert
|
||||
syn keyword cAnsiFunction UINTMAX_C INTMAX_C UINT64_C
|
||||
syn keyword cAnsiFunction UINT32_C UINT16_C UINT8_C
|
||||
syn keyword cAnsiFunction INT64_C INT32_C INT16_C INT8_C
|
||||
|
||||
" Common ANSI-standard Names
|
||||
syn keyword cAnsiName PRId8 PRIi16 PRIo32 PRIu64
|
||||
syn keyword cAnsiName PRId16 PRIi32 PRIo64 PRIuLEAST8
|
||||
syn keyword cAnsiName PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16
|
||||
syn keyword cAnsiName PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32
|
||||
syn keyword cAnsiName PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64
|
||||
syn keyword cAnsiName PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8
|
||||
syn keyword cAnsiName PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16
|
||||
syn keyword cAnsiName PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32
|
||||
syn keyword cAnsiName PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64
|
||||
syn keyword cAnsiName PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX
|
||||
syn keyword cAnsiName PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR
|
||||
syn keyword cAnsiName PRIdFAST64 PRIiMAX PRIoPTR PRIx8
|
||||
syn keyword cAnsiName PRIdMAX PRIiPTR PRIu8 PRIx16
|
||||
syn keyword cAnsiName PRIdPTR PRIo8 PRIu16 PRIx32
|
||||
syn keyword cAnsiName PRIi8 PRIo16 PRIu32 PRIx64
|
||||
|
||||
syn keyword cAnsiName PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32
|
||||
syn keyword cAnsiName PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64
|
||||
syn keyword cAnsiName PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8
|
||||
syn keyword cAnsiName PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16
|
||||
syn keyword cAnsiName PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32
|
||||
syn keyword cAnsiName PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64
|
||||
syn keyword cAnsiName PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX
|
||||
syn keyword cAnsiName PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR
|
||||
syn keyword cAnsiName PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8
|
||||
syn keyword cAnsiName PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16
|
||||
syn keyword cAnsiName PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32
|
||||
syn keyword cAnsiName PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64
|
||||
syn keyword cAnsiName PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8
|
||||
syn keyword cAnsiName PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16
|
||||
syn keyword cAnsiName PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32
|
||||
syn keyword cAnsiName PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64
|
||||
syn keyword cAnsiName PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8
|
||||
syn keyword cAnsiName PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16
|
||||
syn keyword cAnsiName PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32
|
||||
syn keyword cAnsiName PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64
|
||||
syn keyword cAnsiName PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX
|
||||
syn keyword cAnsiName PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR
|
||||
syn keyword cAnsiName PRIXMAX SCNiFAST8 SCNuLEAST8
|
||||
syn keyword cAnsiName PRIXPTR SCNiFAST16 SCNuLEAST16
|
||||
|
||||
syn keyword cAnsiName errno environ
|
||||
|
||||
syn keyword cAnsiName STDC CX_LIMITED_RANGE
|
||||
syn keyword cAnsiName STDC FENV_ACCESS
|
||||
syn keyword cAnsiName STDC FP_CONTRACT
|
||||
|
||||
syn keyword cAnsiName and bitor not_eq xor
|
||||
syn keyword cAnsiName and_eq compl or xor_eq
|
||||
syn keyword cAnsiName bitand not or_eq
|
||||
|
||||
hi def link cAnsiFunction cFunction
|
||||
hi def link cAnsiName cIdentifier
|
||||
hi def link cFunction Function
|
||||
hi def link cIdentifier Identifier
|
||||
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
|
||||
hi def link cBoolean Boolean
|
||||
|
||||
" -----------------------------------------------------------------------------
|
||||
" Additional optional highlighting
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
" Operators
|
||||
"syn match cOperator "\(<<\|>>\|[-+*/%&^|<>!=]\)="
|
||||
"syn match cOperator "<<\|>>\|&&\|||\|++\|--\|->"
|
||||
"syn match cOperator "[.!~*&%<>^|=,+-]"
|
||||
"syn match cOperator "/[^/*=]"me=e-1
|
||||
"syn match cOperator "/$"
|
||||
"syn match cOperator "&&\|||"
|
||||
"syn match cOperator "[][]"
|
||||
"
|
||||
"" Preprocs
|
||||
"syn keyword cDefined defined contained containedin=cDefine
|
||||
"hi def link cDefined cDefine
|
||||
" Default highlighting
|
||||
hi def link cBoolean Boolean
|
||||
hi def link cAnsiName Identifier
|
||||
|
||||
"" Functions
|
||||
"syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine
|
||||
"syn match cUserFunctionPointer "(\s*\*\s*\h\w*\s*)\(\s\|\n\)*(" contains=cDelimiter,cOperator
|
||||
"
|
||||
"hi def link cUserFunction cFunction
|
||||
"hi def link cUserFunctionPointer cFunction
|
||||
"
|
||||
"" Delimiters
|
||||
"syn match cDelimiter "[();\\]"
|
||||
"" foldmethod=syntax fix, courtesy of Ivan Freitas
|
||||
"syn match cBraces display "[{}]"
|
||||
|
||||
" Links
|
||||
"hi def link cDelimiter Delimiter
|
||||
" foldmethod=syntax fix, courtesy of Ivan Freitas
|
||||
"hi def link cBraces Delimiter
|
||||
|
||||
" 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
|
||||
|
||||
2440
after/syntax/cpp.vim
2440
after/syntax/cpp.vim
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
82
after/syntax/idris2.vim
Normal file
82
after/syntax/idris2.vim
Normal file
@@ -0,0 +1,82 @@
|
||||
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 →
|
||||
"
|
||||
" It needs vim >= 7.3, set nocompatible, set enc=utf-8
|
||||
"
|
||||
" If you want to turn this on, let g:idris_conceal = 1
|
||||
|
||||
if !exists('g:idris_conceal') || !has('conceal') || &enc != 'utf-8'
|
||||
finish
|
||||
endif
|
||||
|
||||
" vim: set fenc=utf-8:
|
||||
syntax match idrNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ
|
||||
syntax match idrNiceOperator "<-" conceal cchar=←
|
||||
syntax match idrNiceOperator "->" conceal cchar=→
|
||||
syntax match idrNiceOperator "\<sum\>" conceal cchar=∑
|
||||
syntax match idrNiceOperator "\<product\>" conceal cchar=∏
|
||||
syntax match idrNiceOperator "\<sqrt\>" conceal cchar=√
|
||||
syntax match idrNiceOperator "\<pi\>" conceal cchar=π
|
||||
syntax match idrNiceOperator "==" conceal cchar=≡
|
||||
syntax match idrNiceOperator "\/=" conceal cchar=≠
|
||||
|
||||
|
||||
let s:extraConceal = 1
|
||||
|
||||
let s:doubleArrow = 1
|
||||
" Set this to 0 to use the more technically correct arrow from bar
|
||||
|
||||
" Some windows font don't support some of the characters,
|
||||
" so if they are the main font, we don't load them :)
|
||||
if has("win32")
|
||||
let s:incompleteFont = [ 'Consolas'
|
||||
\ , 'Lucida Console'
|
||||
\ , 'Courier New'
|
||||
\ ]
|
||||
let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '')
|
||||
for s:fontName in s:incompleteFont
|
||||
if s:mainfont ==? s:fontName
|
||||
let s:extraConceal = 0
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if s:extraConceal
|
||||
syntax match idrNiceOperator "Void" conceal cchar=⊥
|
||||
|
||||
" Match greater than and lower than w/o messing with Kleisli composition
|
||||
syntax match idrNiceOperator "<=\ze[^<]" conceal cchar=≤
|
||||
syntax match idrNiceOperator ">=\ze[^>]" conceal cchar=≥
|
||||
|
||||
if s:doubleArrow
|
||||
syntax match idrNiceOperator "=>" conceal cchar=⇒
|
||||
else
|
||||
syntax match idrNiceOperator "=>" conceal cchar=↦
|
||||
endif
|
||||
|
||||
syntax match idrNiceOperator "=\zs<<" conceal cchar=«
|
||||
|
||||
syntax match idrNiceOperator "++" conceal cchar=⧺
|
||||
syntax match idrNiceOperator "::" conceal cchar=∷
|
||||
syntax match idrNiceOperator "-<" conceal cchar=↢
|
||||
syntax match idrNiceOperator ">-" conceal cchar=↣
|
||||
syntax match idrNiceOperator "-<<" conceal cchar=⤛
|
||||
syntax match idrNiceOperator ">>-" conceal cchar=⤜
|
||||
|
||||
" Only replace the dot, avoid taking spaces around.
|
||||
syntax match idrNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘
|
||||
syntax match idrNiceOperator "\.\." conceal cchar=‥
|
||||
|
||||
syntax match idrNiceOperator "`elem`" conceal cchar=∈
|
||||
syntax match idrNiceOperator "`notElem`" conceal cchar=∉
|
||||
endif
|
||||
|
||||
hi link idrNiceOperator Operator
|
||||
hi! link Conceal Operator
|
||||
setlocal conceallevel=2
|
||||
|
||||
@@ -1,59 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
let s:jsx_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
syntax case match
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
if hlexists("jsDebugger") || hlexists("jsNoise") " yuezk/vim-js or pangloss/vim-javascript
|
||||
syntax cluster jsExpression add=jsxRegion
|
||||
elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
|
||||
" refine the javascript line comment
|
||||
syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||
syntax cluster javascriptValue add=jsxRegion
|
||||
syntax cluster javascriptNoReserved add=jsxElement,jsxTag
|
||||
else " build-in javascript syntax
|
||||
" refine the javascript line comment
|
||||
syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||
|
||||
" refine the template string syntax
|
||||
syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr
|
||||
|
||||
" add a javaScriptBlock group for build-in syntax
|
||||
syntax region javaScriptBlock
|
||||
\ matchgroup=javaScriptBraces
|
||||
\ start="{"
|
||||
\ end="}"
|
||||
\ contained
|
||||
\ extend
|
||||
\ contains=javaScriptBlock,@javaScriptEmbededExpr,javaScript.*
|
||||
\ fold
|
||||
|
||||
syntax cluster javaScriptEmbededExpr add=jsxRegion,javaScript.*
|
||||
endif
|
||||
|
||||
runtime syntax/jsx_pretty.vim
|
||||
|
||||
let b:current_syntax = 'javascript.jsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
|
||||
endif
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
@@ -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) 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
|
||||
|
||||
26
after/syntax/javascript/sql.vim
Normal file
26
after/syntax/javascript/sql.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript-sql', 'after/syntax/javascript/sql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim plugin
|
||||
" Language: JavaScript
|
||||
" Maintainer: Ian Langworth <ian@langworth.com>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
exec 'syntax include @SQLSyntax syntax/' . g:javascript_sql_dialect . '.vim'
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syntax region sqlTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=@SQLSyntax,jsTemplateExpression,jsSpecial extend
|
||||
exec 'syntax match sqlTaggedTemplate +\%(SQL\)\%(`\)\@=+ nextgroup=sqlTemplateString'
|
||||
|
||||
hi def link sqlTemplateString jsTemplateString
|
||||
hi def link sqlTaggedTemplate jsTaggedTemplate
|
||||
|
||||
syn cluster jsExpression add=sqlTaggedTemplate
|
||||
syn cluster sqlTaggedTemplate add=sqlTemplateString
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
|
||||
|
||||
source <sfile>:h/javascript.vim
|
||||
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
@@ -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
|
||||
|
||||
59
after/syntax/jsx.vim
Normal file
59
after/syntax/jsx.vim
Normal file
@@ -0,0 +1,59 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
"
|
||||
" Language: javascript.jsx
|
||||
" Maintainer: MaxMellon <maxmellon1994@gmail.com>
|
||||
"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
let s:jsx_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
syntax case match
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
if hlexists("jsDebugger") || hlexists("jsNoise") " yuezk/vim-js or pangloss/vim-javascript
|
||||
syntax cluster jsExpression add=jsxRegion
|
||||
elseif hlexists("javascriptOpSymbols") " othree/yajs.vim
|
||||
" refine the javascript line comment
|
||||
syntax region javascriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||
syntax cluster javascriptValue add=jsxRegion
|
||||
syntax cluster javascriptNoReserved add=jsxElement,jsxTag
|
||||
else " build-in javascript syntax
|
||||
" refine the javascript line comment
|
||||
syntax region javaScriptLineComment start=+//+ end=/$/ contains=@Spell,javascriptCommentTodo extend keepend
|
||||
|
||||
" refine the template string syntax
|
||||
syntax region javaScriptEmbed matchgroup=javaScriptEmbedBraces start=+\${+ end=+}+ contained contains=@javaScriptEmbededExpr
|
||||
|
||||
" add a javaScriptBlock group for build-in syntax
|
||||
syntax region javaScriptBlock
|
||||
\ matchgroup=javaScriptBraces
|
||||
\ start="{"
|
||||
\ end="}"
|
||||
\ contained
|
||||
\ extend
|
||||
\ contains=javaScriptBlock,@javaScriptEmbededExpr,javaScript.*
|
||||
\ fold
|
||||
|
||||
syntax cluster javaScriptEmbededExpr add=jsxRegion,javaScript.*
|
||||
endif
|
||||
|
||||
runtime syntax/jsx_pretty.vim
|
||||
|
||||
let b:current_syntax = 'javascript.jsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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) 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) 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 graphqlMultilineString matchgroup=reasonMultilineString start=+graphql\_s*\zs{|+ end=+|}+ contains=@GraphQLSyntax,reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonStringContinuation 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) 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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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) 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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'yaml') == -1
|
||||
|
||||
" To make this file do stuff, add something like the following (without the
|
||||
" leading ") to your ~/.vimrc:
|
||||
" au BufNewFile,BufRead *.yaml,*.yml so ~/src/PyYaml/YAML.vim
|
||||
|
||||
" Vim syntax/macro file
|
||||
" Language: YAML
|
||||
" Author: Igor Vergeichik <iverg@mail.ru>
|
||||
" Sponsor: Tom Sawyer <transami@transami.net>
|
||||
" Stayven: Ryan King <jking@panoptic.com>
|
||||
" Copyright (c) 2002 Tom Saywer
|
||||
|
||||
" Add an item to a gangly list:
|
||||
"map , o<bs><bs><bs><bs>-<esc>o
|
||||
" Convert to Canonical form:
|
||||
"map \c :%!python -c 'from yaml.redump import redump; import sys; print redump(sys.stdin.read()).rstrip()'
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
endif
|
||||
syntax clear
|
||||
|
||||
syn match yamlInline "[\[\]\{\}]"
|
||||
syn match yamlBlock "[>|]\d\?[+-]"
|
||||
|
||||
syn region yamlComment start="\#" end="$"
|
||||
syn match yamlIndicator "#YAML:\S\+"
|
||||
|
||||
syn region yamlString start="\(^\|\s\|\[\|\,\|\-\)\@<='" end="'" skip="\\'"
|
||||
syn region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
|
||||
syn region yamlString matchgroup=yamlBlock start=/[>|]\s*\n\+\z(\s\+\)\S/rs=s+1 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||
syn region yamlString matchgroup=yamlBlock start=/[>|]\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+2 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||
syn region yamlString matchgroup=yamlBlock start=/[>|]\d\(\d\|[+-]\)\s*\n\+\z(\s\+\)\S/rs=s+3 skip=/^\%(\z1\S\|^$\)/ end=/^\z1\@!.*/me=s-1
|
||||
syn match yamlEscape +\\[abfnrtv'"\\]+ contained
|
||||
syn match yamlEscape "\\\o\o\=\o\=" contained
|
||||
syn match yamlEscape "\\x\x\+" contained
|
||||
|
||||
syn match yamlType "!\S\+"
|
||||
|
||||
syn keyword yamlConstant NULL Null null NONE None none NIL Nil nil
|
||||
syn keyword yamlConstant TRUE True true YES Yes yes ON On on
|
||||
syn keyword yamlConstant FALSE False false NO No no OFF Off off
|
||||
|
||||
syn match yamlKey "^\s*\zs[^ \t\"\'#]\+\ze\s*:"
|
||||
syn match yamlKey "^\s*-\s*\zs[^ \t\"\'#]\+\ze\s*:"
|
||||
syn match yamlAnchor "&\S\+"
|
||||
syn match yamlAlias "*\S\+"
|
||||
|
||||
" Setup the highlighting links
|
||||
|
||||
hi link yamlConstant Keyword
|
||||
hi link yamlIndicator PreCondit
|
||||
hi link yamlAnchor Function
|
||||
hi link yamlAlias Function
|
||||
hi link yamlKey Identifier
|
||||
hi link yamlType Type
|
||||
|
||||
hi link yamlComment Comment
|
||||
hi link yamlInline Operator
|
||||
hi link yamlBlock Operator
|
||||
hi link yamlString String
|
||||
hi link yamlEscape Special
|
||||
|
||||
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
|
||||
|
||||
" 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
|
||||
|
||||
" Additional Zsh and Zinit functions
|
||||
syntax match ZshAndZinitFunctions /\<\%(compdef\|compinit\|zpcdreplay\|zpcdclear\|zpcompinit\|zpcompdef\)\>/
|
||||
" 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
|
||||
|
||||
" 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
|
||||
" zinit packages
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)'+ skip=+\\'+ end=+'+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceSingleQuoteParam
|
||||
|
||||
" 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
|
||||
|
||||
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, '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,7 +1,10 @@
|
||||
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'
|
||||
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo' &&
|
||||
\ &makeprg =~ '\V\^cargo\ \.\*'
|
||||
" Preserve the current directory, and 'lcd' to the nearest Cargo file.
|
||||
let b:rust_compiler_cargo_qf_has_lcd = haslocaldir()
|
||||
let b:rust_compiler_cargo_qf_prev_cd = getcwd()
|
||||
@@ -26,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
@@ -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
|
||||
|
||||
319
autoload/csv.vim
319
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")
|
||||
call csv#Warn("No delimiter found. See :h csv-delimiter to set it manually!")
|
||||
" Use a sane default as delimiter:
|
||||
let b:delimiter = ','
|
||||
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! "
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
call csv#HiCol('', 1)
|
||||
endfu
|
||||
|
||||
fu! csv#DoAutoCommands() "{{{3
|
||||
" Highlight column, on which the cursor is
|
||||
if exists("g:csv_highlight_column") && g:csv_highlight_column =~? 'y'
|
||||
@@ -227,18 +242,12 @@ 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> "'
|
||||
let b:undo_ftplugin .= '| exe "sil! aug! CSV_HI'.bufnr('').'"'
|
||||
let b:undo_ftplugin .= '| call csv#RemoveAutoHighlight()'
|
||||
let b:undo_ftplugin = 'exe "sil! HiColumn!" |' . b:undo_ftplugin
|
||||
|
||||
if has("gui_running") && !exists("#CSV_Menu#FileType")
|
||||
augroup CSV_Menu
|
||||
au!
|
||||
@@ -433,10 +442,14 @@ fu! csv#HiCol(colnr, bang) "{{{3
|
||||
if exists("s:matchid")
|
||||
" ignore errors, that come from already deleted matches
|
||||
sil! call matchdelete(s:matchid)
|
||||
if a:bang
|
||||
unlet! s:matchid
|
||||
return
|
||||
endif
|
||||
endif
|
||||
" Additionally, filter all matches, that could have been used earlier
|
||||
let matchlist=getmatches()
|
||||
call filter(matchlist, 'v:val["group"] !~ s:hiGroup')
|
||||
call filter(matchlist, 'v:val["group"] !~? s:hiGroup')
|
||||
call setmatches(matchlist)
|
||||
if a:bang
|
||||
return
|
||||
@@ -445,6 +458,10 @@ fu! csv#HiCol(colnr, bang) "{{{3
|
||||
elseif !a:bang
|
||||
exe ":2match " . s:hiGroup . ' /' . pat . '/'
|
||||
endif
|
||||
" Remove Highlighting once switching away from the buffer
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au BufWinLeave <buffer=".bufnr('')."> call csv#RemoveAutoHighlight()"
|
||||
aug end
|
||||
endfu
|
||||
fu! csv#GetDelimiter(first, last, ...) "{{{3
|
||||
" This depends on the locale. Hopefully it works
|
||||
@@ -472,12 +489,16 @@ fu! csv#GetDelimiter(first, last, ...) "{{{3
|
||||
" :silent :s does not work with lazyredraw
|
||||
let _lz = &lz
|
||||
set nolz
|
||||
" substitute without output when cmdheight=0
|
||||
let _cmdheight = &cmdheight
|
||||
set cmdheight=1
|
||||
for i in values(Delim)
|
||||
redir => temp[i]
|
||||
" use very non-magic
|
||||
exe ":silent! :". first. ",". last. 's/\V' . i . "/&/nge"
|
||||
redir END
|
||||
endfor
|
||||
let &cmdheight = _cmdheight
|
||||
let &lz = _lz
|
||||
let Delim = map(temp, 'matchstr(substitute(v:val, "\n", "", ""), "^\\s*\\d\\+")')
|
||||
let Delim = filter(temp, 'v:val=~''\d''')
|
||||
@@ -533,7 +554,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 +564,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 +579,10 @@ fu! csv#MaxColumns(...) "{{{3
|
||||
endif
|
||||
|
||||
" Filter comments out
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(l, 'v:val !~ pat')
|
||||
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 +626,10 @@ fu! csv#ColWidth(colnr, row, silent) "{{{3
|
||||
endif
|
||||
endif
|
||||
let b:csv_list=getline(skipfirst+1,last)
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(b:csv_list, 'v:val !~ pat')
|
||||
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
|
||||
@@ -762,9 +790,12 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" does not work with fixed width columns
|
||||
" row for the row for which to calculate the width
|
||||
let b:col_width=[]
|
||||
let vts_save=""
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
let vts_save=&vts
|
||||
set vts=
|
||||
if &l:vts
|
||||
let vts_save=&vts
|
||||
endif
|
||||
setlocal vts=
|
||||
endif
|
||||
try
|
||||
if exists("b:csv_headerline")
|
||||
@@ -784,8 +815,8 @@ 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
|
||||
if vts_save
|
||||
let &l:vts=vts_save
|
||||
endif
|
||||
endfu
|
||||
fu! csv#Columnize(field) "{{{3
|
||||
@@ -813,8 +844,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 +923,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 +937,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 +1047,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 +1145,12 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
|
||||
let pat=csv#GetColPat(1, 0)
|
||||
else
|
||||
" Move backwards
|
||||
let pat=csv#GetColPat(maxcol, 0)
|
||||
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,9 +1184,13 @@ fu! csv#MoveCol(forward, line, ...) "{{{3
|
||||
" of a field.
|
||||
let epos = getpos('.')
|
||||
if getline('.')[col('.')-1] == ' '
|
||||
call search('\S', 'W', line('.'))
|
||||
if getpos('.')[2] > spos
|
||||
call setpos('.', epos)
|
||||
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
|
||||
@@ -1189,7 +1234,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 +1285,10 @@ fu! csv#CopyCol(reg, col, cnt) "{{{3
|
||||
endfor
|
||||
endif
|
||||
" Filter comments out
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
call filter(a, 'v:val !~ pat')
|
||||
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 +1329,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 +1399,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 +1465,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.
|
||||
|
||||
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)
|
||||
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\)'
|
||||
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], '\\')
|
||||
@@ -1450,7 +1494,7 @@ fu! csv#SumColumn(list) "{{{3
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
else
|
||||
let sum = has("float") ? 0.0 : 0
|
||||
let sum = 0.0
|
||||
for item in a:list
|
||||
if empty(item)
|
||||
continue
|
||||
@@ -1460,33 +1504,25 @@ fu! csv#SumColumn(list) "{{{3
|
||||
let format2 = '\d\+\zs\V' . s:nr_format[1] . '\m\ze\d'
|
||||
try
|
||||
let nr = substitute(nr, format1, '', '')
|
||||
if has("float") && s:nr_format[1] != '.'
|
||||
if s:nr_format[1] != '.'
|
||||
let nr = substitute(nr, format2, '.', '')
|
||||
endif
|
||||
catch
|
||||
let nr = 0
|
||||
let nr = '0'
|
||||
endtry
|
||||
let sum += (has("float") ? str2float(nr) : (nr + 0))
|
||||
let sum += str2float(nr)
|
||||
endfor
|
||||
if has("float")
|
||||
let b:csv_result = string(float2nr(sum))
|
||||
if float2nr(sum) == sum
|
||||
return float2nr(sum)
|
||||
else
|
||||
return printf("%.2f", sum)
|
||||
endif
|
||||
endif
|
||||
let b:csv_result = string(sum)
|
||||
return sum
|
||||
let b:csv_result = sum
|
||||
return printf("%.2f", sum)
|
||||
endif
|
||||
endfu
|
||||
fu! csv#AvgColumn(list) "{{{3
|
||||
if empty(a:list)
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
return 0.0
|
||||
else
|
||||
let cnt = 0
|
||||
let sum = has("float") ? 0.0 : 0
|
||||
let sum = 0.0
|
||||
for item in a:list
|
||||
if empty(item)
|
||||
continue
|
||||
@@ -1496,30 +1532,25 @@ fu! csv#AvgColumn(list) "{{{3
|
||||
let format2 = '\d\+\zs\V' . s:nr_format[1] . '\m\ze\d'
|
||||
try
|
||||
let nr = substitute(nr, format1, '', '')
|
||||
if has("float") && s:nr_format[1] != '.'
|
||||
if s:nr_format[1] != '.'
|
||||
let nr = substitute(nr, format2, '.', '')
|
||||
endif
|
||||
catch
|
||||
let nr = 0
|
||||
let nr ='0'
|
||||
endtry
|
||||
let sum += (has("float") ? str2float(nr) : (nr + 0))
|
||||
let sum += str2float(nr)
|
||||
let cnt += 1
|
||||
endfor
|
||||
if has("float")
|
||||
let b:csv_result = printf("%.2f", sum/cnt)
|
||||
return str2float(b:csv_result)
|
||||
else
|
||||
let b:csv_result = printf("%s", sum/cnt)
|
||||
return b:csv_result + 0
|
||||
endif
|
||||
let b:csv_result = printf("%.2f", sum/cnt)
|
||||
return sum/cnt
|
||||
endif
|
||||
endfu
|
||||
fu! csv#VarianceColumn(list, is_population) "{{{3
|
||||
if empty(a:list)
|
||||
return 0
|
||||
return 0.0
|
||||
else
|
||||
let cnt = 0
|
||||
let sum = has("float") ? 0.0 : 0
|
||||
let sum = 0.0
|
||||
let avg = csv#AvgColumn(a:list)
|
||||
for item in a:list
|
||||
if empty(item)
|
||||
@@ -1530,64 +1561,64 @@ fu! csv#VarianceColumn(list, is_population) "{{{3
|
||||
let format2 = '\d\+\zs\V' . s:nr_format[1] . '\m\ze\d'
|
||||
try
|
||||
let nr = substitute(nr, format1, '', '')
|
||||
if has("float") && s:nr_format[1] != '.'
|
||||
if s:nr_format[1] != '.'
|
||||
let nr = substitute(nr, format2, '.', '')
|
||||
endif
|
||||
catch
|
||||
let nr = 0
|
||||
let nr = '0'
|
||||
endtry
|
||||
let sum += pow((has("float") ? (str2float(nr)-avg) : ((nr + 0)-avg)), 2)
|
||||
let nr = str2float(nr)
|
||||
let sum += pow((nr-avg), 2)
|
||||
let cnt += 1
|
||||
endfor
|
||||
if(a:is_population == 0)
|
||||
let cnt = cnt-1
|
||||
endif
|
||||
if has("float")
|
||||
let b:csv_result = printf("%." . get(b:, 'csv_accuracy', get(g:, 'csv_accuracy', 2)) . "f", sum/cnt)
|
||||
return b:csv_result
|
||||
else
|
||||
let b:csv_result = printf("%s", sum/cnt)
|
||||
return sum/(cnt)
|
||||
endif
|
||||
let b:csv_result = sum/cnt
|
||||
return b:csv_result
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#SmplVarianceColumn(list) "{{{2
|
||||
unlet! b:csv_result
|
||||
if empty(a:list)
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
let b:csv_result = 0.0
|
||||
return 0.0
|
||||
else
|
||||
return csv#VarianceColumn(a:list, 0)
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#PopVarianceColumn(list) "{{{2
|
||||
unlet! b:csv_result
|
||||
if empty(a:list)
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
let b:csv_result = 0.0
|
||||
return 0.0
|
||||
else
|
||||
return csv#VarianceColumn(a:list, 1)
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#SmplStdDevColumn(list) "{{{2
|
||||
unlet! b:csv_result
|
||||
if empty(a:list)
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
let b:csv_result = 0.0
|
||||
return 0.0
|
||||
else
|
||||
let result = sqrt(str2float(csv#VarianceColumn(a:list, 0)))
|
||||
let b:csv_result = string(result)
|
||||
let result = sqrt(csv#VarianceColumn(a:list, 0))
|
||||
let b:csv_result = result
|
||||
return result
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#PopStdDevColumn(list) "{{{2
|
||||
unlet! b:csv_result
|
||||
if empty(a:list)
|
||||
let b:csv_result = '0'
|
||||
return 0
|
||||
let b:csv_result = 0.0
|
||||
return 0.0
|
||||
else
|
||||
let result = sqrt(str2float(csv#VarianceColumn(a:list, 1)))
|
||||
let b:csv_result = string(result)
|
||||
let result = sqrt(csv#VarianceColumn(a:list, 1))
|
||||
let b:csv_result = result
|
||||
return result
|
||||
endif
|
||||
endfu
|
||||
@@ -1610,15 +1641,15 @@ fu! csv#MaxColumn(list) "{{{3
|
||||
let format2 = '\d\+\zs\V' . s:nr_format[1] . '\m\ze\d'
|
||||
try
|
||||
let nr = substitute(nr, format1, '', '')
|
||||
if has("float") && s:nr_format[1] != '.'
|
||||
if s:nr_format[1] != '.'
|
||||
let nr = substitute(nr, format2, '.', '')
|
||||
endif
|
||||
catch
|
||||
let nr = 0
|
||||
let nr = '0'
|
||||
endtry
|
||||
call add(result, has("float") ? str2float(nr) : nr+0)
|
||||
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")
|
||||
@@ -1679,7 +1710,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
|
||||
@@ -1743,7 +1774,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
|
||||
@@ -1905,7 +1936,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
|
||||
|
||||
@@ -1986,7 +2017,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
|
||||
@@ -1995,11 +2026,7 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
call filter(res, 'v:val =~ ''^''.join(max_items, ''\|'').''$''')
|
||||
endif
|
||||
|
||||
if has("float")
|
||||
let title="Nr\tCount\t % \tValue"
|
||||
else
|
||||
let title="Nr\tCount\tValue"
|
||||
endif
|
||||
let title="Nr\tCount\t % \tValue"
|
||||
echohl Title
|
||||
echo printf("%s", title)
|
||||
echohl Normal
|
||||
@@ -2014,12 +2041,8 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
else
|
||||
let k = key
|
||||
endif
|
||||
if has("float")
|
||||
echo printf("%02d\t%02d\t%2.0f%%\t%.50s", i, res[key],
|
||||
\ ((res[key] + 0.0)/qty)*100, k)
|
||||
else
|
||||
echo printf("%02d\t%02d\t%.50s", i, res[key], k)
|
||||
endif
|
||||
echo printf("%02d\t%02d\t%2.0f%%\t%.50s", i, res[key],
|
||||
\ ((res[key] + 0.0)/qty)*100, k)
|
||||
call remove(res,key)
|
||||
let i+=1
|
||||
else
|
||||
@@ -2072,6 +2095,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''))'))
|
||||
@@ -2133,8 +2157,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
|
||||
@@ -2214,7 +2238,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>')
|
||||
call csv#Map('nnoremap', 'E', ':<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>')
|
||||
@@ -2325,7 +2357,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>)',
|
||||
@@ -2438,7 +2470,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
|
||||
@@ -2483,7 +2515,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')
|
||||
@@ -2513,12 +2545,16 @@ fu! csv#CompleteColumnNr(A,L,P) "{{{3
|
||||
return join(range(1,csv#MaxColumns()), "\n")
|
||||
endfu
|
||||
fu! csv#CheckDuplicates(list) "{{{3
|
||||
let string = a:list
|
||||
if string =~ '\d\s\?-\s\?\d'
|
||||
let string = substitute(string, '\(\d\+\)\s\?-\s\?\(\d\+\)',
|
||||
\ '\=join(range(submatch(1),submatch(2)), ",")', '')
|
||||
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
|
||||
let list=split(string, ',')
|
||||
call csv#DuplicateRows(list)
|
||||
endfu
|
||||
fu! csv#Transpose(line1, line2) "{{{3
|
||||
@@ -2535,7 +2571,11 @@ fu! csv#Transpose(line1, line2) "{{{3
|
||||
let TrailingDelim = getline(1) =~ b:delimiter.'$'
|
||||
endif
|
||||
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt != ['','']
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
else
|
||||
let pat = ''
|
||||
endif
|
||||
|
||||
try
|
||||
let columns = csv#MaxColumns(a:line1)
|
||||
@@ -2547,7 +2587,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 = []
|
||||
@@ -2703,7 +2743,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),
|
||||
@@ -2950,6 +2990,11 @@ fu! csv#EvalColumn(nr, func, first, last, ...) range "{{{3
|
||||
call csv#Warn("File is no CSV file!")
|
||||
return
|
||||
endif
|
||||
" Need a Vim with floating point feature
|
||||
if !has("float")
|
||||
call csv#Warn("Your Vim is missing floating point feature!")
|
||||
return
|
||||
endif
|
||||
let save = winsaveview()
|
||||
call csv#CheckHeaderLine()
|
||||
let nr = matchstr(a:nr, '^\-\?\d\+')
|
||||
@@ -3031,10 +3076,12 @@ fu! csv#SumCSVRow(line, nr) "{{{3
|
||||
endif
|
||||
let line=getline(ln)
|
||||
" Filter comments out
|
||||
let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if line =~ pat
|
||||
call csv#Warn("Invalid count specified")
|
||||
return
|
||||
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')
|
||||
@@ -3207,5 +3254,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,37 +116,63 @@ 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
|
||||
return [v:false, {}]
|
||||
endif
|
||||
let dot_packages_dir = fnamemodify(dot_packages, ':p:h')
|
||||
let lines = readfile(dot_packages)
|
||||
let map = {}
|
||||
for line in lines
|
||||
if line =~# '\s*#'
|
||||
continue
|
||||
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 package = substitute(line, ':.*$', '', '')
|
||||
let lib_dir = substitute(line, '^[^:]*:', '', '')
|
||||
if lib_dir =~# 'file:/'
|
||||
let lib_dir = substitute(lib_dir, 'file://', '', '')
|
||||
if lib_dir =~# '/[A-Z]:/'
|
||||
let lib_dir = lib_dir[1:]
|
||||
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
|
||||
else
|
||||
let lib_dir = resolve(dot_packages_dir.'/'.lib_dir)
|
||||
endif
|
||||
if lib_dir =~# '/$'
|
||||
let lib_dir = lib_dir[:len(lib_dir) - 2]
|
||||
endif
|
||||
let map[package] = lib_dir
|
||||
endfor
|
||||
return [v:true, map]
|
||||
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 = {}
|
||||
for line in lines
|
||||
if line =~# '\s*#'
|
||||
continue
|
||||
endif
|
||||
let package = substitute(line, ':.*$', '', '')
|
||||
let lib_dir = substitute(line, '^[^:]*:', '', '')
|
||||
if lib_dir =~# 'file:/'
|
||||
let lib_dir = substitute(lib_dir, 'file://', '', '')
|
||||
if lib_dir =~# '/[A-Z]:/'
|
||||
let lib_dir = lib_dir[1:]
|
||||
endif
|
||||
else
|
||||
let lib_dir = resolve(dot_packages_dir.'/'.lib_dir)
|
||||
endif
|
||||
if lib_dir =~# '/$'
|
||||
let lib_dir = lib_dir[:len(lib_dir) - 2]
|
||||
endif
|
||||
let map[package] = lib_dir
|
||||
endfor
|
||||
return [v:true, map]
|
||||
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
|
||||
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
|
||||
let relative_lnum = max([clause_lnum, block_start_lnum])
|
||||
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)
|
||||
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
|
||||
if s:IsString(v:lnum, 1)
|
||||
return indent(v:lnum)
|
||||
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
|
||||
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
|
||||
" shiftwidth can be misleading in recent versions, use shiftwidth() if
|
||||
" it is available.
|
||||
if exists('*shiftwidth')
|
||||
let l:shiftwidth = shiftwidth()
|
||||
else
|
||||
let l:shiftwidth = &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
|
||||
|
||||
@@ -83,7 +153,5 @@ function! fish#Complete(findstart, base)
|
||||
endfunction
|
||||
|
||||
function! fish#errorformat()
|
||||
return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s'
|
||||
return '%E%f (line %l):%m,%C%p^%.%#,%-C%.%#'
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
678
autoload/fsharp.vim
Normal file
678
autoload/fsharp.vim
Normal file
@@ -0,0 +1,678 @@
|
||||
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
|
||||
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
|
||||
set cmdheight=2
|
||||
endif
|
||||
echom a:msg
|
||||
let &cmdheight = height
|
||||
endfunction
|
||||
|
||||
|
||||
" FSAC payload interfaces
|
||||
|
||||
function! s:PlainNotification(content)
|
||||
return { 'Content': a:content }
|
||||
endfunction
|
||||
|
||||
function! s:TextDocumentIdentifier(path)
|
||||
let usr_ss_opt = &shellslash
|
||||
set shellslash
|
||||
let uri = fnamemodify(a:path, ":p")
|
||||
if uri[0] == "/"
|
||||
let uri = "file://" . uri
|
||||
else
|
||||
let uri = "file:///" . uri
|
||||
endif
|
||||
let &shellslash = usr_ss_opt
|
||||
return { 'Uri': uri }
|
||||
endfunction
|
||||
|
||||
function! s:Position(line, character)
|
||||
return { 'Line': a:line, 'Character': a:character }
|
||||
endfunction
|
||||
|
||||
function! s:TextDocumentPositionParams(documentUri, line, character)
|
||||
return {
|
||||
\ 'TextDocument': s:TextDocumentIdentifier(a:documentUri),
|
||||
\ 'Position': s:Position(a:line, a:character)
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! s:DocumentationForSymbolRequest(xmlSig, assembly)
|
||||
return {
|
||||
\ 'XmlSig': a:xmlSig,
|
||||
\ 'Assembly': a:assembly
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! s:ProjectParms(projectUri)
|
||||
return { 'Project': s:TextDocumentIdentifier(a:projectUri) }
|
||||
endfunction
|
||||
|
||||
function! s:WorkspacePeekRequest(directory, deep, excludedDirs)
|
||||
return {
|
||||
\ 'Directory': fnamemodify(a:directory, ":p"),
|
||||
\ 'Deep': a:deep,
|
||||
\ 'ExcludedDirs': a:excludedDirs
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! s:WorkspaceLoadParms(files)
|
||||
let prm = []
|
||||
for file in a:files
|
||||
call add(prm, s:TextDocumentIdentifier(file))
|
||||
endfor
|
||||
return { 'TextDocuments': prm }
|
||||
endfunction
|
||||
|
||||
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)
|
||||
return s:call('fsharp/signature', s:TextDocumentPositionParams(a:filePath, a:line, a:character), a:cont)
|
||||
endfunction
|
||||
function! s:signatureData(filePath, line, character, cont)
|
||||
return s:call('fsharp/signatureData', s:TextDocumentPositionParams(a:filePath, a:line, a:character), a:cont)
|
||||
endfunction
|
||||
function! s:lineLens(projectPath, cont)
|
||||
return s:call('fsharp/lineLens', s:ProjectParms(a:projectPath), a:cont)
|
||||
endfunction
|
||||
function! s:compilerLocation(cont)
|
||||
return s:call('fsharp/compilerLocation', {}, a:cont)
|
||||
endfunction
|
||||
function! s:compile(projectPath, cont)
|
||||
return s:call('fsharp/compile', s:ProjectParms(a:projectPath), a:cont)
|
||||
endfunction
|
||||
function! s:workspacePeek(directory, depth, excludedDirs, cont)
|
||||
return s:call('fsharp/workspacePeek', s:WorkspacePeekRequest(a:directory, a:depth, a:excludedDirs), a:cont)
|
||||
endfunction
|
||||
function! s:workspaceLoad(files, cont)
|
||||
return s:call('fsharp/workspaceLoad', s:WorkspaceLoadParms(a:files), a:cont)
|
||||
endfunction
|
||||
function! s:project(projectPath, cont)
|
||||
return s:call('fsharp/project', s:ProjectParms(a:projectPath), a:cont)
|
||||
endfunction
|
||||
function! s:fsdn(signature, cont)
|
||||
return s:call('fsharp/fsdn', s:FsdnRequest(a:signature), a:cont)
|
||||
endfunction
|
||||
function! s:f1Help(filePath, line, character, cont)
|
||||
return s:call('fsharp/f1Help', s:TextDocumentPositionParams(a:filePath, a:line, a:character), a:cont)
|
||||
endfunction
|
||||
function! fsharp#documentation(filePath, line, character, cont)
|
||||
return s:call('fsharp/documentation', s:TextDocumentPositionParams(a:filePath, a:line, a:character), a:cont)
|
||||
endfunction
|
||||
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
|
||||
" since the initialization has already completed?
|
||||
" 'AutomaticWorkspaceInit',
|
||||
" 'WorkspaceModePeekDeepLevel',
|
||||
"
|
||||
" * Changes made to linter/unused analyzer settings seems not reflected after sending them to FSAC?
|
||||
"
|
||||
let s:config_keys_camel =
|
||||
\ [
|
||||
\ {'key': 'AutomaticWorkspaceInit', 'default': 1},
|
||||
\ {'key': 'WorkspaceModePeekDeepLevel', 'default': 2},
|
||||
\ {'key': 'ExcludeProjectDirectories', 'default': []},
|
||||
\ {'key': 'keywordsAutocomplete', 'default': 1},
|
||||
\ {'key': 'ExternalAutocomplete', 'default': 0},
|
||||
\ {'key': 'Linter', 'default': 1},
|
||||
\ {'key': 'UnionCaseStubGeneration', 'default': 1},
|
||||
\ {'key': 'UnionCaseStubGenerationBody'},
|
||||
\ {'key': 'RecordStubGeneration', 'default': 1},
|
||||
\ {'key': 'RecordStubGenerationBody'},
|
||||
\ {'key': 'InterfaceStubGeneration', 'default': 1},
|
||||
\ {'key': 'InterfaceStubGenerationObjectIdentifier', 'default': 'this'},
|
||||
\ {'key': 'InterfaceStubGenerationMethodBody'},
|
||||
\ {'key': 'UnusedOpensAnalyzer', 'default': 1},
|
||||
\ {'key': 'UnusedDeclarationsAnalyzer', 'default': 1},
|
||||
\ {'key': 'SimplifyNameAnalyzer', 'default': 0},
|
||||
\ {'key': 'ResolveNamespaces', 'default': 1},
|
||||
\ {'key': 'EnableReferenceCodeLens', 'default': 1},
|
||||
\ {'key': 'EnableAnalyzers', 'default': 0},
|
||||
\ {'key': 'AnalyzersPath'},
|
||||
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'never', 'prefix': ''}},
|
||||
\ {'key': 'UseSdkScripts', 'default': 1},
|
||||
\ {'key': 'dotNetRoot'},
|
||||
\ {'key': 'fsiExtraParameters', 'default': []},
|
||||
\ ]
|
||||
let s:config_keys = []
|
||||
|
||||
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
|
||||
endfunction
|
||||
|
||||
function! s:buildConfigKeys()
|
||||
if len(s:config_keys) == 0
|
||||
for key_camel in s:config_keys_camel
|
||||
let 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
|
||||
endif
|
||||
call add(s:config_keys, key)
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#getServerConfig()
|
||||
let fsharp = {}
|
||||
call s:buildConfigKeys()
|
||||
for key in s:config_keys
|
||||
if exists('g:fsharp#' . key.snake)
|
||||
let fsharp[key.camel] = g:fsharp#{key.snake}
|
||||
elseif exists('g:fsharp#' . key.camel)
|
||||
let fsharp[key.camel] = g:fsharp#{key.camel}
|
||||
elseif has_key(key, 'default') && g:fsharp#use_recommended_server_config
|
||||
let g:fsharp#{key.snake} = key.default
|
||||
let fsharp[key.camel] = key.default
|
||||
endif
|
||||
endfor
|
||||
return fsharp
|
||||
endfunction
|
||||
|
||||
function! fsharp#updateServerConfig()
|
||||
let fsharp = fsharp#getServerConfig()
|
||||
let settings = {'settings': {'FSharp': fsharp}}
|
||||
call s:notify('workspace/didChangeConfiguration', settings)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadConfig()
|
||||
if exists('s:config_is_loaded')
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists('g:fsharp#fsautocomplete_command')
|
||||
let g:fsharp#fsautocomplete_command = ['fsautocomplete']
|
||||
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 g:fsharp#backend = "nvim"
|
||||
endif
|
||||
else
|
||||
let g:fsharp#backend = "languageclient-neovim"
|
||||
endif
|
||||
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)
|
||||
call s:workspaceLoad(a:arg, v:null)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadProject(...)
|
||||
let prjs = []
|
||||
for proj in a:000
|
||||
call add(prjs, fnamemodify(proj, ':p'))
|
||||
endfor
|
||||
call s:load(prjs)
|
||||
endfunction
|
||||
|
||||
function! fsharp#showLoadedProjects()
|
||||
for proj in s:workspace
|
||||
echo "-" proj
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! fsharp#reloadProjects()
|
||||
if len(s:workspace) > 0
|
||||
call s:workspaceLoad(s:workspace, v:null)
|
||||
else
|
||||
echom "[FSAC] Workspace is empty"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#OnFSProjSave()
|
||||
if &ft == "fsharp_project" && exists('g:fsharp#automatic_reload_workspace') && g:fsharp#automatic_reload_workspace
|
||||
call fsharp#reloadProjects()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#showSignature()
|
||||
function! s:callback_showSignature(result)
|
||||
let result = a:result
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
echo substitute(content.Data, '\n\+$', ' ', 'g')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
call s:signature(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showSignature"))
|
||||
endfunction
|
||||
|
||||
function! fsharp#OnCursorMove()
|
||||
if g:fsharp#show_signature_on_cursor_move
|
||||
call fsharp#showSignature()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#showF1Help()
|
||||
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()
|
||||
function! s:callback_showTooltip(result)
|
||||
let result = a:result
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
call s:hover()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
" show hover only if signature exists for the current position
|
||||
call s:signature(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showTooltip"))
|
||||
endfunction
|
||||
|
||||
|
||||
" FSI integration
|
||||
|
||||
let s:fsi_buffer = -1
|
||||
let s:fsi_job = -1
|
||||
let s:fsi_width = 0
|
||||
let s:fsi_height = 0
|
||||
|
||||
function! s:win_gotoid_safe(winid)
|
||||
function! s:vimReturnFocus(window)
|
||||
call win_gotoid(a:window)
|
||||
redraw!
|
||||
endfunction
|
||||
if has('nvim')
|
||||
call win_gotoid(a:winid)
|
||||
else
|
||||
call timer_start(1, { -> s:vimReturnFocus(a:winid) })
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_fsi_command()
|
||||
let cmd = g:fsharp#fsi_command
|
||||
for prm in g:fsharp#fsi_extra_parameters
|
||||
let cmd = cmd . " " . prm
|
||||
endfor
|
||||
return cmd
|
||||
endfunction
|
||||
|
||||
function! fsharp#openFsi(returnFocus)
|
||||
if bufwinid(s:fsi_buffer) <= 0
|
||||
let fsi_command = s:get_fsi_command()
|
||||
if exists('*termopen') || exists('*term_start')
|
||||
let current_win = win_getid()
|
||||
execute g:fsharp#fsi_window_command
|
||||
if s:fsi_width > 0 | execute 'vertical resize' s:fsi_width | endif
|
||||
if s:fsi_height > 0 | execute 'resize' s:fsi_height | endif
|
||||
" if window is closed but FSI is still alive then reuse it
|
||||
if s:fsi_buffer >= 0 && bufexists(str2nr(s:fsi_buffer))
|
||||
exec 'b' s:fsi_buffer
|
||||
normal G
|
||||
if !has('nvim') && mode() == 'n' | execute "normal A" | endif
|
||||
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
|
||||
" open FSI: Neovim
|
||||
elseif has('nvim')
|
||||
let s:fsi_job = termopen(fsi_command)
|
||||
if s:fsi_job > 0
|
||||
let s:fsi_buffer = bufnr("%")
|
||||
else
|
||||
close
|
||||
echom "[FSAC] Failed to open FSI."
|
||||
return -1
|
||||
endif
|
||||
" open FSI: Vim
|
||||
else
|
||||
let options = {
|
||||
\ "term_name": "F# Interactive",
|
||||
\ "curwin": 1,
|
||||
\ "term_finish": "close"
|
||||
\ }
|
||||
let s:fsi_buffer = term_start(fsi_command, options)
|
||||
if s:fsi_buffer != 0
|
||||
if exists('*term_setkill') | call term_setkill(s:fsi_buffer, "term") | endif
|
||||
let s:fsi_job = term_getjob(s:fsi_buffer)
|
||||
else
|
||||
close
|
||||
echom "[FSAC] Failed to open FSI."
|
||||
return -1
|
||||
endif
|
||||
endif
|
||||
setlocal bufhidden=hide
|
||||
normal G
|
||||
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
|
||||
return s:fsi_buffer
|
||||
else
|
||||
echom "[FSAC] Your (neo)vim does not support terminal."
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
return s:fsi_buffer
|
||||
endfunction
|
||||
|
||||
function! fsharp#toggleFsi()
|
||||
let fsiWindowId = bufwinid(s:fsi_buffer)
|
||||
if fsiWindowId > 0
|
||||
let current_win = win_getid()
|
||||
call win_gotoid(fsiWindowId)
|
||||
let s:fsi_width = winwidth('%')
|
||||
let s:fsi_height = winheight('%')
|
||||
close
|
||||
call win_gotoid(current_win)
|
||||
else
|
||||
call fsharp#openFsi(0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#quitFsi()
|
||||
if s:fsi_buffer >= 0 && bufexists(str2nr(s:fsi_buffer))
|
||||
if has('nvim')
|
||||
let winid = bufwinid(s:fsi_buffer)
|
||||
if winid > 0 | execute "close " . winid | endif
|
||||
call jobstop(s:fsi_job)
|
||||
else
|
||||
call job_stop(s:fsi_job, "term")
|
||||
endif
|
||||
let s:fsi_buffer = -1
|
||||
let s:fsi_job = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#resetFsi()
|
||||
call fsharp#quitFsi()
|
||||
return fsharp#openFsi(1)
|
||||
endfunction
|
||||
|
||||
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" . ";;". "\n")
|
||||
" Vim 8
|
||||
else
|
||||
call term_sendkeys(s:fsi_buffer, a:text . "\<cr>" . ";;" . "\<cr>")
|
||||
call term_wait(s:fsi_buffer)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" https://stackoverflow.com/a/6271254
|
||||
function! s:get_visual_selection()
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
let lines = getline(line_start, line_end)
|
||||
if len(lines) == 0
|
||||
return ''
|
||||
endif
|
||||
let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)]
|
||||
let lines[0] = lines[0][column_start - 1:]
|
||||
return lines
|
||||
endfunction
|
||||
|
||||
function! s:get_complete_buffer()
|
||||
return join(getline(1, '$'), "\n")
|
||||
endfunction
|
||||
|
||||
function! fsharp#sendSelectionToFsi() range
|
||||
let lines = s:get_visual_selection()
|
||||
exec 'normal' len(lines) . 'j'
|
||||
let text = join(lines, "\n")
|
||||
return fsharp#sendFsi(text)
|
||||
endfunction
|
||||
|
||||
function! fsharp#sendLineToFsi()
|
||||
let text = getline('.')
|
||||
exec 'normal j'
|
||||
return fsharp#sendFsi(text)
|
||||
endfunction
|
||||
|
||||
function! fsharp#sendAllToFsi()
|
||||
let text = s:get_complete_buffer()
|
||||
return fsharp#sendFsi(text)
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=4 et sts=4
|
||||
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
|
||||
@@ -55,6 +53,10 @@ function! go#config#TermCloseOnExit() abort
|
||||
return get(g:, 'go_term_close_on_exit', 1)
|
||||
endfunction
|
||||
|
||||
function! go#config#TermReuse() abort
|
||||
return get(g:, 'go_term_reuse', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#SetTermCloseOnExit(value) abort
|
||||
let g:go_term_close_on_exit = a:value
|
||||
endfunction
|
||||
@@ -213,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
|
||||
@@ -261,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
|
||||
@@ -298,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
|
||||
@@ -342,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
|
||||
@@ -371,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
|
||||
@@ -510,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
|
||||
@@ -548,18 +569,60 @@ function! go#config#GoplsLocal() abort
|
||||
return get(g:, 'go_gopls_local', v:null)
|
||||
endfunction
|
||||
|
||||
function! go#config#GoplsGofumpt() abort
|
||||
return get(g:, 'go_gopls_gofumpt', v:null)
|
||||
endfunction
|
||||
|
||||
function! go#config#GoplsSettings() abort
|
||||
return get(g:, 'go_gopls_settings', v:null)
|
||||
endfunction
|
||||
|
||||
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
|
||||
@@ -571,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) 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
|
||||
|
||||
30
autoload/jq.vim
Normal file
30
autoload/jq.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jq', 'autoload/jq.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" Refer https://github.com/vim/vim/blob/75e27d78f5370e7d2e0898326d9b080937e7b090/runtime/scripts.vim#L33-L71
|
||||
function! jq#shebang() abort
|
||||
let s:line1 = getline(1)
|
||||
|
||||
if s:line1 =~# "^#!"
|
||||
if s:line1 =~# '^#!\s*\S*\<env\s'
|
||||
let s:line1 = substitute(s:line1, '\S\+=\S\+', '', 'g')
|
||||
let s:line1 = substitute(s:line1, '\(-[iS]\|--ignore-environment\|--split-string\)', '', '')
|
||||
let s:line1 = substitute(s:line1, '\<env\s\+', '', '')
|
||||
endif
|
||||
if s:line1 =~# '^#!\s*\a:[/\\]'
|
||||
let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '')
|
||||
elseif s:line1 =~# '^#!.*\<env\>'
|
||||
let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '')
|
||||
elseif s:line1 =~# '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
|
||||
let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
|
||||
else
|
||||
let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
|
||||
endif
|
||||
if s:name =~# '^jq'
|
||||
set ft=jq
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -107,9 +109,11 @@ function! jsonnet#Format()
|
||||
call setfperm(expand('%'), l:originalFPerm)
|
||||
endif
|
||||
" the file has been changed outside of vim, enable reedit
|
||||
mkview
|
||||
silent edit!
|
||||
let &fileformat = l:originalFileFormat
|
||||
let &syntax = &syntax
|
||||
silent loadview
|
||||
elseif g:jsonnet_fmt_fail_silently == 0
|
||||
" FixMe: We could leverage the errors coming from the `jsonnetfmt` and
|
||||
" give immediate feedback to the user at every save time.
|
||||
@@ -124,6 +128,63 @@ function! jsonnet#Format()
|
||||
call winrestview(l:curw)
|
||||
endfunction
|
||||
|
||||
function! jsonnet#GetVisualSelection()
|
||||
" Source: https://stackoverflow.com/a/6271254
|
||||
" Why is this not a built-in Vim script function?!
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
let lines = getline(line_start, line_end)
|
||||
if len(lines) == 0
|
||||
return ''
|
||||
endif
|
||||
let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)]
|
||||
let lines[0] = lines[0][column_start - 1:]
|
||||
return join(lines, "\n")
|
||||
endfun
|
||||
|
||||
" Format calls `jsonnetfmt ... ` on a Visual selection
|
||||
function! jsonnet#FormatVisual()
|
||||
" Get current visual selection
|
||||
let l:selection = jsonnet#GetVisualSelection()
|
||||
|
||||
endif
|
||||
" Get the command first so we can test it
|
||||
let l:binName = g:jsonnet_fmt_command
|
||||
|
||||
" Check if the user has installed command binary.
|
||||
let l:binPath = jsonnet#CheckBinPath(l:binName)
|
||||
if empty(l:binPath)
|
||||
return
|
||||
endif
|
||||
|
||||
" Populate the final command.
|
||||
let l:command = l:binPath
|
||||
let l:command = l:command . ' -e '
|
||||
let l:command = l:command . g:jsonnet_fmt_options
|
||||
|
||||
" Execute the compiled jsonnetfmt command and save the return value
|
||||
let l:out = jsonnet#System(l:command . " \"" . l:selection . "\"")
|
||||
let l:errorCode = v:shell_error
|
||||
|
||||
" Save register contents
|
||||
let reg = '"'
|
||||
let save_cb = &cb
|
||||
let regInfo = getreginfo(reg)
|
||||
try
|
||||
" Set register to formatted output
|
||||
call setreg(reg,l:out)
|
||||
" Paste formatted output
|
||||
silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`['
|
||||
finally
|
||||
" Restore register contents
|
||||
let &cb = save_cb
|
||||
call setreg(reg, regInfo)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Evaluate jsonnet into vsplit
|
||||
function! jsonnet#Eval()
|
||||
let output = system(g:jsonnet_command . ' ' . shellescape(expand('%')))
|
||||
vnew
|
||||
setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile ft=jsonnet
|
||||
put! = output
|
||||
endfunction
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -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)
|
||||
@@ -115,8 +117,8 @@ function! s:unmap(function)
|
||||
return
|
||||
endif
|
||||
let mapids = a:function =~# "^move" ? ["n", "x", "o"] :
|
||||
\ a:function =~# "^select" ? ["x", "o"] :
|
||||
\ ["n"]
|
||||
\ a:function =~# "^select" ? ["x", "o"] :
|
||||
\ ["n"]
|
||||
let fn = "julia_blocks#" . a:function
|
||||
let cmd = "<buffer> " . chars
|
||||
for m in mapids
|
||||
@@ -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('.')
|
||||
let c = 0
|
||||
while !s:on_end()
|
||||
let pos = getpos('.')
|
||||
call s:matchit()
|
||||
let c = 0
|
||||
if getpos('.') == pos || c > 1000
|
||||
" shouldn't happen, but let's avoid infinite loops anyway
|
||||
return 0
|
||||
@@ -380,14 +382,14 @@ 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
|
||||
return ret
|
||||
endif
|
||||
exe "let skip = " . b:match_skip
|
||||
if !skip
|
||||
let ret = 1
|
||||
break
|
||||
let ret = 1
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endfor
|
||||
@@ -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
|
||||
@@ -493,15 +495,15 @@ function! julia_blocks#moveblock_N()
|
||||
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
|
||||
call setpos('.', save_pos)
|
||||
if s:on_end()
|
||||
normal! h
|
||||
normal! h
|
||||
endif
|
||||
let ret_end = s:moveto_block_delim(1, 0, 1)
|
||||
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
|
||||
|
||||
if ret_start && (!ret_end || s:compare_pos(start1_pos, end1_pos) < 0)
|
||||
call setpos('.', start1_pos)
|
||||
call setpos('.', start1_pos)
|
||||
else
|
||||
call setpos('.', save_pos)
|
||||
call setpos('.', save_pos)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -562,7 +564,7 @@ function! julia_blocks#moveblock_p()
|
||||
if s:on_begin()
|
||||
call s:move_before_begin()
|
||||
if s:on_end()
|
||||
normal! l
|
||||
normal! l
|
||||
endif
|
||||
let save_pos = getpos('.')
|
||||
let ret_start = s:moveto_block_delim(0, 1, 1)
|
||||
@@ -572,9 +574,9 @@ function! julia_blocks#moveblock_p()
|
||||
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
|
||||
|
||||
if ret_end && (!ret_start || s:compare_pos(start1_pos, end1_pos) < 0)
|
||||
call setpos('.', end1_pos)
|
||||
call setpos('.', end1_pos)
|
||||
else
|
||||
call setpos('.', save_pos)
|
||||
call setpos('.', save_pos)
|
||||
endif
|
||||
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.11.0-DEV.14
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -15,6 +17,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\copyright': '©',
|
||||
\ '\:copyright:': '©',
|
||||
\ '\ordfeminine': 'ª',
|
||||
\ '\guillemotleft': '«',
|
||||
\ '\neg': '¬',
|
||||
\ '\circledR': '®',
|
||||
\ '\:registered:': '®',
|
||||
@@ -27,6 +30,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\cdotp': '·',
|
||||
\ '\^1': '¹',
|
||||
\ '\ordmasculine': 'º',
|
||||
\ '\guillemotright': '»',
|
||||
\ '\1/4': '¼',
|
||||
\ '\1/2': '½',
|
||||
\ '\3/4': '¾',
|
||||
@@ -265,7 +269,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\^c': 'ᶜ',
|
||||
\ '\^f': 'ᶠ',
|
||||
\ '\^iota': 'ᶥ',
|
||||
\ '\^Phi': 'ᶲ',
|
||||
\ '\^ltphi': 'ᶲ',
|
||||
\ '\^z': 'ᶻ',
|
||||
\ '\^theta': 'ᶿ',
|
||||
\ '\enspace': ' ',
|
||||
@@ -279,8 +283,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\lq': '‘',
|
||||
\ '\rq': '’',
|
||||
\ '\reapos': '‛',
|
||||
\ '\quotedblleft': '“',
|
||||
\ '\quotedblright': '”',
|
||||
\ '\ldq': '“',
|
||||
\ '\rdq': '”',
|
||||
\ '\dagger': '†',
|
||||
\ '\ddagger': '‡',
|
||||
\ '\bullet': '•',
|
||||
@@ -372,10 +376,12 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\scrH': 'ℋ',
|
||||
\ '\frakH': 'ℌ',
|
||||
\ '\bbH': 'ℍ',
|
||||
\ '\ith': 'ℎ',
|
||||
\ '\planck': 'ℎ',
|
||||
\ '\hslash': 'ℏ',
|
||||
\ '\scrI': 'ℐ',
|
||||
\ '\Im': 'ℑ',
|
||||
\ '\frakI': 'ℑ',
|
||||
\ '\scrL': 'ℒ',
|
||||
\ '\ell': 'ℓ',
|
||||
\ '\bbN': 'ℕ',
|
||||
@@ -385,6 +391,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bbQ': 'ℚ',
|
||||
\ '\scrR': 'ℛ',
|
||||
\ '\Re': 'ℜ',
|
||||
\ '\frakR': 'ℜ',
|
||||
\ '\bbR': 'ℝ',
|
||||
\ '\xrat': '℞',
|
||||
\ '\trademark': '™',
|
||||
@@ -654,6 +661,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\measeq': '≞',
|
||||
\ '\questeq': '≟',
|
||||
\ '\ne': '≠',
|
||||
\ '\neq': '≠',
|
||||
\ '\equiv': '≡',
|
||||
\ '\nequiv': '≢',
|
||||
\ '\Equiv': '≣',
|
||||
@@ -757,7 +765,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\veebar': '⊻',
|
||||
\ '\xor': '⊻',
|
||||
\ '\barwedge': '⊼',
|
||||
\ '\nand': '⊼',
|
||||
\ '\barvee': '⊽',
|
||||
\ '\nor': '⊽',
|
||||
\ '\rightanglearc': '⊾',
|
||||
\ '\varlrtriangle': '⊿',
|
||||
\ '\bigwedge': '⋀',
|
||||
@@ -797,7 +807,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\nsqsubseteq': '⋢',
|
||||
\ '\nsqsupseteq': '⋣',
|
||||
\ '\sqsubsetneq': '⋤',
|
||||
\ '\sqspne': '⋥',
|
||||
\ '\sqsupsetneq': '⋥',
|
||||
\ '\lnsim': '⋦',
|
||||
\ '\gnsim': '⋧',
|
||||
\ '\precnsim': '⋨',
|
||||
@@ -1007,6 +1017,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\astrosun': '☉',
|
||||
\ '\:phone:': '☎',
|
||||
\ '\:ballot_box_with_check:': '☑',
|
||||
\ '\:umbrella_with_rain_drops:': '☔',
|
||||
\ '\:umbrella:': '☔',
|
||||
\ '\:coffee:': '☕',
|
||||
\ '\:point_up:': '☝',
|
||||
@@ -1095,6 +1106,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:soccer:': '⚽',
|
||||
\ '\:baseball:': '⚾',
|
||||
\ '\:snowman:': '⛄',
|
||||
\ '\:snowman_without_snow:': '⛄',
|
||||
\ '\:partly_sunny:': '⛅',
|
||||
\ '\:ophiuchus:': '⛎',
|
||||
\ '\:no_entry:': '⛔',
|
||||
@@ -1142,6 +1154,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\threedangle': '⟀',
|
||||
\ '\whiteinwhitetriangle': '⟁',
|
||||
\ '\perp': '⟂',
|
||||
\ '\veedot': '⟇',
|
||||
\ '\bsolhsub': '⟈',
|
||||
\ '\suphsol': '⟉',
|
||||
\ '\wedgedot': '⟑',
|
||||
@@ -1264,6 +1277,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\UpEquilibrium': '⥮',
|
||||
\ '\ReverseUpEquilibrium': '⥯',
|
||||
\ '\RoundImplies': '⥰',
|
||||
\ '\leftarrowless': '⥷',
|
||||
\ '\leftarrowsubset': '⥺',
|
||||
\ '\Vvert': '⦀',
|
||||
\ '\Elroang': '⦆',
|
||||
\ '\ddfnc': '⦙',
|
||||
@@ -1350,8 +1365,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\intcup': '⨚',
|
||||
\ '\upint': '⨛',
|
||||
\ '\lowint': '⨜',
|
||||
\ '\Join': '⨝',
|
||||
\ '\join': '⨝',
|
||||
\ '\bbsemi': '⨟',
|
||||
\ '\ringplus': '⨢',
|
||||
\ '\plushat': '⨣',
|
||||
\ '\simplus': '⨤',
|
||||
@@ -1539,6 +1554,11 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\forksnot': '⫝',
|
||||
\ '\dashV': '⫣',
|
||||
\ '\Dashv': '⫤',
|
||||
\ '\Top': '⫪',
|
||||
\ '\downvDash': '⫪',
|
||||
\ '\upvDash': '⫫',
|
||||
\ '\Bot': '⫫',
|
||||
\ '\indep': '⫫',
|
||||
\ '\interleave': '⫴',
|
||||
\ '\tdcol': '⫶',
|
||||
\ '\lllnest': '⫷',
|
||||
@@ -1623,6 +1643,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:part_alternation_mark:': '〽',
|
||||
\ '\:congratulations:': '㊗',
|
||||
\ '\:secret:': '㊙',
|
||||
\ '\^uparrow': 'ꜛ',
|
||||
\ '\^downarrow': 'ꜜ',
|
||||
\ '\^!': 'ꜝ',
|
||||
\ '\bfA': '𝐀',
|
||||
\ '\bfB': '𝐁',
|
||||
\ '\bfC': '𝐂',
|
||||
@@ -2307,7 +2330,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfbeta': '𝛃',
|
||||
\ '\bfgamma': '𝛄',
|
||||
\ '\bfdelta': '𝛅',
|
||||
\ '\bfepsilon': '𝛆',
|
||||
\ '\bfvarepsilon': '𝛆',
|
||||
\ '\bfzeta': '𝛇',
|
||||
\ '\bfeta': '𝛈',
|
||||
\ '\bftheta': '𝛉',
|
||||
@@ -2329,7 +2352,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfpsi': '𝛙',
|
||||
\ '\bfomega': '𝛚',
|
||||
\ '\bfpartial': '𝛛',
|
||||
\ '\bfvarepsilon': '𝛜',
|
||||
\ '\bfepsilon': '𝛜',
|
||||
\ '\bfvartheta': '𝛝',
|
||||
\ '\bfvarkappa': '𝛞',
|
||||
\ '\bfphi': '𝛟',
|
||||
@@ -2365,7 +2388,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\itbeta': '𝛽',
|
||||
\ '\itgamma': '𝛾',
|
||||
\ '\itdelta': '𝛿',
|
||||
\ '\itepsilon': '𝜀',
|
||||
\ '\itvarepsilon': '𝜀',
|
||||
\ '\itzeta': '𝜁',
|
||||
\ '\iteta': '𝜂',
|
||||
\ '\ittheta': '𝜃',
|
||||
@@ -2382,15 +2405,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 +2446,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bibeta': '𝜷',
|
||||
\ '\bigamma': '𝜸',
|
||||
\ '\bidelta': '𝜹',
|
||||
\ '\biepsilon': '𝜺',
|
||||
\ '\bivarepsilon': '𝜺',
|
||||
\ '\bizeta': '𝜻',
|
||||
\ '\bieta': '𝜼',
|
||||
\ '\bitheta': '𝜽',
|
||||
@@ -2440,15 +2463,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 +2504,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bsansbeta': '𝝱',
|
||||
\ '\bsansgamma': '𝝲',
|
||||
\ '\bsansdelta': '𝝳',
|
||||
\ '\bsansepsilon': '𝝴',
|
||||
\ '\bsansvarepsilon': '𝝴',
|
||||
\ '\bsanszeta': '𝝵',
|
||||
\ '\bsanseta': '𝝶',
|
||||
\ '\bsanstheta': '𝝷',
|
||||
@@ -2498,15 +2521,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 +2562,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisansbeta': '𝞫',
|
||||
\ '\bisansgamma': '𝞬',
|
||||
\ '\bisansdelta': '𝞭',
|
||||
\ '\bisansepsilon': '𝞮',
|
||||
\ '\bisansvarepsilon': '𝞮',
|
||||
\ '\bisanszeta': '𝞯',
|
||||
\ '\bisanseta': '𝞰',
|
||||
\ '\bisanstheta': '𝞱',
|
||||
@@ -2556,15 +2579,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 +2707,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:sun_with_face:': '🌞',
|
||||
\ '\:star2:': '🌟',
|
||||
\ '\:stars:': '🌠',
|
||||
\ '\:hotdog:': '🌭',
|
||||
\ '\:taco:': '🌮',
|
||||
\ '\:burrito:': '🌯',
|
||||
\ '\:chestnut:': '🌰',
|
||||
\ '\:seedling:': '🌱',
|
||||
\ '\:evergreen_tree:': '🌲',
|
||||
@@ -2750,7 +2776,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:cake:': '🍰',
|
||||
\ '\:bento:': '🍱',
|
||||
\ '\:stew:': '🍲',
|
||||
\ '\:egg:': '🍳',
|
||||
\ '\:fried_egg:': '🍳',
|
||||
\ '\:fork_and_knife:': '🍴',
|
||||
\ '\:tea:': '🍵',
|
||||
\ '\:sake:': '🍶',
|
||||
@@ -2760,6 +2786,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:beer:': '🍺',
|
||||
\ '\:beers:': '🍻',
|
||||
\ '\:baby_bottle:': '🍼',
|
||||
\ '\:champagne:': '🍾',
|
||||
\ '\:popcorn:': '🍿',
|
||||
\ '\:ribbon:': '🎀',
|
||||
\ '\:gift:': '🎁',
|
||||
\ '\:birthday:': '🎂',
|
||||
@@ -2817,11 +2845,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 +2873,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 +2912,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:bug:': '🐛',
|
||||
\ '\:ant:': '🐜',
|
||||
\ '\:bee:': '🐝',
|
||||
\ '\:beetle:': '🐞',
|
||||
\ '\:ladybug:': '🐞',
|
||||
\ '\:fish:': '🐟',
|
||||
\ '\:tropical_fish:': '🐠',
|
||||
\ '\:blowfish:': '🐡',
|
||||
@@ -2950,6 +2988,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 +3107,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:pager:': '📟',
|
||||
\ '\:fax:': '📠',
|
||||
\ '\:satellite:': '📡',
|
||||
\ '\:satellite_antenna:': '📡',
|
||||
\ '\:loudspeaker:': '📢',
|
||||
\ '\:mega:': '📣',
|
||||
\ '\:outbox_tray:': '📤',
|
||||
@@ -3090,10 +3130,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 +3198,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 +3226,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 +3300,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 +3384,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
|
||||
|
||||
841
autoload/ledger.vim
Normal file
841
autoload/ledger.vim
Normal file
@@ -0,0 +1,841 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'ledger', 'autoload/ledger.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists ('b:is_hledger')
|
||||
let b:is_hledger = g:ledger_is_hledger
|
||||
endif
|
||||
|
||||
" vim:ts=2:sw=2:sts=2:foldmethod=marker
|
||||
function! ledger#transaction_state_toggle(lnum, ...) abort
|
||||
if a:0 == 1
|
||||
let chars = a:1
|
||||
else
|
||||
let chars = ' *'
|
||||
endif
|
||||
let trans = s:transaction.from_lnum(a:lnum)
|
||||
if empty(trans) || has_key(trans, 'expr')
|
||||
return
|
||||
endif
|
||||
|
||||
let old = has_key(trans, 'state') ? trans['state'] : ' '
|
||||
let i = stridx(chars, old) + 1
|
||||
let new = chars[i >= len(chars) ? 0 : i]
|
||||
|
||||
call trans.set_state(new)
|
||||
|
||||
call setline(trans['head'], trans.format_head())
|
||||
endf
|
||||
|
||||
function! ledger#transaction_state_set(lnum, char) abort
|
||||
" 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')
|
||||
return
|
||||
endif
|
||||
|
||||
call trans.set_state(a:char)
|
||||
|
||||
call setline(trans['head'], trans.format_head())
|
||||
endf
|
||||
|
||||
function! ledger#transaction_date_set(lnum, type, ...) abort
|
||||
let time = a:0 == 1 ? a:1 : localtime()
|
||||
let trans = s:transaction.from_lnum(a:lnum)
|
||||
if empty(trans) || has_key(trans, 'expr')
|
||||
return
|
||||
endif
|
||||
|
||||
let formatted = strftime(g:ledger_date_format, time)
|
||||
if has_key(trans, 'date') && ! empty(trans['date'])
|
||||
let date = split(trans['date'], '=')
|
||||
else
|
||||
let date = [formatted]
|
||||
endif
|
||||
|
||||
if a:type =~? 'effective\|actual'
|
||||
echoerr 'actual/effective arguments were replaced by primary/auxiliary'
|
||||
return
|
||||
endif
|
||||
|
||||
if a:type ==? 'primary'
|
||||
let date[0] = formatted
|
||||
elseif a:type ==? 'auxiliary'
|
||||
if time < 0
|
||||
" remove auxiliary date
|
||||
let date = [date[0]]
|
||||
else
|
||||
" set auxiliary date
|
||||
if len(date) >= 2
|
||||
let date[1] = formatted
|
||||
else
|
||||
call add(date, formatted)
|
||||
endif
|
||||
endif
|
||||
elseif a:type ==? 'unshift'
|
||||
let date = [formatted, date[0]]
|
||||
endif
|
||||
|
||||
let trans['date'] = join(date[0:1], '=')
|
||||
|
||||
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
|
||||
return s:transaction.from_lnum(a:lnum)
|
||||
endf
|
||||
|
||||
function! ledger#transactions(...) abort
|
||||
if a:0 == 2
|
||||
let lnum = a:1
|
||||
let end = a:2
|
||||
elseif a:0 == 0
|
||||
let lnum = 1
|
||||
let end = line('$')
|
||||
else
|
||||
throw 'wrong number of arguments for get_transactions()'
|
||||
return []
|
||||
endif
|
||||
|
||||
" safe view / position
|
||||
let view = winsaveview()
|
||||
let fe = &foldenable
|
||||
set nofoldenable
|
||||
|
||||
let transactions = []
|
||||
call cursor(lnum, 0)
|
||||
while lnum && lnum < end
|
||||
let trans = s:transaction.from_lnum(lnum)
|
||||
if ! empty(trans)
|
||||
call add(transactions, trans)
|
||||
call cursor(trans['tail'], 0)
|
||||
endif
|
||||
let lnum = search('^[~=[:digit:]]', 'cW')
|
||||
endw
|
||||
|
||||
" restore view / position
|
||||
let &foldenable = fe
|
||||
call winrestview(view)
|
||||
|
||||
return transactions
|
||||
endf
|
||||
|
||||
" == transaction object implementation ==
|
||||
|
||||
let s:transaction = {} "{{{1
|
||||
function! s:transaction.new() abort dict
|
||||
return copy(s:transaction)
|
||||
endf
|
||||
|
||||
function! s:transaction.from_lnum(lnum) abort dict "{{{2
|
||||
let [head, tail] = s:get_transaction_extents(a:lnum)
|
||||
if ! head
|
||||
return {}
|
||||
endif
|
||||
|
||||
let trans = copy(s:transaction)
|
||||
let trans['head'] = head
|
||||
let trans['tail'] = tail
|
||||
|
||||
" split off eventual comments at the end of line
|
||||
let line = split(getline(head), '\ze\s*\%(\t\| \);', 1)
|
||||
if len(line) > 1
|
||||
let trans['appendix'] = join(line[1:], '')
|
||||
endif
|
||||
|
||||
" parse rest of line
|
||||
" FIXME (minor): will not preserve spacing (see 'join(parts)')
|
||||
let parts = split(line[0], '\s\+')
|
||||
if parts[0] ==# '~'
|
||||
let trans['expr'] = join(parts[1:])
|
||||
return trans
|
||||
elseif parts[0] ==# '='
|
||||
let trans['auto'] = join(parts[1:])
|
||||
return trans
|
||||
elseif parts[0] !~# '^\d'
|
||||
" this case is avoided in s:get_transaction_extents(),
|
||||
" but we'll check anyway.
|
||||
return {}
|
||||
endif
|
||||
|
||||
for part in parts
|
||||
if ! has_key(trans, 'date') && part =~# '^\d'
|
||||
let trans['date'] = part
|
||||
elseif ! has_key(trans, 'code') && part =~# '^([^)]*)$'
|
||||
let trans['code'] = part[1:-2]
|
||||
elseif ! has_key(trans, 'state') && part =~# '^[[:punct:]]$'
|
||||
" the first character by itself is assumed to be the state of the transaction.
|
||||
let trans['state'] = part
|
||||
else
|
||||
" everything after date/code or state belongs to the description
|
||||
break
|
||||
endif
|
||||
call remove(parts, 0)
|
||||
endfor
|
||||
|
||||
let trans['description'] = join(parts)
|
||||
return trans
|
||||
endf "}}}
|
||||
|
||||
function! s:transaction.set_state(char) abort dict "{{{2
|
||||
if a:char =~# '^\s*$'
|
||||
if has_key(self, 'state')
|
||||
call remove(self, 'state')
|
||||
endif
|
||||
else
|
||||
let self['state'] = a:char
|
||||
endif
|
||||
endf "}}}
|
||||
|
||||
function! s:transaction.parse_body(...) abort dict "{{{2
|
||||
if a:0 == 2
|
||||
let head = a:1
|
||||
let tail = a:2
|
||||
elseif a:0 == 0
|
||||
let head = self['head']
|
||||
let tail = self['tail']
|
||||
else
|
||||
throw 'wrong number of arguments for parse_body()'
|
||||
return []
|
||||
endif
|
||||
|
||||
if ! head || tail <= head
|
||||
return []
|
||||
endif
|
||||
|
||||
let lnum = head
|
||||
let tags = {}
|
||||
let postings = []
|
||||
while lnum <= tail
|
||||
let line = split(getline(lnum), '\s*\%(\t\| \);', 1)
|
||||
|
||||
if line[0] =~# '^\s\+[^[:blank:];]'
|
||||
" posting
|
||||
let [state, rest] = matchlist(line[0], '^\s\+\([*!]\?\)\s*\(.*\)$')[1:2]
|
||||
if rest =~# '\t\| '
|
||||
let [account, amount] = matchlist(rest, '^\(.\{-}\)\%(\t\| \)\s*\(.\{-}\)\s*$')[1:2]
|
||||
else
|
||||
let amount = ''
|
||||
let account = matchstr(rest, '^\s*\zs.\{-}\ze\s*$')
|
||||
endif
|
||||
call add(postings, {'account': account, 'amount': amount, 'state': state})
|
||||
end
|
||||
|
||||
" where are tags to be stored?
|
||||
if empty(postings)
|
||||
" they belong to the transaction
|
||||
let tag_container = tags
|
||||
else
|
||||
" they belong to last posting
|
||||
if ! has_key(postings[-1], 'tags')
|
||||
let postings[-1]['tags'] = {}
|
||||
endif
|
||||
let tag_container = postings[-1]['tags']
|
||||
endif
|
||||
|
||||
let comment = join(line[1:], ' ;')
|
||||
if comment =~# '^\s*:'
|
||||
" tags without values
|
||||
for t in s:findall(comment, ':\zs[^:[:blank:]]\([^:]*[^:[:blank:]]\)\?\ze:')
|
||||
let tag_container[t] = ''
|
||||
endfor
|
||||
elseif comment =~# '^\s*[^:[:blank:]][^:]\+:'
|
||||
" tag with value
|
||||
let key = matchstr(comment, '^\s*\zs[^:]\+\ze:')
|
||||
if ! empty(key)
|
||||
let val = matchstr(comment, ':\s*\zs.*\ze\s*$')
|
||||
let tag_container[key] = val
|
||||
endif
|
||||
endif
|
||||
let lnum += 1
|
||||
endw
|
||||
return [tags, postings]
|
||||
endf "}}}
|
||||
|
||||
function! s:transaction.format_head() abort dict "{{{2
|
||||
if has_key(self, 'expr')
|
||||
return '~ '.self['expr']
|
||||
elseif has_key(self, 'auto')
|
||||
return '= '.self['auto']
|
||||
endif
|
||||
|
||||
let parts = []
|
||||
if has_key(self, 'date') | call add(parts, self['date']) | endif
|
||||
if has_key(self, 'state') | call add(parts, self['state']) | endif
|
||||
if has_key(self, 'code') | call add(parts, '('.self['code'].')') | endif
|
||||
if has_key(self, 'description') | call add(parts, self['description']) | endif
|
||||
|
||||
let line = join(parts)
|
||||
if has_key(self, 'appendix') | let line .= self['appendix'] | endif
|
||||
|
||||
return line
|
||||
endf "}}}
|
||||
"}}}
|
||||
|
||||
" == helper functions ==
|
||||
|
||||
" get a list of declared accounts in the buffer
|
||||
function! ledger#declared_accounts(...) abort
|
||||
if a:0 == 2
|
||||
let lnum = a:1
|
||||
let lend = a:2
|
||||
elseif a:0 == 0
|
||||
let lnum = 1
|
||||
let lend = line('$')
|
||||
else
|
||||
throw 'wrong number of arguments for ledger#declared_accounts()'
|
||||
return []
|
||||
endif
|
||||
|
||||
" save view / position
|
||||
let view = winsaveview()
|
||||
let fe = &foldenable
|
||||
set nofoldenable
|
||||
|
||||
let accounts = []
|
||||
call cursor(lnum, 0)
|
||||
while 1
|
||||
let lnum = search('^account\s', 'cW', lend)
|
||||
if !lnum || lnum > lend
|
||||
break
|
||||
endif
|
||||
|
||||
" remove comments at the end and "account" at the front
|
||||
let line = split(getline(lnum), '\s\+;')[0]
|
||||
let line = matchlist(line, 'account\s\+\(.\+\)')[1]
|
||||
|
||||
if len(line) > 1
|
||||
call add(accounts, line)
|
||||
endif
|
||||
|
||||
call cursor(lnum+1,0)
|
||||
endw
|
||||
|
||||
" restore view / position
|
||||
let &foldenable = fe
|
||||
call winrestview(view)
|
||||
|
||||
return accounts
|
||||
endf
|
||||
|
||||
function! s:get_transaction_extents(lnum) abort
|
||||
if ! (indent(a:lnum) || getline(a:lnum) =~# '^[~=[:digit:]]')
|
||||
" only do something if lnum is in a transaction
|
||||
return [0, 0]
|
||||
endif
|
||||
|
||||
" safe view / position
|
||||
let view = winsaveview()
|
||||
let fe = &foldenable
|
||||
set nofoldenable
|
||||
|
||||
call cursor(a:lnum, 0)
|
||||
let head = search('^[~=[:digit:]]', 'bcnW')
|
||||
let tail = search('^[^;[:blank:]]\S\+', 'nW')
|
||||
let tail = tail > head ? tail - 1 : line('$')
|
||||
|
||||
" restore view / position
|
||||
let &foldenable = fe
|
||||
call winrestview(view)
|
||||
|
||||
return head ? [head, tail] : [0, 0]
|
||||
endf
|
||||
|
||||
function! ledger#find_in_tree(tree, levels) abort
|
||||
if empty(a:levels)
|
||||
return []
|
||||
endif
|
||||
let results = []
|
||||
let currentlvl = a:levels[0]
|
||||
let nextlvls = a:levels[1:]
|
||||
let branches = ledger#filter_items(keys(a:tree), currentlvl)
|
||||
for branch in branches
|
||||
let exact = empty(nextlvls)
|
||||
call add(results, [branch, exact])
|
||||
if ! empty(nextlvls)
|
||||
for [result, exact] in ledger#find_in_tree(a:tree[branch], nextlvls)
|
||||
call add(results, [branch.':'.result, exact])
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
return results
|
||||
endf
|
||||
|
||||
function! ledger#filter_items(list, keyword) abort
|
||||
" return only those items that start with a specified keyword
|
||||
return filter(copy(a:list), 'v:val =~ ''^\V'.substitute(a:keyword, '\\', '\\\\', 'g').'''')
|
||||
endf
|
||||
|
||||
function! s:findall(text, rx) abort
|
||||
" returns all the matches in a string,
|
||||
" there will be overlapping matches according to :help match()
|
||||
let matches = []
|
||||
|
||||
while 1
|
||||
let m = matchstr(a:text, a:rx, 0, len(matches)+1)
|
||||
if empty(m)
|
||||
break
|
||||
endif
|
||||
|
||||
call add(matches, m)
|
||||
endw
|
||||
|
||||
return matches
|
||||
endf
|
||||
|
||||
" Move the cursor to the specified column, filling the line with spaces if necessary.
|
||||
" Ensure that at least min_spaces are added, and go to the end of the line if
|
||||
" the line is already too long
|
||||
function! s:goto_col(pos, min_spaces) abort
|
||||
exec 'normal!' '$'
|
||||
let diff = max([a:min_spaces, a:pos - virtcol('.')])
|
||||
if diff > 0 | exec 'normal!' diff . 'a ' | endif
|
||||
endf
|
||||
|
||||
" Return character position of decimal separator (multibyte safe)
|
||||
function! s:decimalpos(expr) abort
|
||||
" 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
|
||||
|
||||
" Align the amount expression after an account name at the decimal point.
|
||||
"
|
||||
" This function moves the amount expression of a posting so that the decimal
|
||||
" separator is aligned at the column specified by g:ledger_align_at.
|
||||
"
|
||||
" For example, after selecting:
|
||||
"
|
||||
" 2015/05/09 Some Payee
|
||||
" Expenses:Other $120,23 ; Tags here
|
||||
" Expenses:Something $-4,99
|
||||
" Expenses:More ($12,34 + $16,32)
|
||||
"
|
||||
" :'<,'>call ledger#align_commodity() produces:
|
||||
"
|
||||
" 2015/05/09 Some Payee
|
||||
" Expenses:Other $120,23 ; Tags here
|
||||
" Expenses:Something $-4,99
|
||||
" Expenses:More ($12,34 + $16,32)
|
||||
"
|
||||
function! ledger#align_commodity() abort
|
||||
" Extract the part of the line after the account name (excluding spaces):
|
||||
let l:line = getline('.')
|
||||
let rhs = matchstr(l:line, '\m^\s\+[^;[:space:]].\{-}\(\t\| \)\s*\zs.*$')
|
||||
if rhs !=# ''
|
||||
" Remove everything after the account name (including spaces):
|
||||
call setline('.', substitute(l:line, '\m^\s\+[^[:space:]].\{-}\zs\(\t\| \).*$', '', ''))
|
||||
let pos = -1
|
||||
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
|
||||
if pos < 0
|
||||
" Find the position after the first digits
|
||||
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
|
||||
call s:goto_col(g:ledger_align_at - pos - 1, 2)
|
||||
else
|
||||
call s:goto_col(g:ledger_align_at - strdisplaywidth(rhs) - 2, 2)
|
||||
endif " Append the part of the line that was previously removed:
|
||||
exe 'normal! a' . rhs
|
||||
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:
|
||||
normal! viWd
|
||||
" Find the position of the decimal separator
|
||||
let pos = s:decimalpos(@") " Returns zero when the separator is the empty string
|
||||
if pos <= 0
|
||||
let pos = len(@")
|
||||
endif
|
||||
" Paste text at the correct column and append/prepend default commodity:
|
||||
if g:ledger_commodity_before
|
||||
call s:goto_col(g:ledger_align_at - pos - len(g:ledger_default_commodity) - len(g:ledger_commodity_sep) - 1, 2)
|
||||
exe 'normal! a' . g:ledger_default_commodity . g:ledger_commodity_sep
|
||||
normal! p
|
||||
else
|
||||
call s:goto_col(g:ledger_align_at - pos - 1, 2)
|
||||
exe 'normal! pa' . g:ledger_commodity_sep . g:ledger_default_commodity
|
||||
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
|
||||
" Position of report windows
|
||||
let s:winpos_map = {
|
||||
\ 'T': 'to new', 't': 'abo new', 'B': 'bo new', 'b': 'bel new',
|
||||
\ 'L': 'to vnew', 'l': 'abo vnew', 'R': 'bo vnew', 'r': 'bel vnew'
|
||||
\ }
|
||||
|
||||
function! s:error_message(msg) abort
|
||||
redraw " See h:echo-redraw
|
||||
echohl ErrorMsg
|
||||
echo "\r"
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endf
|
||||
|
||||
function! s:warning_message(msg) abort
|
||||
redraw " See h:echo-redraw
|
||||
echohl WarningMsg
|
||||
echo "\r"
|
||||
echomsg a:msg
|
||||
echohl NONE
|
||||
endf
|
||||
|
||||
" Open the quickfix/location window when it is not empty,
|
||||
" closes it if it is empty.
|
||||
"
|
||||
" Optional parameters:
|
||||
" a:1 Quickfix window title.
|
||||
" a:2 Message to show when the window is empty.
|
||||
"
|
||||
" Returns 0 if the quickfix window is empty, 1 otherwise.
|
||||
function! s:quickfix_toggle(...) abort
|
||||
if g:ledger_use_location_list
|
||||
let l:list = 'l'
|
||||
let l:open = (len(getloclist(winnr())) > 0)
|
||||
else
|
||||
let l:list = 'c'
|
||||
let l:open = (len(getqflist()) > 0)
|
||||
endif
|
||||
|
||||
if l:open
|
||||
execute (g:ledger_qf_vertical ? 'vert' : 'botright') l:list.'open' g:ledger_qf_size
|
||||
" Set local mappings to quit the quickfix window or lose focus.
|
||||
nnoremap <silent> <buffer> <tab> <c-w><c-w>
|
||||
execute 'nnoremap <silent> <buffer> q :' l:list.'close<CR>'
|
||||
" Note that the following settings do not persist (e.g., when you close and re-open the quickfix window).
|
||||
" See: https://superuser.com/questions/356912/how-do-i-change-the-quickix-title-status-bar-in-vim
|
||||
if g:ledger_qf_hide_file
|
||||
setl conceallevel=2
|
||||
setl concealcursor=nc
|
||||
syntax match qfFile /^[^|]*/ transparent conceal
|
||||
endif
|
||||
if a:0 > 0
|
||||
let w:quickfix_title = a:1
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
|
||||
execute l:list.'close'
|
||||
call s:warning_message((a:0 > 1) ? a:2 : 'No results')
|
||||
return 0
|
||||
endf
|
||||
|
||||
" Populate a quickfix/location window with data. The argument must be a String
|
||||
" or a List.
|
||||
function! s:quickfix_populate(data) abort
|
||||
" Note that cexpr/lexpr always uses the global value of errorformat
|
||||
let l:efm = &errorformat " Save global errorformat
|
||||
set errorformat=%EWhile\ parsing\ file\ \"%f\"\\,\ line\ %l:,%ZError:\ %m,%-C%.%#
|
||||
set errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m
|
||||
" Format to parse command-line errors:
|
||||
set errorformat+=Error:\ %m
|
||||
" Format to parse reports:
|
||||
set errorformat+=%f:%l\ %m
|
||||
set errorformat+=%-G%.%#
|
||||
execute (g:ledger_use_location_list ? 'l' : 'c').'getexpr' 'a:data'
|
||||
let &errorformat = l:efm " Restore global errorformat
|
||||
return
|
||||
endf
|
||||
|
||||
" Build a ledger command to process the given file.
|
||||
function! s:ledger_cmd(file, args) abort
|
||||
let l:options = g:ledger_extra_options
|
||||
if len(g:ledger_date_format) > 0 && !b:is_hledger
|
||||
let l:options = join([l:options, '--date-format', g:ledger_date_format,
|
||||
\ '--input-date-format', g:ledger_date_format])
|
||||
endif
|
||||
return join([g:ledger_bin, l:options, '-f', shellescape(expand(a:file)), a:args])
|
||||
endf
|
||||
" }}}
|
||||
|
||||
function! ledger#autocomplete_and_align() abort
|
||||
if pumvisible()
|
||||
return "\<c-n>"
|
||||
endif
|
||||
" Align an amount only if there is a digit immediately before the cursor and
|
||||
" such digit is preceded by at least one space (the latter condition is
|
||||
" necessary to avoid situations where a date starting at the first column is
|
||||
" confused with a commodity to be aligned).
|
||||
if match(getline('.'), '\s.*\d\%'.col('.').'c') > -1
|
||||
normal! h
|
||||
call ledger#align_amount_at_cursor()
|
||||
return "\<c-o>A"
|
||||
endif
|
||||
return "\<c-x>\<c-o>"
|
||||
endf
|
||||
|
||||
" Use current line as input to ledger entry and replace with output. If there
|
||||
" are errors, they are echoed instead.
|
||||
function! ledger#entry() abort
|
||||
let l:output = systemlist(s:ledger_cmd(g:ledger_main, join(['entry', getline('.')])))
|
||||
" Filter out warnings
|
||||
let l:output = filter(l:output, "v:val !~? '^Warning: '")
|
||||
" Errors may occur
|
||||
if v:shell_error
|
||||
echomsg join(l:output)
|
||||
return
|
||||
endif
|
||||
" Append output so we insert instead of overwrite, then delete line
|
||||
call append('.', l:output)
|
||||
normal! "_dd
|
||||
endfunc
|
||||
|
||||
" Run an arbitrary ledger command and show the output in a new buffer. If
|
||||
" there are errors, no new buffer is opened: the errors are displayed in a
|
||||
" quickfix window instead.
|
||||
"
|
||||
" Parameters:
|
||||
" file The file to be processed.
|
||||
" args A string of Ledger command-line arguments.
|
||||
"
|
||||
" Returns:
|
||||
" Ledger's output as a String.
|
||||
function! ledger#report(file, args) abort
|
||||
let l:output = systemlist(s:ledger_cmd(a:file, a:args))
|
||||
if v:shell_error " If there are errors, show them in a quickfix/location list.
|
||||
call s:quickfix_populate(l:output)
|
||||
call s:quickfix_toggle('Errors', 'Unable to parse errors')
|
||||
endif
|
||||
return l:output
|
||||
endf
|
||||
|
||||
" Open the output of a Ledger's command in a new buffer.
|
||||
"
|
||||
" Parameters:
|
||||
" report A String containing the output of a Ledger's command.
|
||||
"
|
||||
" Returns:
|
||||
" 1 if a new buffer is created; 0 otherwise.
|
||||
function! ledger#output(report) abort
|
||||
if empty(a:report)
|
||||
call s:warning_message('No results')
|
||||
return 0
|
||||
endif
|
||||
" Open a new buffer to show Ledger's output.
|
||||
execute get(s:winpos_map, g:ledger_winpos, 'bo new')
|
||||
setlocal buftype=nofile bufhidden=wipe modifiable nobuflisted noswapfile nowrap
|
||||
call append(0, a:report)
|
||||
setlocal nomodifiable
|
||||
" Set local mappings to quit window or lose focus.
|
||||
nnoremap <silent> <buffer> <tab> <c-w><c-p>
|
||||
nnoremap <silent> <buffer> q <c-w><c-p>@=winnr('#')<cr><c-w>c
|
||||
" Add some coloring to the report
|
||||
syntax match LedgerNumber /-\@1<!\d\+\([,.]\d\+\)*/
|
||||
syntax match LedgerNegativeNumber /-\d\+\([,.]\d\+\)*/
|
||||
syntax match LedgerImproperPerc /\d\d\d\+%/
|
||||
return 1
|
||||
endf
|
||||
|
||||
" Show an arbitrary register report in a quickfix list.
|
||||
"
|
||||
" Parameters:
|
||||
" file The file to be processed
|
||||
" args A string of Ledger command-line arguments.
|
||||
function! ledger#register(file, args) abort
|
||||
let l:cmd = s:ledger_cmd(a:file, join([
|
||||
\ 'register',
|
||||
\ "--format='" . g:ledger_qf_register_format . "'",
|
||||
\ "--prepend-format='%(filename):%(beg_line) '",
|
||||
\ a:args
|
||||
\ ]))
|
||||
call s:quickfix_populate(systemlist(l:cmd))
|
||||
call s:quickfix_toggle('Register report')
|
||||
endf
|
||||
|
||||
" Reconcile the given account.
|
||||
"
|
||||
" Parameters:
|
||||
" file The file to be processed
|
||||
" account An account name (String)
|
||||
" target_amount The target amount (Float)
|
||||
function! ledger#reconcile(file, account, target_amount) abort
|
||||
let l:cmd = s:ledger_cmd(a:file, join([
|
||||
\ 'register',
|
||||
\ '--uncleared',
|
||||
\ "--format='" . g:ledger_qf_reconcile_format . "'",
|
||||
\ "--prepend-format='%(filename):%(beg_line) %(pending ? \"P\" : \"U\") '",
|
||||
\ shellescape(a:account)
|
||||
\ ]))
|
||||
let l:file = expand(a:file) " Needed for #show_balance() later
|
||||
call s:quickfix_populate(systemlist(l:cmd))
|
||||
if s:quickfix_toggle('Reconcile ' . a:account, 'Nothing to reconcile')
|
||||
let g:ledger_target_amount = a:target_amount
|
||||
" Show updated account balance upon saving, as long as the quickfix window is open
|
||||
augroup reconcile
|
||||
autocmd!
|
||||
execute "autocmd BufWritePost *.ldg,*.ledger call ledger#show_balance('" . l:file . "','" . a:account . "')"
|
||||
autocmd BufWipeout <buffer> call <sid>finish_reconciling()
|
||||
augroup END
|
||||
" Add refresh shortcut
|
||||
execute "nnoremap <silent> <buffer> <c-l> :<c-u>call ledger#reconcile('"
|
||||
\ . l:file . "','" . a:account . "'," . string(a:target_amount) . ')<cr>'
|
||||
call ledger#show_balance(l:file, a:account)
|
||||
endif
|
||||
endf
|
||||
|
||||
function! s:finish_reconciling() abort
|
||||
unlet g:ledger_target_amount
|
||||
augroup reconcile
|
||||
autocmd!
|
||||
augroup END
|
||||
augroup! reconcile
|
||||
endf
|
||||
|
||||
" Show the pending/cleared balance of an account.
|
||||
" This function has an optional parameter:
|
||||
"
|
||||
" a:1 An account name
|
||||
"
|
||||
" If no account if given, the account in the current line is used.
|
||||
function! ledger#show_balance(file, ...) abort
|
||||
let l:account = a:0 > 0 && !empty(a:1) ? a:1 : matchstr(getline('.'), '\m\( \|\t\)\zs\S.\{-}\ze\( \|\t\|$\)')
|
||||
if empty(l:account)
|
||||
call s:error_message('No account found')
|
||||
return
|
||||
endif
|
||||
let l:cmd = s:ledger_cmd(a:file, join([
|
||||
\ 'cleared',
|
||||
\ shellescape(l:account),
|
||||
\ '--empty',
|
||||
\ '--collapse',
|
||||
\ "--format='%(scrub(get_at(display_total, 0)))|%(scrub(get_at(display_total, 1)))|%(quantity(scrub(get_at(display_total, 1))))'",
|
||||
\ (empty(g:ledger_default_commodity) ? '' : '-X ' . shellescape(g:ledger_default_commodity))
|
||||
\ ]))
|
||||
let l:output = systemlist(l:cmd)
|
||||
" Errors may occur, for example, when the account has multiple commodities
|
||||
" and g:ledger_default_commodity is empty.
|
||||
if v:shell_error
|
||||
call s:quickfix_populate(l:output)
|
||||
call s:quickfix_toggle('Errors', 'Unable to parse errors')
|
||||
return
|
||||
endif
|
||||
let l:amounts = split(l:output[-1], '|')
|
||||
redraw " Necessary in some cases to overwrite previous messages. See :h echo-redraw
|
||||
if len(l:amounts) < 3
|
||||
call s:error_message('Could not determine balance. Did you use a valid account?')
|
||||
return
|
||||
endif
|
||||
echo g:ledger_pending_string
|
||||
echohl LedgerPending
|
||||
echon l:amounts[0]
|
||||
echohl NONE
|
||||
echon ' ' g:ledger_cleared_string
|
||||
echohl LedgerCleared
|
||||
echon l:amounts[1]
|
||||
echohl NONE
|
||||
if exists('g:ledger_target_amount')
|
||||
echon ' ' g:ledger_target_string
|
||||
echohl LedgerTarget
|
||||
echon printf('%.2f', (g:ledger_target_amount - str2float(l:amounts[2])))
|
||||
echohl NONE
|
||||
endif
|
||||
endf
|
||||
" }}}
|
||||
18
autoload/neomake/makers/ft/pony.vim
Normal file
18
autoload/neomake/makers/ft/pony.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'pony', 'autoload/neomake/makers/ft/pony.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! neomake#makers#ft#pony#EnabledMakers()
|
||||
return ['ponyc']
|
||||
endfunction
|
||||
|
||||
function! neomake#makers#ft#pony#ponyc()
|
||||
" This is currently a hack. Ponyc itself uses the project directory as
|
||||
" the target to build. Using %:p:h like this fetches the parent
|
||||
" directory of the current file which might cause supurious errors on
|
||||
" package imports if the current file is nested under a sub-directory.
|
||||
return {
|
||||
\ 'args': ['--pass=expr', '%:p:h'],
|
||||
\ 'errorformat': '%f:%l:%c: %m'
|
||||
\ }
|
||||
endfunction
|
||||
244
autoload/nim.vim
Normal file
244
autoload/nim.vim
Normal file
@@ -0,0 +1,244 @@
|
||||
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')
|
||||
let g:nim_caas_enabled = 0
|
||||
endif
|
||||
|
||||
if !executable('nim')
|
||||
echoerr "the Nim compiler must be in your system's PATH"
|
||||
endif
|
||||
|
||||
if has('pythonx')
|
||||
exe 'pyxfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
|
||||
endif
|
||||
|
||||
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'
|
||||
let false = 0 " Needed for eval of json
|
||||
let true = 1 " Needed for eval of json
|
||||
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
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
let b:nim_caas_enabled = 0
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! s:UpdateNimLog() abort
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=hide
|
||||
setlocal noswapfile
|
||||
|
||||
for entry in g:nim_log
|
||||
call append(line('$'), split(entry, "\n"))
|
||||
endfor
|
||||
|
||||
let g:nim_log = []
|
||||
|
||||
match Search /^nim\ .*/
|
||||
endf
|
||||
|
||||
augroup NimVim
|
||||
au!
|
||||
au BufEnter log://nim call s:UpdateNimLog()
|
||||
if has('pythonx')
|
||||
" au QuitPre * :pyx nimTerminateAll()
|
||||
au VimLeavePre * :pyx nimTerminateAll()
|
||||
endif
|
||||
augroup END
|
||||
|
||||
command! NimLog :e log://nim
|
||||
|
||||
command! NimTerminateService
|
||||
\ :exe printf("pyx nimTerminateService('%s')", b:nim_project_root)
|
||||
|
||||
command! NimRestartService
|
||||
\ :exe printf("pyx nimRestartService('%s')", b:nim_project_root)
|
||||
|
||||
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')
|
||||
|
||||
if l != 0
|
||||
let f = matchstr(getline(l), PATTERN)
|
||||
let l:to_check = expand('%:h') . '/' . f
|
||||
else
|
||||
let l:to_check = expand('%')
|
||||
endif
|
||||
|
||||
call setpos('.', save_cur)
|
||||
return l:to_check
|
||||
endf
|
||||
|
||||
let g:nim_symbol_types = {
|
||||
\ 'skParam': 'v',
|
||||
\ 'skVar': 'v',
|
||||
\ 'skLet': 'v',
|
||||
\ 'skTemp': 'v',
|
||||
\ 'skForVar': 'v',
|
||||
\ 'skConst': 'v',
|
||||
\ 'skResult': 'v',
|
||||
\ 'skGenericParam': 't',
|
||||
\ 'skType': 't',
|
||||
\ 'skField': 'm',
|
||||
\ 'skProc': 'f',
|
||||
\ 'skMethod': 'f',
|
||||
\ 'skIterator': 'f',
|
||||
\ 'skConverter': 'f',
|
||||
\ 'skMacro': 'f',
|
||||
\ 'skTemplate': 'f',
|
||||
\ 'skEnumField': 'v',
|
||||
\ }
|
||||
|
||||
fun! NimExec(op) abort
|
||||
let isDirty = getbufvar(bufnr('%'), '&modified')
|
||||
if isDirty
|
||||
let tmp = tempname() . bufname('%') . '_dirty.nim'
|
||||
silent! exe ':w ' . tmp
|
||||
|
||||
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"',
|
||||
\ a:op, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())
|
||||
endif
|
||||
|
||||
if b:nim_caas_enabled
|
||||
exe printf("pyx nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd)
|
||||
let output = get(l:, 'py_res', '')
|
||||
else
|
||||
let output = system('nim ' . cmd)
|
||||
endif
|
||||
|
||||
call add(g:nim_log, 'nim ' . cmd . "\n" . output)
|
||||
return output
|
||||
endf
|
||||
|
||||
fun! NimExecAsync(op, Handler) abort
|
||||
let result = NimExec(a:op)
|
||||
call a:Handler(result)
|
||||
endf
|
||||
|
||||
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'
|
||||
return -1
|
||||
endif
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
while start > 0 && line[start - 1] =~? '\w'
|
||||
let start -= 1
|
||||
endwhile
|
||||
return start
|
||||
else
|
||||
let result = []
|
||||
let sugOut = NimExec('--suggest')
|
||||
for line in split(sugOut, '\n')
|
||||
let lineData = split(line, '\t')
|
||||
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], '')
|
||||
let c = { 'word': word, 'kind': kind, 'menu': lineData[3], 'dup': 1 }
|
||||
call add(result, c)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return result
|
||||
endif
|
||||
endf
|
||||
|
||||
if !exists('g:neocomplcache_omni_patterns')
|
||||
let g:neocomplcache_omni_patterns = {}
|
||||
endif
|
||||
let g:neocomplcache_omni_patterns['nim'] = '[^. *\t]\.\w*'
|
||||
|
||||
if !exists('g:neocomplete#sources#omni#input_patterns')
|
||||
let g:neocomplete#sources#omni#input_patterns = {}
|
||||
endif
|
||||
let g:neocomplete#sources#omni#input_patterns['nim'] = '[^. *\t]\.\w*'
|
||||
|
||||
let g:nim_completion_callbacks = {}
|
||||
|
||||
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)
|
||||
let Callback = get(g:nim_completion_callbacks, a:cmd)
|
||||
call Callback(a:output)
|
||||
" remove(g:nim_completion_callbacks, a:cmd)
|
||||
else
|
||||
echom 'ERROR, Unknown Command: ' . a:cmd
|
||||
endif
|
||||
return 1
|
||||
endf
|
||||
|
||||
fun! GotoDefinition_nim_ready(def_output) abort
|
||||
if 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'
|
||||
return 0
|
||||
endif
|
||||
|
||||
let defBits = split(rawDef, '\t')
|
||||
let file = defBits[4]
|
||||
let line = defBits[5]
|
||||
let column = defBits[6]
|
||||
exe printf('e +%d %s', line, file)
|
||||
call cursor(line, column + 1)
|
||||
return 1
|
||||
endf
|
||||
|
||||
fun! GotoDefinition_nim() abort
|
||||
call NimExecAsync('--def', function('GotoDefinition_nim_ready'))
|
||||
endf
|
||||
|
||||
fun! FindReferences_nim() abort
|
||||
"setloclist()
|
||||
endf
|
||||
|
||||
" Syntastic syntax checking
|
||||
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() abort
|
||||
return executable('nim')
|
||||
endfunction
|
||||
|
||||
if exists('g:SyntasticRegistry')
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'nim',
|
||||
\ 'name': 'nim'})
|
||||
endif
|
||||
27
autoload/nix.vim
Normal file
27
autoload/nix.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'nix', 'autoload/nix.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! nix#find_drv_position()
|
||||
let line = search("description")
|
||||
if line == 0
|
||||
let line = search("name")
|
||||
endif
|
||||
if line == 0
|
||||
echo "error: could not find derivation"
|
||||
return
|
||||
endif
|
||||
|
||||
return expand("%") . ":" . line
|
||||
endfunction
|
||||
|
||||
function! nix#edit(attr)
|
||||
let output = system("nix-instantiate --eval ./. -A " . a:attr . ".meta.position")
|
||||
if match(output, "^error:") == -1
|
||||
let position = split(split(output, '"')[0], ":")
|
||||
execute "edit " . position[0]
|
||||
execute position[1]
|
||||
" Update default command to nix-build.
|
||||
let b:dispatch = 'nix-build --no-out-link -A ' . a:attr
|
||||
endif
|
||||
endfunction
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user