mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
129 Commits
v4.15.1
...
009e095c86
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
009e095c86 | ||
|
|
692e359ad9 | ||
|
|
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 | ||
|
|
10e7eff1e4 | ||
|
|
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 |
2
Makefile
2
Makefile
@@ -7,4 +7,4 @@ test:
|
||||
@ scripts/test
|
||||
|
||||
dev:
|
||||
@ find scripts autoload/polyglot ftdetect tests . -type f -depth 1 | DEV=1 entr bash -c 'make && make test'
|
||||
@ find scripts autoload/polyglot ftdetect tests . -type f -maxdepth 1 | DEV=1 entr bash -c 'make'
|
||||
|
||||
108
README.md
108
README.md
@@ -1,6 +1,8 @@
|
||||

|
||||
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
|
||||
|
||||

|
||||
- 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)
|
||||
- Includes some defaults from [vim-sensible](https://github.com/tpope/vim-sensible), which are usually necessary for editing in any language (can be disabled)
|
||||
|
||||
\*To be completely honest, optimized `ftdetect` script takes around `10ms` to load.
|
||||
|
||||
@@ -52,15 +53,16 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [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, cxx and 17 more files)
|
||||
- [c/c++](https://github.com/vim-jp/vim-cpp) (C++ and C syntax highlighting for cpp, c++, cc, cp, cxx and 18 more files)
|
||||
- [caddyfile](https://github.com/isobit/vim-caddyfile)
|
||||
- [carp](https://github.com/hellerve/carp-vim) (Syntax highlighting for carp files)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (Clojure syntax highlighting for clj, boot, cl2, cljc, cljs, cljs.hl, cljscm, cljx, hic and edn files)
|
||||
- [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, litcoffee and coffee.md 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)
|
||||
@@ -72,20 +74,20 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [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 and leex files)
|
||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (Elixir and HTML+EEX syntax highlighting for ex, exs, eex, html.heex, html.leex and leex files)
|
||||
- [elm](https://github.com/andys8/vim-elm-syntax) (Elm syntax highlighting for elm files)
|
||||
- [emberscript](https://github.com/yalesov/vim-ember-script) (EmberScript syntax highlighting for em and emberscript files)
|
||||
- [emblem](https://github.com/yalesov/vim-emblem) (Syntax highlighting for emblem and em files)
|
||||
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (Erlang syntax highlighting for erl, app.src, es, escript, hrl, xrl, yrl, app and yaws files)
|
||||
- [fennel](https://github.com/bakpakin/fennel.vim) (Syntax highlighting for fnl files)
|
||||
- [ferm](https://github.com/vim-scripts/ferm.vim) (Syntax highlighting for ferm files)
|
||||
- [fish](https://github.com/georgewitteman/vim-fish) (fish syntax highlighting for fish 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)
|
||||
- [gdscript](https://github.com/calviken/vim-gdscript3) (GDScript syntax highlighting for gd files)
|
||||
- [git](https://github.com/tpope/vim-git) (Git Config syntax highlighting for gitconfig files)
|
||||
- [gitignore](https://github.com/fszymanski/fzf-gitignore)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (GLSL syntax highlighting for glsl, fp, frag, frg, fs and 16 more files)
|
||||
- [gitignore](https://github.com/SirJson/fzf-gitignore)
|
||||
- [gleam](https://github.com/gleam-lang/gleam.vim) (Syntax highlighting for gleam files)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (GLSL syntax highlighting for glsl, fp, frag, frg, fs and 18 more files)
|
||||
- [gmpl](https://github.com/maelvalais/gmpl.vim) (Syntax highlighting for mod files)
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) (Gnuplot syntax highlighting for gp, gnu, gnuplot, p, plot, plt and gpi files)
|
||||
- [go](https://github.com/fatih/vim-go) (Go syntax highlighting for go and tmpl files)
|
||||
@@ -95,40 +97,44 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [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/yaymukund/vim-haxe) (Haxe syntax highlighting for hx and hxsl files)
|
||||
- [hcl](https://github.com/b4b4r07/vim-hcl) (HCL syntax highlighting for hcl, nomad and workflow 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)
|
||||
- [html5](https://github.com/sheerun/html5.vim)
|
||||
- [i3](https://github.com/mboughaba/i3config.vim) (Syntax highlighting for i3.config and i3config 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 17 more files)
|
||||
- [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, avsc, geojson, gltf, har and 13 more 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 and jst files)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (JSX syntax highlighting for jsx files)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (EJS syntax highlighting for ejs, ect, ejs.t and jst files)
|
||||
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (Syntax highlighting for jsx files)
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (Julia syntax highlighting for jl files)
|
||||
- [just](https://github.com/NoahTheDuke/vim-just) (Syntax highlighting for just files)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim) (Kotlin syntax highlighting for kt, ktm and kts files)
|
||||
- [ledger](https://github.com/ledger/vim-ledger) (Syntax highlighting for ldg, ledger and journal files)
|
||||
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond) (LilyPond syntax highlighting for ly and ily 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, markdown, mdown, mdwn, mkd, mkdn, mkdown, ronn and workbook 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)
|
||||
@@ -137,7 +143,10 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [octave](https://github.com/McSinyx/vim-octave) (Syntax highlighting for oct and m files)
|
||||
- [odin](https://github.com/Tetralux/odin.vim) (Odin syntax highlighting for odin files)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (OpenCL syntax highlighting for cl and opencl files)
|
||||
- [openscad](https://github.com/sirtaj/vim-openscad) (Syntax highlighting for scad files)
|
||||
- [org](https://github.com/axvr/org.vim) (Syntax highlighting for org files)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files)
|
||||
- [pest](https://github.com/pest-parser/pest.vim) (Syntax highlighting for pest files)
|
||||
- [pgsql](https://github.com/lifepillar/pgsql.vim) (PLpgSQL syntax highlighting for pgsql files)
|
||||
- [php](https://github.com/StanAngeloff/php.vim) (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 7 more files)
|
||||
- [plantuml](https://github.com/aklt/plantuml-syntax) (PlantUML syntax highlighting for puml, iuml, plantuml, uml and pu files)
|
||||
@@ -162,29 +171,31 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [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 25 more 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 7 more 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/tomlion/vim-solidity) (Solidity syntax highlighting for sol 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/evanleck/vim-svelte/tree/main) (Svelte syntax highlighting for svelte 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) (TOML syntax highlighting for toml files)
|
||||
- [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 and tsx 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)
|
||||
@@ -193,12 +204,12 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
|
||||
- [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, axml and 93 more files)
|
||||
- [xml](https://github.com/amadeus/vim-xml) (XML syntax highlighting for xml, adml, admx, ant, axaml and 97 more files)
|
||||
- [xsl](https://github.com/vim-scripts/XSLT-syntax) (XSLT syntax highlighting for xslt and xsl files)
|
||||
- [yard](https://github.com/noprompt/vim-yardoc)
|
||||
- [zephir](https://github.com/xwsoul/vim-zephir) (Zephir syntax highlighting for zep files)
|
||||
- [zig](https://github.com/ziglang/zig.vim) (Zig syntax highlighting for zir, zig and zir files)
|
||||
- [zinit](https://github.com/zinit-zsh/zplugin-vim-syntax)
|
||||
- [zinit](https://github.com/zdharma-continuum/zinit-vim-syntax/tree/main)
|
||||
<!--/Language Packs-->
|
||||
|
||||
## Updating
|
||||
@@ -235,15 +246,52 @@ Vim Polyglot tries to automatically detect indentation settings (just like vim-s
|
||||
let g:polyglot_disabled = ['autoindent']
|
||||
```
|
||||
|
||||
## Reindent
|
||||
|
||||
If you want to disable reindenting of the current line in insert mode (see vim 'indentkeys') you can turn it off with:
|
||||
|
||||
```vim
|
||||
autocmd BufEnter * set indentexpr=
|
||||
```
|
||||
|
||||
This will not affect smart autoindenting when starting a new line.
|
||||
|
||||
|
||||
## Default settings
|
||||
|
||||
Vim Polyglot includes vim-sensible plugin, which is usually necessary for editing any language. This can be disabled with:
|
||||
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.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tex') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/compiler/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim compiler file
|
||||
" Compiler: TeX
|
||||
@@ -20,7 +22,7 @@ endif
|
||||
if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') ||
|
||||
\(!filereadable('Makefile') && !filereadable('makefile'))
|
||||
" If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
|
||||
" otherwize the same for global variable with same name, else it will be
|
||||
" otherwise the same for global variable with same name, else it will be
|
||||
" LaTeX
|
||||
if exists("b:tex_flavor")
|
||||
let current_compiler = b:tex_flavor
|
||||
@@ -67,5 +69,3 @@ CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
@@ -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,13 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" Maintainer: othree <othree@gmail.com>
|
||||
" URL: http://github.com/othree/html5.vim
|
||||
" Last Change: 2014-05-02
|
||||
" License: MIT
|
||||
" Changes: Add - to keyword
|
||||
|
||||
" setlocal iskeyword+=-
|
||||
|
||||
setlocal commentstring=<!--%s-->
|
||||
|
||||
endif
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris', 'after/ftplugin/idris.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+='
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris2') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris2', 'after/ftplugin/idris2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+='
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript', 'after/ftplugin/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: JavaScript
|
||||
@@ -12,5 +14,3 @@ if exists('b:undo_ftplugin')
|
||||
else
|
||||
let b:undo_ftplugin = 'setlocal iskeyword< suffixesadd<'
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/javascript-2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim ftplugin file
|
||||
@@ -13,7 +15,7 @@ if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') =
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
let b:match_words = '(:),\[:\],{:},<:>,' .
|
||||
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
|
||||
\ '<\@<=\([A-z0-9.]\+\):\(</\)\@<=\1'
|
||||
endif
|
||||
|
||||
" For andymass/vim-matchup plugin
|
||||
@@ -31,5 +33,3 @@ augroup jsx_comment
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.jsx
|
||||
|
||||
endif
|
||||
|
||||
11
after/ftplugin/just.vim
Normal file
11
after/ftplugin/just.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'just', 'after/ftplugin/just.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim ftplugin file
|
||||
" Language: Justfile
|
||||
" Maintainer: Noah Bogart <noah.bogart@hey.com>
|
||||
" URL: https://github.com/NoahTheDuke/vim-just.git
|
||||
" Last Change: 2021 May 19
|
||||
|
||||
setlocal iskeyword+=-
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'after/ftplugin/llvm.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2018 rhysd
|
||||
"
|
||||
@@ -327,7 +329,7 @@ function! s:extract_identifier(word) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
if a:word[1] == '"'
|
||||
if a:word[1] ==# '"'
|
||||
let idx = stridx(a:word, '"', 2)
|
||||
if idx == -1
|
||||
return ''
|
||||
@@ -341,7 +343,7 @@ function! s:extract_identifier(word) abort
|
||||
endif
|
||||
|
||||
if prefix ==# '#'
|
||||
return matchstr(a:word, '^#\d\+')
|
||||
return matchstr(a:word, '^#\d\+\>')
|
||||
endif
|
||||
|
||||
return ''
|
||||
@@ -476,12 +478,16 @@ function! s:run_lli(...) abort
|
||||
let tmpfile = tempname()
|
||||
call writefile(getline(1, '$'), tmpfile)
|
||||
let Cleanup = {ch -> filereadable(tmpfile) ? delete(tmpfile) : 0}
|
||||
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, 'tex') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/ftplugin/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" LaTeX filetype plugin
|
||||
" Language: LaTeX (ft=tex)
|
||||
@@ -30,7 +32,7 @@ let &l:define .= '\|\\\(re\)\=new\(boolean\|command\|counter\|environment\|font'
|
||||
|
||||
" Tell Vim how to recognize LaTeX \include{foo} and plain \input bar :
|
||||
let &l:include .= '\|\\include{'
|
||||
" On some file systems, "{" and "}" are inluded in 'isfname'. In case the
|
||||
" On some file systems, "{" and "}" are included in 'isfname'. In case the
|
||||
" TeX file has \include{fname} (LaTeX only), strip everything except "fname".
|
||||
let &l:includeexpr = "substitute(v:fname, '^.\\{-}{\\|}.*', '', 'g')"
|
||||
|
||||
@@ -46,5 +48,3 @@ let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:sts=2:sw=2:
|
||||
|
||||
endif
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" modified from html.vim
|
||||
" For matchit plugin
|
||||
@@ -28,5 +30,3 @@ augroup jsx_comment
|
||||
augroup end
|
||||
|
||||
setlocal suffixesadd+=.tsx
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/ftplugin/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/indent/javascript-2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -36,11 +38,9 @@ setlocal indentexpr=GetJavascriptGraphQLIndent()
|
||||
|
||||
function GetJavascriptGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0) ==# 'graphqlTemplateString'
|
||||
if get(l:stack, 0, '') ==# 'graphqlTemplateString'
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
@@ -29,5 +31,3 @@ endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'objc', 'after/indent/objc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim indent file
|
||||
" Language: Objective-C
|
||||
@@ -93,5 +95,3 @@ endfunction
|
||||
" Restore 'cpo' options
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
endif
|
||||
|
||||
46
after/indent/php.vim
Normal file
46
after/indent/php.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/indent/php.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('*GetPHPGraphQLIndent') && !empty(&indentexpr)
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/graphql.vim
|
||||
|
||||
" Set the indentexpr with our own version that will call GetGraphQLIndent when
|
||||
" we're inside of a GraphQL string and otherwise defer to the base function.
|
||||
let b:indentexpr_base = &indentexpr
|
||||
setlocal indentexpr=GetPHPGraphQLIndent()
|
||||
|
||||
function GetPHPGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0, '') ==# 'phpRegion' && count(l:stack, 'graphqlFold') > 0
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tex') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/indent/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim indent file
|
||||
" Language: LaTeX
|
||||
@@ -290,7 +292,7 @@ function! GetTeXIndent() " {{{
|
||||
let ind = ind - shiftwidth()
|
||||
let stay = 0
|
||||
endif
|
||||
" lines following to '\item' are intented once again:
|
||||
" lines following to '\item' are indented once again:
|
||||
if line =~ g:tex_items
|
||||
let ind = ind + shiftwidth()
|
||||
let stay = 0
|
||||
@@ -423,5 +425,3 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: set sw=4 textwidth=80:
|
||||
|
||||
endif
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim indent file
|
||||
@@ -36,5 +38,3 @@ endfunction
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
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/indent/typescript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -36,11 +38,9 @@ setlocal indentexpr=GetTypescriptGraphQLIndent()
|
||||
|
||||
function GetTypescriptGraphQLIndent()
|
||||
let l:stack = map(synstack(v:lnum, 1), "synIDattr(v:val, 'name')")
|
||||
if get(l:stack, 0) ==# 'graphqlTemplateString'
|
||||
if get(l:stack, 0, '') ==# 'graphqlTemplateString'
|
||||
return GetGraphQLIndent()
|
||||
endif
|
||||
|
||||
return eval(b:indentexpr_base)
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/indent/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cpp-modern', 'after/syntax/c.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Vim syntax file
|
||||
" Language: C Additions
|
||||
" Original Author: Mikhail Wolfson <mywolfson@gmail.com>
|
||||
" http://www.vim.org/scripts/script.php?script_id=3064
|
||||
" Maintainer: bfrg <bfrg@users.noreply.github.com>
|
||||
" Maintainer: bfrg <https://github.com/bfrg>
|
||||
" Website: https://github.com/bfrg/vim-cpp-modern
|
||||
" Last Change: Oct 17, 2020
|
||||
"
|
||||
" Extended C syntax highlighting including highlighting of user-defined
|
||||
" functions.
|
||||
" Last Change: Jul 24, 2021
|
||||
"
|
||||
" This syntax file is based on:
|
||||
" https://github.com/octol/vim-cpp-enhanced-highlight
|
||||
@@ -22,7 +20,7 @@ syn keyword cTodo contained BUG NOTE
|
||||
|
||||
|
||||
" Highlight function names
|
||||
if !get(g:, 'cpp_no_function_highlight', 0)
|
||||
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
|
||||
@@ -34,6 +32,7 @@ if get(g:, 'cpp_member_highlight', 0)
|
||||
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'
|
||||
@@ -60,9 +59,8 @@ hi def link cAnsiName Identifier
|
||||
" Highlight all standard C keywords as Statement
|
||||
" This is very similar to what other IDEs and editors do
|
||||
if get(g:, 'cpp_simple_highlight', 0)
|
||||
hi link cStorageClass Statement
|
||||
hi link cStructure Statement
|
||||
hi link cLabel Statement
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'cpp-modern', 'after/syntax/cpp.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ==============================================================================
|
||||
" Vim syntax file
|
||||
@@ -6,7 +8,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') ==
|
||||
" Original Author: Jon Haggblad <https://github.com/octol>
|
||||
" Maintainer: bfrg <https://github.com/bfrg>
|
||||
" Website: https://github.com/bfrg/vim-cpp-modern
|
||||
" Last Change: Oct 8, 2020
|
||||
" Last Change: Sep 15, 2022
|
||||
"
|
||||
" This syntax file is based on:
|
||||
" https://github.com/octol/vim-cpp-enhanced-highlight
|
||||
@@ -68,7 +70,7 @@ if !exists('cpp_no_cpp11')
|
||||
syntax keyword cppSTLnamespace chrono this_thread
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ array atomic atomic_bool atomic_char atomic_flag atomic_int atomic_llong atomic_long atomic_schar atomic_short atomic_uchar atomic_uint atomic_ullong atomic_ulong atomic_ushort duration duration_values high_resolution_clock hours microseconds milliseconds minutes nanoseconds seconds steady_clock system_clock time_point treat_as_floating_point condition_variable exception_ptr nested_exception hash is_bind_expression is_placeholder reference_wrapper forward_list future packaged_task promise shared_future initializer_list codecvt_mode codecvt_utf16 codecvt_utf8 codecvt_utf8_utf16 wbuffer_convert wstring_convert allocator_traits allocator_type default_delete enable_shared_from_this is_always_equal owner_less pointer_safety pointer_traits propagate_on_container_copy_assignment propagate_on_container_move_assignment propagate_on_container_swap rebind_alloc rebind_traits shared_ptr unique_ptr uses_allocator void_pointer const_void_pointer weak_ptr condition_variable_any lock_guard mutex once_flag recursive_mutex recursive_timed_mutex timed_mutex unique_lock bernoulli_distribution binomial_distribution cauchy_distribution chi_squared_distribution default_random_engine discard_block_engine discrete_distribution exponential_distribution extreme_value_distribution fisher_f_distribution gamma_distribution geometric_distribution independent_bits_engine knuth_b linear_congruential_engine lognormal_distribution mersenne_twister_engine minstd_rand minstd_rand0 mt19937 mt19937_64 negative_binomial_distribution normal_distribution piecewise_constant_distribution piecewise_linear_distribution poisson_distribution random_device ranlux24 ranlux24_base ranlux48 ranlux48_base seed_seq shuffle_order_engine student_t_distribution subtract_with_carry_engine uniform_int_distribution uniform_real_distribution weibull_distribution atto centi deca deci exa femto giga hecto kilo mega micro milli nano peta pico ratio ratio_add ratio_divide ratio_equal ratio_greater ratio_greater_equal ratio_less ratio_less_equal ratio_multiply ratio_not_equal ratio_subtract tera yocto yotta zepto zetta basic_regex match_results regex_traits sub_match syntax_option_type match_flag_type error_type scoped_allocator_adaptor outer_allocator_type inner_allocator_type error_code error_condition error_category is_error_code_enum is_error_condition_enum thread tuple tuple_size tuple_element type_index add_const add_cv add_lvalue_reference add_pointer add_rvalue_reference add_volatile aligned_storage aligned_union alignment_of common_type conditional decay enable_if extent false_type has_virtual_destructor integral_constant is_abstract is_arithmetic is_array is_assignable is_base_of is_class is_compound is_const is_constructible is_convertible is_copy_assignable is_copy_constructible is_default_constructible is_destructible is_empty is_enum is_floating_point is_function is_fundamental is_integral is_literal_type is_lvalue_reference is_member_function_pointer is_member_object_pointer is_member_pointer is_move_assignable is_move_constructible is_nothrow_assignable is_nothrow_constructible is_nothrow_copy_assignable is_nothrow_copy_constructible is_nothrow_default_constructible is_nothrow_destructible is_nothrow_move_assignable is_nothrow_move_constructible is_object is_pod is_pointer is_polymorphic is_reference is_rvalue_reference is_same is_scalar is_signed is_standard_layout is_trivial is_trivially_assignable is_trivially_constructible is_trivially_copy_assignable is_trivially_copy_constructible is_trivially_copyable is_trivially_default_constructible is_trivially_destructible is_trivially_move_assignable is_trivially_move_constructible is_union is_unsigned is_void is_volatile make_signed make_unsigned rank remove_all_extents remove_const remove_cv remove_extent remove_pointer remove_reference remove_volatile result_of true_type underlying_type hasher key_equal unordered_map unordered_multimap unordered_multiset unordered_set function
|
||||
\ array atomic atomic_bool atomic_char atomic_flag atomic_int atomic_llong atomic_long atomic_schar atomic_short atomic_uchar atomic_uint atomic_ullong atomic_ulong atomic_ushort duration duration_values high_resolution_clock hours microseconds milliseconds minutes nanoseconds seconds steady_clock system_clock time_point treat_as_floating_point condition_variable exception_ptr nested_exception hash is_bind_expression is_placeholder reference_wrapper forward_list future packaged_task promise shared_future initializer_list codecvt_mode codecvt_utf16 codecvt_utf8 codecvt_utf8_utf16 wbuffer_convert wstring_convert allocator_traits allocator_type default_delete enable_shared_from_this is_always_equal owner_less pointer_safety pointer_traits propagate_on_container_copy_assignment propagate_on_container_move_assignment propagate_on_container_swap rebind_alloc rebind_traits shared_ptr unique_ptr uses_allocator void_pointer const_void_pointer weak_ptr condition_variable_any lock_guard mutex once_flag recursive_mutex recursive_timed_mutex timed_mutex unique_lock bernoulli_distribution binomial_distribution cauchy_distribution chi_squared_distribution default_random_engine discard_block_engine discrete_distribution exponential_distribution extreme_value_distribution fisher_f_distribution gamma_distribution geometric_distribution independent_bits_engine knuth_b linear_congruential_engine lognormal_distribution mersenne_twister_engine minstd_rand minstd_rand0 mt19937 mt19937_64 negative_binomial_distribution normal_distribution piecewise_constant_distribution piecewise_linear_distribution poisson_distribution random_device ranlux24 ranlux24_base ranlux48 ranlux48_base seed_seq shuffle_order_engine student_t_distribution subtract_with_carry_engine uniform_int_distribution uniform_real_distribution weibull_distribution atto centi deca deci exa femto giga hecto kilo mega micro milli nano peta pico ratio ratio_add ratio_divide ratio_equal ratio_greater ratio_greater_equal ratio_less ratio_less_equal ratio_multiply ratio_not_equal ratio_subtract tera yocto yotta zepto zetta basic_regex regex wregex match_results regex_traits sub_match syntax_option_type match_flag_type error_type scoped_allocator_adaptor outer_allocator_type inner_allocator_type error_code error_condition error_category is_error_code_enum is_error_condition_enum thread tuple tuple_size tuple_element type_index add_const add_cv add_lvalue_reference add_pointer add_rvalue_reference add_volatile aligned_storage aligned_union alignment_of common_type conditional decay enable_if extent false_type has_virtual_destructor integral_constant is_abstract is_arithmetic is_array is_assignable is_base_of is_class is_compound is_const is_constructible is_convertible is_copy_assignable is_copy_constructible is_default_constructible is_destructible is_empty is_enum is_floating_point is_function is_fundamental is_integral is_literal_type is_lvalue_reference is_member_function_pointer is_member_object_pointer is_member_pointer is_move_assignable is_move_constructible is_nothrow_assignable is_nothrow_constructible is_nothrow_copy_assignable is_nothrow_copy_constructible is_nothrow_default_constructible is_nothrow_destructible is_nothrow_move_assignable is_nothrow_move_constructible is_object is_pod is_pointer is_polymorphic is_reference is_rvalue_reference is_same is_scalar is_signed is_standard_layout is_trivial is_trivially_assignable is_trivially_constructible is_trivially_copy_assignable is_trivially_copy_constructible is_trivially_copyable is_trivially_default_constructible is_trivially_destructible is_trivially_move_assignable is_trivially_move_constructible is_union is_unsigned is_void is_volatile make_signed make_unsigned rank remove_all_extents remove_const remove_cv remove_extent remove_pointer remove_reference remove_volatile result_of true_type underlying_type hasher key_equal unordered_map unordered_multimap unordered_multiset unordered_set function
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ atomic_char16_t atomic_char32_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_int_fast8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_int_least8_t atomic_intmax_t atomic_intptr_t atomic_ptrdiff_t atomic_size_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t atomic_uint_fast8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_uint_least8_t atomic_uintmax_t atomic_uintptr_t atomic_wchar_t nullptr_t max_align_t allocator_arg_t adopt_lock_t defer_lock_t try_to_lock_t piecewise_construct_t
|
||||
@@ -90,7 +92,6 @@ if !exists('cpp_no_cpp11')
|
||||
syntax keyword cppSTLexception
|
||||
\ bad_function_call future_error regex_error system_error bad_weak_ptr bad_array_new_length
|
||||
|
||||
" syntax keyword cppSTLiterator contained
|
||||
syntax keyword cppSTLiterator
|
||||
\ move_iterator regex_iterator regex_token_iterator const_local_iterator local_iterator
|
||||
|
||||
@@ -101,7 +102,7 @@ endif
|
||||
|
||||
" C++14 extensions {{{1
|
||||
if !exists('cpp_no_cpp14')
|
||||
syntax keyword cppSTLnamespace literals chrono_literals string_literals
|
||||
syntax keyword cppSTLnamespace literals chrono_literals string_literals complex_literals
|
||||
|
||||
syntax keyword cppSTLfunction make_unique
|
||||
|
||||
@@ -115,10 +116,10 @@ endif
|
||||
|
||||
" C++17 extensions {{{1
|
||||
if !exists('cpp_no_cpp17')
|
||||
syntax keyword cppSTLnamespace filesystem execution
|
||||
syntax keyword cppSTLnamespace filesystem execution string_view_literals
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ any is_execution_policy parallel_policy parallel_unsequenced_policy sequenced_policy directory_entry directory_iterator file_status file_time_type path recursive_directory_iterator space_info default_order default_searcher boyer_moore_searcher boyer_moore_horspool_searcher memory_resource monotonic_buffer_resource polymorphic_allocator pool_options synchronized_pool_resource unsynchronized_pool_resource scoped_lock optional shared_mutex basic_string_view string_view u16string_view u32string_view wstring_view bool_constant conjunction disjunction has_unique_object_representations invoke_result is_aggregate is_callable is_invocable is_invocable_r is_nothrow_invocable is_nothrow_invocable_r is_nothrow_swappable is_nothrow_swappable_with is_nowthrow_callable is_swappable is_swappable_with negation node_type insert_return_type in_place_tag monostate variant variant_size variant_alternative
|
||||
\ any byte is_execution_policy parallel_policy parallel_unsequenced_policy sequenced_policy directory_entry directory_iterator file_status file_time_type path recursive_directory_iterator space_info default_order default_searcher boyer_moore_searcher boyer_moore_horspool_searcher memory_resource monotonic_buffer_resource polymorphic_allocator pool_options synchronized_pool_resource unsynchronized_pool_resource scoped_lock optional shared_mutex basic_string_view string_view u16string_view u32string_view wstring_view bool_constant conjunction disjunction has_unique_object_representations invoke_result is_aggregate is_callable is_invocable is_invocable_r is_nothrow_invocable is_nothrow_invocable_r is_nothrow_swappable is_nothrow_swappable_with is_nowthrow_callable is_swappable is_swappable_with negation node_type insert_return_type in_place_tag monostate variant variant_size variant_alternative from_chars_result to_chars_result chars_format
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ invoke_result_t default_order_t nullopt_t void_t in_place_t in_place_type_t in_place_index_t variant_alternative_t
|
||||
@@ -155,12 +156,13 @@ if !exists('cpp_no_cpp20')
|
||||
syntax keyword cppSTLnamespace ranges views
|
||||
syntax keyword cppSTLconstant dynamic_extent
|
||||
syntax keyword cppSTLvariable default_sentinel unreachable_sentinel
|
||||
syntax keyword cppSTLexception format_error
|
||||
|
||||
syntax keyword cppSTLtype
|
||||
\ atomic_ref endian weak_ordering strong_ordering partial_ordering weak_equality strong_equality common_comparison_category contract_violation coroutine_traits coroutine_handle noop_coroutine_handle noop_coroutine_promise suspend_never suspend_always remove_cvref is_bounded_array is_layout_compatible is_unbounded_array is_nothrow_convertible has_strong_structural_equality is_pointer_interconvertible_base_of unwrap_reference unwrap_ref_decay basic_common_reference common_reference dangling ref_view filter_view transform_view iota_view join_view empty_view single_view split_view common_view reverse_view view_interface span basic_syncbuf basic_osyncstream syncbuf wsyncbuf osyncstream wosyncstream jthread latch barrier stop_token stop_source stop_callback counting_semaphore binary_semaphore source_location compare_three_way_result contiguous_iterator_tag incrementable_traits indirectly_readable_traits move_sentinel common_iterator counted_iterator projected type_identity
|
||||
\ atomic_ref endian weak_ordering strong_ordering partial_ordering weak_equality strong_equality common_comparison_category contract_violation coroutine_traits coroutine_handle noop_coroutine_handle noop_coroutine_promise suspend_never suspend_always remove_cvref is_bounded_array is_layout_compatible is_unbounded_array is_nothrow_convertible has_strong_structural_equality is_pointer_interconvertible_base_of unwrap_reference unwrap_ref_decay basic_common_reference common_reference dangling ref_view filter_view transform_view iota_view join_view empty_view single_view split_view common_view reverse_view view_interface span basic_syncbuf basic_osyncstream syncbuf wsyncbuf osyncstream wosyncstream jthread latch barrier stop_token stop_source stop_callback counting_semaphore binary_semaphore source_location compare_three_way_result contiguous_iterator_tag incrementable_traits indirectly_readable_traits move_sentinel common_iterator counted_iterator projected type_identity formatter basic_format_context basic_format_args basic_format_string basic_format_parse_context
|
||||
|
||||
syntax keyword cppSTLtypedef
|
||||
\ common_comparison_category_t remove_cvref_t unwrap_reference_t unwrap_ref_decay_t common_reference_t iterator_t sentinel_t safe_iterator_t safe_subrange_t compare_three_way_result_t iter_value_t iter_reference_t iter_difference_t iter_rvalue_reference_t iter_common_reference_t default_sentinel_t unreachable_sentinel_t indirect_result_t type_identity_t
|
||||
\ common_comparison_category_t remove_cvref_t unwrap_reference_t unwrap_ref_decay_t common_reference_t iterator_t sentinel_t safe_iterator_t safe_subrange_t compare_three_way_result_t iter_value_t iter_reference_t iter_difference_t iter_rvalue_reference_t iter_common_reference_t default_sentinel_t unreachable_sentinel_t indirect_result_t type_identity_t format_context wformat_context format_args wformat_args format_string wformat_string format_parse_context wformat_parse_context
|
||||
|
||||
syntax keyword cppSTLfunction
|
||||
\ make_unique_default_init make_shared_default_init allocate_shared_default_init uses_allocator_construction_args make_obj_using_allocator is_corresponding_member subspan in_range is_pointer_interconvertible_with_class
|
||||
@@ -173,6 +175,17 @@ if !exists('cpp_no_cpp20')
|
||||
endif
|
||||
|
||||
|
||||
" C++23 extensions {{{1
|
||||
if !exists('cpp_no_cpp23')
|
||||
syntax keyword cppSTLtype basic_stacktrace stacktrace_entry is_scoped_enum
|
||||
syntax keyword cppSTLtypedef stacktrace
|
||||
syntax keyword cppSTLbool is_scoped_enum_v
|
||||
syntax keyword cppSTLfunction invoke_r
|
||||
syntax keyword cppSTLtype expected unexpected unexpect_t bad_expected_access
|
||||
syntax keyword cppSTLvariable unexpect
|
||||
endif
|
||||
|
||||
|
||||
" Boost {{{1
|
||||
if !exists('cpp_no_boost')
|
||||
syntax keyword cppSTLnamespace boost
|
||||
@@ -199,14 +212,12 @@ hi def link cppSTLvariable Identifier
|
||||
|
||||
" The keywords {inline, virtual, explicit, export, override, final} are
|
||||
" standard C++ keywords and NOT types!
|
||||
hi link cppModifier Statement
|
||||
hi! def link cppModifier Statement
|
||||
|
||||
|
||||
" Highlight all standard C++ keywords as Statement
|
||||
if get(g:, 'cpp_simple_highlight', 0)
|
||||
hi link cppStructure Statement
|
||||
hi link cppExceptions Statement
|
||||
hi link cppStorageClass Statement
|
||||
endif
|
||||
|
||||
hi! def link cppStructure Statement
|
||||
hi! def link cppExceptions Statement
|
||||
hi! def link cppStorageClass Statement
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dhall') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'dhall', 'after/syntax/haskell.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" store and remove current syntax value
|
||||
let old_syntax = b:current_syntax
|
||||
@@ -13,5 +15,3 @@ hi def link quasiQuote Underlined
|
||||
|
||||
" restore current syntax value
|
||||
let b:current_syntax = old_syntax
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scala') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'scala', 'after/syntax/help.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Extends standard help syntax with highlighting of Scala code.
|
||||
"
|
||||
@@ -14,5 +16,3 @@ if has('conceal')
|
||||
else
|
||||
syntax region rgnScala matchgroup=Ignore start='!sc!' end='!/sc!' contains=@ScalaCode
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,200 +1,16 @@
|
||||
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)
|
||||
" SVG (SVG 1.1 Second Edition)
|
||||
" MathML (MathML 3.0 Second Edition)
|
||||
" Last Change: 2017 Mar 07
|
||||
" Last Change: 2017 Feb 15
|
||||
" License: Public domain
|
||||
" (but let me know if you like :) )
|
||||
"
|
||||
" Note: This file just add new tags from HTML 5
|
||||
" and don't replace default html.vim syntax file
|
||||
"
|
||||
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||
" Changes: update to Draft 2016 Jan 13
|
||||
" add microdata Attributes
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Modified: htdebeer <H.T.de.Beer@gmail.com>
|
||||
" Changes: add common SVG elements and attributes for inline SVG
|
||||
|
||||
" Patch 7.4.1142
|
||||
if has("patch-7.4-1142")
|
||||
if has("win32")
|
||||
syn iskeyword @,48-57,_,128-167,224-235,-
|
||||
else
|
||||
syn iskeyword @,48-57,_,192-255,-
|
||||
endif
|
||||
endif
|
||||
|
||||
" HTML 5 tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu menuitem nav output
|
||||
syn keyword htmlTagName contained progress ruby rt rp rb rtc section source summary time track video data
|
||||
syn keyword htmlTagName contained template content shadow slot
|
||||
syn keyword htmlTagName contained wbr bdi
|
||||
syn keyword htmlTagName contained picture
|
||||
|
||||
" SVG tags
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" as found in http://www.w3.org/TR/SVG/eltindex.html
|
||||
syn keyword htmlTagName contained svg
|
||||
syn keyword htmlTagName contained altGlyph altGlyphDef altGlyphItem
|
||||
syn keyword htmlTagName contained animate animateColor animateMotion animateTransform
|
||||
syn keyword htmlTagName contained circle ellipse rect line polyline polygon image path
|
||||
syn keyword htmlTagName contained clipPath color-profile cursor
|
||||
syn keyword htmlTagName contained defs desc g symbol view use switch foreignObject
|
||||
syn keyword htmlTagName contained filter feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence
|
||||
syn keyword htmlTagName contained font font-face font-face-format font-face-name font-face-src font-face-uri
|
||||
syn keyword htmlTagName contained glyph glyphRef hkern
|
||||
syn keyword htmlTagName contained linearGradient marker mask pattern radialGradient set stop
|
||||
syn keyword htmlTagName contained missing-glyph mpath
|
||||
syn keyword htmlTagName contained text textPath tref tspan vkern
|
||||
syn keyword htmlTagName contained metadata title
|
||||
|
||||
" MathML tags
|
||||
" https://www.w3.org/TR/MathML3/appendixi.html#index.elem
|
||||
syn keyword htmlTagName contained abs and annotation annotation-xml apply approx arccos arccosh arccot arccoth
|
||||
syn keyword htmlTagName contained arccsc arccsch arcsec arcsech arcsin arcsinh arctan arctanh arg bind
|
||||
syn keyword htmlTagName contained bvar card cartesianproduct cbytes ceiling cerror ci cn codomain complexes
|
||||
syn keyword htmlTagName contained compose condition conjugate cos cosh cot coth cs csc csch
|
||||
syn keyword htmlTagName contained csymbol curl declare degree determinant diff divergence divide domain domainofapplication
|
||||
syn keyword htmlTagName contained emptyset eq equivalent eulergamma exists exp exponentiale factorial factorof false
|
||||
syn keyword htmlTagName contained floor fn forall gcd geq grad gt ident image imaginary
|
||||
syn keyword htmlTagName contained imaginaryi implies in infinity int integers intersect interval inverse lambda
|
||||
syn keyword htmlTagName contained laplacian lcm leq limit list ln log logbase lowlimit lt
|
||||
syn keyword htmlTagName contained maction maligngroup malignmark math matrix matrixrow max mean median menclose
|
||||
syn keyword htmlTagName contained merror mfenced mfrac mglyph mi mi" min minus mlabeledtr mlongdiv
|
||||
syn keyword htmlTagName contained mmultiscripts mn mo mode moment momentabout mover mpadded mphantom mprescripts
|
||||
syn keyword htmlTagName contained mroot mrow ms mscarries mscarry msgroup msline mspace msqrt msrow
|
||||
syn keyword htmlTagName contained mstack mstyle msub msubsup msup mtable mtd mtext mtr munder
|
||||
syn keyword htmlTagName contained munderover naturalnumbers neq none not notanumber notin notprsubset notsubset or
|
||||
syn keyword htmlTagName contained otherwise outerproduct partialdiff pi piece piecewise plus power primes product
|
||||
syn keyword htmlTagName contained prsubset quotient rationals real reals reln rem root scalarproduct sdev
|
||||
syn keyword htmlTagName contained sec sech selector semantics sep set setdiff share sin sinh
|
||||
syn keyword htmlTagName contained span subset sum tan tanh tendsto times transpose true union
|
||||
syn keyword htmlTagName contained uplimit variance vector vectorproduct xor
|
||||
|
||||
" Custom Element
|
||||
syn match htmlTagName contained "\<[a-z][-.0-9_a-z]*-[-.0-9_a-z]*\>"
|
||||
syn match htmlTagName contained "[.0-9_a-z]\@<=-[-.0-9_a-z]*\>"
|
||||
|
||||
" HTML 5 arguments
|
||||
" Core Attributes
|
||||
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
|
||||
syn keyword htmlArg contained draggable hidden id is lang spellcheck style tabindex title translate
|
||||
" Event-handler Attributes
|
||||
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
|
||||
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
|
||||
syn keyword htmlArg contained ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange
|
||||
syn keyword htmlArg contained onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata
|
||||
syn keyword htmlArg contained onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup
|
||||
syn keyword htmlArg contained onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange
|
||||
syn keyword htmlArg contained onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate
|
||||
syn keyword htmlArg contained onvolumechange onwaiting
|
||||
" XML Attributes
|
||||
syn keyword htmlArg contained xml:lang xml:space xml:base xmlns
|
||||
" new features
|
||||
" <body>
|
||||
syn keyword htmlArg contained onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload
|
||||
syn keyword htmlArg contained onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload
|
||||
" <video>, <audio>, <source>, <track>
|
||||
syn keyword htmlArg contained autoplay preload controls loop poster media kind charset srclang track playsinline
|
||||
" <form>, <input>, <button>
|
||||
syn keyword htmlArg contained form autocomplete autofocus list min max step
|
||||
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
|
||||
syn keyword htmlArg contained required placeholder pattern
|
||||
" <command>, <details>, <time>
|
||||
syn keyword htmlArg contained label icon open datetime-local pubdate
|
||||
" <script>
|
||||
syn keyword htmlArg contained async
|
||||
" <content>
|
||||
syn keyword htmlArg contained select
|
||||
" <iframe>
|
||||
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest allowpresentation
|
||||
" <picture>
|
||||
syn keyword htmlArg contained srcset sizes
|
||||
" <a>
|
||||
syn keyword htmlArg contained download media
|
||||
" <script>, <style>
|
||||
syn keyword htmlArg contained nonce
|
||||
" <area>, <a>, <img>, <iframe>, <link>
|
||||
syn keyword htmlArg contained referrerpolicy
|
||||
" https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
|
||||
syn keyword htmlArg contained integrity crossorigin
|
||||
" <link>
|
||||
syn keyword htmlArg contained prefetch
|
||||
" syn keyword htmlArg contained preload
|
||||
" <img>
|
||||
syn keyword htmlArg contained decoding
|
||||
" https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers
|
||||
syn keyword htmlArg contained onselectstart onselectionchange
|
||||
" https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading
|
||||
syn keyword htmlArg contained loading
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
||||
syn match htmlArg "\<data[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Vendor Extension Attributes
|
||||
" http://w3c.github.io/html/single-page.html#conformance-requirements-extensibility
|
||||
syn match htmlArg "\<x[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Microdata
|
||||
" http://dev.w3.org/html5/md/
|
||||
syn keyword htmlArg contained itemid itemscope itemtype itemprop itemref
|
||||
|
||||
" SVG
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" Some common attributes from http://www.w3.org/TR/SVG/attindex.html
|
||||
syn keyword htmlArg contained accent-height accumulate additive alphabetic amplitude arabic-form ascent attributeName attributeType azimuth
|
||||
syn keyword htmlArg contained baseFrequency baseProfile bbox begin bias by
|
||||
syn keyword htmlArg contained calcMode cap-height class clipPathUnits contentScriptType contentStyleType cx cy
|
||||
syn keyword htmlArg contained d descent diffuseConstant divisor dur dx dy
|
||||
syn keyword htmlArg contained edgeMode elevation end exponent externalResourcesRequired
|
||||
syn keyword htmlArg contained fill filterRes filterUnits font-family font-size font-stretch font-style font-variant font-weight format format from fx fy
|
||||
syn keyword htmlArg contained g1 g2 glyph-name glyphRef gradientTransform gradientUnits
|
||||
syn keyword htmlArg contained hanging height horiz-adv-x horiz-origin-x horiz-origin-y
|
||||
syn keyword htmlArg contained id ideographic in in2 intercept
|
||||
syn keyword htmlArg contained k k1 k2 k3 k4 kernelMatrix kernelUnitLength keyPoints keySplines keyTimes
|
||||
syn keyword htmlArg contained lang lengthAdjust limitingConeAngle local
|
||||
syn keyword htmlArg contained markerHeight markerUnits markerWidth maskContentUnits maskUnits mathematical max media method min mode name
|
||||
syn keyword htmlArg contained numOctaves
|
||||
syn keyword htmlArg contained offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload onzoom operator order orient orientation origin overline-position overline-thickness
|
||||
syn keyword htmlArg contained panose-1 path pathLength patternContentUnits patternTransform patternUnits points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits
|
||||
syn keyword htmlArg contained r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry
|
||||
syn keyword htmlArg contained scale seed slope spacing specularConstant specularExponent spreadMethod startOffset stdDeviation stemh stemv stitchTiles strikethrough-position strikethrough-thickness string surfaceScale systemLanguage
|
||||
syn keyword htmlArg contained tableValues target targetX targetY textLength title to transform type
|
||||
syn keyword htmlArg contained u1 u2 underline-position underline-thickness unicode unicode-range units-per-em
|
||||
syn keyword htmlArg contained v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget
|
||||
syn keyword htmlArg contained width widths
|
||||
syn keyword htmlArg contained x x-height x1 x2 xChannelSelector xlink:actuate xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space
|
||||
syn keyword htmlArg contained y y1 y2 yChannelSelector
|
||||
syn keyword htmlArg contained z zoomAndPan
|
||||
syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode
|
||||
|
||||
" MathML attributes
|
||||
" https://www.w3.org/TR/MathML3/chapter2.html#interf.toplevel.atts
|
||||
syn keyword htmlArg contained accent accentunder actiontype align alignmentscope altimg altimg-height altimg-valign altimg-width alttext
|
||||
syn keyword htmlArg contained annotation-xml background base baseline bevelled cd cdgroup charalign charspacing close
|
||||
syn keyword htmlArg contained closure color columnalign columnalignment columnlines columnspacing columnspan columnwidth crossout decimalpoint
|
||||
syn keyword htmlArg contained definitionURL denomalign depth display displaystyle edge encoding equalcolumns equalrows fence
|
||||
syn keyword htmlArg contained fontfamily fontsize fontstyle fontweight form frame framespacing groupalign height indentalign
|
||||
syn keyword htmlArg contained indentalignfirst indentalignlast indentshift indentshiftfirst indentshiftlast indenttarget index infixlinebreakstyle integer largeop
|
||||
syn keyword htmlArg contained leftoverhang length linebreak linebreakmultchar linebreakstyle lineleading linethickness location longdivstyle lquote
|
||||
syn keyword htmlArg contained lspace ltr macros math mathbackground mathcolor mathsize mathvariant maxsize maxwidth
|
||||
syn keyword htmlArg contained mediummathspace menclose minlabelspacing minsize mode movablelimits msgroup mslinethickness name nargs
|
||||
syn keyword htmlArg contained newline notation numalign number occurrence open order other overflow position
|
||||
syn keyword htmlArg contained rightoverhang role rowalign rowlines rowspacing rowspan rquote rspace schemaLocation scope
|
||||
syn keyword htmlArg contained scriptlevel scriptminsize scriptsize scriptsizemultiplier selection separator separators shift side stackalign
|
||||
syn keyword htmlArg contained stretchy subscriptshift superscriptshift symmetric thickmathspace thinmathspace type valign verythickmathspace verythinmathspace
|
||||
syn keyword htmlArg contained veryverythickmathspace veryverythinmathspace voffset width xref
|
||||
|
||||
" Comment
|
||||
" https://github.com/w3c/html/issues/694
|
||||
syntax region htmlComment start=+<!--+ end=+-->+ contains=@Spell
|
||||
syntax region htmlComment start=+<!DOCTYPE+ keepend end=+>+
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris', 'after/syntax/idris.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" This script allows for unicode concealing of certain characters
|
||||
" For instance -> goes to →
|
||||
@@ -78,5 +80,3 @@ hi link idrNiceOperator Operator
|
||||
hi! link Conceal Operator
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'idris2') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'idris2', 'after/syntax/idris2.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" This script allows for unicode concealing of certain characters
|
||||
" For instance -> goes to →
|
||||
@@ -78,5 +80,3 @@ hi link idrNiceOperator Operator
|
||||
hi! link Conceal Operator
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascript.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if get(g:, 'vim_jsx_pretty_disable_js', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/javascript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,7 +29,11 @@ if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
@@ -40,11 +46,13 @@ if graphql#has_syntax_group('jsTemplateExpression')
|
||||
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
|
||||
@@ -52,6 +60,8 @@ elseif graphql#has_syntax_group('javaScriptStringT')
|
||||
exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlTemplateString'
|
||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=@javaScriptEmbededExpr containedin=graphqlFold keepend
|
||||
|
||||
syntax region graphqlTemplateString matchgroup=javaScriptStringT start=+`#\s\{,4\}\(gql\|graphql\)\>\s*$+ skip=+\\\\\|\\`+ end=+`+ contains=@GraphQLSyntax,javaScriptSpecial,javaScriptEmbed,@htmlPreproc extend
|
||||
|
||||
hi def link graphqlTemplateString javaScriptStringT
|
||||
hi def link graphqlTaggedTemplate javaScriptEmbed
|
||||
hi def link graphqlTemplateExpression javaScriptEmbed
|
||||
@@ -60,5 +70,3 @@ elseif graphql#has_syntax_group('javaScriptStringT')
|
||||
syn cluster javaScriptEmbededExpr add=graphqlTaggedTemplate
|
||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript-sql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'javascript-sql', 'after/syntax/javascript/sql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim plugin
|
||||
" Language: JavaScript
|
||||
@@ -22,5 +24,3 @@ hi def link sqlTaggedTemplate jsTaggedTemplate
|
||||
|
||||
syn cluster jsExpression add=sqlTaggedTemplate
|
||||
syn cluster sqlTaggedTemplate add=sqlTemplateString
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/javascriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/jsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/javascriptreact/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/javascript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/jsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
@@ -55,5 +57,3 @@ let b:current_syntax = 'javascript.jsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/jsx_pretty.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
|
||||
|
||||
@@ -138,7 +140,7 @@ exe 'syntax match jsxTagName
|
||||
" and
|
||||
" <tag id='sample'>
|
||||
" ~~~~~~~~
|
||||
syntax region jsxString start=+\z(["']\)+ skip=+\\\\\|\\\z1\|\\\n+ end=+\z1+ contained contains=@Spell
|
||||
syntax region jsxString start=+\z(["']\)+ skip=+\\\\\|\\\z1\|\\\n+ end=+\z1+ extend contained contains=@Spell
|
||||
|
||||
let s:tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
|
||||
let s:enable_tagged_jsx = !empty(s:tags)
|
||||
@@ -221,5 +223,3 @@ if s:vim_jsx_pretty_colorful_config == 1
|
||||
highlight def link jsArrowFuncArgs Type
|
||||
highlight def link jsFuncArgs Type
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'llvm', 'after/syntax/llvm.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2018 rhysd
|
||||
"
|
||||
@@ -22,5 +24,3 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1
|
||||
|
||||
syn keyword llvmKeyword attributes
|
||||
syn match llvmNoName /#\d\+\>/
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mdx') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'mdx', 'after/syntax/mdx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
" based on mxw/vim-jsx
|
||||
@@ -41,5 +43,3 @@ syn cluster jsExpression add=jsxRegion
|
||||
|
||||
" Allow jsxRegion to contain reserved words.
|
||||
syn cluster javascriptNoReserved add=jsxRegion
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mathematica') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'mathematica', 'after/syntax/mma.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"Vim conceal file
|
||||
" Language: Mathematica
|
||||
@@ -1442,5 +1444,3 @@ endif
|
||||
hi! link Conceal Normal
|
||||
setlocal conceallevel=2
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'objc') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'objc', 'after/syntax/objc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" ARC type modifiers
|
||||
syn keyword objcTypeModifier __bridge __bridge_retained __bridge_transfer __autoreleasing __strong __weak __unsafe_unretained
|
||||
@@ -19,5 +21,3 @@ syn match objcDirective "@property\|@synthesize\|@dynamic\|@package"
|
||||
|
||||
" Highlight property attributes as if they were type modifiers
|
||||
hi def link objcPropertyAttribute objcTypeModifier
|
||||
|
||||
endif
|
||||
|
||||
42
after/syntax/php/graphql.vim
Normal file
42
after/syntax/php/graphql.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/php/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\(\"\=\)\z(\(\I\i*\)\=\(gql\)\c\(\i*\)\)\2$" end="^\s*\z1\>" contained contains=@GraphQLSyntax,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpBackslashSequences,phpMethodsVar,@Spell keepend extend
|
||||
syntax region phpNowDoc matchgroup=Delimiter start="\(<<<\)\@<='\z(\(\I\i*\)\=\(gql\)\c\(\i*\)\)'$" end="^\s*\z1\>" contained contains=@GraphQLSyntax,@Spell keepend extend
|
||||
28
after/syntax/puppet.vim
Normal file
28
after/syntax/puppet.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'yard', 'after/syntax/puppet.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Puppet syntax extensions for highlighting YARD documentation.
|
||||
"
|
||||
" Author: Gabriel Filion <gabster@lelutin.ca>
|
||||
" URI: https://github.com/noprompt/vim-yardoc
|
||||
" Version: 0.0.1
|
||||
"
|
||||
" This file reuses the main yardoc syntax definitions and glues them together
|
||||
" with puppet syntax groups from vim-puppet
|
||||
|
||||
runtime! after/syntax/yardoc_support.vim
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Yard glue to puppet
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match puppetComment "\s*#.*$" contains=puppetTodo,@Spell,yardComment
|
||||
syn region puppetComment start="/\*" end="\*/" contains=puppetTodo,@Spell,yardComment extend fold keepend
|
||||
syn cluster puppetNotTop add=@yardTags,@yardDirectives,@yardTypes,@yardLists,@yardHashes
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tacking on Yard to puppet syntax classes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
hi def link yardComment puppetComment
|
||||
hi def link yardGenericTag puppetKeyword
|
||||
hi def link yardGenericDirective puppetKeyword
|
||||
@@ -1,4 +1,4 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'reason') == -1
|
||||
|
||||
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'reason', 'after/syntax/reason.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/reason/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,11 +29,14 @@ if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syntax region graphqlExtensionPoint matchgroup=Noise start=+\[%graphql\_s*{|+lc=10 end=+|}\_s*]+he=s+1 contains=@GraphQLSyntax keepend
|
||||
|
||||
endif
|
||||
syntax region graphqlExtensionPoint start=+\[%\(graphql\|relay\)+ end=+\]+ contains=graphqlExtensionPointS
|
||||
syntax region graphqlExtensionPointS matchgroup=String start=+{|+ end=+|}+ contains=@GraphQLSyntax contained
|
||||
|
||||
42
after/syntax/rescript/graphql.vim
Normal file
42
after/syntax/rescript/graphql.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/rescript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
" deal in the Software without restriction, including without limitation the
|
||||
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
" sell copies of the Software, and to permit persons to whom the Software is
|
||||
" furnished to do so, subject to the following conditions:
|
||||
"
|
||||
" The above copyright notice and this permission notice shall be included in
|
||||
" all copies or substantial portions of the Software.
|
||||
"
|
||||
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
" IN THE SOFTWARE.
|
||||
"
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax = b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:graphql_nested_syntax = 1
|
||||
syn include @GraphQLSyntax syntax/graphql.vim
|
||||
unlet b:graphql_nested_syntax
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax = s:current_syntax
|
||||
endif
|
||||
|
||||
syntax region graphqlExtensionPoint start=+%\(graphql\|relay\)(+ end=+)+ contains=graphqlExtensionPointS
|
||||
syntax region graphqlExtensionPointS matchgroup=String start=+`+ end=+`+ contains=@GraphQLSyntax contained
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rspec') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rspec', 'after/syntax/rspec.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"
|
||||
" An rspec syntax file
|
||||
@@ -189,5 +191,3 @@ highlight link rspecMatchers Function
|
||||
highlight link rspecMessageExpectation Function
|
||||
|
||||
let b:current_syntax = 'rspec'
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,131 +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 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
|
||||
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 yardYield yardGenericTag
|
||||
hi def link yardYieldParam yardGenericTag
|
||||
hi def link yardYieldReturn 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, 'tex') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'tex', 'after/syntax/tex.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim syntax file
|
||||
" Language: TeX
|
||||
@@ -1340,5 +1342,3 @@ let b:current_syntax = "tex"
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
" vim: ts=8 fdm=marker
|
||||
|
||||
endif
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/tsx.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Vim syntax file
|
||||
@@ -59,5 +61,3 @@ let b:current_syntax = 'typescript.tsx'
|
||||
|
||||
let &cpo = s:jsx_cpo
|
||||
unlet s:jsx_cpo
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/typescript/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -27,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
|
||||
@@ -40,10 +46,17 @@ exec 'syntax match graphqlTaggedTemplate +' . s:tags . '\ze`+ nextgroup=graphqlT
|
||||
" Support expression interpolation ((${...})) inside template strings.
|
||||
syntax region graphqlTemplateExpression start=+${+ end=+}+ contained contains=typescriptTemplateSubstitution containedin=graphqlFold keepend
|
||||
|
||||
" support #graphql , #gql comment strings
|
||||
syntax region graphqlTemplateString
|
||||
\ start=+`\(#\s\{,4\}\(gql\|graphql\)\)\@=+
|
||||
\ skip=+\\\\\|\\`+
|
||||
\ end=+`+me=s-1
|
||||
\ containedin=typescriptTemplate
|
||||
\ contained
|
||||
\ contains=@GraphQLSyntax,typescriptTemplateSubstitution extend
|
||||
|
||||
hi def link graphqlTemplateString typescriptTemplate
|
||||
hi def link graphqlTemplateExpression typescriptTemplateSubstitution
|
||||
|
||||
syn cluster typescriptExpression add=graphqlTaggedTemplate
|
||||
syn cluster graphqlTaggedTemplate add=graphqlTemplateString
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'after/syntax/typescriptreact.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
source <sfile>:h/tsx.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/typescriptreact/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/typescript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'after/syntax/vue/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! after/syntax/javascript/graphql.vim
|
||||
|
||||
endif
|
||||
|
||||
128
after/syntax/yardoc_support.vim
Normal file
128
after/syntax/yardoc_support.vim
Normal file
@@ -0,0 +1,128 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'yard', 'after/syntax/yardoc_support.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Generic syntax extensions for highlighting YARD documentation.
|
||||
"
|
||||
" Author: Joel Holdbrooks <https://github.com/noprompt>
|
||||
" URI: https://github.com/noprompt/vim-yardoc
|
||||
" Version: 0.0.1
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tags
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericTag "@\h\+" contained
|
||||
syn match yardAbstract "@abstract" contained
|
||||
syn match yardApi "@api" contained
|
||||
syn match yardAttr "@attr" contained
|
||||
syn match yardAttrReader "@attr_reader" contained
|
||||
syn match yardAttrWriter "@attr_writer" contained
|
||||
syn match yardAuthor "@author" contained
|
||||
syn match yardDeprecated "@deprecated" contained
|
||||
syn match yardExample "@example" contained
|
||||
syn match yardNote "@note" contained
|
||||
syn match yardOption "@option" contained
|
||||
syn match yardOverload "@overload" contained
|
||||
syn match yardParam "@param" contained
|
||||
syn match yardParamName /@param \h\+/hs=s+7 contained contains=yardParam
|
||||
syn match yardPrivate "@private" contained
|
||||
syn match yardRaise "@raise" contained
|
||||
syn match yardReturn "@return" contained
|
||||
syn match yardSee "@see" contained
|
||||
syn match yardSince "@since" contained
|
||||
syn match yardTodo "@todo" contained
|
||||
syn match yardVersion "@version" contained
|
||||
syn match yardYield "@yield" contained
|
||||
syn match yardYieldParam "@yieldparam" contained
|
||||
syn match yardYieldReturn "@yieldreturn" contained
|
||||
syn cluster yardTags contains=yardGenericTag,yardAbstract,yardApi,yardAttr,yardAttrReader,yardAttrWriter,yardAuthor,yardDeprecated,yardExample,yardNote,yardOption,yardOverload,yardParam,yardParamName,yardPrivate,yardRaise,yardReturn,yardSee,yardSince,yardTodo,yardVersion,yardYield,yardYieldParam,yardYieldReturn
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Directives
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardGenericDirective "@!\h\+" contained
|
||||
syn match yardAttribute "@!attribute" contained
|
||||
syn match yardEndGroup "@!endgroup" contained
|
||||
syn match yardGroup "@!group" contained
|
||||
syn match yardMacro "@!macro" contained
|
||||
syn match yardMethod "@!method" contained
|
||||
syn match yardParse "@!parse" contained
|
||||
syn match yardScope "@!scope" contained
|
||||
syn match yardVisibility "@!visibility" contained
|
||||
|
||||
syn cluster yardDirectives contains=yardGenericDirective,yardAttribute,yardEndGroup,yardGroup,yardMacro,yardMethod,yardParse,yardScope,yardVisibility
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Types, Lists, and Hashes
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardDuckType "#\h\+" contained
|
||||
syn match yardType "[A-Z]\h\+" contained
|
||||
syn match yardLiteral "\(true\|false\|nil\|self\|void\)" contained
|
||||
syn match yardComma "," nextgroup=@yardTypes contained
|
||||
syn match yardArrow "=>" nextgroup=@yardTypes contained
|
||||
|
||||
syn region yardParametricType start="[A-Z]\+\h\+<" end=">" contains=yardType,yardOrderDependentList,yardComma skipwhite contained
|
||||
syn region yardOrderDependentList start="(" end=")" contains=@yardTypes,yardComma skipwhite contained
|
||||
syn region yardTypeList start="\[" end="]" contains=@yardTypes,yardOrderDependentList,@yardHashes skipwhite contained
|
||||
syn region yardHashAngle start="Hash<" end=">" contains=yardDuckType,yardType,yardLiteral,yardArrow,yardComma skipwhite contained
|
||||
syn region yardHashCurly start="Hash{" end="}" contains=@yardTypes,yardArrow,yardComma skipwhite contained
|
||||
|
||||
syn cluster yardTypes contains=yardDuckType,yardType,yardLiteral,yardParametricType
|
||||
syn cluster yardHashes contains=yardArrow,yardHashAngle,yardHashCurly
|
||||
syn cluster yardLists contains=yardComma,yardTypeList,yardOrderDependentList
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Yard
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
syn match yardComment "#\s*@!\{,1}\h\+.*" contains=@yardTags,@yardDirectives,yardTypeList
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Links
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" @note The links to language syntax classes is done in each language syntax
|
||||
" script.
|
||||
"
|
||||
" Tags
|
||||
hi def link yardAbstract yardGenericTag
|
||||
hi def link yardApi yardGenericTag
|
||||
hi def link yardAttr yardGenericTag
|
||||
hi def link yardAttrReader yardGenericTag
|
||||
hi def link yardAttrWriter yardGenericTag
|
||||
hi def link yardAuthor yardGenericTag
|
||||
hi def link yardDeprecated yardGenericTag
|
||||
hi def link yardExample yardGenericTag
|
||||
hi def link yardNote yardGenericTag
|
||||
hi def link yardOption yardGenericTag
|
||||
hi def link yardOverload yardGenericTag
|
||||
hi def link yardParam yardGenericTag
|
||||
hi def link yardPrivate yardGenericTag
|
||||
hi def link yardRaise yardGenericTag
|
||||
hi def link yardReturn yardGenericTag
|
||||
hi def link yardSee yardGenericTag
|
||||
hi def link yardSince yardGenericTag
|
||||
hi def link yardTodo yardGenericTag
|
||||
hi def link yardVersion yardGenericTag
|
||||
hi def link yardYield yardGenericTag
|
||||
hi def link yardYieldParam yardGenericTag
|
||||
hi def link yardYieldReturn yardGenericTag
|
||||
" Directives
|
||||
hi def link yardAttribute yardGenericDirective
|
||||
hi def link yardEndGroup yardGenericDirective
|
||||
hi def link yardGroup yardGenericDirective
|
||||
hi def link yardMacro yardGenericDirective
|
||||
hi def link yardMethod yardGenericDirective
|
||||
hi def link yardParse yardGenericDirective
|
||||
hi def link yardScope yardGenericDirective
|
||||
hi def link yardVisibility yardGenericDirective
|
||||
" Types
|
||||
hi def link yardComma yardComment
|
||||
hi def link yardType yardComment
|
||||
hi def link yardDuckType yardComment
|
||||
hi def link yardLiteral yardComment
|
||||
" Lists
|
||||
hi def link yardTypeList yardComment
|
||||
hi def link yardParametricType yardComment
|
||||
" Hashes
|
||||
hi def link yardArrow yardComment
|
||||
hi def link yardHashAngle yardComment
|
||||
hi def link yardHashCurly yardComment
|
||||
@@ -1,6 +1,9 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zinit') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'zinit', 'after/syntax/zsh.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2019 Sebastian Gniazdowski
|
||||
" Copyright (c) 2021 Joakim Gottzén
|
||||
"
|
||||
" Syntax highlighting for Zinit commands in any file of type `zsh'.
|
||||
" It adds definitions for the Zinit syntax to the ones from the
|
||||
@@ -8,119 +11,163 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zinit') == -1
|
||||
|
||||
" Main Zinit command.
|
||||
" Should be the only TOP rule for the whole syntax.
|
||||
syntax match ZinitCommand /\<zinit\>\s/me=e-1
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSubCommands,ZinitPluginSubCommands,ZinitSnippetSubCommands
|
||||
\ contains=ZinitSubCommands,ZinitPluginSubCommands,ZinitSnippetSubCommands
|
||||
syn match ZinitCommand '\(^\|\s\)zinit\s'ms=e-5,me=e-1 skipwhite
|
||||
\ nextgroup=ZinitCommand,ZinitIceCommand,ZinitPluginCommand,ZinitSnippetCommand,ZinitForCommand,ZinitContinue,ZinitIceWithParam,ZinitIce
|
||||
|
||||
" TODO: add options for e.g. light
|
||||
syntax match ZinitSubCommands /\s\<\%(ice\|compinit\|env-whitelist\|cdreplay\|cdclear\|update\)\>\s/ms=s+1,me=e-1
|
||||
\ contained
|
||||
syn match ZinitCommand '\s\%(help\|man\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(unload\)\>'ms=s+1 skipwhite contained " load,light and snippet are handled elsewhere
|
||||
syn match ZinitCommand '\s\%(clist\|completions\|cdisable\|cenable\|creinstall\|cuninstall\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(csearch\|compinit\|cclear\|cdlist\|cdreplay\|cdclear\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(dtrace\|dstart\|dstop\|dunload\|dreport\|dclear\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(times\|zstatus\|report\|loaded\|list\|ls\|status\|recently\|bindkeys\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(compile\|uncompile\|compiled\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(self-update\|update\|delete\|cd\|edit\|glance\|stress\|changes\|create\)\>'ms=s+1 skipwhite contained
|
||||
syn match ZinitCommand '\s\%(srv\|recall\|env-whitelist\|module\|add-fpath\|fpath\|run\)\>'ms=s+1 skipwhite contained
|
||||
|
||||
syntax match ZinitPluginSubCommands /\s\<\%(light\|load\)\>\s/ms=s+1,me=e-1
|
||||
\ skipwhite nextgroup=ZinitPlugin1,ZinitPlugin2,ZinitPlugin3
|
||||
\ contains=ZinitPlugin1,ZinitPlugin2,ZinitPlugin3
|
||||
syn match ZinitIceCommand '\sice\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitIce,ZinitIceWithParam
|
||||
|
||||
syntax match ZinitSnippetSubCommands /\s\<\%(snippet\)\>\s/ms=s+1,me=e-1
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetShorthands1,ZinitSnippetShorthands2
|
||||
\ contains=ZinitSnippetShorthands1,ZinitSnippetShorthands2
|
||||
syn match ZinitPluginCommand '\s\%(light\|load\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitPlugin,ZinitContinue
|
||||
|
||||
" "user/plugin"
|
||||
syntax match ZinitPlugin1 /\s["]\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)["]/ms=s+1,hs=s+2,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn match ZinitSnippetCommand '\s\%(snippet\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitSnippet,ZinitContinue
|
||||
|
||||
" 'user/plugin'
|
||||
syntax match ZinitPlugin2 /\s[']\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)[']/ms=s+1,hs=s+2,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn match ZinitForCommand '\sfor\s'ms=s+1,me=e-1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
" user/plugin
|
||||
syntax match ZinitPlugin3 /\s\%([!-_]*\%(\/[!-_]\+\)\+\|[!-_]\+\)/ms=s+1,me=e+2
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
syn cluster ZinitLine contains=ZinitIce,ZinitIceWithParam,ZinitPlugin,ZinitSnippet,ZinitForCommand
|
||||
|
||||
" OMZ:: or PZT::
|
||||
" TODO: 'OMZ:: or 'PZT::
|
||||
syntax match ZinitSnippetShorthands1 /\s\<\%(\%(OMZ\|PZT\)\>::\|\)/hs=s+1,he=e-2
|
||||
\ contained
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetUrl1,ZinitSnippetUrl2
|
||||
\ contains=ZinitSnippetUrl1,ZinitSnippetUrl2
|
||||
syn match ZinitContinue '\s\\\s*$'ms=s+1,me=s+2 skipwhite contained skipnl
|
||||
\ nextgroup=@ZinitLine
|
||||
|
||||
" "OMZ:: or "PZT::
|
||||
syntax match ZinitSnippetShorthands2 /\s["]\%(\%(OMZ\|PZT\)\>::\|\)/hs=s+2,he=e-2
|
||||
\ contained
|
||||
\ skipwhite
|
||||
\ nextgroup=ZinitSnippetUrl3,ZinitSnippetUrl4
|
||||
\ contains=ZinitSnippetUrl3,ZinitSnippetUrl4
|
||||
" user/plugin or @user/plugin
|
||||
syn match ZinitPlugin '\s@\?\<[a-zA-Z0-9][a-zA-Z0-9_\-]*\/[a-zA-Z0-9_\-\.]\+\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
syntax match ZinitSnippetUrl3 /\<\%(http:\/\/\|https:\/\/\|ftp:\/\/\|\$HOME\|\/\)[!-_]\+\%(\/[!-_]\+\)*\/\?["]/he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" shorthands
|
||||
syn match ZinitSnippet '\s\%(OMZ[LPT]\?\|PZT[M]\?\)::[a-zA-Z0-9_\-\.\/]\+\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" url
|
||||
syn match ZinitSnippet '\s\%(http[s]\?\|ftp\):\/\/[[:alnum:]%\/_#.-]*\>'ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" "$VAR" local path
|
||||
syn match ZinitSnippet +\s"\$\<[a-zA-Z0-9_]\+[^"]*"+ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
" "${VAR}" local path
|
||||
syn match ZinitSnippet +\s"\${\<[a-zA-Z0-9_]\+}[^"]*"+ms=s+1 skipwhite contained
|
||||
\ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue
|
||||
|
||||
" TODO: Fix ZinitTrailingWhiteSpace not matching
|
||||
syntax match ZinitSnippetUrl4 /\%(\%(OMZ\|PZT\)::\)[!-_]\+\%(\/[!-_]\+\)*\/\?["]/hs=s+5,he=e-1
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" ices which takes a param enclosed in "
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(proto\|from\|ver\|bpick\|depth\|cloneopts\|pullopts\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(pick\|src\|multisrc\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wait\|load\|unload\|if\|has\|subscribe\|on-update-of\|trigger-load\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(mv\|cp\|atclone\|atpull\|atinit\|atload\|atdelete\|make\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(as\|id-as\|compile\|nocompile\|service\|bindmap\|wrap-track\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(extract\|subst\|autoload\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wrap\|ps-on-unload\|ps-on-update\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
|
||||
" http://… or https://… or ftp://… or $HOME/… or /…
|
||||
" TODO: Fix $HOME/… and /… not matching
|
||||
syntax match ZinitSnippetUrl1 /\<\%(http:\/\/\|https:\/\/\|ftp:\/\/\|\$HOME\|\/\)[!-_]\+\%(\/[!-_]\+\)*\/\?/
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" zinit packages
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
|
||||
" TODO: Fix ZinitTrailingWhiteSpace not matching
|
||||
syntax match ZinitSnippetUrl2 /\<\%(\%(OMZ\|PZT\)::\)[!-_]\+\%(\/[!-_]\+\)*\/\?/hs=s+5
|
||||
\ contained
|
||||
\ nextgroup=ZinitTrailingWhiteSpace
|
||||
\ contains=ZinitTrailingWhiteSpace
|
||||
" added by the existing annexes
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(fbin\|lbin\|sbin\|gem\|node\|pip\|fmod\|fsrc\|ferc\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(dl\|patch\|submods\|cargo\|dlink\|dlink0\)"+ skip=+\\"+ end=+"+ skipwhite contained
|
||||
\ nextgroup=@ZinitLine,ZinitContinue
|
||||
\ contains=ZinitIceDoubleQuoteParam
|
||||
|
||||
syntax match ZinitTrailingWhiteSpace /[[:space:]]\+$/ contained
|
||||
syn match ZinitIceDoubleQuoteParam +[^"]*+ contained
|
||||
|
||||
" TODO: differentiate the no-value ices
|
||||
" TODO: use contained
|
||||
syntax match ZinitIceSubCommand /\sice\s/ms=s+1,me=e-1 nextgroup=ZinitIceModifiers
|
||||
syntax match ZinitIceModifiers /\s\<\%(svn\|proto\|from\|teleid\|bindmap\|cloneopts\|id-as\|depth\|if\|wait\|load\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(unload\|blockf\|on-update-of\|subscribe\|pick\|bpick\|src\|as\|ver\|silent\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(lucid\|notify\|mv\|cp\|atinit\|atclone\|atload\|atpull\|nocd\|run-atpull\|has\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(cloneonly\|make\|service\|trackbinds\|multisrc\|compile\|nocompile\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(nocompletions\|reset-prompt\|wrap-track\|reset\|aliases\|sh\|bash\|ksh\|csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(\\!sh\|!sh\|\\!bash\|!bash\|\\!ksh\|!ksh\|\\!csh\|!csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(blockf\|silent\|lucid\|trackbinds\|cloneonly\|nocd\|run-atpull\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(\|sh\|\!sh\|bash\|\!bash\|ksh\|\!ksh\|csh\|\!csh\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(nocompletions\|svn\|aliases\|trigger-load\)\>/ms=s+1
|
||||
syntax match ZinitIceModifiers /\s\<\%(light-mode\|is-snippet\|countdown\|ps-on-unload\|ps-on-update\)\>/ms=s+1
|
||||
|
||||
" 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, 'ada') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'ada', 'autoload/ada.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Description: Perform Ada specific completion & tagging.
|
||||
@@ -69,13 +71,13 @@ if exists ('g:ada_with_gnat_project_files')
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Section: add standart exception {{{2
|
||||
" Section: add standard exception {{{2
|
||||
"
|
||||
for Item in ['Constraint_Error', 'Program_Error', 'Storage_Error', 'Tasking_Error', 'Status_Error', 'Mode_Error', 'Name_Error', 'Use_Error', 'Device_Error', 'End_Error', 'Data_Error', 'Layout_Error', 'Length_Error', 'Pattern_Error', 'Index_Error', 'Translation_Error', 'Time_Error', 'Argument_Error', 'Tag_Error', 'Picture_Error', 'Terminator_Error', 'Conversion_Error', 'Pointer_Error', 'Dereference_Error', 'Update_Error']
|
||||
let g:ada#Keywords += [{
|
||||
\ 'word': Item,
|
||||
\ 'menu': 'exception',
|
||||
\ 'info': 'Ada standart exception.',
|
||||
\ 'info': 'Ada standard exception.',
|
||||
\ 'kind': 'x',
|
||||
\ 'icase': 1}]
|
||||
endfor
|
||||
@@ -212,7 +214,7 @@ function ada#Word (...)
|
||||
let l:Line = substitute (getline (l:Line_Nr), g:ada#Comment, '', '' )
|
||||
|
||||
" Cope with tag searching for items in comments; if we are, don't loop
|
||||
" backards looking for previous lines
|
||||
" backwards looking for previous lines
|
||||
if l:Column_Nr > strlen(l:Line)
|
||||
" We were in a comment
|
||||
let l:Line = getline(l:Line_Nr)
|
||||
@@ -637,5 +639,3 @@ finish " 1}}}
|
||||
"------------------------------------------------------------------------------
|
||||
" vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab
|
||||
" vim: foldmethod=marker
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rust', 'autoload/cargo.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! cargo#Load()
|
||||
" Utility call to get this script loaded, for debugging
|
||||
@@ -147,5 +149,3 @@ function! cargo#runtarget(args)
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'rust', 'autoload/cargo/quickfix.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! cargo#quickfix#CmdPre() abort
|
||||
if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo' &&
|
||||
@@ -27,5 +29,3 @@ function! cargo#quickfix#CmdPost() abort
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
||||
endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
autoload/coc/source/requirements.vim
Normal file
24
autoload/coc/source/requirements.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/coc/source/requirements.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
function! coc#source#requirements#init() abort
|
||||
return {
|
||||
\ 'shortcut': 'pip',
|
||||
\ 'priority': 9,
|
||||
\ 'filetypes': ['requirements'],
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
"
|
||||
" Completion pip option and PYPI package names.
|
||||
" Note: completion PYPI package names need install pip-cache from PYPI,
|
||||
" and run `pip-cache update` first to generate cache.
|
||||
function! coc#source#requirements#complete(opt, cb) abort
|
||||
call a:cb(g:requirements#items)
|
||||
endfunction
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'coffee-script', 'autoload/coffee.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <mick@kochm.co>
|
||||
@@ -54,5 +56,3 @@ function! coffee#CoffeeSetUpErrorFormat()
|
||||
\%f:%l:%c:\ error:\ %m,
|
||||
\%-G%.%#
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'crystal', 'autoload/crystal/indent.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Variables {{{1
|
||||
" =========
|
||||
@@ -94,7 +96,7 @@ lockvar g:crystal#indent#block_regex
|
||||
" Regex that defines the beginning of a hanging expression.
|
||||
let g:crystal#indent#hanging_assignment_regex =
|
||||
\ '\%('.g:crystal#indent#operator_regex.'\s*\)\@<=' .
|
||||
\ '\.\@1<!\<\%(if\||unless\|case\|begin\)\>'
|
||||
\ '\.\@1<!\<\%(if\||unless\|case\|begin\|select\)\>'
|
||||
lockvar g:crystal#indent#hanging_assignment_regex
|
||||
|
||||
" Regex that defines the start-match for the 'end' keyword.
|
||||
@@ -105,7 +107,7 @@ let g:crystal#indent#end_start_regex =
|
||||
\ '\%(\<\%(private\|protected\)\s\+\)\=' .
|
||||
\ '\%(\<\%(abstract\s\+\)\=\%(class\|struct\)\>\|\<\%(def\|module\|macro\|lib\|enum\|annotation\)\>\)' .
|
||||
\ '\|' .
|
||||
\ '\<\%(if\|unless\|while\|until\|case\|begin\|union\)\>' .
|
||||
\ '\<\%(if\|unless\|while\|until\|case\|begin\|union\|select\)\>' .
|
||||
\ '\)' .
|
||||
\ '\|' .
|
||||
\ g:crystal#indent#hanging_assignment_regex .
|
||||
@@ -1041,4 +1043,3 @@ endfunction
|
||||
" }}}1
|
||||
|
||||
" vim:sw=2 sts=2 ts=8 fdm=marker et:
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'crystal', 'autoload/crystal_lang.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:V = vital#crystal#new()
|
||||
let s:P = s:V.import('Process')
|
||||
@@ -363,5 +365,3 @@ function! crystal_lang#expand(file, pos, ...) abort
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 sts=2 et:
|
||||
|
||||
endif
|
||||
|
||||
176
autoload/csv.vim
176
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
|
||||
@@ -220,6 +222,15 @@ fu! csv#LocalSettings(type) "{{{3
|
||||
endif
|
||||
endfu
|
||||
|
||||
fu! csv#RemoveAutoHighlight() "{{{3
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au! CursorMoved <buffer=".bufnr('').">"
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
HiColumn!
|
||||
endfu
|
||||
|
||||
fu! csv#DoAutoCommands() "{{{3
|
||||
" Highlight column, on which the cursor is
|
||||
if exists("g:csv_highlight_column") && g:csv_highlight_column =~? 'y'
|
||||
@@ -231,12 +242,7 @@ fu! csv#DoAutoCommands() "{{{3
|
||||
" Set highlighting for column, on which the cursor is currently
|
||||
HiColumn
|
||||
else
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au! CursorMoved <buffer=".bufnr('').">"
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
HiColumn!
|
||||
call csv#RemoveAutoHighlight()
|
||||
endif
|
||||
" undo autocommand:
|
||||
let b:undo_ftplugin .= '| exe "sil! au! CSV_HI'.bufnr('').' CursorMoved <buffer> "'
|
||||
@@ -537,7 +543,7 @@ fu! csv#WColumn(...) "{{{3
|
||||
let temp=getpos('.')[2]
|
||||
let j=1
|
||||
let ret = 1
|
||||
for i in sort(b:csv_fixed_width_cols, s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
for i in sort(b:csv_fixed_width_cols, s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
if temp >= i
|
||||
let ret = j
|
||||
endif
|
||||
@@ -547,6 +553,9 @@ fu! csv#WColumn(...) "{{{3
|
||||
call setpos('.',_cur)
|
||||
return ret
|
||||
endfu
|
||||
fu! csv#ValidComment() "{{{3
|
||||
return b:csv_cmt != ['', ''] && !empty(b:csv_cmt[0])
|
||||
endfu
|
||||
fu! csv#MaxColumns(...) "{{{3
|
||||
let this_col = exists("a:1")
|
||||
"return maximum number of columns in first 10 lines
|
||||
@@ -559,8 +568,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
|
||||
@@ -604,8 +615,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
|
||||
@@ -767,8 +780,7 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" row for the row for which to calculate the width
|
||||
let b:col_width=[]
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
let vts_save=&vts
|
||||
set vts=
|
||||
setlocal vts=
|
||||
endif
|
||||
try
|
||||
if exists("b:csv_headerline")
|
||||
@@ -788,9 +800,6 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" delete buffer content in variable b:csv_list,
|
||||
" this was only necessary for calculating the max width
|
||||
unlet! b:csv_list s:columnize_count s:decimal_column
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
let &vts=vts_save
|
||||
endif
|
||||
endfu
|
||||
fu! csv#Columnize(field) "{{{3
|
||||
" Internal function, not called from external,
|
||||
@@ -817,8 +826,8 @@ fu! csv#Columnize(field) "{{{3
|
||||
let colnr = s:columnize_count % s:max_cols
|
||||
let width = get(b:col_width, colnr, 20)
|
||||
let align = 'r'
|
||||
if exists('b:csv_arrange_align')
|
||||
let align=b:csv_arrange_align
|
||||
if exists('b:csv_arrange_align') || exists('g:csv_arrange_align')
|
||||
let align=get(b:, 'csv_arrange_align', g:csv_arrange_align)
|
||||
let indx=match(align, '\*')
|
||||
if indx > 0
|
||||
let align = align[0:(indx-1)]. repeat(align[indx-1], len(b:col_width)-indx)
|
||||
@@ -896,7 +905,7 @@ fu! csv#Columnize(field) "{{{3
|
||||
return result
|
||||
else
|
||||
" right align
|
||||
return printf("%*S", width+1 , a:field)
|
||||
return printf("%*S", width , a:field)
|
||||
endif
|
||||
endfun
|
||||
fu! csv#GetColPat(colnr, zs_flag) "{{{3
|
||||
@@ -910,21 +919,26 @@ fu! csv#GetColPat(colnr, zs_flag) "{{{3
|
||||
let pat='\%' . b:csv_fixed_width_cols[-1] . 'v.*'
|
||||
else
|
||||
let pat='\%' . b:csv_fixed_width_cols[(a:colnr - 1)] .
|
||||
\ 'c.\{-}\%' . b:csv_fixed_width_cols[a:colnr] . 'v'
|
||||
\ 'c.*\%<' . (b:csv_fixed_width_cols[a:colnr] + 1) . 'v'
|
||||
endif
|
||||
endif
|
||||
elseif !exists("b:csv_fixed_width_cols")
|
||||
let pat=b:col
|
||||
else
|
||||
let pat='\%' . b:csv_fixed_width_cols[0] . 'v.\{-}' .
|
||||
let pat='\%' . b:csv_fixed_width_cols[0] . 'v.*' .
|
||||
\ (len(b:csv_fixed_width_cols) > 1 ?
|
||||
\ '\%' . b:csv_fixed_width_cols[1] . 'v' :
|
||||
\ '\%<' . (b:csv_fixed_width_cols[1] + 1) . 'v' :
|
||||
\ '')
|
||||
endif
|
||||
return pat . (a:zs_flag ? '\zs' : '')
|
||||
endfu
|
||||
fu! csv#SetupAutoCmd(window,bufnr) "{{{3
|
||||
" Setup QuitPre autocommand to quit cleanly
|
||||
if a:bufnr == 0
|
||||
" something went wrong,
|
||||
" how can this happen?
|
||||
return
|
||||
endif
|
||||
aug CSV_QuitPre
|
||||
au!
|
||||
exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")"
|
||||
@@ -1015,7 +1029,7 @@ fu! csv#SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
" disable airline
|
||||
let w:airline_disabled = 1
|
||||
let win = winnr()
|
||||
setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted
|
||||
setl scrollbind buftype=nofile bufhidden=wipe noswapfile nobuflisted
|
||||
noa wincmd p
|
||||
let b:csv_SplitWindow = win
|
||||
aug CSV_Preview
|
||||
@@ -1113,7 +1127,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
|
||||
@@ -1147,9 +1166,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
|
||||
@@ -1193,7 +1216,7 @@ endfun
|
||||
fu! csv#Sort(bang, line1, line2, colnr) range "{{{3
|
||||
" :Sort command
|
||||
let wsv = winsaveview()
|
||||
let flag = matchstr(a:colnr, '[nixo]')
|
||||
let flag = matchstr(a:colnr, '[nixof]')
|
||||
call csv#CheckHeaderLine()
|
||||
let line1 = a:line1
|
||||
let line2 = a:line2
|
||||
@@ -1244,8 +1267,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]')
|
||||
@@ -1286,10 +1311,9 @@ fu! csv#MoveColumn(start, stop, ...) range "{{{3
|
||||
endif
|
||||
|
||||
" Swap line by line, instead of reading the whole range into memory
|
||||
|
||||
for i in range(a:start, a:stop)
|
||||
let content = getline(i)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt != ['',''] && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" skip comments
|
||||
continue
|
||||
endif
|
||||
@@ -1357,13 +1381,9 @@ fu! csv#DupColumn(start, stop, ...) range "{{{3
|
||||
" skipping comment lines (we could do it with a single :s statement,
|
||||
" but that would fail for the first and last column.
|
||||
|
||||
let commentpat = '\%(\%>'.(a:start-1).'l\V'.
|
||||
\ escape(b:csv_cmt[0], '\\').'\m\)'. '\&\%(\%<'.
|
||||
\ (a:stop+1). 'l\V'. escape(b:csv_cmt[0], '\\'). '\m\)'
|
||||
|
||||
for i in range(a:start, a:stop)
|
||||
let content = getline(i)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" skip comments
|
||||
continue
|
||||
endif
|
||||
@@ -1427,10 +1447,12 @@ fu! csv#AddColumn(start, stop, ...) range "{{{3
|
||||
" skipping comment lines (we could do it with a single :s statement,
|
||||
" but that would fail for the first and last column.
|
||||
|
||||
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], '\\')
|
||||
@@ -1609,7 +1631,7 @@ fu! csv#MaxColumn(list) "{{{3
|
||||
endtry
|
||||
call add(result, str2float(nr))
|
||||
endfor
|
||||
let result = sort(result, s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
let result = sort(result, s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
let ind = len(result) > 9 ? 9 : len(result)
|
||||
if has_key(get(s:, 'additional', {}), 'distinct') && s:additional['distinct']
|
||||
if exists("*uniq")
|
||||
@@ -1670,7 +1692,7 @@ fu! csv#DoForEachColumn(start, stop, bang) range "{{{3
|
||||
endif
|
||||
let t = g:csv_convert
|
||||
let line = getline(item)
|
||||
if line =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt!=['',''] && line =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
" Filter comments out
|
||||
call add(result, line)
|
||||
continue
|
||||
@@ -1734,7 +1756,7 @@ fu! csv#FoldValue(lnum, filter) "{{{3
|
||||
for item in values(a:filter)
|
||||
" always fold comments away
|
||||
let content = getline(a:lnum)
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if b:csv_cmt != ['',''] && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
return 1
|
||||
elseif eval('content' . (item.match ? '!~' : '=~') . 'item.pat')
|
||||
let result += 1
|
||||
@@ -1896,7 +1918,7 @@ fu! csv#GetColumn(line, col, strip) "{{{3
|
||||
" Return Column content at a:line, a:col
|
||||
let a=getline(a:line)
|
||||
" Filter comments out
|
||||
if a =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && a =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
return ''
|
||||
endif
|
||||
|
||||
@@ -1977,7 +1999,7 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
let res[item]+=1
|
||||
endfor
|
||||
|
||||
let max_items = reverse(sort(values(res), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues'))
|
||||
let max_items = reverse(sort(values(res), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues'))
|
||||
" What about the minimum 5 items?
|
||||
let count_items = keys(res)
|
||||
if len(max_items) > topn
|
||||
@@ -1987,7 +2009,6 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
endif
|
||||
|
||||
let title="Nr\tCount\t % \tValue"
|
||||
endif
|
||||
echohl Title
|
||||
echo printf("%s", title)
|
||||
echohl Normal
|
||||
@@ -2056,6 +2077,7 @@ fu! csv#InitCSVFixedWidth() "{{{3
|
||||
endif
|
||||
" Turn off syntax highlighting
|
||||
syn clear
|
||||
call csv#RemoveAutoHighlight()
|
||||
let max_line = line('$') > 10 ? 10 : line('$')
|
||||
let t = getline(1, max_line)
|
||||
let max_len = max(map(t, 'len(split(v:val, ''\zs''))'))
|
||||
@@ -2117,8 +2139,8 @@ fu! csv#InitCSVFixedWidth() "{{{3
|
||||
endw
|
||||
let b:csv_fixed_width_cols=[]
|
||||
let tcc=0
|
||||
let b:csv_fixed_width_cols = sort(keys(Dict), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues')
|
||||
let b:csv_fixed_width = join(sort(keys(Dict), s:csv_numeric_sort ? 'n' : 'csv#CSVSortValues'), ',')
|
||||
let b:csv_fixed_width_cols = sort(keys(Dict), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues')
|
||||
let b:csv_fixed_width = join(sort(keys(Dict), s:csv_numeric_sort ? 'N' : 'csv#CSVSortValues'), ',')
|
||||
call csv#Init(1, line('$'))
|
||||
|
||||
let &l:cc=_cc
|
||||
@@ -2198,7 +2220,15 @@ fu! csv#CSVMappings() "{{{3
|
||||
call csv#Map('nnoremap', 'W', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
call csv#Map('nnoremap', '<C-Right>', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
call csv#Map('nnoremap', 'L', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
|
||||
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>')
|
||||
@@ -2309,7 +2339,7 @@ fu! csv#CommandDefinitions() "{{{3
|
||||
call csv#LocalCmd("NewDelimiter", ':call csv#NewDelimiter(<q-args>, 1, line(''$''))',
|
||||
\ '-nargs=1')
|
||||
call csv#LocalCmd("Duplicates", ':call csv#CheckDuplicates(<q-args>)',
|
||||
\ '-nargs=1 -complete=custom,csv#CompleteColumnNr')
|
||||
\ '-nargs=? -complete=custom,csv#CompleteColumnNr')
|
||||
call csv#LocalCmd('Transpose', ':call csv#Transpose(<line1>, <line2>)',
|
||||
\ '-range=%')
|
||||
call csv#LocalCmd('CSVTabularize', ':call csv#Tabularize(<bang>0,<line1>,<line2>)',
|
||||
@@ -2422,7 +2452,7 @@ fu! csv#NewDelimiter(newdelimiter, firstl, lastl) "{{{3
|
||||
let line=a:firstl
|
||||
while line <= a:lastl
|
||||
" Don't change delimiter for comments
|
||||
if getline(line) =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && getline(line) =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
let line+=1
|
||||
continue
|
||||
endif
|
||||
@@ -2467,7 +2497,7 @@ fu! csv#DuplicateRows(columnlist) "{{{3
|
||||
let i = 1
|
||||
let content = getline(line)
|
||||
" Skip comments
|
||||
if content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
if csv#ValidComment() && content =~ '^\s*\V'. escape(b:csv_cmt[0], '\\')
|
||||
continue
|
||||
endif
|
||||
let cols = split(content, b:col. '\zs')
|
||||
@@ -2497,12 +2527,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
|
||||
@@ -2519,7 +2553,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)
|
||||
@@ -2531,7 +2569,7 @@ fu! csv#Transpose(line1, line2) "{{{3
|
||||
let matrix = []
|
||||
for line in range(a:line1, a:line2)
|
||||
" Filter comments out
|
||||
if getline(line) =~ pat
|
||||
if !empty(pat) && getline(line) =~ pat
|
||||
continue
|
||||
endif
|
||||
let r = []
|
||||
@@ -2687,7 +2725,7 @@ fu! csv#Tabularize(bang, first, last) "{{{3
|
||||
if getline(a:first)[-1:] isnot? b:delimiter
|
||||
let b:col_width[-1] += 1
|
||||
endif
|
||||
let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val)'), s:td.cros). s:td.ecol
|
||||
let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val-1)'), s:td.cros). s:td.ecol
|
||||
|
||||
call csv#NewDelimiter(s:td.vbar, 1, line('$'))
|
||||
"exe printf('sil %d,%ds/%s/%s/ge', a:first, (a:last+adjust_last),
|
||||
@@ -3020,10 +3058,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')
|
||||
@@ -3196,5 +3236,3 @@ endfun
|
||||
|
||||
" Vim Modeline " {{{2
|
||||
" vim: set foldmethod=marker et sw=0 sts=-1 ts=4:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'dart', 'autoload/dart.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
function! s:error(text) abort
|
||||
@@ -29,9 +31,9 @@ endfunction
|
||||
|
||||
function! dart#fmt(...) abort
|
||||
let l:dartfmt = s:FindDartFmt()
|
||||
if type(l:dartfmt) != type('') | return | endif
|
||||
if empty(l:dartfmt) | return | endif
|
||||
let buffer_content = getline(1, '$')
|
||||
let l:cmd = [l:dartfmt, '--stdin-name', shellescape(expand('%'))]
|
||||
let l:cmd = extend(l:dartfmt, ['--stdin-name', shellescape(expand('%'))])
|
||||
if exists('g:dartfmt_options')
|
||||
call extend(l:cmd, g:dartfmt_options)
|
||||
endif
|
||||
@@ -62,33 +64,37 @@ function! dart#fmt(...) abort
|
||||
endfunction
|
||||
|
||||
function! s:FindDartFmt() abort
|
||||
if executable('dartfmt') | return 'dartfmt' | endif
|
||||
if executable('dart')
|
||||
let l:version_text = system('dart --version')
|
||||
let l:match = matchlist(l:version_text,
|
||||
\ '\vDart SDK version: (\d+)\.(\d+)\.\d+.*')
|
||||
if empty(l:match)
|
||||
call s:error('Unable to determine dart version')
|
||||
return []
|
||||
endif
|
||||
let l:major = l:match[1]
|
||||
let l:minor = l:match[2]
|
||||
if l:major > 2 || l:major == 2 && l:minor >= 14
|
||||
return ['dart', 'format']
|
||||
endif
|
||||
endif
|
||||
" Legacy fallback for Dart SDK pre 2.14
|
||||
if executable('dartfmt') | return ['dartfmt'] | endif
|
||||
if executable('flutter')
|
||||
let l:flutter_cmd = resolve(exepath('flutter'))
|
||||
let l:bin = fnamemodify(l:flutter_cmd, ':h')
|
||||
let l:dartfmt = l:bin.'/cache/dart-sdk/bin/dartfmt'
|
||||
if executable(l:dartfmt) | return l:dartfmt | endif
|
||||
if executable(l:dartfmt) | return [l:dartfmt] | endif
|
||||
endif
|
||||
call s:error('Cannot find a `dartfmt` command')
|
||||
endfunction
|
||||
|
||||
function! dart#analyzer(q_args) abort
|
||||
call s:error('DartAnalyzer support has been removed. '.
|
||||
\'If this broke your workflow please comment on '.
|
||||
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||
endfunction
|
||||
|
||||
function! dart#tojs(q_args) abort
|
||||
call s:error('Dart2JS support has been removed. '.
|
||||
\'If this broke your workflow please comment on '.
|
||||
\'https://github.com/dart-lang/dart-vim-plugin/issues/89')
|
||||
return []
|
||||
endfunction
|
||||
|
||||
" Finds the path to `uri`.
|
||||
"
|
||||
" If the file is a package: uri, looks for a .packages file to resolve the path.
|
||||
" If the path cannot be resolved, or is not a package: uri, returns the
|
||||
" original.
|
||||
" If the file is a package: uri, looks for a package_config.json or .packages
|
||||
" file to resolve the path. If the path cannot be resolved, or is not a
|
||||
" package: uri, returns the original.
|
||||
function! dart#resolveUri(uri) abort
|
||||
if a:uri !~# 'package:'
|
||||
return a:uri
|
||||
@@ -96,7 +102,7 @@ function! dart#resolveUri(uri) abort
|
||||
let package_name = substitute(a:uri, 'package:\(\w\+\)\/.*', '\1', '')
|
||||
let [found, package_map] = s:PackageMap()
|
||||
if !found
|
||||
call s:error('cannot find .packages file')
|
||||
call s:error('cannot find .packages or package_config.json file')
|
||||
return a:uri
|
||||
endif
|
||||
if !has_key(package_map, package_name)
|
||||
@@ -110,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
|
||||
@@ -371,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
|
||||
|
||||
@@ -85,5 +155,3 @@ endfunction
|
||||
function! fish#errorformat()
|
||||
return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s'
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
45
autoload/freebasic.vim
Normal file
45
autoload/freebasic.vim
Normal file
@@ -0,0 +1,45 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'freebasic', 'autoload/freebasic.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: FreeBASIC
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2021 Mar 16
|
||||
|
||||
" Dialects can be one of fb, qb, fblite, or deprecated
|
||||
" Precedence is forcelang > #lang > lang
|
||||
function! freebasic#GetDialect() abort
|
||||
if exists("g:freebasic_forcelang")
|
||||
return g:freebasic_forcelang
|
||||
endif
|
||||
|
||||
if exists("g:freebasic_lang")
|
||||
let dialect = g:freebasic_lang
|
||||
else
|
||||
let dialect = "fb"
|
||||
endif
|
||||
|
||||
" override with #lang directive or metacommand
|
||||
|
||||
let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
|
||||
let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
|
||||
|
||||
let save_cursor = getcurpos()
|
||||
call cursor(1, 1)
|
||||
let lnum = search(pat, 'n', '', '', skip)
|
||||
call setpos('.', save_cursor)
|
||||
|
||||
if lnum
|
||||
let word = matchlist(getline(lnum), pat)[1]
|
||||
if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
|
||||
let dialect = word
|
||||
else
|
||||
echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
return dialect
|
||||
endfunction
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
||||
@@ -1,7 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'fsharp', 'autoload/fsharp.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim autoload functions
|
||||
|
||||
if exists('g:loaded_autoload_fsharp')
|
||||
finish
|
||||
endif
|
||||
@@ -10,6 +11,15 @@ let g:loaded_autoload_fsharp = 1
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
" basic setups
|
||||
|
||||
let s:script_root_dir = expand('<sfile>:p:h') . "/../"
|
||||
|
||||
if has('nvim-0.5')
|
||||
lua ionide = require("ionide")
|
||||
endif
|
||||
|
||||
function! s:prompt(msg)
|
||||
let height = &cmdheight
|
||||
if height < 2
|
||||
@@ -19,6 +29,9 @@ function! s:prompt(msg)
|
||||
let &cmdheight = height
|
||||
endfunction
|
||||
|
||||
|
||||
" FSAC payload interfaces
|
||||
|
||||
function! s:PlainNotification(content)
|
||||
return { 'Content': a:content }
|
||||
endfunction
|
||||
@@ -78,8 +91,24 @@ function! s:FsdnRequest(query)
|
||||
return { 'Query': a:query }
|
||||
endfunction
|
||||
|
||||
|
||||
" LSP functions
|
||||
|
||||
function! s:call(method, params, cont)
|
||||
call LanguageClient#Call(a:method, a:params, a:cont)
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#Call(a:method, a:params, a:cont)
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
let key = fsharp#register_callback(a:cont)
|
||||
call luaeval('ionide.call(_A[1], _A[2], _A[3])', [a:method, a:params, key])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:notify(method, params)
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#Notify(a:method, a:params)
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
call luaeval('ionide.notify(_A[1], _A[2])', [a:method, a:params])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:signature(filePath, line, character, cont)
|
||||
@@ -119,8 +148,11 @@ 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',
|
||||
@@ -151,14 +183,14 @@ let s:config_keys_camel =
|
||||
\ {'key': 'EnableAnalyzers', 'default': 0},
|
||||
\ {'key': 'AnalyzersPath'},
|
||||
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'replaceCodeLens', 'prefix': '//'}},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'never', 'prefix': ''}},
|
||||
\ {'key': 'UseSdkScripts', 'default': 1},
|
||||
\ {'key': 'dotNetRoot'},
|
||||
\ {'key': 'fsiExtraParameters', 'default': []},
|
||||
\ ]
|
||||
let s:config_keys = []
|
||||
|
||||
function! fsharp#toSnakeCase(str)
|
||||
function! s:toSnakeCase(str)
|
||||
let sn = substitute(a:str, '\(\<\u\l\+\|\l\+\)\(\u\)', '\l\1_\l\2', 'g')
|
||||
if sn == a:str | return tolower(a:str) | endif
|
||||
return sn
|
||||
@@ -168,7 +200,7 @@ function! s:buildConfigKeys()
|
||||
if len(s:config_keys) == 0
|
||||
for key_camel in s:config_keys_camel
|
||||
let key = {}
|
||||
let key.snake = fsharp#toSnakeCase(key_camel.key)
|
||||
let key.snake = s:toSnakeCase(key_camel.key)
|
||||
let key.camel = key_camel.key
|
||||
if has_key(key_camel, 'default')
|
||||
let key.default = key_camel.default
|
||||
@@ -178,9 +210,9 @@ function! s:buildConfigKeys()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! g:fsharp#getServerConfig()
|
||||
function! fsharp#getServerConfig()
|
||||
let fsharp = {}
|
||||
call s:buildConfigKeys()
|
||||
call s:buildConfigKeys()
|
||||
for key in s:config_keys
|
||||
if exists('g:fsharp#' . key.snake)
|
||||
let fsharp[key.camel] = g:fsharp#{key.snake}
|
||||
@@ -194,54 +226,205 @@ function! g:fsharp#getServerConfig()
|
||||
return fsharp
|
||||
endfunction
|
||||
|
||||
function! g:fsharp#updateServerConfig()
|
||||
function! fsharp#updateServerConfig()
|
||||
let fsharp = fsharp#getServerConfig()
|
||||
let settings = {'settings': {'FSharp': fsharp}}
|
||||
call LanguageClient#Notify('workspace/didChangeConfiguration', settings)
|
||||
call s:notify('workspace/didChangeConfiguration', settings)
|
||||
endfunction
|
||||
|
||||
function! s:findWorkspace(dir, cont)
|
||||
let s:cont_findWorkspace = a:cont
|
||||
function! s:callback_findWorkspace(result)
|
||||
let result = a:result
|
||||
let content = json_decode(result.result.content)
|
||||
if len(content.Data.Found) < 1
|
||||
return []
|
||||
endif
|
||||
let workspace = { 'Type': 'none' }
|
||||
for found in content.Data.Found
|
||||
if workspace.Type == 'none'
|
||||
let workspace = found
|
||||
elseif found.Type == 'solution'
|
||||
if workspace.Type == 'project'
|
||||
let workspace = found
|
||||
else
|
||||
let curLen = len(workspace.Data.Items)
|
||||
let newLen = len(found.Data.Items)
|
||||
if newLen > curLen
|
||||
let workspace = found
|
||||
endif
|
||||
endif
|
||||
function! fsharp#loadConfig()
|
||||
if exists('s:config_is_loaded')
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists('g:fsharp#fsautocomplete_command')
|
||||
let g:fsharp#fsautocomplete_command = ['fsautocomplete', '--background-service-enabled']
|
||||
endif
|
||||
if !exists('g:fsharp#use_recommended_server_config')
|
||||
let g:fsharp#use_recommended_server_config = 1
|
||||
endif
|
||||
call fsharp#getServerConfig()
|
||||
if !exists('g:fsharp#automatic_workspace_init')
|
||||
let g:fsharp#automatic_workspace_init = 1
|
||||
endif
|
||||
if !exists('g:fsharp#automatic_reload_workspace')
|
||||
let g:fsharp#automatic_reload_workspace = 1
|
||||
endif
|
||||
if !exists('g:fsharp#show_signature_on_cursor_move')
|
||||
let g:fsharp#show_signature_on_cursor_move = 0
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_command')
|
||||
let g:fsharp#fsi_command = "dotnet fsi"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_keymap')
|
||||
let g:fsharp#fsi_keymap = "vscode"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_window_command')
|
||||
let g:fsharp#fsi_window_command = "botright 10new"
|
||||
endif
|
||||
if !exists('g:fsharp#fsi_focus_on_send')
|
||||
let g:fsharp#fsi_focus_on_send = 0
|
||||
endif
|
||||
if !exists('g:fsharp#backend')
|
||||
if has('nvim-0.5')
|
||||
if exists('g:LanguageClient_loaded')
|
||||
let g:fsharp#backend = "languageclient-neovim"
|
||||
else
|
||||
let g:fsharp#backend = "nvim"
|
||||
endif
|
||||
endfor
|
||||
if workspace.Type == 'solution'
|
||||
call s:cont_findWorkspace([workspace.Data.Path])
|
||||
else
|
||||
call s:cont_findWorkspace(workspace.Data.Fsprojs)
|
||||
let g:fsharp#backend = "languageclient-neovim"
|
||||
endif
|
||||
endfunction
|
||||
call s:workspacePeek(a:dir, g:fsharp#workspace_mode_peek_deep_level, g:fsharp#exclude_project_directories, function("s:callback_findWorkspace"))
|
||||
endif
|
||||
|
||||
" backend configuration
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
let $DOTNET_ROLL_FORWARD='LatestMajor'
|
||||
if !exists('g:LanguageClient_serverCommands')
|
||||
let g:LanguageClient_serverCommands = {}
|
||||
endif
|
||||
if !has_key(g:LanguageClient_serverCommands, 'fsharp')
|
||||
let g:LanguageClient_serverCommands.fsharp = {
|
||||
\ 'name': 'fsautocomplete',
|
||||
\ 'command': g:fsharp#fsautocomplete_command,
|
||||
\ 'initializationOptions': {},
|
||||
\}
|
||||
if g:fsharp#automatic_workspace_init
|
||||
let g:LanguageClient_serverCommands.fsharp.initializationOptions = {
|
||||
\ 'AutomaticWorkspaceInit': v:true,
|
||||
\}
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists('g:LanguageClient_rootMarkers')
|
||||
let g:LanguageClient_rootMarkers = {}
|
||||
endif
|
||||
if !has_key(g:LanguageClient_rootMarkers, 'fsharp')
|
||||
let g:LanguageClient_rootMarkers.fsharp = ['*.sln', '*.fsproj', '.git']
|
||||
endif
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
if !exists('g:fsharp#lsp_auto_setup')
|
||||
let g:fsharp#lsp_auto_setup = 1
|
||||
endif
|
||||
if !exists('g:fsharp#lsp_recommended_colorscheme')
|
||||
let g:fsharp#lsp_recommended_colorscheme = 1
|
||||
endif
|
||||
if !exists('g:fsharp#lsp_codelens')
|
||||
let g:fsharp#lsp_codelens = 1
|
||||
endif
|
||||
|
||||
else
|
||||
if g:fsharp#backend != 'disable'
|
||||
echoerr "[FSAC] Invalid backend: " . g:fsharp#backend
|
||||
endif
|
||||
endif
|
||||
|
||||
" FSI keymaps
|
||||
if g:fsharp#fsi_keymap == "vscode"
|
||||
if has('nvim')
|
||||
let g:fsharp#fsi_keymap_send = "<M-cr>"
|
||||
let g:fsharp#fsi_keymap_toggle = "<M-@>"
|
||||
else
|
||||
let g:fsharp#fsi_keymap_send = "<esc><cr>"
|
||||
let g:fsharp#fsi_keymap_toggle = "<esc>@"
|
||||
endif
|
||||
elseif g:fsharp#fsi_keymap == "vim-fsharp"
|
||||
let g:fsharp#fsi_keymap_send = "<leader>i"
|
||||
let g:fsharp#fsi_keymap_toggle = "<leader>e"
|
||||
elseif g:fsharp#fsi_keymap == "custom"
|
||||
let g:fsharp#fsi_keymap = "none"
|
||||
if !exists('g:fsharp#fsi_keymap_send')
|
||||
echoerr "g:fsharp#fsi_keymap_send is not set"
|
||||
elseif !exists('g:fsharp#fsi_keymap_toggle')
|
||||
echoerr "g:fsharp#fsi_keymap_toggle is not set"
|
||||
else
|
||||
let g:fsharp#fsi_keymap = "custom"
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:config_is_loaded = 1
|
||||
endfunction
|
||||
|
||||
|
||||
" handlers for notifications
|
||||
|
||||
let s:handlers = {
|
||||
\ 'fsharp/notifyWorkspace': 'fsharp#handle_notifyWorkspace',
|
||||
\ }
|
||||
|
||||
function! s:registerAutocmds()
|
||||
if g:fsharp#backend == 'nvim' && g:fsharp#lsp_codelens
|
||||
augroup FSharp_AutoRefreshCodeLens
|
||||
autocmd!
|
||||
autocmd CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
|
||||
augroup END
|
||||
endif
|
||||
if g:fsharp#backend != 'disable'
|
||||
augroup FSharp_OnCursorMove
|
||||
autocmd!
|
||||
autocmd CursorMoved *.fs,*.fsi,*.fsx call fsharp#OnCursorMove()
|
||||
augroup END
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#initialize()
|
||||
echom '[FSAC] Initialized'
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient_registerHandlers(s:handlers)
|
||||
endif
|
||||
call fsharp#updateServerConfig()
|
||||
call s:registerAutocmds()
|
||||
endfunction
|
||||
|
||||
|
||||
" nvim-lsp specific functions
|
||||
|
||||
" handlers are picked up by ionide.setup()
|
||||
function! fsharp#get_handlers()
|
||||
return s:handlers
|
||||
endfunction
|
||||
|
||||
let s:callbacks = {}
|
||||
|
||||
function! fsharp#register_callback(fn)
|
||||
if g:fsharp#backend != 'nvim'
|
||||
return -1
|
||||
endif
|
||||
let rnd = reltimestr(reltime())
|
||||
let s:callbacks[rnd] = a:fn
|
||||
return rnd
|
||||
endfunction
|
||||
|
||||
function! fsharp#resolve_callback(key, arg)
|
||||
if g:fsharp#backend != 'nvim'
|
||||
return
|
||||
endif
|
||||
if has_key(s:callbacks, a:key)
|
||||
let Callback = s:callbacks[a:key]
|
||||
call Callback(a:arg)
|
||||
call remove(s:callbacks, a:key)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" .NET/F# specific operations
|
||||
|
||||
let s:workspace = []
|
||||
|
||||
function! fsharp#handle_notifyWorkspace(payload) abort
|
||||
let content = json_decode(a:payload.content)
|
||||
if content.Kind == 'projectLoading'
|
||||
echom "[FSAC] Loading" content.Data.Project
|
||||
let s:workspace = uniq(sort(add(s:workspace, content.Data.Project)))
|
||||
elseif content.Kind == 'workspaceLoad' && content.Data.Status == 'finished'
|
||||
echom printf("[FSAC] Workspace loaded (%d project(s))", len(s:workspace))
|
||||
call fsharp#updateServerConfig()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:load(arg)
|
||||
let s:loading_workspace = a:arg
|
||||
function! s:callback_load(_)
|
||||
echo "[FSAC] Workspace loaded: " . join(s:loading_workspace, ', ')
|
||||
let s:workspace = s:workspace + s:loading_workspace
|
||||
endfunction
|
||||
call s:workspaceLoad(a:arg, function("s:callback_load"))
|
||||
call s:workspaceLoad(a:arg, v:null)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadProject(...)
|
||||
@@ -252,23 +435,15 @@ function! fsharp#loadProject(...)
|
||||
call s:load(prjs)
|
||||
endfunction
|
||||
|
||||
function! fsharp#loadWorkspaceAuto()
|
||||
if &ft == 'fsharp'
|
||||
call fsharp#updateServerConfig()
|
||||
if g:fsharp#automatic_workspace_init
|
||||
echom "[FSAC] Loading workspace..."
|
||||
let bufferDirectory = fnamemodify(resolve(expand('%:p')), ':h')
|
||||
call s:findWorkspace(bufferDirectory, function("s:load"))
|
||||
endif
|
||||
endif
|
||||
function! fsharp#showLoadedProjects()
|
||||
for proj in s:workspace
|
||||
echo "-" proj
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! fsharp#reloadProjects()
|
||||
if len(s:workspace) > 0
|
||||
function! s:callback_reloadProjects(_)
|
||||
call s:prompt("[FSAC] Workspace reloaded.")
|
||||
endfunction
|
||||
call s:workspaceLoad(s:workspace, function("s:callback_reloadProjects"))
|
||||
call s:workspaceLoad(s:workspace, v:null)
|
||||
else
|
||||
echom "[FSAC] Workspace is empty"
|
||||
endif
|
||||
@@ -286,7 +461,7 @@ function! fsharp#showSignature()
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
echom substitute(content.Data, '\n\+$', ' ', 'g')
|
||||
echo substitute(content.Data, '\n\+$', ' ', 'g')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@@ -300,8 +475,25 @@ function! fsharp#OnCursorMove()
|
||||
endfunction
|
||||
|
||||
function! fsharp#showF1Help()
|
||||
let result = s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1)
|
||||
echo result
|
||||
function! s:callback_showF1Help(result)
|
||||
let result = a:result
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
let url = 'https://docs.microsoft.com/en-us/dotnet/api/' . substitute(content.Data, '#ctor', '-ctor', 'g')
|
||||
echo url
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
call s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showF1Help"))
|
||||
endfunction
|
||||
|
||||
function! s:hover()
|
||||
if g:fsharp#backend == 'languageclient-neovim'
|
||||
call LanguageClient#textDocument_hover()
|
||||
elseif g:fsharp#backend == 'nvim'
|
||||
lua vim.lsp.buf.hover()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#showTooltip()
|
||||
@@ -310,7 +502,7 @@ function! fsharp#showTooltip()
|
||||
if exists('result.result.content')
|
||||
let content = json_decode(result.result.content)
|
||||
if exists('content.Data')
|
||||
call LanguageClient#textDocument_hover()
|
||||
call s:hover()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
@@ -318,36 +510,8 @@ function! fsharp#showTooltip()
|
||||
call s:signature(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showTooltip"))
|
||||
endfunction
|
||||
|
||||
let s:script_root_dir = expand('<sfile>:p:h') . "/../"
|
||||
let s:fsac = fnamemodify(s:script_root_dir . "fsac/fsautocomplete.dll", ":p")
|
||||
let g:fsharp#languageserver_command =
|
||||
\ ['dotnet', s:fsac,
|
||||
\ '--background-service-enabled'
|
||||
\ ]
|
||||
|
||||
function! s:download(branch)
|
||||
echom "[FSAC] Downloading FSAC. This may take a while..."
|
||||
let zip = s:script_root_dir . "fsac.zip"
|
||||
call system(
|
||||
\ 'curl -fLo ' . zip . ' --create-dirs ' .
|
||||
\ '"https://github.com/fsharp/FsAutoComplete/releases/latest/download/fsautocomplete.netcore.zip"'
|
||||
\ )
|
||||
if v:shell_error == 0
|
||||
call system('unzip -o -d ' . s:script_root_dir . "/fsac " . zip)
|
||||
echom "[FSAC] Updated FsAutoComplete to version " . a:branch . ""
|
||||
else
|
||||
echom "[FSAC] Failed to update FsAutoComplete"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fsharp#updateFSAC(...)
|
||||
if len(a:000) == 0
|
||||
let branch = "master"
|
||||
else
|
||||
let branch = a:000[0]
|
||||
endif
|
||||
call s:download(branch)
|
||||
endfunction
|
||||
" FSI integration
|
||||
|
||||
let s:fsi_buffer = -1
|
||||
let s:fsi_job = -1
|
||||
@@ -377,7 +541,6 @@ endfunction
|
||||
function! fsharp#openFsi(returnFocus)
|
||||
if bufwinid(s:fsi_buffer) <= 0
|
||||
let fsi_command = s:get_fsi_command()
|
||||
" Neovim
|
||||
if exists('*termopen') || exists('*term_start')
|
||||
let current_win = win_getid()
|
||||
execute g:fsharp#fsi_window_command
|
||||
@@ -421,7 +584,7 @@ function! fsharp#openFsi(returnFocus)
|
||||
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
|
||||
return s:fsi_buffer
|
||||
else
|
||||
echom "[FSAC] Your Vim does not support terminal".
|
||||
echom "[FSAC] Your (neo)vim does not support terminal".
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
@@ -465,10 +628,10 @@ function! fsharp#sendFsi(text)
|
||||
if fsharp#openFsi(!g:fsharp#fsi_focus_on_send) > 0
|
||||
" Neovim
|
||||
if has('nvim')
|
||||
call chansend(s:fsi_job, a:text . ";;". "\n")
|
||||
call chansend(s:fsi_job, a:text . "\n" . ";;". "\n")
|
||||
" Vim 8
|
||||
else
|
||||
call term_sendkeys(s:fsi_buffer, a:text . ";;" . "\<cr>")
|
||||
call term_sendkeys(s:fsi_buffer, a:text . "\<cr>" . ";;" . "\<cr>")
|
||||
call term_wait(s:fsi_buffer)
|
||||
endif
|
||||
endif
|
||||
@@ -513,5 +676,3 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=4 et sts=4
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'gitignore', 'autoload/fzf_gitignore.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -37,5 +39,3 @@ function! fzf_gitignore#run() abort
|
||||
endfunction
|
||||
|
||||
" vim: ts=2 et sw=2
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'go', 'autoload/go/config.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" don't spam the user when Vim is started in Vi compatibility mode
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! go#config#AutodetectGopath() abort
|
||||
return get(g:, 'go_autodetect_gopath', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#ListTypeCommands() abort
|
||||
return get(g:, 'go_list_type_commands', {})
|
||||
endfunction
|
||||
@@ -217,6 +215,14 @@ function! go#config#DebugWindows() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugSubstitutePaths() abort
|
||||
return get(g:, 'go_debug_substitute_paths', [])
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugPreserveLayout() abort
|
||||
return get(g:, 'go_debug_preserve_layout', 0)
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugAddress() abort
|
||||
return get(g:, 'go_debug_address', '127.0.0.1:8181')
|
||||
endfunction
|
||||
@@ -265,14 +271,15 @@ 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
|
||||
let l:default = []
|
||||
if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint'
|
||||
let l:default = ['govet', 'golint']
|
||||
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)
|
||||
@@ -280,15 +287,15 @@ endfunction
|
||||
|
||||
function! go#config#MetalinterEnabled() abort
|
||||
let l:default = []
|
||||
if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint'
|
||||
let l:default = ['vet', 'golint', 'errcheck']
|
||||
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
|
||||
@@ -312,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
|
||||
@@ -356,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
|
||||
@@ -385,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
|
||||
@@ -612,6 +619,10 @@ function! go#config#DebugMappings() abort
|
||||
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
|
||||
@@ -623,5 +634,3 @@ let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'autoload/graphql.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
"
|
||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
" of this software and associated documentation files (the "Software"), to
|
||||
@@ -35,5 +37,3 @@ endfunction
|
||||
function! graphql#javascript_tags() abort
|
||||
return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
20
autoload/hcl.vim
Normal file
20
autoload/hcl.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'terraform', 'autoload/hcl.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
function! hcl#align() abort
|
||||
let p = '^.*=[^>]*$'
|
||||
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
|
||||
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
|
||||
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
|
||||
Tabularize/=.*/l1
|
||||
normal! 0
|
||||
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let &cpoptions = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'html5', 'autoload/htmlcomplete.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim completion script
|
||||
" Language: HTML and XHTML
|
||||
@@ -841,5 +843,3 @@ function! htmlcomplete#CheckDoctype() " {{{
|
||||
endfunction
|
||||
" }}}
|
||||
" vim:set foldmethod=marker:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsonnet', 'autoload/jsonnet.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -125,5 +127,3 @@ function! jsonnet#Format()
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'autoload/jsx_pretty/comment.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! jsx_pretty#comment#update_commentstring(original)
|
||||
let line = getline(".")
|
||||
@@ -37,5 +39,3 @@ function! s:syn_contains(lnum, cnum, syn_name)
|
||||
let syn_names = map(stack, 'synIDattr(v:val, "name")')
|
||||
return index(syn_names, a:syn_name) >= 0
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1)
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'jsx', 'autoload/jsx_pretty/indent.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('*shiftwidth')
|
||||
function! s:sw()
|
||||
@@ -302,5 +304,3 @@ function! jsx_pretty#indent#get(js_indent)
|
||||
|
||||
return a:js_indent()
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! julia#set_syntax_version(jvers)
|
||||
echo "The julia#set_syntax_version function is deprecated"
|
||||
@@ -165,5 +167,3 @@ function! julia#gotodefinition()
|
||||
return
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia/doc.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" path to the julia binary to communicate with
|
||||
if has('win32') || has('win64')
|
||||
@@ -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
|
||||
|
||||
@@ -242,5 +244,3 @@ function! s:likely(str) abort
|
||||
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.9.0-DEV.16
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -265,7 +267,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\^c': 'ᶜ',
|
||||
\ '\^f': 'ᶠ',
|
||||
\ '\^iota': 'ᶥ',
|
||||
\ '\^Phi': 'ᶲ',
|
||||
\ '\^ltphi': 'ᶲ',
|
||||
\ '\^z': 'ᶻ',
|
||||
\ '\^theta': 'ᶿ',
|
||||
\ '\enspace': ' ',
|
||||
@@ -279,8 +281,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\lq': '‘',
|
||||
\ '\rq': '’',
|
||||
\ '\reapos': '‛',
|
||||
\ '\quotedblleft': '“',
|
||||
\ '\quotedblright': '”',
|
||||
\ '\ldq': '“',
|
||||
\ '\rdq': '”',
|
||||
\ '\dagger': '†',
|
||||
\ '\ddagger': '‡',
|
||||
\ '\bullet': '•',
|
||||
@@ -372,10 +374,12 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\scrH': 'ℋ',
|
||||
\ '\frakH': 'ℌ',
|
||||
\ '\bbH': 'ℍ',
|
||||
\ '\ith': 'ℎ',
|
||||
\ '\planck': 'ℎ',
|
||||
\ '\hslash': 'ℏ',
|
||||
\ '\scrI': 'ℐ',
|
||||
\ '\Im': 'ℑ',
|
||||
\ '\frakI': 'ℑ',
|
||||
\ '\scrL': 'ℒ',
|
||||
\ '\ell': 'ℓ',
|
||||
\ '\bbN': 'ℕ',
|
||||
@@ -385,6 +389,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bbQ': 'ℚ',
|
||||
\ '\scrR': 'ℛ',
|
||||
\ '\Re': 'ℜ',
|
||||
\ '\frakR': 'ℜ',
|
||||
\ '\bbR': 'ℝ',
|
||||
\ '\xrat': '℞',
|
||||
\ '\trademark': '™',
|
||||
@@ -757,7 +762,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\veebar': '⊻',
|
||||
\ '\xor': '⊻',
|
||||
\ '\barwedge': '⊼',
|
||||
\ '\nand': '⊼',
|
||||
\ '\barvee': '⊽',
|
||||
\ '\nor': '⊽',
|
||||
\ '\rightanglearc': '⊾',
|
||||
\ '\varlrtriangle': '⊿',
|
||||
\ '\bigwedge': '⋀',
|
||||
@@ -1007,6 +1014,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\astrosun': '☉',
|
||||
\ '\:phone:': '☎',
|
||||
\ '\:ballot_box_with_check:': '☑',
|
||||
\ '\:umbrella_with_rain_drops:': '☔',
|
||||
\ '\:umbrella:': '☔',
|
||||
\ '\:coffee:': '☕',
|
||||
\ '\:point_up:': '☝',
|
||||
@@ -1095,6 +1103,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:soccer:': '⚽',
|
||||
\ '\:baseball:': '⚾',
|
||||
\ '\:snowman:': '⛄',
|
||||
\ '\:snowman_without_snow:': '⛄',
|
||||
\ '\:partly_sunny:': '⛅',
|
||||
\ '\:ophiuchus:': '⛎',
|
||||
\ '\:no_entry:': '⛔',
|
||||
@@ -1350,8 +1359,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\intcup': '⨚',
|
||||
\ '\upint': '⨛',
|
||||
\ '\lowint': '⨜',
|
||||
\ '\Join': '⨝',
|
||||
\ '\join': '⨝',
|
||||
\ '\bbsemi': '⨟',
|
||||
\ '\ringplus': '⨢',
|
||||
\ '\plushat': '⨣',
|
||||
\ '\simplus': '⨤',
|
||||
@@ -1539,6 +1548,11 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\forksnot': '⫝',
|
||||
\ '\dashV': '⫣',
|
||||
\ '\Dashv': '⫤',
|
||||
\ '\Top': '⫪',
|
||||
\ '\downvDash': '⫪',
|
||||
\ '\upvDash': '⫫',
|
||||
\ '\Bot': '⫫',
|
||||
\ '\indep': '⫫',
|
||||
\ '\interleave': '⫴',
|
||||
\ '\tdcol': '⫶',
|
||||
\ '\lllnest': '⫷',
|
||||
@@ -1623,6 +1637,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:part_alternation_mark:': '〽',
|
||||
\ '\:congratulations:': '㊗',
|
||||
\ '\:secret:': '㊙',
|
||||
\ '\^uparrow': 'ꜛ',
|
||||
\ '\^downarrow': 'ꜜ',
|
||||
\ '\^!': 'ꜝ',
|
||||
\ '\bfA': '𝐀',
|
||||
\ '\bfB': '𝐁',
|
||||
\ '\bfC': '𝐂',
|
||||
@@ -2307,7 +2324,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfbeta': '𝛃',
|
||||
\ '\bfgamma': '𝛄',
|
||||
\ '\bfdelta': '𝛅',
|
||||
\ '\bfepsilon': '𝛆',
|
||||
\ '\bfvarepsilon': '𝛆',
|
||||
\ '\bfzeta': '𝛇',
|
||||
\ '\bfeta': '𝛈',
|
||||
\ '\bftheta': '𝛉',
|
||||
@@ -2329,7 +2346,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bfpsi': '𝛙',
|
||||
\ '\bfomega': '𝛚',
|
||||
\ '\bfpartial': '𝛛',
|
||||
\ '\bfvarepsilon': '𝛜',
|
||||
\ '\bfepsilon': '𝛜',
|
||||
\ '\bfvartheta': '𝛝',
|
||||
\ '\bfvarkappa': '𝛞',
|
||||
\ '\bfphi': '𝛟',
|
||||
@@ -2365,7 +2382,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\itbeta': '𝛽',
|
||||
\ '\itgamma': '𝛾',
|
||||
\ '\itdelta': '𝛿',
|
||||
\ '\itepsilon': '𝜀',
|
||||
\ '\itvarepsilon': '𝜀',
|
||||
\ '\itzeta': '𝜁',
|
||||
\ '\iteta': '𝜂',
|
||||
\ '\ittheta': '𝜃',
|
||||
@@ -2382,15 +2399,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\itsigma': '𝜎',
|
||||
\ '\ittau': '𝜏',
|
||||
\ '\itupsilon': '𝜐',
|
||||
\ '\itphi': '𝜑',
|
||||
\ '\itvarphi': '𝜑',
|
||||
\ '\itchi': '𝜒',
|
||||
\ '\itpsi': '𝜓',
|
||||
\ '\itomega': '𝜔',
|
||||
\ '\itpartial': '𝜕',
|
||||
\ '\itvarepsilon': '𝜖',
|
||||
\ '\itepsilon': '𝜖',
|
||||
\ '\itvartheta': '𝜗',
|
||||
\ '\itvarkappa': '𝜘',
|
||||
\ '\itvarphi': '𝜙',
|
||||
\ '\itphi': '𝜙',
|
||||
\ '\itvarrho': '𝜚',
|
||||
\ '\itvarpi': '𝜛',
|
||||
\ '\biAlpha': '𝜜',
|
||||
@@ -2423,7 +2440,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bibeta': '𝜷',
|
||||
\ '\bigamma': '𝜸',
|
||||
\ '\bidelta': '𝜹',
|
||||
\ '\biepsilon': '𝜺',
|
||||
\ '\bivarepsilon': '𝜺',
|
||||
\ '\bizeta': '𝜻',
|
||||
\ '\bieta': '𝜼',
|
||||
\ '\bitheta': '𝜽',
|
||||
@@ -2440,15 +2457,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisigma': '𝝈',
|
||||
\ '\bitau': '𝝉',
|
||||
\ '\biupsilon': '𝝊',
|
||||
\ '\biphi': '𝝋',
|
||||
\ '\bivarphi': '𝝋',
|
||||
\ '\bichi': '𝝌',
|
||||
\ '\bipsi': '𝝍',
|
||||
\ '\biomega': '𝝎',
|
||||
\ '\bipartial': '𝝏',
|
||||
\ '\bivarepsilon': '𝝐',
|
||||
\ '\biepsilon': '𝝐',
|
||||
\ '\bivartheta': '𝝑',
|
||||
\ '\bivarkappa': '𝝒',
|
||||
\ '\bivarphi': '𝝓',
|
||||
\ '\biphi': '𝝓',
|
||||
\ '\bivarrho': '𝝔',
|
||||
\ '\bivarpi': '𝝕',
|
||||
\ '\bsansAlpha': '𝝖',
|
||||
@@ -2481,7 +2498,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bsansbeta': '𝝱',
|
||||
\ '\bsansgamma': '𝝲',
|
||||
\ '\bsansdelta': '𝝳',
|
||||
\ '\bsansepsilon': '𝝴',
|
||||
\ '\bsansvarepsilon': '𝝴',
|
||||
\ '\bsanszeta': '𝝵',
|
||||
\ '\bsanseta': '𝝶',
|
||||
\ '\bsanstheta': '𝝷',
|
||||
@@ -2498,15 +2515,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bsanssigma': '𝞂',
|
||||
\ '\bsanstau': '𝞃',
|
||||
\ '\bsansupsilon': '𝞄',
|
||||
\ '\bsansphi': '𝞅',
|
||||
\ '\bsansvarphi': '𝞅',
|
||||
\ '\bsanschi': '𝞆',
|
||||
\ '\bsanspsi': '𝞇',
|
||||
\ '\bsansomega': '𝞈',
|
||||
\ '\bsanspartial': '𝞉',
|
||||
\ '\bsansvarepsilon': '𝞊',
|
||||
\ '\bsansepsilon': '𝞊',
|
||||
\ '\bsansvartheta': '𝞋',
|
||||
\ '\bsansvarkappa': '𝞌',
|
||||
\ '\bsansvarphi': '𝞍',
|
||||
\ '\bsansphi': '𝞍',
|
||||
\ '\bsansvarrho': '𝞎',
|
||||
\ '\bsansvarpi': '𝞏',
|
||||
\ '\bisansAlpha': '𝞐',
|
||||
@@ -2539,7 +2556,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisansbeta': '𝞫',
|
||||
\ '\bisansgamma': '𝞬',
|
||||
\ '\bisansdelta': '𝞭',
|
||||
\ '\bisansepsilon': '𝞮',
|
||||
\ '\bisansvarepsilon': '𝞮',
|
||||
\ '\bisanszeta': '𝞯',
|
||||
\ '\bisanseta': '𝞰',
|
||||
\ '\bisanstheta': '𝞱',
|
||||
@@ -2556,15 +2573,15 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\bisanssigma': '𝞼',
|
||||
\ '\bisanstau': '𝞽',
|
||||
\ '\bisansupsilon': '𝞾',
|
||||
\ '\bisansphi': '𝞿',
|
||||
\ '\bisansvarphi': '𝞿',
|
||||
\ '\bisanschi': '𝟀',
|
||||
\ '\bisanspsi': '𝟁',
|
||||
\ '\bisansomega': '𝟂',
|
||||
\ '\bisanspartial': '𝟃',
|
||||
\ '\bisansvarepsilon': '𝟄',
|
||||
\ '\bisansepsilon': '𝟄',
|
||||
\ '\bisansvartheta': '𝟅',
|
||||
\ '\bisansvarkappa': '𝟆',
|
||||
\ '\bisansvarphi': '𝟇',
|
||||
\ '\bisansphi': '𝟇',
|
||||
\ '\bisansvarrho': '𝟈',
|
||||
\ '\bisansvarpi': '𝟉',
|
||||
\ '\bfDigamma': '𝟊',
|
||||
@@ -2684,6 +2701,9 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:sun_with_face:': '🌞',
|
||||
\ '\:star2:': '🌟',
|
||||
\ '\:stars:': '🌠',
|
||||
\ '\:hotdog:': '🌭',
|
||||
\ '\:taco:': '🌮',
|
||||
\ '\:burrito:': '🌯',
|
||||
\ '\:chestnut:': '🌰',
|
||||
\ '\:seedling:': '🌱',
|
||||
\ '\:evergreen_tree:': '🌲',
|
||||
@@ -2750,7 +2770,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:cake:': '🍰',
|
||||
\ '\:bento:': '🍱',
|
||||
\ '\:stew:': '🍲',
|
||||
\ '\:egg:': '🍳',
|
||||
\ '\:fried_egg:': '🍳',
|
||||
\ '\:fork_and_knife:': '🍴',
|
||||
\ '\:tea:': '🍵',
|
||||
\ '\:sake:': '🍶',
|
||||
@@ -2760,6 +2780,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:beer:': '🍺',
|
||||
\ '\:beers:': '🍻',
|
||||
\ '\:baby_bottle:': '🍼',
|
||||
\ '\:champagne:': '🍾',
|
||||
\ '\:popcorn:': '🍿',
|
||||
\ '\:ribbon:': '🎀',
|
||||
\ '\:gift:': '🎁',
|
||||
\ '\:birthday:': '🎂',
|
||||
@@ -2817,11 +2839,17 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:snowboarder:': '🏂',
|
||||
\ '\:runner:': '🏃',
|
||||
\ '\:surfer:': '🏄',
|
||||
\ '\:sports_medal:': '🏅',
|
||||
\ '\:trophy:': '🏆',
|
||||
\ '\:horse_racing:': '🏇',
|
||||
\ '\:football:': '🏈',
|
||||
\ '\:rugby_football:': '🏉',
|
||||
\ '\:swimmer:': '🏊',
|
||||
\ '\:cricket_bat_and_ball:': '🏏',
|
||||
\ '\:volleyball:': '🏐',
|
||||
\ '\:field_hockey_stick_and_ball:': '🏑',
|
||||
\ '\:ice_hockey_stick_and_puck:': '🏒',
|
||||
\ '\:table_tennis_paddle_and_ball:': '🏓',
|
||||
\ '\:house:': '🏠',
|
||||
\ '\:house_with_garden:': '🏡',
|
||||
\ '\:office:': '🏢',
|
||||
@@ -2839,6 +2867,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:izakaya_lantern:': '🏮',
|
||||
\ '\:japanese_castle:': '🏯',
|
||||
\ '\:european_castle:': '🏰',
|
||||
\ '\:waving_black_flag:': '🏴',
|
||||
\ '\:badminton_racquet_and_shuttlecock:': '🏸',
|
||||
\ '\:bow_and_arrow:': '🏹',
|
||||
\ '\:amphora:': '🏺',
|
||||
\ '\:skin-tone-2:': '🏻',
|
||||
\ '\:skin-tone-3:': '🏼',
|
||||
\ '\:skin-tone-4:': '🏽',
|
||||
@@ -2874,7 +2906,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:bug:': '🐛',
|
||||
\ '\:ant:': '🐜',
|
||||
\ '\:bee:': '🐝',
|
||||
\ '\:beetle:': '🐞',
|
||||
\ '\:ladybug:': '🐞',
|
||||
\ '\:fish:': '🐟',
|
||||
\ '\:tropical_fish:': '🐠',
|
||||
\ '\:blowfish:': '🐡',
|
||||
@@ -2950,6 +2982,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:woman:': '👩',
|
||||
\ '\:family:': '👪',
|
||||
\ '\:couple:': '👫',
|
||||
\ '\:man_and_woman_holding_hands:': '👫',
|
||||
\ '\:two_men_holding_hands:': '👬',
|
||||
\ '\:two_women_holding_hands:': '👭',
|
||||
\ '\:cop:': '👮',
|
||||
@@ -3068,6 +3101,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:pager:': '📟',
|
||||
\ '\:fax:': '📠',
|
||||
\ '\:satellite:': '📡',
|
||||
\ '\:satellite_antenna:': '📡',
|
||||
\ '\:loudspeaker:': '📢',
|
||||
\ '\:mega:': '📣',
|
||||
\ '\:outbox_tray:': '📤',
|
||||
@@ -3090,10 +3124,12 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:no_mobile_phones:': '📵',
|
||||
\ '\:signal_strength:': '📶',
|
||||
\ '\:camera:': '📷',
|
||||
\ '\:camera_with_flash:': '📸',
|
||||
\ '\:video_camera:': '📹',
|
||||
\ '\:tv:': '📺',
|
||||
\ '\:radio:': '📻',
|
||||
\ '\:vhs:': '📼',
|
||||
\ '\:prayer_beads:': '📿',
|
||||
\ '\:twisted_rightwards_arrows:': '🔀',
|
||||
\ '\:repeat:': '🔁',
|
||||
\ '\:repeat_one:': '🔂',
|
||||
@@ -3156,6 +3192,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:small_red_triangle_down:': '🔻',
|
||||
\ '\:arrow_up_small:': '🔼',
|
||||
\ '\:arrow_down_small:': '🔽',
|
||||
\ '\:kaaba:': '🕋',
|
||||
\ '\:mosque:': '🕌',
|
||||
\ '\:synagogue:': '🕍',
|
||||
\ '\:menorah_with_nine_branches:': '🕎',
|
||||
\ '\:clock1:': '🕐',
|
||||
\ '\:clock2:': '🕑',
|
||||
\ '\:clock3:': '🕒',
|
||||
@@ -3180,6 +3220,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:clock1030:': '🕥',
|
||||
\ '\:clock1130:': '🕦',
|
||||
\ '\:clock1230:': '🕧',
|
||||
\ '\:man_dancing:': '🕺',
|
||||
\ '\:middle_finger:': '🖕',
|
||||
\ '\:spock-hand:': '🖖',
|
||||
\ '\:black_heart:': '🖤',
|
||||
\ '\:mount_fuji:': '🗻',
|
||||
\ '\:tokyo_tower:': '🗼',
|
||||
\ '\:statue_of_liberty:': '🗽',
|
||||
@@ -3250,6 +3294,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:pouting_cat:': '😾',
|
||||
\ '\:crying_cat_face:': '😿',
|
||||
\ '\:scream_cat:': '🙀',
|
||||
\ '\:slightly_frowning_face:': '🙁',
|
||||
\ '\:slightly_smiling_face:': '🙂',
|
||||
\ '\:upside_down_face:': '🙃',
|
||||
\ '\:face_with_rolling_eyes:': '🙄',
|
||||
\ '\:no_good:': '🙅',
|
||||
\ '\:ok_woman:': '🙆',
|
||||
\ '\:bow:': '🙇',
|
||||
@@ -3330,7 +3378,328 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:passport_control:': '🛂',
|
||||
\ '\:customs:': '🛃',
|
||||
\ '\:baggage_claim:': '🛄',
|
||||
\ '\:left_luggage:': '🛅'}
|
||||
\ '\:left_luggage:': '🛅',
|
||||
\ '\:sleeping_accommodation:': '🛌',
|
||||
\ '\:place_of_worship:': '🛐',
|
||||
\ '\:octagonal_sign:': '🛑',
|
||||
\ '\:shopping_trolley:': '🛒',
|
||||
\ '\:hindu_temple:': '🛕',
|
||||
\ '\:hut:': '🛖',
|
||||
\ '\:elevator:': '🛗',
|
||||
\ '\:airplane_departure:': '🛫',
|
||||
\ '\:airplane_arriving:': '🛬',
|
||||
\ '\:scooter:': '🛴',
|
||||
\ '\:motor_scooter:': '🛵',
|
||||
\ '\:canoe:': '🛶',
|
||||
\ '\:sled:': '🛷',
|
||||
\ '\:flying_saucer:': '🛸',
|
||||
\ '\:skateboard:': '🛹',
|
||||
\ '\:auto_rickshaw:': '🛺',
|
||||
\ '\:pickup_truck:': '🛻',
|
||||
\ '\:roller_skate:': '🛼',
|
||||
\ '\:large_orange_circle:': '🟠',
|
||||
\ '\:large_yellow_circle:': '🟡',
|
||||
\ '\:large_green_circle:': '🟢',
|
||||
\ '\:large_purple_circle:': '🟣',
|
||||
\ '\:large_brown_circle:': '🟤',
|
||||
\ '\:large_red_square:': '🟥',
|
||||
\ '\:large_blue_square:': '🟦',
|
||||
\ '\:large_orange_square:': '🟧',
|
||||
\ '\:large_yellow_square:': '🟨',
|
||||
\ '\:large_green_square:': '🟩',
|
||||
\ '\:large_purple_square:': '🟪',
|
||||
\ '\:large_brown_square:': '🟫',
|
||||
\ '\:pinched_fingers:': '🤌',
|
||||
\ '\:white_heart:': '🤍',
|
||||
\ '\:brown_heart:': '🤎',
|
||||
\ '\:pinching_hand:': '🤏',
|
||||
\ '\:zipper_mouth_face:': '🤐',
|
||||
\ '\:money_mouth_face:': '🤑',
|
||||
\ '\:face_with_thermometer:': '🤒',
|
||||
\ '\:nerd_face:': '🤓',
|
||||
\ '\:thinking_face:': '🤔',
|
||||
\ '\:face_with_head_bandage:': '🤕',
|
||||
\ '\:robot_face:': '🤖',
|
||||
\ '\:hugging_face:': '🤗',
|
||||
\ '\:the_horns:': '🤘',
|
||||
\ '\:call_me_hand:': '🤙',
|
||||
\ '\:raised_back_of_hand:': '🤚',
|
||||
\ '\:left-facing_fist:': '🤛',
|
||||
\ '\:right-facing_fist:': '🤜',
|
||||
\ '\:handshake:': '🤝',
|
||||
\ '\:crossed_fingers:': '🤞',
|
||||
\ '\:i_love_you_hand_sign:': '🤟',
|
||||
\ '\:face_with_cowboy_hat:': '🤠',
|
||||
\ '\:clown_face:': '🤡',
|
||||
\ '\:nauseated_face:': '🤢',
|
||||
\ '\:rolling_on_the_floor_laughing:': '🤣',
|
||||
\ '\:drooling_face:': '🤤',
|
||||
\ '\:lying_face:': '🤥',
|
||||
\ '\:face_palm:': '🤦',
|
||||
\ '\:sneezing_face:': '🤧',
|
||||
\ '\:face_with_raised_eyebrow:': '🤨',
|
||||
\ '\:star-struck:': '🤩',
|
||||
\ '\:zany_face:': '🤪',
|
||||
\ '\:shushing_face:': '🤫',
|
||||
\ '\:face_with_symbols_on_mouth:': '🤬',
|
||||
\ '\:face_with_hand_over_mouth:': '🤭',
|
||||
\ '\:face_vomiting:': '🤮',
|
||||
\ '\:exploding_head:': '🤯',
|
||||
\ '\:pregnant_woman:': '🤰',
|
||||
\ '\:breast-feeding:': '🤱',
|
||||
\ '\:palms_up_together:': '🤲',
|
||||
\ '\:selfie:': '🤳',
|
||||
\ '\:prince:': '🤴',
|
||||
\ '\:person_in_tuxedo:': '🤵',
|
||||
\ '\:mrs_claus:': '🤶',
|
||||
\ '\:shrug:': '🤷',
|
||||
\ '\:person_doing_cartwheel:': '🤸',
|
||||
\ '\:juggling:': '🤹',
|
||||
\ '\:fencer:': '🤺',
|
||||
\ '\:wrestlers:': '🤼',
|
||||
\ '\:water_polo:': '🤽',
|
||||
\ '\:handball:': '🤾',
|
||||
\ '\:diving_mask:': '🤿',
|
||||
\ '\:wilted_flower:': '🥀',
|
||||
\ '\:drum_with_drumsticks:': '🥁',
|
||||
\ '\:clinking_glasses:': '🥂',
|
||||
\ '\:tumbler_glass:': '🥃',
|
||||
\ '\:spoon:': '🥄',
|
||||
\ '\:goal_net:': '🥅',
|
||||
\ '\:first_place_medal:': '🥇',
|
||||
\ '\:second_place_medal:': '🥈',
|
||||
\ '\:third_place_medal:': '🥉',
|
||||
\ '\:boxing_glove:': '🥊',
|
||||
\ '\:martial_arts_uniform:': '🥋',
|
||||
\ '\:curling_stone:': '🥌',
|
||||
\ '\:lacrosse:': '🥍',
|
||||
\ '\:softball:': '🥎',
|
||||
\ '\:flying_disc:': '🥏',
|
||||
\ '\:croissant:': '🥐',
|
||||
\ '\:avocado:': '🥑',
|
||||
\ '\:cucumber:': '🥒',
|
||||
\ '\:bacon:': '🥓',
|
||||
\ '\:potato:': '🥔',
|
||||
\ '\:carrot:': '🥕',
|
||||
\ '\:baguette_bread:': '🥖',
|
||||
\ '\:green_salad:': '🥗',
|
||||
\ '\:shallow_pan_of_food:': '🥘',
|
||||
\ '\:stuffed_flatbread:': '🥙',
|
||||
\ '\:egg:': '🥚',
|
||||
\ '\:glass_of_milk:': '🥛',
|
||||
\ '\:peanuts:': '🥜',
|
||||
\ '\:kiwifruit:': '🥝',
|
||||
\ '\:pancakes:': '🥞',
|
||||
\ '\:dumpling:': '🥟',
|
||||
\ '\:fortune_cookie:': '🥠',
|
||||
\ '\:takeout_box:': '🥡',
|
||||
\ '\:chopsticks:': '🥢',
|
||||
\ '\:bowl_with_spoon:': '🥣',
|
||||
\ '\:cup_with_straw:': '🥤',
|
||||
\ '\:coconut:': '🥥',
|
||||
\ '\:broccoli:': '🥦',
|
||||
\ '\:pie:': '🥧',
|
||||
\ '\:pretzel:': '🥨',
|
||||
\ '\:cut_of_meat:': '🥩',
|
||||
\ '\:sandwich:': '🥪',
|
||||
\ '\:canned_food:': '🥫',
|
||||
\ '\:leafy_green:': '🥬',
|
||||
\ '\:mango:': '🥭',
|
||||
\ '\:moon_cake:': '🥮',
|
||||
\ '\:bagel:': '🥯',
|
||||
\ '\:smiling_face_with_3_hearts:': '🥰',
|
||||
\ '\:yawning_face:': '🥱',
|
||||
\ '\:smiling_face_with_tear:': '🥲',
|
||||
\ '\:partying_face:': '🥳',
|
||||
\ '\:woozy_face:': '🥴',
|
||||
\ '\:hot_face:': '🥵',
|
||||
\ '\:cold_face:': '🥶',
|
||||
\ '\:ninja:': '🥷',
|
||||
\ '\:disguised_face:': '🥸',
|
||||
\ '\:pleading_face:': '🥺',
|
||||
\ '\:sari:': '🥻',
|
||||
\ '\:lab_coat:': '🥼',
|
||||
\ '\:goggles:': '🥽',
|
||||
\ '\:hiking_boot:': '🥾',
|
||||
\ '\:womans_flat_shoe:': '🥿',
|
||||
\ '\:crab:': '🦀',
|
||||
\ '\:lion_face:': '🦁',
|
||||
\ '\:scorpion:': '🦂',
|
||||
\ '\:turkey:': '🦃',
|
||||
\ '\:unicorn_face:': '🦄',
|
||||
\ '\:eagle:': '🦅',
|
||||
\ '\:duck:': '🦆',
|
||||
\ '\:bat:': '🦇',
|
||||
\ '\:shark:': '🦈',
|
||||
\ '\:owl:': '🦉',
|
||||
\ '\:fox_face:': '🦊',
|
||||
\ '\:butterfly:': '🦋',
|
||||
\ '\:deer:': '🦌',
|
||||
\ '\:gorilla:': '🦍',
|
||||
\ '\:lizard:': '🦎',
|
||||
\ '\:rhinoceros:': '🦏',
|
||||
\ '\:shrimp:': '🦐',
|
||||
\ '\:squid:': '🦑',
|
||||
\ '\:giraffe_face:': '🦒',
|
||||
\ '\:zebra_face:': '🦓',
|
||||
\ '\:hedgehog:': '🦔',
|
||||
\ '\:sauropod:': '🦕',
|
||||
\ '\:t-rex:': '🦖',
|
||||
\ '\:cricket:': '🦗',
|
||||
\ '\:kangaroo:': '🦘',
|
||||
\ '\:llama:': '🦙',
|
||||
\ '\:peacock:': '🦚',
|
||||
\ '\:hippopotamus:': '🦛',
|
||||
\ '\:parrot:': '🦜',
|
||||
\ '\:raccoon:': '🦝',
|
||||
\ '\:lobster:': '🦞',
|
||||
\ '\:mosquito:': '🦟',
|
||||
\ '\:microbe:': '🦠',
|
||||
\ '\:badger:': '🦡',
|
||||
\ '\:swan:': '🦢',
|
||||
\ '\:mammoth:': '🦣',
|
||||
\ '\:dodo:': '🦤',
|
||||
\ '\:sloth:': '🦥',
|
||||
\ '\:otter:': '🦦',
|
||||
\ '\:orangutan:': '🦧',
|
||||
\ '\:skunk:': '🦨',
|
||||
\ '\:flamingo:': '🦩',
|
||||
\ '\:oyster:': '🦪',
|
||||
\ '\:beaver:': '🦫',
|
||||
\ '\:bison:': '🦬',
|
||||
\ '\:seal:': '🦭',
|
||||
\ '\:guide_dog:': '🦮',
|
||||
\ '\:probing_cane:': '🦯',
|
||||
\ '\:bone:': '🦴',
|
||||
\ '\:leg:': '🦵',
|
||||
\ '\:foot:': '🦶',
|
||||
\ '\:tooth:': '🦷',
|
||||
\ '\:superhero:': '🦸',
|
||||
\ '\:supervillain:': '🦹',
|
||||
\ '\:safety_vest:': '🦺',
|
||||
\ '\:ear_with_hearing_aid:': '🦻',
|
||||
\ '\:motorized_wheelchair:': '🦼',
|
||||
\ '\:manual_wheelchair:': '🦽',
|
||||
\ '\:mechanical_arm:': '🦾',
|
||||
\ '\:mechanical_leg:': '🦿',
|
||||
\ '\:cheese_wedge:': '🧀',
|
||||
\ '\:cupcake:': '🧁',
|
||||
\ '\:salt:': '🧂',
|
||||
\ '\:beverage_box:': '🧃',
|
||||
\ '\:garlic:': '🧄',
|
||||
\ '\:onion:': '🧅',
|
||||
\ '\:falafel:': '🧆',
|
||||
\ '\:waffle:': '🧇',
|
||||
\ '\:butter:': '🧈',
|
||||
\ '\:mate_drink:': '🧉',
|
||||
\ '\:ice_cube:': '🧊',
|
||||
\ '\:bubble_tea:': '🧋',
|
||||
\ '\:standing_person:': '🧍',
|
||||
\ '\:kneeling_person:': '🧎',
|
||||
\ '\:deaf_person:': '🧏',
|
||||
\ '\:face_with_monocle:': '🧐',
|
||||
\ '\:adult:': '🧑',
|
||||
\ '\:child:': '🧒',
|
||||
\ '\:older_adult:': '🧓',
|
||||
\ '\:bearded_person:': '🧔',
|
||||
\ '\:person_with_headscarf:': '🧕',
|
||||
\ '\:person_in_steamy_room:': '🧖',
|
||||
\ '\:person_climbing:': '🧗',
|
||||
\ '\:person_in_lotus_position:': '🧘',
|
||||
\ '\:mage:': '🧙',
|
||||
\ '\:fairy:': '🧚',
|
||||
\ '\:vampire:': '🧛',
|
||||
\ '\:merperson:': '🧜',
|
||||
\ '\:elf:': '🧝',
|
||||
\ '\:genie:': '🧞',
|
||||
\ '\:zombie:': '🧟',
|
||||
\ '\:brain:': '🧠',
|
||||
\ '\:orange_heart:': '🧡',
|
||||
\ '\:billed_cap:': '🧢',
|
||||
\ '\:scarf:': '🧣',
|
||||
\ '\:gloves:': '🧤',
|
||||
\ '\:coat:': '🧥',
|
||||
\ '\:socks:': '🧦',
|
||||
\ '\:red_envelope:': '🧧',
|
||||
\ '\:firecracker:': '🧨',
|
||||
\ '\:jigsaw:': '🧩',
|
||||
\ '\:test_tube:': '🧪',
|
||||
\ '\:petri_dish:': '🧫',
|
||||
\ '\:dna:': '🧬',
|
||||
\ '\:compass:': '🧭',
|
||||
\ '\:abacus:': '🧮',
|
||||
\ '\:fire_extinguisher:': '🧯',
|
||||
\ '\:toolbox:': '🧰',
|
||||
\ '\:bricks:': '🧱',
|
||||
\ '\:magnet:': '🧲',
|
||||
\ '\:luggage:': '🧳',
|
||||
\ '\:lotion_bottle:': '🧴',
|
||||
\ '\:thread:': '🧵',
|
||||
\ '\:yarn:': '🧶',
|
||||
\ '\:safety_pin:': '🧷',
|
||||
\ '\:teddy_bear:': '🧸',
|
||||
\ '\:broom:': '🧹',
|
||||
\ '\:basket:': '🧺',
|
||||
\ '\:roll_of_paper:': '🧻',
|
||||
\ '\:soap:': '🧼',
|
||||
\ '\:sponge:': '🧽',
|
||||
\ '\:receipt:': '🧾',
|
||||
\ '\:nazar_amulet:': '🧿',
|
||||
\ '\:ballet_shoes:': '🩰',
|
||||
\ '\:one-piece_swimsuit:': '🩱',
|
||||
\ '\:briefs:': '🩲',
|
||||
\ '\:shorts:': '🩳',
|
||||
\ '\:thong_sandal:': '🩴',
|
||||
\ '\:drop_of_blood:': '🩸',
|
||||
\ '\:adhesive_bandage:': '🩹',
|
||||
\ '\:stethoscope:': '🩺',
|
||||
\ '\:yo-yo:': '🪀',
|
||||
\ '\:kite:': '🪁',
|
||||
\ '\:parachute:': '🪂',
|
||||
\ '\:boomerang:': '🪃',
|
||||
\ '\:magic_wand:': '🪄',
|
||||
\ '\:pinata:': '🪅',
|
||||
\ '\:nesting_dolls:': '🪆',
|
||||
\ '\:ringed_planet:': '🪐',
|
||||
\ '\:chair:': '🪑',
|
||||
\ '\:razor:': '🪒',
|
||||
\ '\:axe:': '🪓',
|
||||
\ '\:diya_lamp:': '🪔',
|
||||
\ '\:banjo:': '🪕',
|
||||
\ '\:military_helmet:': '🪖',
|
||||
\ '\:accordion:': '🪗',
|
||||
\ '\:long_drum:': '🪘',
|
||||
\ '\:coin:': '🪙',
|
||||
\ '\:carpentry_saw:': '🪚',
|
||||
\ '\:screwdriver:': '🪛',
|
||||
\ '\:ladder:': '🪜',
|
||||
\ '\:hook:': '🪝',
|
||||
\ '\:mirror:': '🪞',
|
||||
\ '\:window:': '🪟',
|
||||
\ '\:plunger:': '🪠',
|
||||
\ '\:sewing_needle:': '🪡',
|
||||
\ '\:knot:': '🪢',
|
||||
\ '\:bucket:': '🪣',
|
||||
\ '\:mouse_trap:': '🪤',
|
||||
\ '\:toothbrush:': '🪥',
|
||||
\ '\:headstone:': '🪦',
|
||||
\ '\:placard:': '🪧',
|
||||
\ '\:rock:': '🪨',
|
||||
\ '\:fly:': '🪰',
|
||||
\ '\:worm:': '🪱',
|
||||
\ '\:beetle:': '🪲',
|
||||
\ '\:cockroach:': '🪳',
|
||||
\ '\:potted_plant:': '🪴',
|
||||
\ '\:wood:': '🪵',
|
||||
\ '\:feather:': '🪶',
|
||||
\ '\:anatomical_heart:': '🫀',
|
||||
\ '\:lungs:': '🫁',
|
||||
\ '\:people_hugging:': '🫂',
|
||||
\ '\:blueberries:': '🫐',
|
||||
\ '\:bell_pepper:': '🫑',
|
||||
\ '\:olive:': '🫒',
|
||||
\ '\:flatbread:': '🫓',
|
||||
\ '\:tamale:': '🫔',
|
||||
\ '\:fondue:': '🫕',
|
||||
\ '\:teapot:': '🫖'}
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ledger') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'ledger', 'autoload/ledger.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
" vim:ts=2:sw=2:sts=2:foldmethod=marker
|
||||
@@ -23,7 +25,7 @@ function! ledger#transaction_state_toggle(lnum, ...) abort
|
||||
endf
|
||||
|
||||
function! ledger#transaction_state_set(lnum, char) abort
|
||||
" modifies or sets the state of the transaction at the cursor,
|
||||
" modifies or sets the state of the transaction at the given line no.,
|
||||
" removing the state altogether if a:char is empty
|
||||
let trans = s:transaction.from_lnum(a:lnum)
|
||||
if empty(trans) || has_key(trans, 'expr')
|
||||
@@ -77,6 +79,69 @@ function! ledger#transaction_date_set(lnum, type, ...) abort
|
||||
call setline(trans['head'], trans.format_head())
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_get(lnum) abort
|
||||
" safe view / position
|
||||
let view = winsaveview()
|
||||
call cursor(a:lnum, 0)
|
||||
|
||||
let line = getline('.')
|
||||
if line[0] !~# '[ \t]'
|
||||
" not a post
|
||||
let state = ''
|
||||
else
|
||||
let m = matchlist(line, '^[ \t]\+\([*?!]\)')
|
||||
if len(m) > 1
|
||||
let state = m[1]
|
||||
else
|
||||
let state = ' '
|
||||
endif
|
||||
endif
|
||||
|
||||
call winrestview(view)
|
||||
return state
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_toggle(lnum, ...) abort
|
||||
if a:0 == 1
|
||||
let chars = a:1
|
||||
else
|
||||
let chars = ' *'
|
||||
endif
|
||||
|
||||
let old = ledger#transaction_post_state_get(a:lnum)
|
||||
if old ==# ''
|
||||
" not a post, probably at the first line of transaction
|
||||
call ledger#transaction_state_toggle(a:lnum, chars)
|
||||
return
|
||||
endif
|
||||
let i = stridx(chars, old) + 1
|
||||
let new = chars[i >= len(chars) ? 0 : i]
|
||||
|
||||
call ledger#transaction_post_state_set(a:lnum, new)
|
||||
endf
|
||||
|
||||
function! ledger#transaction_post_state_set(lnum, char) abort
|
||||
let state = ledger#transaction_post_state_get(a:lnum)
|
||||
if state ==# ''
|
||||
" not a post, probably at the first line of transaction
|
||||
call ledger#transaction_state_set(a:lnum, a:char)
|
||||
return
|
||||
elseif state == a:char || (state ==# ' ' && a:char ==# '')
|
||||
return
|
||||
endif
|
||||
|
||||
let line = getline(a:lnum)
|
||||
if a:char =~# '^\s*$'
|
||||
let newline = substitute(line, '\V' . state . '\m[ \t]', '', '')
|
||||
elseif state ==# ' '
|
||||
let m = matchlist(line, '^\([ \t]\+\)\(.*\)')
|
||||
let newline = m[1] . a:char . ' ' . m[2]
|
||||
else
|
||||
let newline = substitute(line, '\V' . state, a:char, '')
|
||||
endif
|
||||
call setline(a:lnum, newline)
|
||||
endf
|
||||
|
||||
" == get transactions ==
|
||||
|
||||
function! ledger#transaction_from_lnum(lnum) abort
|
||||
@@ -176,8 +241,10 @@ function! s:transaction.from_lnum(lnum) abort dict "{{{2
|
||||
endf "}}}
|
||||
|
||||
function! s:transaction.set_state(char) abort dict "{{{2
|
||||
if has_key(self, 'state') && a:char =~# '^\s*$'
|
||||
call remove(self, 'state')
|
||||
if a:char =~# '^\s*$'
|
||||
if has_key(self, 'state')
|
||||
call remove(self, 'state')
|
||||
endif
|
||||
else
|
||||
let self['state'] = a:char
|
||||
endif
|
||||
@@ -390,10 +457,20 @@ endf
|
||||
|
||||
" Return character position of decimal separator (multibyte safe)
|
||||
function! s:decimalpos(expr) abort
|
||||
let pos = match(a:expr, '\V' . g:ledger_decimal_sep)
|
||||
if pos > 0
|
||||
let pos = strchars(a:expr[:pos]) - 1
|
||||
endif
|
||||
" Remove trailing comments
|
||||
let l:expr = substitute(a:expr, '\v +;.*$', '', '')
|
||||
" Find first or last possible decimal separator candidate
|
||||
if g:ledger_align_last
|
||||
let pos = matchend(l:expr, '\v.*[' . g:ledger_decimal_sep . ']')
|
||||
if pos > 0
|
||||
let pos = strchars(a:expr[:pos]) + 1
|
||||
endif
|
||||
else
|
||||
let pos = match(l:expr, '\v[' . g:ledger_decimal_sep . ']')
|
||||
if pos > 0
|
||||
let pos = strchars(a:expr[:pos]) - 1
|
||||
endif
|
||||
end
|
||||
return pos
|
||||
endf
|
||||
|
||||
@@ -424,7 +501,9 @@ function! ledger#align_commodity() abort
|
||||
" Remove everything after the account name (including spaces):
|
||||
call setline('.', substitute(l:line, '\m^\s\+[^[:space:]].\{-}\zs\(\t\| \).*$', '', ''))
|
||||
let pos = -1
|
||||
if g:ledger_decimal_sep !=# ''
|
||||
if g:ledger_align_commodity == 1
|
||||
let pos = 0
|
||||
elseif g:ledger_decimal_sep !=# ''
|
||||
" Find the position of the first decimal separator:
|
||||
let pos = s:decimalpos(rhs)
|
||||
endif
|
||||
@@ -433,7 +512,7 @@ function! ledger#align_commodity() abort
|
||||
let pos = matchend(rhs, '\m\d[^[:space:]]*')
|
||||
endif
|
||||
" Go to the column that allows us to align the decimal separator at g:ledger_align_at:
|
||||
if pos > 0
|
||||
if pos >= 0
|
||||
call s:goto_col(g:ledger_align_at - pos - 1, 2)
|
||||
else
|
||||
call s:goto_col(g:ledger_align_at - strdisplaywidth(rhs) - 2, 2)
|
||||
@@ -442,6 +521,19 @@ function! ledger#align_commodity() abort
|
||||
endif
|
||||
endf
|
||||
|
||||
" Align the commodity on the entire buffer
|
||||
function! ledger#align_commodity_buffer() abort
|
||||
" Store the viewport position
|
||||
let view = winsaveview()
|
||||
|
||||
" Call ledger#align_commodity for every line
|
||||
%call ledger#align_commodity()
|
||||
|
||||
" Restore the viewport position
|
||||
call winrestview(view)
|
||||
unlet view
|
||||
endf
|
||||
|
||||
" Align the amount under the cursor and append/prepend the default currency.
|
||||
function! ledger#align_amount_at_cursor() abort
|
||||
" Select and cut text:
|
||||
@@ -462,6 +554,10 @@ function! ledger#align_amount_at_cursor() abort
|
||||
endif
|
||||
endf
|
||||
|
||||
function! ledger#align_formatexpr(lnum, count) abort
|
||||
execute a:lnum . ',' . (a:lnum + a:count - 1) . 'call ledger#align_commodity()'
|
||||
endfunction
|
||||
|
||||
" Report generation {{{1
|
||||
|
||||
" Helper functions and variables {{{2
|
||||
@@ -650,8 +746,6 @@ function! ledger#register(file, args) abort
|
||||
endf
|
||||
|
||||
" Reconcile the given account.
|
||||
" This function accepts a file path as a third optional argument.
|
||||
" The default is to use the value of g:ledger_main.
|
||||
"
|
||||
" Parameters:
|
||||
" file The file to be processed
|
||||
@@ -740,5 +834,3 @@ function! ledger#show_balance(file, ...) abort
|
||||
endif
|
||||
endf
|
||||
" }}}
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'nim', 'autoload/nim.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:nim_log = []
|
||||
let s:plugin_path = escape(expand('<sfile>:p:h'), '\')
|
||||
@@ -21,8 +23,8 @@ fun! nim#init() abort
|
||||
if !v:shell_error && expand('%:e') ==# 'nim'
|
||||
let false = 0 " Needed for eval of json
|
||||
let true = 1 " Needed for eval of json
|
||||
let dumpdata = eval(substitute(raw_dumpdata, "\n", '', 'g'))
|
||||
|
||||
let dumpdata = json_decode(raw_dumpdata)
|
||||
|
||||
let b:nim_project_root = dumpdata['project_path']
|
||||
let b:nim_defined_symbols = dumpdata['defined_symbols']
|
||||
let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1
|
||||
@@ -209,7 +211,9 @@ fun! GotoDefinition_nim_ready(def_output) abort
|
||||
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
|
||||
|
||||
@@ -238,5 +242,3 @@ if exists('g:SyntasticRegistry')
|
||||
\ 'filetype': 'nim',
|
||||
\ 'name': 'nim'})
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
30
autoload/org.vim
Normal file
30
autoload/org.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'org', 'autoload/org.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Helper functions for org.vim
|
||||
"
|
||||
" Maintainer: Alex Vear <alex@vear.uk>
|
||||
" License: Vim (see `:help license`)
|
||||
" Location: autoload/org.vim
|
||||
" Website: https://github.com/axvr/org.vim
|
||||
" Last Change: 2020-01-04
|
||||
|
||||
" Fallback chain for options. Buffer local --> Global --> default.
|
||||
function org#option(name, default) abort
|
||||
return get(b:, a:name, get(g:, a:name, a:default))
|
||||
endfunction
|
||||
|
||||
" Emacs-like fold text.
|
||||
function org#fold_text() abort
|
||||
return getline(v:foldstart) . '...'
|
||||
endfunction
|
||||
|
||||
" Check fold depth of a line.
|
||||
function org#fold_expr()
|
||||
let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
|
||||
if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# '\m^o\(rg\|utline\)Heading'
|
||||
return ">" . l:depth
|
||||
endif
|
||||
return "="
|
||||
endfunction
|
||||
@@ -53,16 +53,16 @@ func! polyglot#detect#H(...)
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
if exists("g:c_syntax_for_h")
|
||||
if exists('g:c_syntax_for_h')
|
||||
set ft=objc | return
|
||||
endif
|
||||
set ft=objcpp | return
|
||||
endif
|
||||
endfor
|
||||
if exists("g:c_syntax_for_h")
|
||||
if exists('g:c_syntax_for_h')
|
||||
set ft=c | return
|
||||
endif
|
||||
if exists("g:ch_syntax_for_h")
|
||||
if exists('g:ch_syntax_for_h')
|
||||
set ft=ch | return
|
||||
endif
|
||||
set ft=cpp | return
|
||||
@@ -82,7 +82,14 @@ func! polyglot#detect#M(...)
|
||||
set ft=objc | return
|
||||
endif
|
||||
if line =~# '^\s*%'
|
||||
set ft=octave | return
|
||||
if !has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=octave | return
|
||||
endif
|
||||
endif
|
||||
if line =~# '^\s*%'
|
||||
if has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=matlab | return
|
||||
endif
|
||||
endif
|
||||
if line =~# '^\s*(\*'
|
||||
set ft=mma | return
|
||||
@@ -97,7 +104,12 @@ func! polyglot#detect#M(...)
|
||||
if exists("g:filetype_m")
|
||||
let &ft = g:filetype_m | return
|
||||
endif
|
||||
set ft=octave | return
|
||||
if !has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=octave | return
|
||||
endif
|
||||
if has_key(g:polyglot_is_disabled, 'octave')
|
||||
set ft=matlab | return
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Fs(...)
|
||||
@@ -122,6 +134,18 @@ func! polyglot#detect#Fs(...)
|
||||
set ft=forth | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Frag(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
||||
set ft=glsl | return
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#detect#Re(...)
|
||||
if a:0 != 1 && did_filetype()
|
||||
return
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user