Compare commits

..

56 Commits

Author SHA1 Message Date
Adam Stankiewicz
25db54573a Mention vim-polyglot is more secure than using individual packs 2020-08-24 10:32:03 +02:00
Adam Stankiewicz
d1bfe50419 Ignore compiler for javascript, fixes #521 2020-08-24 10:29:39 +02:00
Adam Stankiewicz
22e8e01c1e Use setf for ambiguous extensions 2020-08-24 09:52:25 +02:00
Adam Stankiewicz
30bef582ba Fix blade ftdetect 2020-08-24 09:31:34 +02:00
Adam Stankiewicz
74d940cda3 Remove travis 2020-08-24 00:21:35 +02:00
Adam Stankiewicz
54d2386262 Update readme 2020-08-24 00:05:31 +02:00
Adam Stankiewicz
a47c315b01 Update readme 2020-08-24 00:04:36 +02:00
Adam Stankiewicz
ff0ada0dc3 Fix CI 2020-08-24 00:01:53 +02:00
Adam Stankiewicz
e194de5875 Debug CI 2020-08-23 23:59:02 +02:00
Adam Stankiewicz
012cf89210 Fix CI 2020-08-23 23:54:23 +02:00
Adam Stankiewicz
ac71777dc2 Fix CI 2020-08-23 23:40:50 +02:00
Adam Stankiewicz
23defeb610 fix: Migrate build script to ruby 2020-08-23 23:35:05 +02:00
Adam Stankiewicz
114a93bb7c Migrate ftdetect generation to ruby 2020-08-23 23:25:06 +02:00
Adam Stankiewicz
f3ab28a287 Move packages to yaml file 2020-08-23 19:39:42 +02:00
Adam Stankiewicz
bc3b36088e Update 2020-08-23 17:26:30 +02:00
Adam Stankiewicz
5d0150e326 Migrate build script to ruby 2020-08-21 19:49:36 +02:00
Adam Stankiewicz
cf8e31ff7f Update 2020-08-21 14:51:19 +02:00
Adam Stankiewicz
0df1bfa0c5 Add requirements.txt support, closes #507 2020-08-18 23:31:31 +02:00
Adam Stankiewicz
f7302d9262 Add jq syntax, closes #502 2020-08-18 23:25:22 +02:00
Adam Stankiewicz
7e38f4288a Add improved sql syntax, closes #505 2020-08-18 23:22:09 +02:00
Adam Stankiewicz
e521ba3ae2 Add fennel support, closes #514 2020-08-18 23:09:35 +02:00
Adam Stankiewicz
ee4f51587d Add ftdetect for jsonnet 2020-08-18 23:06:10 +02:00
Adam Stankiewicz
20a388cbc8 Add jsonnet support, closes #515 2020-08-18 23:04:38 +02:00
Adam Stankiewicz
81e61a3c5d Ignore auto-generated tags file 2020-08-18 23:00:07 +02:00
Adam Stankiewicz
5670985b3a Add docs, fixes #501 2020-08-18 22:45:46 +02:00
Adam Stankiewicz
69eae22ea6 Let fsharp have priority over fs files, fixes #523 2020-08-18 21:30:22 +02:00
Adam Stankiewicz
f8cee0172b Allow to set let g:python_highlight_all = 0, closes #474 2020-08-18 20:52:00 +02:00
Adam Stankiewicz
c6936aeeb1 Fix dhall plugin, closes #519 2020-08-18 20:08:26 +02:00
Adam Stankiewicz
6bb111eaba Embed plugin guards 2020-08-18 20:01:12 +02:00
Adam Stankiewicz
dfecb63078 Report download errors 2020-08-18 18:49:24 +02:00
Adam Stankiewicz
00015bd105 Migrate all ftdetect to linguist 2020-08-18 15:53:18 +02:00
Adam Stankiewicz
d821de3142 Migrate more filetypes 2020-08-18 11:54:28 +02:00
Adam Stankiewicz
a3bdbcdb3c Fix svelte branch name, closes #522 2020-08-14 19:15:07 +02:00
Adam Stankiewicz
34e01b8b62 Start github-linguist rewrite 2020-08-06 13:42:56 +02:00
Adam Stankiewicz
1e533e5982 Update 2020-08-06 13:22:17 +02:00
Adam Stankiewicz
56121b4e27 Update 2020-07-26 10:20:08 +02:00
Adam Stankiewicz
9c3c0bc082 Fix rspect ftdetect, #503 2020-07-06 19:14:22 +02:00
Adam Stankiewicz
8500ae8bb9 Update 2020-07-06 19:13:39 +02:00
Adam Stankiewicz
d09a56a494 Add unison language support 2020-06-25 13:40:40 +02:00
Adam Stankiewicz
abca7c2014 Update 2020-06-25 13:38:15 +02:00
TravonteD
8b6c06e723 Add detection for rspec files (#503)
Standard convention for rspec files is "*_spec.rb". This is also what
rspec.vim (the syntax plugin that is pulled in) uses.
2020-06-19 14:47:03 +02:00
Adam Stankiewicz
a86c0179eb Update 2020-06-13 11:36:03 +02:00
Adam Stankiewicz
22095febb7 Update 2020-06-10 11:46:12 +02:00
Adam Stankiewicz
ff066ee9f0 Update 2020-06-07 17:37:15 +02:00
Adam Stankiewicz
5b38663027 Update README.md 2020-06-01 22:01:48 +02:00
Adam Stankiewicz
f0b38f2c1d Install vim 8 for tests 2020-05-31 23:53:41 +02:00
Adam Stankiewicz
6676d61f61 Fix 2020-05-31 23:51:46 +02:00
Adam Stankiewicz
f0da1a9f4d Update vim version 2020-05-31 23:48:07 +02:00
Adam Stankiewicz
298d6b6356 Fix tests 2020-05-31 23:44:10 +02:00
Adam Stankiewicz
62f004c3da Update travis script 2020-05-31 23:42:04 +02:00
Adam Stankiewicz
c73ea49ecb Improve bash and zsh highlighting 2020-05-31 20:57:37 +02:00
Adam Stankiewicz
b2be47befc Update 2020-05-31 20:52:04 +02:00
Adam Kwiatek
de38ccabbd Enable TypeScript in ftdetect (#496) 2020-05-29 21:10:18 +02:00
Adam Stankiewicz
f0f49cf0fa Add support for ics, closes #492 2020-05-28 11:12:25 +02:00
Adam Stankiewicz
224a6348f9 Update 2020-05-28 11:09:19 +02:00
Emerson MX
00c3f02945 Remove gdscript ftplugin (#494) 2020-05-28 11:05:53 +02:00
122 changed files with 8251 additions and 8077 deletions

7
.gitattributes vendored
View File

@@ -1,7 +0,0 @@
.gitignore export-ignore
.gitattributes export-ignore
README.md export-ignore
/spec export-ignore
Gemfile export-ignore
Gemfile.lock export-ignore
.travis.yml export-ignore

21
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Vim Polyglot CI
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # weekly
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Vim
run: |
sudo add-apt-repository ppa:jonathonf/vim -y
sudo apt-get update -q
sudo apt-get install -y vim
vim --version
- uses: actions/checkout@v2
- name: Run Tests
run: scripts/test

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/tmp
!*ctags*
tags

View File

@@ -1,11 +0,0 @@
language: ruby
rvm:
- 2.6
sudo: false
addons:
apt:
packages:
- vim-gtk
before_script:
- "./build"
script: xvfb-run bundle exec rspec --format=documentation

View File

@@ -1,4 +0,0 @@
source 'https://rubygems.org'
gem 'vimrunner'
gem 'rspec'

View File

@@ -1,28 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
vimrunner (0.3.4)
PLATFORMS
ruby
DEPENDENCIES
rspec
vimrunner
BUNDLED WITH
1.16.2

View File

@@ -1,22 +1,20 @@
![vim-polyglot](https://i.imgur.com/9RxQK6k.png)
[![Build Status][travis-img-url]][travis-url] [![Maintenance](https://img.shields.io/maintenance/yes/2020.svg?maxAge=2592000)]()
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
![build](https://github.com/sheerun/vim-polyglot/workflows/Vim%20Polyglot%20CI/badge.svg) [![Maintenance](https://img.shields.io/maintenance/yes/2020.svg?maxAge=2592000)]()
A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->149<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->156<!--/Package Count--> packages it consists of.
- It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect).
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
\*To be completely honest, concatenated `ftdetect` script takes up to `17ms` to load.
\*To be completely honest, optimized `ftdetect` script takes around `19ms` to load.
## Installation
@@ -38,7 +36,7 @@ mkdir -p ~/.vim/pack/default/start
git clone https://github.com/sheerun/vim-polyglot ~/.vim/pack/default/start/vim-polyglot
```
NOTE: Not all features of listed language packs are available. We strip them from functionality slowing vim startup in general (for example we ignore `plugins` folder that is loaded regardless of file type, use `ftplugin` instead).
NOTE: Not all features of individual language packs are available. We strip them from functionality slowing vim startup (for example we ignore `plugins` folder that is loaded regardless of file type, instead we prefer `ftplugin` which is loaded lazily).
If you need full functionality of any plugin, please use it directly with your plugin manager.
@@ -77,11 +75,12 @@ If you need full functionality of any plugin, please use it directly with your p
- [emberscript](https://github.com/yalesov/vim-ember-script) (syntax, indent, ftplugin)
- [emblem](https://github.com/yalesov/vim-emblem) (syntax, indent, ftplugin)
- [erlang](https://github.com/vim-erlang/vim-erlang-runtime) (syntax, indent)
- [fennel](https://github.com/bakpakin/fennel.vim) (syntax, indent, ftplugin)
- [ferm](https://github.com/vim-scripts/ferm.vim) (syntax)
- [fish](https://github.com/georgewitteman/vim-fish) (syntax, indent, compiler, autoload, ftplugin)
- [flatbuffers](https://github.com/dcharbon/vim-flatbuffers) (syntax)
- [fsharp](https://github.com/ionide/Ionide-vim) (syntax, indent)
- [gdscript](https://github.com/calviken/vim-gdscript3) (syntax, indent, ftplugin)
- [gdscript](https://github.com/calviken/vim-gdscript3) (syntax, indent)
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin)
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent)
- [gmpl](https://github.com/maelvalais/gmpl.vim) (syntax)
@@ -90,7 +89,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [gradle](https://github.com/tfnico/vim-gradle) (compiler)
- [graphql](https://github.com/jparise/vim-graphql) (syntax, indent, autoload, ftplugin, after)
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin)
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin)
- [handlebars](https://github.com/sheerun/vim-mustache-handlebars) (syntax, indent, ftplugin)
- [haproxy](https://github.com/CH-DanReif/haproxy.vim) (syntax)
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin)
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax)
@@ -99,13 +98,16 @@ If you need full functionality of any plugin, please use it directly with your p
- [hive](https://github.com/zebradil/hive.vim) (syntax, ftplugin)
- [html5](https://github.com/othree/html5.vim) (syntax, indent, autoload, ftplugin)
- [i3](https://github.com/mboughaba/i3config.vim) (syntax, ftplugin)
- [icalendar](https://github.com/chutzpah/icalendar.vim) (syntax)
- [idris](https://github.com/idris-hackers/idris-vim) (syntax, indent, ftplugin)
- [ion](https://github.com/vmchale/ion-vim) (syntax, ftplugin)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, compiler, ftplugin, extras)
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftplugin, extras)
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax) (syntax, indent)
- [jinja](https://github.com/lepture/vim-jinja) (syntax, indent)
- [jq](https://github.com/vito-c/jq.vim) (syntax, ftplugin)
- [json5](https://github.com/GutenYe/json5.vim) (syntax)
- [json](https://github.com/elzr/vim-json) (syntax, indent, ftplugin)
- [jsonnet](https://github.com/google/vim-jsonnet) (syntax, autoload, ftplugin)
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent)
- [jsx](https://github.com/MaxMEllon/vim-jsx-pretty) (autoload, after)
- [julia](https://github.com/JuliaEditorSupport/julia-vim) (syntax, indent, autoload, ftplugin)
@@ -152,6 +154,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
- [razor](https://github.com/adamclerk/vim-razor) (syntax, indent, ftplugin)
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
- [requirements](https://github.com/raimon49/requirements.txt.vim) (syntax, autoload)
- [rspec](https://github.com/keith/rspec.vim) (syntax)
- [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, indent, autoload, ftplugin)
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin)
@@ -159,10 +162,12 @@ If you need full functionality of any plugin, please use it directly with your p
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ctags)
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, indent, ftplugin)
- [sh](https://github.com/arzg/vim-sh) (syntax)
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
- [sql](https://github.com/shmup/vim-sql-syntax) (syntax)
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
- [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent, ftplugin)
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
@@ -174,31 +179,31 @@ If you need full functionality of any plugin, please use it directly with your p
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin)
- [thrift](https://github.com/solarnz/thrift.vim) (syntax)
- [tmux](https://github.com/ericpruitt/tmux.vim) (syntax, ftplugin)
- [tomdoc](https://github.com/wellbredgrapefruit/tomdoc.vim) (syntax)
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin)
- [tptp](https://github.com/c-cube/vim-tptp) (syntax)
- [twig](https://github.com/lumiliet/vim-twig) (syntax, indent, ftplugin)
- [typescript](https://github.com/HerringtonDarkholme/yats.vim) (syntax, indent, compiler, ftplugin, ctags)
- [unison](https://github.com/unisonweb/unison) (syntax)
- [v](https://github.com/ollykel/v-vim) (syntax, indent, ftplugin)
- [vala](https://github.com/arrufat/vala.vim) (syntax, indent, ftplugin)
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
- [vcl](https://github.com/smerrill/vcl-vim-plugin) (syntax)
- [velocity](https://github.com/lepture/vim-velocity) (syntax, indent)
- [vifm](https://github.com/vifm/vifm.vim) (syntax, autoload, ftplugin)
- [vm](https://github.com/lepture/vim-velocity) (syntax, indent)
- [vue](https://github.com/posva/vim-vue) (syntax, indent, ftplugin)
- [xdc](https://github.com/amal-khailtash/vim-xdc-syntax) (syntax)
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
- [xml](https://github.com/amadeus/vim-xml) (syntax)
- [xsl](https://github.com/vim-scripts/XSLT-syntax) (syntax)
- [yaml](https://github.com/stephpy/vim-yaml) (syntax, ftplugin)
- [yard](https://github.com/sheerun/vim-yardoc) (syntax)
- [zephir](https://github.com/xwsoul/vim-zephir) (syntax)
- [zig](https://github.com/ziglang/zig.vim) (syntax, autoload, ftplugin)
- [zig](https://github.com/ziglang/zig.vim) (syntax, indent, autoload, ftplugin)
- [zinit](https://github.com/zinit-zsh/zplugin-vim-syntax) (syntax)
<!--/Language Packs-->
## Updating
You can either wait for new patch release with updates or run the `./build` script by yourself.
You can either wait for new patch release with updates or run the `scripts/build` script by yourself.
## Troubleshooting
@@ -211,19 +216,14 @@ Individual language packs can be disabled by setting `g:polyglot_disabled` as fo
let g:polyglot_disabled = ['css']
```
Note that disabling languages won't make in general your vim startup any faster / slower (only for specific file type). Vim-polyglot is selection of language plugins that are loaded only on demand.
Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are loaded lazily, on demand.
## Contributing
Language packs are periodically updated using automated `build` script.
Language packs are periodically updated using automated `scripts/build` script.
Feel free to add your language, and send pull-request. In your pull request, please include:
1. How you chose the particular repo from which to pull support for this language.
2. An updated https://github.com/sheerun/vim-polyglot/blob/master/build .
3. If at all possible, absolutely nothing else (in particular, please don't run `build` and include that in your PR).
The easier it is to validate that the new language won't do anything wacky, the faster it'll be merged. In particular, languages that utilize global plugins (loaded for every filetype), or plugins with dangerous features (like `call` based on the contents of a file being edited), will never be merged, as they will be slow or dangerous, respectively.
Feel free to add your language to `packages.yaml`, and send pull-request. Please don't run `scripts/build` and include that in your PR, send just changes to `packages.yaml` and `build` script if really necessary. You can run `scripts/test` to run rough tests.
## License
See linked repositories for detailed license information.
See linked repositories for detailed license information. This repository is MIT-licensed.

View File

@@ -4,7 +4,7 @@ let s:highlight_close_tag = get(g:, 'vim_jsx_pretty_highlight_close_tag', 0)
" detect jsx region
syntax region jsxRegion
\ start=+\%(\%(\_[([,?:=+\-*/>{}]\|<\s\+\|&&\|||\|=>\|\<return\|\<default\|\<await\|\<yield\)\_s*\)\@<=<\_s*\%(>\|\z(\%(script\|T\s*>\s*(\)\@!\<[_$A-Za-z][-:._$A-Za-z0-9]*\>\)\%(\_s*\%([-+*)\]}&|?,]\|/\%([/*]\|\_s*>\)\@!\)\)\@!\)+
\ start=+\%(\%(\_[([,?:=+\-*/>{}]\|<\s\+\|&&\|||\|=>\|\<return\|\<default\|\<await\|\<yield\)\_s*\)\@<=<\_s*\%(>\|\z(\%(script\|\s*\<T\>\)\@!\<[_$A-Za-z][-:._$A-Za-z0-9]*\>\)\%(\_s*\%([-+*)\]}&|?,]\|/\%([/*]\|\_s*>\)\@!\)\)\@!\)+
\ end=++
\ contains=jsxElement

View File

@@ -0,0 +1,37 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2020 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
syn include @GraphQLSyntax syntax/graphql.vim
if exists('s:current_syntax')
let b:current_syntax = s:current_syntax
endif
syntax region graphqlMultilineString matchgroup=reasonMultilineString start=+graphql\_s*\zs{|+ end=+|}+ contains=@GraphQLSyntax,reasonEscape,reasonEscapeUnicode,reasonEscapeError,reasonStringContinuation keepend
endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
let s:save_cpo = &cpo
set cpo&vim
let s:V = vital#crystal#new()
let s:P = s:V.import('Process')
let s:C = s:V.import('ColorEcho')
@@ -365,9 +362,6 @@ function! crystal_lang#expand(file, pos, ...) abort
return crystal_lang#tool('expand', a:file, a:pos, get(a:, 1, ''))
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: sw=2 sts=2 et:
endif

View File

@@ -267,7 +267,7 @@ fu! csv#GetPat(colnr, maxcolnr, pat, allowmore) "{{{3
" Allow space in front of the pattern, so that it works correctly
" even if :Arrange Col has been used #100
return '^' . csv#GetColPat(a:colnr - 1,0) .
\ '\s*\zs' . a:pat . '\ze' . (a:allowmore ? '' : '$')
\ '.*\zs' . a:pat . '\ze' . (a:allowmore ? '' : '$')
else
return '\%' . b:csv_fixed_width_cols[-1] .
\ 'c\zs' . a:pat . '\ze' . (a:allowmore ? '' : '$')
@@ -504,7 +504,7 @@ fu! csv#WColumn(...) "{{{3
" Return on which column the cursor is
let _cur = getpos('.')
if !exists("b:csv_fixed_width_cols")
if line('.') > 1 && mode('') != 'n'
if line('.') > 1 && mode('') != 'n' && empty(getline('.')[0:col('.')-1])
" in insert mode, get line from above, just in case the current
" line is empty
let line = getline(line('.')-1)
@@ -1507,10 +1507,10 @@ fu! csv#AvgColumn(list) "{{{3
endfor
if has("float")
let b:csv_result = printf("%.2f", sum/cnt)
return b:csv_result
return str2float(b:csv_result)
else
let b:csv_result = printf("%s", sum/cnt)
return sum/cnt
return b:csv_result + 0
endif
endif
endfu
@@ -1543,7 +1543,7 @@ fu! csv#VarianceColumn(list, is_population) "{{{3
let cnt = cnt-1
endif
if has("float")
let b:csv_result = printf("%.2f", sum/cnt)
let b:csv_result = printf("%." . get(b:, 'csv_accuracy', get(g:, 'csv_accuracy', 2)) . "f", sum/cnt)
return b:csv_result
else
let b:csv_result = printf("%s", sum/cnt)
@@ -1956,8 +1956,12 @@ fu! csv#CheckHeaderLine() "{{{3
endfu
fu! csv#AnalyzeColumn(...) "{{{3
let maxcolnr = csv#MaxColumns()
if len(a:000) == 1
let topn = 5
if len(a:000) > 0
let colnr = a:1
if len(a:000) == 2
let topn = a:2
endif
else
let colnr = csv#WColumn()
endif
@@ -1985,8 +1989,8 @@ fu! csv#AnalyzeColumn(...) "{{{3
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) > 5
call remove(max_items, 5, -1)
if len(max_items) > topn
call remove(max_items, topn, -1)
call map(max_items, 'printf(''\V%s\m'', escape(v:val, ''\\''))')
call filter(res, 'v:val =~ ''^''.join(max_items, ''\|'').''$''')
endif
@@ -2263,7 +2267,7 @@ fu! csv#CommandDefinitions() "{{{3
\ ':echo csv#EvalColumn(<q-args>, "csv#SmplStdDevColumn", <line1>,<line2>)',
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
call csv#LocalCmd("PopStdCol",
\ ':echo csv#EvalColumn(<q-args>, "csv#SmplStdDevColumn", <line1>,<line2>)',
\ ':echo csv#EvalColumn(<q-args>, "csv#PopStdDevColumn", <line1>,<line2>)',
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
call csv#LocalCmd("UnArrangeColumn",
\':call csv#PrepUnArrangeCol(<line1>, <line2>)',
@@ -2311,8 +2315,8 @@ fu! csv#CommandDefinitions() "{{{3
\ '-bang -nargs=? -range=%')
call csv#LocalCmd("Filters", ':call csv#OutputFilters(<bang>0)',
\ '-nargs=0 -bang')
call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<args>)',
\ '-nargs=?')
call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<f-args>)',
\ '-nargs=*' )
call csv#LocalCmd("VertFold", ':call csv#Vertfold(<bang>0,<q-args>)',
\ '-bang -nargs=? -range=% -complete=custom,csv#SortComplete')
call csv#LocalCmd("CSVFixed", ':call csv#InitCSVFixedWidth()', '')

View File

@@ -27,12 +27,16 @@ function! s:clearQfList(reason) abort
endif
endfunction
function! dart#fmt(q_args) abort
let cmd = s:FindDartFmt()
if type(cmd) != type('') | return | endif
function! dart#fmt(...) abort
let l:dartfmt = s:FindDartFmt()
if type(l:dartfmt) != type('') | return | endif
let buffer_content = getline(1, '$')
let args = '--stdin-name '.expand('%').' '.a:q_args
let lines = systemlist(printf('%s %s', cmd, args), join(buffer_content, "\n"))
let l:cmd = [l:dartfmt, '--stdin-name', shellescape(expand('%'))]
if exists('g:dartfmt_options')
call extend(l:cmd, g:dartfmt_options)
endif
call extend(l:cmd, a:000)
let lines = systemlist(join(l:cmd), join(buffer_content, "\n"))
" TODO(https://github.com/dart-lang/sdk/issues/38507) - Remove once the
" tool no longer emits this line on SDK upgrades.
if lines[-1] ==# 'Isolate creation failed'

View File

@@ -1,25 +1,43 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1
function! fish#Indent()
let l:shiftwidth = shiftwidth()
let l:prevlnum = prevnonblank(v:lnum - 1)
if l:prevlnum ==# 0
return 0
endif
let l:indent = 0
let l:prevline = getline(l:prevlnum)
if l:prevline =~# '\v^\s*switch>'
return indent(l:prevlnum) + l:shiftwidth
elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>'
let l:indent = l:shiftwidth
endif
let l:line = getline(v:lnum)
if l:line =~# '\v^\s*end>'
return indent(l:prevlnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent)
elseif l:line =~# '\v^\s*%(case|else)>'
return indent(l:prevlnum) - l:shiftwidth
let l:shiftwidth = shiftwidth()
let l:previndent = indent(l:prevlnum)
let l:indent = l:previndent
if l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|switch|case)>'
let l:indent += l:shiftwidth
endif
return indent(l:prevlnum) + l:indent
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
endif
if l:indent < 0
return 0
endif
return l:indent
endfunction
function! fish#Format()

View File

@@ -170,8 +170,8 @@ function! go#config#EchoCommandInfo() abort
endfunction
function! go#config#DocUrl() abort
let godoc_url = get(g:, 'go_doc_url', 'https://godoc.org')
if godoc_url isnot 'https://godoc.org'
let godoc_url = get(g:, 'go_doc_url', 'https://pkg.go.dev')
if godoc_url isnot 'https://pkg.go.dev'
" strip last '/' character if available
let last_char = strlen(godoc_url) - 1
if godoc_url[last_char] == '/'
@@ -266,23 +266,11 @@ function! go#config#MetalinterCommand() abort
endfunction
function! go#config#MetalinterAutosaveEnabled() abort
let l:default_enabled = ["vet", "golint"]
if go#config#MetalinterCommand() == "golangci-lint"
let l:default_enabled = ["govet", "golint"]
endif
return get(g:, "go_metalinter_autosave_enabled", default_enabled)
return get(g:, "go_metalinter_autosave_enabled", ["govet", "golint"])
endfunction
function! go#config#MetalinterEnabled() abort
let l:default_enabled = ["vet", "golint", "errcheck"]
if go#config#MetalinterCommand() == "golangci-lint"
let l:default_enabled = ["govet", "golint"]
endif
return get(g:, "go_metalinter_enabled", default_enabled)
return get(g:, "go_metalinter_enabled", ["vet", "golint", "errcheck"])
endfunction
function! go#config#GolintBin() abort
@@ -383,7 +371,7 @@ function! go#config#RenameCommand() abort
endfunction
function! go#config#GorenameBin() abort
return get(g:, "go_gorename_bin", "gorename")
return get(g:, "go_gorename_bin", "gopls")
endfunction
function! go#config#GorenamePrefill() abort
@@ -508,6 +496,10 @@ function! go#config#CodeCompletionEnabled() abort
return get(g:, "go_code_completion_enabled", 1)
endfunction
function! go#config#CodeCompletionIcase() abort
return get(g:, "go_code_completion_icase", 0)
endfunction
function! go#config#Updatetime() abort
let go_updatetime = get(g:, 'go_updatetime', 800)
return go_updatetime == 0 ? &updatetime : go_updatetime
@@ -565,7 +557,7 @@ function! go#config#DiagnosticsEnabled() abort
endfunction
function! go#config#GoplsOptions() abort
return get(g:, 'go_gopls_options', [])
return get(g:, 'go_gopls_options', ['-remote=auto'])
endfunction
" Set the default value. A value of "1" is a shortcut for this, for

129
autoload/jsonnet.vim Normal file
View File

@@ -0,0 +1,129 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1
" Options.
if !exists("g:jsonnet_command")
let g:jsonnet_command = "jsonnet"
endif
if !exists("g:jsonnet_fmt_command")
let g:jsonnet_fmt_command = "jsonnetfmt"
endif
if !exists('g:jsonnet_fmt_options')
let g:jsonnet_fmt_options = ''
endif
if !exists('g:jsonnet_fmt_fail_silently')
let g:jsonnet_fmt_fail_silently = 1
endif
" System runs a shell command. It will reset the shell to /bin/sh for Unix-like
" systems if it is executable.
function! jsonnet#System(str, ...)
let l:shell = &shell
if executable('/bin/sh')
let &shell = '/bin/sh'
endif
try
let l:output = call("system", [a:str] + a:000)
return l:output
finally
let &shell = l:shell
endtry
endfunction
" CheckBinPath checks whether the given binary exists or not and returns the
" path of the binary. It returns an empty string if it doesn't exists.
function! jsonnet#CheckBinPath(binName)
if executable(a:binName)
if exists('*exepath')
let binPath = exepath(a:binName)
return binPath
else
return a:binName
endif
else
echo "vim-jsonnet: could not find '" . a:binName . "'."
return ""
endif
endfunction
" Format calls `jsonnetfmt ... ` on the file and replaces the file with the
" auto formatted version. Does some primitive error checking of the
" jsonnetfmt command too.
function! jsonnet#Format()
" Save cursor position and many other things.
let l:curw = winsaveview()
" Write current unsaved buffer to a temp file
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
" get the command first so we can test it
let l:binName = g:jsonnet_fmt_command
" check if the user has installed command binary.
let l:binPath = jsonnet#CheckBinPath(l:binName)
if empty(l:binPath)
return
endif
" Populate the final command.
let l:command = l:binPath
" The inplace modification is default. Makes file management easier
let l:command = l:command . ' -i '
let l:command = l:command . g:jsonnet_fmt_options
" Execute the compiled jsonnetfmt command and save the return value
let l:out = jsonnet#System(l:command . " " . l:tmpname)
let l:errorCode = v:shell_error
if l:errorCode == 0
" The format command succeeded Move the formatted temp file over the
" current file and restore other settings
" stop undo recording
try | silent undojoin | catch | endtry
let l:originalFileFormat = &fileformat
if exists("*getfperm")
" save old file permissions
let l:originalFPerm = getfperm(expand('%'))
endif
" Overwrite current file with the formatted temp file
call rename(l:tmpname, expand('%'))
if exists("*setfperm") && l:originalFPerm != ''
call setfperm(expand('%'), l:originalFPerm)
endif
" the file has been changed outside of vim, enable reedit
silent edit!
let &fileformat = l:originalFileFormat
let &syntax = &syntax
elseif g:jsonnet_fmt_fail_silently == 0
" FixMe: We could leverage the errors coming from the `jsonnetfmt` and
" give immediate feedback to the user at every save time.
" Our inspiration, vim-go, opens a new list below the current edit
" window and shows the errors (the output of the fmt command).
" We are not sure whether this is desired in the vim-jsonnet community
" or not. Nevertheless, this else block is a suitable place to benefit
" from the `jsonnetfmt` errors.
endif
" Restore our cursor/windows positions.
call winrestview(l:curw)
endfunction
endif

36
autoload/requirements.vim Normal file
View File

@@ -0,0 +1,36 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'requirements') == -1
" the Requirements File Format syntax support for Vim
" Version: 1.5.3
" Author: raimon <raimon49@hotmail.com>
" License: MIT LICENSE
" The MIT License (MIT)
"
" Copyright (c) 2015 raimon
"
" 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.
let s:save_cpo = &cpo
set cpo&vim
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: et sw=4 ts=4 sts=4:
endif

View File

@@ -55,6 +55,8 @@ function! terraform#commands(ArgLead, CmdLine, CursorPos) abort
\ 'graph',
\ 'import',
\ 'init',
\ 'login',
\ 'logout',
\ 'output',
\ 'plan',
\ 'providers',

View File

@@ -10,8 +10,6 @@ execute join(['function! vital#_crystal#ColorEcho#import() abort', printf("retur
delfunction s:_SID
" ___vital___
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
function! s:_is_available() abort
if has('gui_running')
@@ -185,7 +183,4 @@ function! s:echo(str) abort
call echorizer.echo()
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
endif

View File

@@ -11,9 +11,6 @@ delfunction s:_SID
" ___vital___
" Utilities for list.
let s:save_cpo = &cpo
set cpo&vim
function! s:pop(list) abort
return remove(a:list, -1)
endfunction
@@ -460,9 +457,6 @@ function! s:combinations(list, r) abort
return result
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:
endif

View File

@@ -11,9 +11,6 @@ delfunction s:_SID
" ___vital___
" Utilities for string.
let s:save_cpo = &cpo
set cpo&vim
function! s:_vital_loaded(V) abort
let s:V = a:V
let s:L = s:V.import('Data.List')
@@ -624,8 +621,6 @@ function! s:split_posix_text(text, ...) abort
return split(text, newline, 1)
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:
endif

View File

@@ -15,9 +15,6 @@ delfunction s:_SID
" FIXME: This module name should be Vital.System ?
" But the name has been already taken.
let s:save_cpo = &cpo
set cpo&vim
" FIXME: Unfortunately, can't use s:_vital_loaded() for this purpose.
" Because these variables are used when this script file is loaded.
@@ -169,9 +166,6 @@ else
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:
endif

View File

@@ -9,8 +9,6 @@ endfunction
execute join(['function! vital#_crystal#Web#JSON#import() abort', printf("return map({'decode': '', '_vital_depends': '', '_vital_created': '', 'encode': '', '_vital_loaded': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
let s:save_cpo = &cpo
set cpo&vim
function! s:_true() abort
return 1
@@ -174,9 +172,6 @@ function! s:_encode_dict(val, settings) abort
endfunction
" @vimlint(EVL102, 0, l:ns)
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:
endif

View File

@@ -131,6 +131,7 @@ let attributes_value = {
\ 'label': ['Text', ''],
\ 'lang': ['Lang Tag', ''],
\ 'list': ['ID', ''],
\ 'loading': ['eager/lazy', ''],
\ 'loop': ['Bool', ''],
\ 'low': ['Number', ''],
\ 'manifest': ['URL', ''],
@@ -588,11 +589,11 @@ let g:xmldata_html5 = {
\ ],
\ 'iframe': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': referrerpolicy, 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': []})
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': referrerpolicy, 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': [], 'loading': ['eager', 'lazy']})
\ ],
\ 'img': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': referrerpolicy, 'crossorigin': ['anonymous', 'use-credentials']})
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'decoding': ['async', 'sync', 'auto'], 'usemap': [], 'ismap': ['ismap', ''], 'referrerpolicy': referrerpolicy, 'crossorigin': ['anonymous', 'use-credentials'], 'loading': ['eager', 'lazy']})
\ ],
\ 'input': [
\ [],

300
build
View File

@@ -1,300 +0,0 @@
#!/usr/bin/env bash
set -E
DIRS="syntax indent compiler autoload ftplugin ctags after/syntax after/indent after/ftplugin"
# shellcheck disable=SC2034
DIRS_BASIC="syntax compiler indent after/syntax after/indent"
# shellcheck disable=SC2034
DIRS_ALL="syntax indent compiler autoload ftplugin after extras ctags"
# shellcheck disable=SC2034
DIRS_SYNTAX="syntax indent after/syntax after/indent"
# shellcheck disable=SC2034
DIRS_NOAFTER="syntax compiler indent autoload ftplugin"
DIRS_JAVASCRIPT="${DIRS} extras"
read -r -a DIRS_RM <<<"$DIRS_ALL"
OUTPUT=""
output() {
OUTPUT="$OUTPUT$1"
echo -n "$1"
}
download() {
for pack in $1; do
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
repo="$(awk -F\# '{print $1}' <<<"$path")"
branch="$(awk -F\# '{print $2}' <<<"$path")"
rm -rf "$dir"
(mkdir -p "$dir" && curl --silent -L "https://codeload.github.com/$repo/tar.gz/${branch:-master}" | tar -zx -C "$dir" --strip 1 && printf '.') &
done
wait
}
extract() {
echo
for pack in $1; do
name="$(cut -d ':' -f 1 <<<"$pack")"
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
directories="DIRS$(cut -d ':' -f 3 <<<"$pack")"
subtree="$(cut -d ':' -f 4 <<<"$pack")"
output "- [$name](https://github.com/$path) ("
subdirs=""
for subdir in ${!directories}; do
if [ -d "${dir}${subtree:-/}${subdir}" ]; then
base="$(basename "$subdir")"
if [[ "$subdirs" != *"$base"* ]]; then
subdirs="$subdirs, $base"
fi
copy_dir "${dir}${subtree}" "$subdir" "$name"
fi
done
# syntax for go.vim depends on autoload for go.vim, but we exclude the
# autoload always and the ftplugin because it's too complex. FML.
if [ "${pack%%:*}" = "go" ]; then
copy_file "${dir}${subtree}" "${dir}${subtree}/autoload/go/config.vim" "${name}"
fi
output "${subdirs##, })"$'\n'
done
for pack in $1; do
name="$(cut -d ':' -f 1 <<<"$pack")"
path="$(cut -d ':' -f 2 <<<"$pack")"
dir="tmp/$(cut -d '/' -f 2 <<<"$path")"
subtree="$(cut -d ':' -f 4 <<<"$pack")"
if [ -d "$dir${subtree:-/}plugin" ]; then
echo "Possible error (plugin directory exists): $path" >&2
fi
done
}
copy_dir() {
find "$1/$2" \( -name '*.vim' -o -name '*.vital' -o -name '*.ctags' \) -print0 | while read -r -d $'\0' file; do
copy_file "$1" "$file" "$3"
done
}
copy_file() {
## $1 is the build dir (e.g. tmp/vim-go)
## $2 is the full file path, as returned by `find` (e.g. tmp/vim-go/indent/go.vim)
## $3 is the name of the package (so that we can detect if it's disabled at runtime)
local tmp_dir="$1"
local file_in_tmp="$2"
local file_basename="${2##*/}"
local file_path="${file_in_tmp##$tmp_dir/}" # Just this file's (full) path
file_path="${file_path%/*}" # Minus the actual name of the file
local file_in_dst="${file_path}/${file_basename}" # Could also be ${file_in_tmp##$tmp_dir/}
local package_name="$3"
if [ "${file_in_tmp##$tmp_dir/}" != "${file_in_dst}" ]; then
echo "Failure in logic in build script; '${file_in_tmp##$tmp_dir/}' != '${file_in_dst}'. Bailing." >&2
exit 1
fi
mkdir -p "${file_path}"
touch "$file_in_dst"
# Use comma instead of / to handle cases like c/c++
if [[ "${package_name}" == "jsx" ]]; then
sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard_jsx.vim.template >> "$file_in_dst"
else
sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard.vim.template >> "$file_in_dst"
fi
}
update_readme() {
local tf of
tf="$(mktemp)"
of="$(mktemp)"
LC_ALL=C sort <<<"$OUTPUT" | grep -vxE '[[:space:]]*' > "$of"
awk 'suppress == 0 {
gsub(/<!--Package Count-->[^<]*<!--\/Package Count-->/,
"<!--Package Count-->'"$(awk 'END {print NR}' "$of")"'<!--/Package Count-->");
print;
}
/<!--Language Packs-->/ {
suppress = 1;
while ( ( getline line < "'"$of"'" ) > 0 ) {
print line;
}
}
/<!--\/Language Packs-->/ {
suppress = 0;
print;
}' "README.md" >"$tf"
mv "$tf" "README.md"
}
PACKS="
acpiasl:martinlroth/vim-acpi-asl
ansible:pearofducks/ansible-vim
apiblueprint:sheerun/apiblueprint.vim
applescript:mityu/vim-applescript:_SYNTAX
arduino:sudar/vim-arduino-syntax
asciidoc:asciidoc/vim-asciidoc
autohotkey:hnamikaw/vim-autohotkey
blade:jwalton512/vim-blade
brewfile:bfontaine/Brewfile.vim
c++11:octol/vim-cpp-enhanced-highlight
c/c++:vim-jp/vim-cpp
caddyfile:isobit/vim-caddyfile
carp:hellerve/carp-vim
cjsx:mtscout6/vim-cjsx
clojure:guns/vim-clojure-static
cmake:pboettch/vim-cmake-syntax
coffee-script:kchmck/vim-coffee-script:_NOAFTER
cql:elubow/cql-vim
cryptol:victoredwardocallaghan/cryptol.vim
crystal:rhysd/vim-crystal
csv:chrisbra/csv.vim
cucumber:tpope/vim-cucumber
cue:mgrabovsky/vim-cuesheet
dart:dart-lang/dart-vim-plugin
dhall:vmchale/dhall-vim
dlang:JesseKPhillips/d.vim
dockerfile:ekalinin/Dockerfile.vim
elixir:elixir-lang/vim-elixir
elm:andys8/vim-elm-syntax
emberscript:yalesov/vim-ember-script
emblem:yalesov/vim-emblem
erlang:vim-erlang/vim-erlang-runtime
ferm:vim-scripts/ferm.vim
fish:georgewitteman/vim-fish
flatbuffers:dcharbon/vim-flatbuffers
fsharp:ionide/Ionide-vim:_BASIC
gdscript:calviken/vim-gdscript3
git:tpope/vim-git
glsl:tikhomirov/vim-glsl:_NOAFTER
gmpl:maelvalais/gmpl.vim
gnuplot:vim-scripts/gnuplot-syntax-highlighting
go:fatih/vim-go:_BASIC
graphql:jparise/vim-graphql:_ALL
gradle:tfnico/vim-gradle
haml:sheerun/vim-haml
handlebars:mustache/vim-mustache-handlebars
haproxy:CH-DanReif/haproxy.vim
haskell:neovimhaskell/haskell-vim
haxe:yaymukund/vim-haxe
hcl:b4b4r07/vim-hcl
helm:towolf/vim-helm
hive:zebradil/hive.vim
html5:othree/html5.vim
i3:mboughaba/i3config.vim
idris:idris-hackers/idris-vim
ion:vmchale/ion-vim
javascript:pangloss/vim-javascript:_JAVASCRIPT
jenkins:martinda/Jenkinsfile-vim-syntax
jinja:lepture/vim-jinja
json5:GutenYe/json5.vim
json:elzr/vim-json
jst:briancollins/vim-jst
jsx:MaxMEllon/vim-jsx-pretty:_ALL
julia:JuliaEditorSupport/julia-vim
kotlin:udalov/kotlin-vim
ledger:ledger/vim-ledger:_BASIC
less:groenewege/vim-less:_NOAFTER
lilypond:anowlcalledjosh/vim-lilypond
livescript:gkz/vim-ls
llvm:rhysd/vim-llvm
log:MTDL9/vim-log-highlighting
lua:tbastos/vim-lua
mako:sophacles/vim-bundle-mako
markdown:plasticboy/vim-markdown:_NOAFTER
mathematica:voldikss/vim-mma
mdx:jxnblk/vim-mdx-js
meson:mesonbuild/meson:_ALL:/data/syntax-highlighting/vim/
moonscript:leafo/moonscript-vim
nginx:chr4/nginx.vim
nim:zah/nim.vim:_BASIC
nix:LnL7/vim-nix
objc:b4winckler/vim-objc
ocaml:rgrinberg/vim-ocaml
octave:McSinyx/vim-octave
opencl:petRUShka/vim-opencl
perl:vim-perl/vim-perl
pgsql:lifepillar/pgsql.vim
php:StanAngeloff/php.vim
plantuml:aklt/plantuml-syntax
pony:jakwings/vim-pony
powershell:PProvost/vim-ps1
protobuf:uarun/vim-protobuf
pug:digitaltoad/vim-pug
puppet:rodjek/vim-puppet
purescript:purescript-contrib/purescript-vim
python-compiler:aliev/vim-compiler-python
python-indent:Vimjas/vim-python-pep8-indent
python:vim-python/python-syntax
qmake:artoj/qmake-syntax-vim
qml:peterhoeg/vim-qml
r-lang:vim-scripts/R.vim:_BASIC
racket:wlangstroth/vim-racket
ragel:jneen/ragel.vim
raku:Raku/vim-raku
raml:IN3D/vim-raml
razor:adamclerk/vim-razor
reason:reasonml-editor/vim-reason-plus
rspec:keith/rspec.vim
rst:marshallward/vim-restructuredtext
ruby:vim-ruby/vim-ruby
rust:rust-lang/rust.vim
sbt:derekwyatt/vim-sbt
scala:derekwyatt/vim-scala
scss:cakebaker/scss-syntax.vim
slim:slim-template/vim-slim
slime:slime-lang/vim-slime-syntax
smt2:bohlender/vim-smt2
solidity:tomlion/vim-solidity
stylus:wavded/vim-stylus
svelte:evanleck/vim-svelte
svg-indent:jasonshell/vim-svg-indent
svg:vim-scripts/svg.vim
swift:keith/swift.vim
sxhkd:baskerville/vim-sxhkdrc
systemd:wgwoods/vim-systemd-syntax
terraform:hashivim/vim-terraform
textile:timcharper/textile.vim
thrift:solarnz/thrift.vim
tmux:ericpruitt/tmux.vim:_ALL:/vim/
tomdoc:wellbredgrapefruit/tomdoc.vim
toml:cespare/vim-toml
tptp:c-cube/vim-tptp
twig:lumiliet/vim-twig
typescript:HerringtonDarkholme/yats.vim
v:ollykel/v-vim
vala:arrufat/vala.vim
vbnet:vim-scripts/vbnet.vim
vcl:smerrill/vcl-vim-plugin
vifm:vifm/vifm.vim
vm:lepture/vim-velocity
vue:posva/vim-vue
xdc:amal-khailtash/vim-xdc-syntax
xml:amadeus/vim-xml
xls:vim-scripts/XSLT-syntax
yaml:stephpy/vim-yaml
yard:sheerun/vim-yardoc
zephir:xwsoul/vim-zephir
zig:ziglang/zig.vim
zinit:zinit-zsh/zplugin-vim-syntax
"
rm -rf tmp
rm -rf "${DIRS_RM[@]}"
mkdir tmp
printf "Downloading packs..."
download "$(sed '/^#/d' <<<"$PACKS")"
extract "$(sed '/^#/d' <<<"$PACKS")"
update_readme
rm -rf tmp

View File

@@ -1,20 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
" Vim compiler plugin
" Language: JavaScript
" Maintainer: vim-javascript community
" URL: https://github.com/pangloss/vim-javascript
if exists("current_compiler")
finish
endif
let current_compiler = "eslint"
if exists(":CompilerSet") != 2
command! -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=eslint\ -f\ compact\ %
CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m
endif

View File

@@ -17,6 +17,10 @@ if exists(':CompilerSet') != 2
command -nargs=* CompilerSet setlocal <args>
endif
if !exists('g:ledger_main')
let g:ledger_main = '%'
endif
if !g:ledger_is_hledger
" Capture Ledger errors (%-C ignores all lines between "While parsing..." and "Error:..."):
CompilerSet errorformat=%EWhile\ parsing\ file\ \"%f\"\\,\ line\ %l:,%ZError:\ %m,%-C%.%#
@@ -24,9 +28,9 @@ if !g:ledger_is_hledger
CompilerSet errorformat+=%tarning:\ \"%f\"\\,\ line\ %l:\ %m
" Skip all other lines:
CompilerSet errorformat+=%-G%.%#
exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ %\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ %'
exe 'CompilerSet makeprg='.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . shellescape(expand(g:ledger_main)) . '\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ source\ ' . shellescape(expand(g:ledger_main))
else
exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ %\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ >\ /dev/null)'
exe 'CompilerSet makeprg=('.substitute(g:ledger_bin, ' ', '\\ ', 'g').'\ -f\ ' . shellescape(expand(g:ledger_main)) . '\ print\ '.substitute(g:ledger_extra_options, ' ', '\\ ', 'g').'\ >\ /dev/null)'
endif
endif

25
doc/vim-polyglot.txt Normal file
View File

@@ -0,0 +1,25 @@
*vim-polyglot* Vim Polyglot
===============================================================================
*vim-polyglot-introduction*
Introduction ~
Vim Polyglot is a solid language pack for vim. No configuration needed.
Please make sure you have `syntax on` in your `.vimrc`
===============================================================================
DISABLING LANGUAGE PACKS *vim-polyglot-disabled*
Individual language packs can be disabled by setting `g:polyglot_disabled`:
>
" ~/.vimrc, declare this variable before polyglot is loaded let
g:polyglot_disabled = ['css']
<
Note that disabling languages won't make in general your vim startup any faster
/ slower (only for specific file type). Vim-polyglot is selection of language
plugins that are loaded only on demand.

File diff suppressed because it is too large Load Diff

View File

@@ -5,34 +5,6 @@ if exists('b:did_ftplugin')
endif
let b:did_ftplugin = 1
" This file is loaded on 'ecrystal' filetype
if &filetype !=# 'crystal'
finish
endif
let s:save_cpo = &cpo
set cpo&vim
if exists('loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0
let b:match_words =
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|struct\|lib\|macro\|ifdef\|def\|fun\|begin\|enum\)\>=\@!' .
\ ':' .
\ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' .
\ ':' .
\ '\<end\>' .
\ ',{:},\[:\],(:)'
let b:match_skip =
\ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" .
\ "\\<crystal\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" .
\ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" .
\ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" .
\ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" .
\ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'"
endif
setlocal comments=:#
setlocal commentstring=#\ %s
setlocal suffixesadd=.cr
@@ -66,7 +38,8 @@ nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<
nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR>
augroup plugin-ft-crystal
autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif
autocmd!
autocmd BufWritePre <buffer> if g:crystal_auto_format && &filetype ==# 'crystal' | call crystal_lang#format('', 1) | endif
augroup END
if get(g:, 'crystal_define_mappings', 1)
@@ -81,14 +54,33 @@ if &l:ofu ==# ''
setlocal omnifunc=crystal_lang#complete
endif
if exists('AutoPairsLoaded')
" Options for vim-matchit
if exists('g:loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0
let b:match_words =
\ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|struct\|lib\|macro\|ifdef\|def\|begin\|enum\|annotation\)\>=\@!' .
\ ':' .
\ '\<\%(else\|elsif\|ensure\|when\|in\|rescue\|break\|next\)\>' .
\ ':' .
\ '\<end\>' .
\ ',{:},\[:\],(:)'
let b:match_skip =
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~# ''' .
\ '\<crystal\%(String\|StringDelimiter\|ASCIICode\|Escape\|' .
\ 'Interpolation\|NoInterpolation\|Comment\|Documentation\|' .
\ 'ConditionalModifier\|' .
\ 'Function\|BlockArgument\|KeywordAsMethod\|ClassVariable\|' .
\ 'InstanceVariable\|GlobalVariable\|Symbol\)\>'''
endif
" Options for jiangmiao/auto-pairs
if exists('g:AutoPairsLoaded')
let b:AutoPairs = { '{%': '%}' }
call extend(b:AutoPairs, g:AutoPairs, 'force')
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: sw=2 sts=2 et:
endif

View File

@@ -11,9 +11,7 @@ set smarttab
if exists('g:dhall_use_ctags')
if g:dhall_use_ctags == 1
augroup dhall
autocmd BufWritePost *.dhall silent !ctags -R .
augroup END
autocmd BufWritePost *.dhall silent !ctags -R .
endif
endif
@@ -26,9 +24,7 @@ endfunction
if exists('g:dhall_strip_whitespace')
if g:dhall_strip_whitespace == 1
augroup dhall
au BufWritePre *.dhall silent! call StripTrailingWhitespace()
augroup END
au BufWritePre *.dhall silent! call StripTrailingWhitespace()
endif
endif
@@ -42,14 +38,10 @@ endfunction
if exists('g:dhall_format')
if g:dhall_format == 1
augroup dhall
au BufWritePost *.dhall call DhallFormat()
augroup END
au BufWritePost *.dhall call DhallFormat()
endif
endif
augroup dhall
au BufNewFile,BufRead *.dhall setl shiftwidth=2
augroup END
au BufNewFile,BufRead *.dhall setl shiftwidth=2
endif

View File

@@ -1,5 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Filetype plugin for https://crystal-lang.org/api/0.35.1/ECR.html
if exists('b:did_ftplugin')
finish
endif

View File

@@ -119,7 +119,7 @@ endif
" TODO: comments=
setlocal commentstring=<%#%s%>
let b:undo_ftplugin = "setl cms< "
let b:undo_ftplugin = "setl cms< " .
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo

30
ftplugin/fennel.vim Normal file
View File

@@ -0,0 +1,30 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fennel') == -1
" Vim filetype plugin file
" Language: FENNEL
" Maintainer: Calvin Rose
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
"setlocal iskeyword+=!,_,%,?,-,*,!,+,/,=,<,>,.,:,$,^
setlocal iskeyword=!,$,%,#,*,+,-,.,/,:,<,=,>,?,_,a-z,A-Z,48-57,128-247,124,126,38,94
" There will be false positives, but this is better than missing the whole set
" of user-defined def* definitions.
setlocal define=\\v[(/]def(ault)@!\\S*
" Remove 't' from 'formatoptions' to avoid auto-wrapping code.
setlocal formatoptions-=t
setlocal comments=n:;
setlocal commentstring=;\ %s
let &cpo = s:cpo_save
endif

View File

@@ -1,107 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gdscript') == -1
setlocal commentstring=#\ %s
if exists("g:gdscript3_loaded")
finish
endif
let g:gdscript3_loaded=1
if !has("python3") && !has("python")
finish
endif
if has("python3")
let s:pyfile_cmd = "py3file"
let s:py_cmd = "py3"
else
let s:pyfile_cmd = "pyfile"
let s:py_cmd = "py"
endif
execute s:pyfile_cmd . " " . expand('<sfile>:p:h') . "/../python/init.py"
fun! GDScriptComplete(findstart, base)
if a:findstart == 1
let line = getline('.')
let start = col('.') - 1
" Treat '-' as part of the word when completing in a string.
if synIDattr(synID(line('.'), col('.')-1, 1), 'name') ==# "gdString"
let pattern = '[-a-zA-Z0-9_]'
else
let pattern = '[a-zA-Z0-9_]'
endif
while start > 0 && line[start - 1] =~ pattern
let start -= 1
endwhile
return start
else
execute s:py_cmd . " gdscript_complete()"
if exists("gdscript_completions")
return gdscript_completions
else
return []
endif
endif
endfun
set omnifunc=GDScriptComplete
" Configure for common completion frameworks.
" Deoplete
if &rtp =~ 'deoplete.nvim'
call deoplete#custom#option('sources', {
\ 'gdscript3': ['omni'],
\ })
call deoplete#custom#var('omni', 'input_patterns', {
\ 'gdscript3': [
\ '\.|\w+',
\ '\bextends\s+',
\ '\bexport\(',
\ '\bfunc\s+',
\ '"res://[^"]*'
\ ]
\ })
endif
" SuperTab
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
" YouCompleteMe
if !exists('g:ycm_semantic_triggers')
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers.gdscript3 = [
\'re!\w+',
\'.',
\'re!\bextends\s+',
\'re!\bexport\(',
\'re!\bfunc\s+',
\'re!"res://[^"]*'
\]
" Configure echodoc
if &rtp =~ 'echodoc'
let s:echodoc_dict = { "name": "gdscript3", "rank": 9 }
fun! s:echodoc_dict.search(text)
execute s:py_cmd . " echodoc_search()"
if exists("echodoc_search_result")
return echodoc_search_result
else
return []
endif
endfun
call echodoc#register('gdscript3', s:echodoc_dict)
" Reset echodoc cache when exiting insert mode.
" This fixes an issue where the function signature wouldn't re-appear
" after exiting and re-entering insert mode.
au InsertLeave * let b:prev_echodoc = []
endif
" Configure Syntastic checker
let g:syntastic_gdscript3_checkers = ['godot_server']
endif

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Vim filetype plugin
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2016 Aug 29
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Vim filetype plugin
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2016 Aug 29
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -14,6 +14,7 @@ runtime! ftplugin/git.vim
let b:did_ftplugin = 1
setlocal comments=:# commentstring=#\ %s
setlocal include=^\+\+\+
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Vim filetype plugin
" Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2016 Aug 29
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))

View File

@@ -1,5 +1,5 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '%%PACK%%') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jq') == -1
%%CONTENT%%
setlocal commentstring=#%s
endif

View File

@@ -1,5 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gdscript') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1
" -- fmt
command! -nargs=0 JsonnetFmt call jsonnet#Format()
setlocal commentstring=//\ %s
endif

View File

@@ -25,6 +25,8 @@ let b:julia_vim_loaded = 1
let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<"
\ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<"
\ . " | unlet! b:commentary_format"
\ . " | unlet! b:smartcomment_force_linemode"
\ . " | unlet! b:julia_vim_loaded"
" MatchIt plugin support
@@ -94,6 +96,10 @@ if exists("loaded_matchit")
endif
" Some plugin-specific tweaks for commenting
let b:commentary_format = "# %s" " for tpope/vim-commentary
let b:smartcomment_force_linemode = 1 " for carlobaldassi/vim-smartcomment
if has("gui_win32")
let b:browsefilter = "Julia Source Files (*.jl)\t*.jl\n"
let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter"

View File

@@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" Mail file type extension to pick files for attachments via vifm
" Maintainer: xaizek <xaizek@posteo.net>
" Last Change: January 02, 2018
" Last Change: June 22, 2020
" Insert attachment picked via vifm after 'Subject' header
function! s:AddMailAttachments()
@@ -43,9 +43,7 @@ endfunction
function! s:HandleRunResults(exitcode, listf)
if a:exitcode != 0
echohl WarningMsg
echo 'Got non-zero code from vifm: ' . a:exitcode
echohl None
echoerr 'Got non-zero code from vifm: ' . a:exitcode
call delete(a:listf)
return
endif

View File

@@ -156,6 +156,58 @@ function! s:GetHeaderLevel(...)
endif
endfunction
" Return list of headers and their levels.
"
function! s:GetHeaderList()
let l:bufnr = bufnr('%')
let l:fenced_block = 0
let l:front_matter = 0
let l:header_list = []
let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0)
for i in range(1, line('$'))
let l:lineraw = getline(i)
let l:l1 = getline(i+1)
let l:line = substitute(l:lineraw, "#", "\\\#", "g")
" exclude lines in fenced code blocks
if l:line =~ '````*' || l:line =~ '\~\~\~\~*'
if l:fenced_block == 0
let l:fenced_block = 1
elseif l:fenced_block == 1
let l:fenced_block = 0
endif
" exclude lines in frontmatters
elseif l:vim_markdown_frontmatter == 1
if l:front_matter == 1
if l:line == '---'
let l:front_matter = 0
endif
elseif i == 1
if l:line == '---'
let l:front_matter = 1
endif
endif
endif
" match line against header regex
if join(getline(i, i + 1), "\n") =~ s:headersRegexp && l:line =~ '^\S'
let l:is_header = 1
else
let l:is_header = 0
endif
if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0
" remove hashes from atx headers
if match(l:line, "^#") > -1
let l:line = substitute(l:line, '\v^#*[ ]*', '', '')
let l:line = substitute(l:line, '\v[ ]*#*$', '', '')
endif
" append line to list
let l:level = s:GetHeaderLevel(i)
let l:item = {'level': l:level, 'text': l:line, 'lnum': i, 'bufnr': bufnr}
let l:header_list = l:header_list + [l:item]
endif
endfor
return l:header_list
endfunction
" Returns the level of the header at the given line.
"
" If there is no header at the given line, returns `0`.
@@ -177,6 +229,7 @@ endfunction
function! s:MoveToParentHeader()
let l:linenum = s:GetParentHeaderLineNumber()
if l:linenum != 0
call setpos("''", getpos('.'))
call cursor(l:linenum, 1)
else
echo 'no parent header'
@@ -305,65 +358,38 @@ function! s:Toc(...)
endif
let l:bufnr = bufnr('%')
let l:cursor_line = line('.')
let l:cursor_header = 0
let l:fenced_block = 0
let l:front_matter = 0
let l:header_list = []
let l:header_max_len = 0
let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0)
let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0)
for i in range(1, line('$'))
let l:lineraw = getline(i)
let l:l1 = getline(i+1)
let l:line = substitute(l:lineraw, "#", "\\\#", "g")
if l:line =~ '````*' || l:line =~ '\~\~\~\~*'
if l:fenced_block == 0
let l:fenced_block = 1
elseif l:fenced_block == 1
let l:fenced_block = 0
endif
elseif l:vim_markdown_frontmatter == 1
if l:front_matter == 1
if l:line == '---'
let l:front_matter = 0
endif
elseif i == 1
if l:line == '---'
let l:front_matter = 1
endif
endif
endif
if l:line =~ '^#\+' || (l:l1 =~ '^=\+\s*$' || l:l1 =~ '^-\+\s*$') && l:line =~ '^\S'
let l:is_header = 1
else
let l:is_header = 0
endif
if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0
" append line to location list
let l:item = {'lnum': i, 'text': l:line, 'valid': 1, 'bufnr': l:bufnr, 'col': 1}
let l:header_list = l:header_list + [l:item]
" set header number of the cursor position
if l:cursor_header == 0
if i == l:cursor_line
let l:cursor_header = len(l:header_list)
elseif i > l:cursor_line
let l:cursor_header = len(l:header_list) - 1
endif
endif
" keep track of the longest header size (heading level + title)
let l:total_len = stridx(l:line, ' ') + strdisplaywidth(l:line)
if l:total_len > l:header_max_len
let l:header_max_len = l:total_len
endif
endif
endfor
call setloclist(0, l:header_list)
let l:header_list = s:GetHeaderList()
let l:indented_header_list = []
if len(l:header_list) == 0
echom "Toc: No headers."
return
endif
let l:header_max_len = 0
let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0)
for h in l:header_list
" set header number of the cursor position
if l:cursor_header == 0
let l:header_line = h.lnum
if l:header_line == l:cursor_line
let l:cursor_header = index(l:header_list, h) + 1
elseif l:header_line > l:cursor_line
let l:cursor_header = index(l:header_list, h)
endif
endif
" indent header based on level
let l:text = repeat(' ', h.level-1) . h.text
" keep track of the longest header size (heading level + title)
let l:total_len = strdisplaywidth(l:text)
if l:total_len > l:header_max_len
let l:header_max_len = l:total_len
endif
" append indented line to list
let l:item = {'lnum': h.lnum, 'text': l:text, 'valid': 1, 'bufnr': h.bufnr, 'col': 1}
let l:indented_header_list = l:indented_header_list + [l:item]
endfor
call setloclist(0, l:indented_header_list)
if l:window_type ==# 'horizontal'
lopen
@@ -371,7 +397,8 @@ function! s:Toc(...)
vertical lopen
" auto-fit toc window when possible to shrink it
if (&columns/2) > l:header_max_len && l:vim_markdown_toc_autofit == 1
execute 'vertical resize ' . (l:header_max_len + 1)
" header_max_len + 1 space for first header + 3 spaces for line numbers
execute 'vertical resize ' . (l:header_max_len + 1 + 3)
else
execute 'vertical resize ' . (&columns/2)
endif
@@ -384,27 +411,84 @@ function! s:Toc(...)
for i in range(1, line('$'))
" this is the location-list data for the current item
let d = getloclist(0)[i-1]
" atx headers
if match(d.text, "^#") > -1
let l:level = len(matchstr(d.text, '#*', 'g'))-1
let d.text = substitute(d.text, '\v^#*[ ]*', '', '')
let d.text = substitute(d.text, '\v[ ]*#*$', '', '')
" setex headers
else
let l:next_line = getbufline(d.bufnr, d.lnum+1)
if match(l:next_line, "=") > -1
let l:level = 0
elseif match(l:next_line, "-") > -1
let l:level = 1
endif
endif
call setline(i, repeat(' ', l:level). d.text)
call setline(i, d.text)
endfor
setlocal nomodified
setlocal nomodifiable
execute 'normal! ' . l:cursor_header . 'G'
endfunction
function! s:InsertToc(format, ...)
if a:0 > 0
if type(a:1) != type(0)
echohl WarningMsg
echomsg '[vim-markdown] Invalid argument, must be an integer >= 2.'
echohl None
return
endif
let l:max_level = a:1
if l:max_level < 2
echohl WarningMsg
echomsg '[vim-markdown] Maximum level cannot be smaller than 2.'
echohl None
return
endif
else
let l:max_level = 0
endif
let l:toc = []
let l:header_list = s:GetHeaderList()
if len(l:header_list) == 0
echom "InsertToc: No headers."
return
endif
if a:format ==# 'numbers'
let l:h2_count = 0
for header in l:header_list
if header.level == 2
let l:h2_count += 1
endif
endfor
let l:max_h2_number_len = strlen(string(l:h2_count))
else
let l:max_h2_number_len = 0
endif
let l:h2_count = 0
for header in l:header_list
let l:level = header.level
if l:level == 1
" skip level-1 headers
continue
elseif l:max_level != 0 && l:level > l:max_level
" skip unwanted levels
continue
elseif l:level == 2
" list of level-2 headers can be bullets or numbers
if a:format ==# 'bullets'
let l:indent = ''
let l:marker = '* '
else
let l:h2_count += 1
let l:number_len = strlen(string(l:h2_count))
let l:indent = repeat(' ', l:max_h2_number_len - l:number_len)
let l:marker = l:h2_count . '. '
endif
else
let l:indent = repeat(' ', l:max_h2_number_len + 2 * (l:level - 2))
let l:marker = '* '
endif
let l:text = '[' . header.text . ']'
let l:link = '(#' . substitute(tolower(header.text), '\v[ ]+', '-', 'g') . ')'
let l:line = l:indent . l:marker . l:text . l:link
let l:toc = l:toc + [l:line]
endfor
call append(line('.'), l:toc)
endfunction
" Convert Setex headers in range `line1 .. line2` to Atx.
"
" Return the number of conversions.
@@ -681,6 +765,8 @@ command! -buffer Toc call s:Toc()
command! -buffer Toch call s:Toc('horizontal')
command! -buffer Tocv call s:Toc('vertical')
command! -buffer Toct call s:Toc('tab')
command! -buffer -nargs=? InsertToc call s:InsertToc('bullets', <args>)
command! -buffer -nargs=? InsertNToc call s:InsertToc('numbers', <args>)
" Heavily based on vim-notes - http://peterodding.com/code/vim/notes/
if exists('g:vim_markdown_fenced_languages')
@@ -704,7 +790,7 @@ function! s:MarkdownHighlightSources(force)
" Look for code blocks in the current file
let filetypes = {}
for line in getline(1, '$')
let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*')
let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*\ze.*')
if !empty(ft) && ft !~ '^\d*$' | let filetypes[ft] = 1 | endif
endfor
if !exists('b:mkd_known_filetypes')
@@ -735,7 +821,7 @@ function! s:MarkdownHighlightSources(force)
else
let include = '@' . toupper(filetype)
endif
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
execute printf('syntax cluster mkdNonListItem add=%s', group)

View File

@@ -40,7 +40,8 @@ let s:cposet=&cpoptions
set cpo&vim
" Comment string
setlocal comments=
setlocal comments=sr:(*\ ,mb:\ ,ex:*)
setlocal comments^=sr:(**,mb:\ \ ,ex:*)
setlocal commentstring=(*%s*)
" Add mappings, unless the user didn't want this.

View File

@@ -4,6 +4,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1
" Maintainer: Will Langstroth <will@langstroth.com>
" URL: http://github.com/wlangstroth/vim-racket
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setl iskeyword+=#,%,^
setl lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local
setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
@@ -37,7 +42,10 @@ setl makeprg=raco\ make\ --\ %
" but then vim says:
" "press ENTER or type a command to continue"
" We avoid the annoyance of having to hit enter by remapping K directly.
nnoremap <buffer> K :silent !raco docs <cword><cr>:redraw!<cr>
nnoremap <buffer> <Plug>RacketDoc :silent !raco docs <cword><cr>:redraw!<cr>
if maparg("K", "n") == ""
nmap <buffer> K <Plug>RacketDoc
endif
" For the visual mode K mapping, it's slightly more convoluted to get the
" selected text:
@@ -53,9 +61,20 @@ function! s:Racket_visual_doc()
endtry
endfunction
vnoremap <buffer> K :call <SID>Racket_visual_doc()<cr>
vnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr>
if maparg("K", "v") == ""
vmap <buffer> K <Plug>RacketDoc
endif
"setl commentstring=;;%s
setl commentstring=#\|\ %s\ \|#
" Undo our settings when the filetype changes away from Racket
" (this should be amended if settings/mappings are added above!)
let b:undo_ftplugin =
\ "setl iskeyword< lispwords< lisp< comments< formatoptions<"
\. "| setl makeprg< commentstring<"
\. "| nunmap <buffer> K"
\. "| vunmap <buffer> K"
endif

View File

@@ -11,6 +11,9 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal comments< commentstring<"
setlocal comments=:#
setlocal commentstring=#\ %s
endif

View File

@@ -16,4 +16,9 @@ setlocal suffixesadd=.zir
setlocal commentstring=//\ %s
setlocal makeprg=zig\ build
if (has("comments"))
set comments=:///,://,:\\\\
set formatoptions=tcqor
endif
endif

View File

@@ -1,21 +1,21 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Initialization {{{1
" ==============
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetCrystalIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,.
setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue
setlocal indentkeys+==private,=protected
let s:cpo_save = &cpo
set cpo&vim
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,.
setlocal indentkeys+==end,=else,=elsif,=when,=in,=ensure,=rescue
" Only define the function once.
if exists('*GetCrystalIndent')
@@ -26,7 +26,7 @@ endif
if exists('*shiftwidth')
let s:sw = function('shiftwidth')
else
function s:sw()
function! s:sw()
return &shiftwidth
endfunction
endif
@@ -34,262 +34,81 @@ endif
" GetCrystalIndent Function {{{1
" =========================
function GetCrystalIndent(...)
function! GetCrystalIndent(...) abort
" Setup {{{2
" -----
" For the current line, use the first argument if given, else v:lnum
let clnum = a:0 ? a:1 : v:lnum
let indent_info = {}
" Set up variables for restoring position in file
let vcol = col('.')
" The value of a single shift-width
let indent_info.sw = s:sw()
" For the current line, use the first argument if given, else v:lnum
let indent_info.clnum = a:0 ? a:1 : v:lnum
let indent_info.cline = getline(indent_info.clnum)
" Set up variables for restoring position in file.
let indent_info.col = col('.')
" Work on the current line {{{2
" ------------------------
" Get the current line.
let line = getline(clnum)
let ind = -1
for callback_name in g:crystal#indent#curr_line_callbacks
let indent = call(function(callback_name), [indent_info])
" If we got a closing bracket on an empty line, find its match and indent
" according to it. For parentheses we indent to its column - 1, for the
" others we indent to the containing line's MSL's level. Return -1 if fail.
let col = matchend(line, '^\s*[]})]')
if col > 0 && !crystal#indent#IsInStringOrComment(clnum, col)
call cursor(clnum, col)
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', g:crystal#indent#skip_expr)
if line[col-1] ==# ')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1
else
let ind = indent(crystal#indent#GetMSL(line('.')))
endif
if indent >= 0
return indent
endif
return ind
endif
" If we have a deindenting keyword, find its match and indent to its level.
" TODO: this is messy
if crystal#indent#Match(clnum, g:crystal#indent#crystal_deindent_keywords)
call cursor(clnum, 1)
if searchpair(
\ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bW', g:crystal#indent#skip_expr)
let msl = crystal#indent#GetMSL(line('.'))
let line = getline(line('.'))
if strpart(line, 0, col('.') - 1) =~# '=\s*$' &&
\ strpart(line, col('.') - 1, 2) !~# 'do'
" assignment to case/begin/etc, on the same line, hanging indent
let ind = virtcol('.') - 1
elseif getline(msl) =~# '=\s*\(#.*\)\=$'
" in the case of assignment to the msl, align to the starting line,
" not to the msl
let ind = indent(line('.'))
else
" align to the msl
let ind = indent(msl)
endif
endif
return ind
endif
" If we are in a multi-line string, don't do anything to it.
if crystal#indent#IsInString(clnum, matchend(line, '^\s*') + 1)
return indent('.')
endif
" If we are at the closing delimiter of a "<<" heredoc-style string, set the
" indent to 0.
if line =~# '^\k\+\s*$'
\ && crystal#indent#IsInStringDelimiter(clnum, 1)
\ && search('\V<<'.line, 'nbW')
return 0
endif
" If the current line starts with a leading operator, add a level of indent.
if crystal#indent#Match(clnum, g:crystal#indent#leading_operator_regex)
return indent(crystal#indent#GetMSL(clnum)) + s:sw()
endif
endfor
" Work on the previous line. {{{2
" --------------------------
" Find a non-blank, non-multi-line string line above the current line.
let lnum = crystal#indent#PrevNonBlankNonString(clnum - 1)
" Special case: we don't need the real PrevNonBlank for an empty line
" inside a string. And that call can be quite expensive in that
" particular situation.
let indent = crystal#indent#EmptyInsideString(indent_info)
" If the line is empty and inside a string, use the previous line.
if line =~# '^\s*$' && lnum != prevnonblank(clnum - 1)
return indent(prevnonblank(clnum))
if indent >= 0
return indent
endif
" At the start of the file use zero indent.
if lnum == 0
return 0
endif
" Previous line number
let indent_info.plnum = crystal#indent#PrevNonBlank(indent_info.clnum - 1)
let indent_info.pline = getline(indent_info.plnum)
" Set up variables for the previous line.
let line = getline(lnum)
let ind = indent(lnum)
for callback_name in g:crystal#indent#prev_line_callbacks
let indent = call(function(callback_name), [indent_info])
if crystal#indent#Match(lnum, g:crystal#indent#continuable_regex) &&
\ crystal#indent#Match(lnum, g:crystal#indent#continuation_regex)
return indent(crystal#indent#GetMSL(lnum)) + s:sw() * 2
endif
" If the previous line ended with a block opening, add a level of indent.
if crystal#indent#Match(lnum, g:crystal#indent#block_regex)
let msl = crystal#indent#GetMSL(lnum)
if getline(msl) =~# '=\s*\(#.*\)\=$'
" in the case of assignment to the msl, align to the starting line,
" not to the msl
let ind = indent(lnum) + s:sw()
else
let ind = indent(msl) + s:sw()
if indent >= 0
return indent
endif
return ind
endif
endfor
" If the previous line started with a leading operator, use its MSL's level
" of indent
if crystal#indent#Match(lnum, g:crystal#indent#leading_operator_regex)
return indent(crystal#indent#GetMSL(lnum))
endif
" Work on the MSL. {{{2
" ----------------
" If the previous line ended with the "*" of a splat, add a level of indent
if line =~ g:crystal#indent#splat_regex
return indent(lnum) + s:sw()
endif
" Most Significant line based on the previous one -- in case it's a
" contination of something above
let indent_info.plnum_msl = crystal#indent#GetMSL(indent_info.plnum)
let indent_info.pline_msl = getline(indent_info.plnum_msl)
" If the previous line contained unclosed opening brackets and we are still
" in them, find the rightmost one and add indent depending on the bracket
" type.
"
" If it contained hanging closing brackets, find the rightmost one, find its
" match and indent according to that.
if line =~# '[[({]' || line =~# '[])]\s*\%(#.*\)\=$'
let [opening, closing] = crystal#indent#ExtraBrackets(lnum)
for callback_name in g:crystal#indent#msl_callbacks
let indent = call(function(callback_name), [indent_info])
if opening.pos != -1
if opening.type ==# '(' && searchpair('(', '', ')', 'bW', g:crystal#indent#skip_expr)
if col('.') + 1 == col('$')
return ind + s:sw()
else
return virtcol('.')
endif
else
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
return nonspace > 0 ? nonspace : ind + s:sw()
endif
elseif closing.pos != -1
call cursor(lnum, closing.pos + 1)
keepjumps normal! %
if crystal#indent#Match(line('.'), g:crystal#indent#crystal_indent_keywords)
return indent('.') + s:sw()
else
return indent('.')
endif
else
call cursor(clnum, vcol)
end
endif
" If the previous line ended with an "end", match that "end"s beginning's
" indent.
let col = crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
if col
call cursor(lnum, col)
if searchpair(
\ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bW',
\ g:crystal#indent#skip_expr)
let n = line('.')
let ind = indent('.')
let msl = crystal#indent#GetMSL(n)
if msl != n
let ind = indent(msl)
end
return ind
if indent >= 0
return indent
endif
end
let col = crystal#indent#Match(lnum, g:crystal#indent#crystal_indent_keywords)
if col
call cursor(lnum, col)
let ind = virtcol('.') - 1 + s:sw()
" TODO: make this better (we need to count them) (or, if a searchpair
" fails, we know that something is lacking an end and thus we indent a
" level
if crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
let ind = indent('.')
endif
return ind
endif
" Work on the MSL line. {{{2
" ---------------------
" Set up variables to use and search for MSL to the previous line.
let p_lnum = lnum
let lnum = crystal#indent#GetMSL(lnum)
" If the previous line wasn't a MSL.
if p_lnum != lnum
" If previous line ends bracket and begins non-bracket continuation decrease indent by 1.
if crystal#indent#Match(p_lnum, g:crystal#indent#bracket_switch_continuation_regex)
return ind - 1
" If previous line is a continuation return its indent.
" TODO: the || crystal#indent#IsInString() thing worries me a bit.
elseif crystal#indent#Match(p_lnum, g:crystal#indent#non_bracket_continuation_regex) ||
\ crystal#indent#IsInString(p_lnum,strlen(line))
return ind
endif
endif
" Set up more variables, now that we know we wasn't continuation bound.
let line = getline(lnum)
let msl_ind = indent(lnum)
" If the MSL line had an indenting keyword in it, add a level of indent.
" TODO: this does not take into account contrived things such as
" module Foo; class Bar; end
if crystal#indent#Match(lnum, g:crystal#indent#crystal_indent_keywords)
let ind = msl_ind + s:sw()
if crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
let ind = ind - s:sw()
endif
return ind
endif
" If the previous line ended with an operator -- but wasn't a block
" ending, closing bracket, or type declaration -- indent one extra
" level.
if crystal#indent#Match(lnum, g:crystal#indent#non_bracket_continuation_regex) &&
\ !crystal#indent#Match(lnum, '^\s*\([\])}]\|end\)')
if lnum == p_lnum
let ind = msl_ind + s:sw()
else
let ind = msl_ind
endif
return ind
endif
endfor
" }}}2
return ind
" By default, just return the previous line's indent
return indent(indent_info.plnum)
endfunction
" }}}1
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2 ts=8 et:
" vim:sw=2 sts=2 ts=8 fdm=marker et:
endif

View File

@@ -52,7 +52,7 @@ if b:ecrystal_indent_multiline
endif
setlocal indentexpr=GetEcrystalIndent()
setlocal indentkeys+=<>>,=end,=else,=elsif,=rescue,=ensure,=when
setlocal indentkeys+=<>>,=end,=else,=elsif,=rescue,=ensure,=when,=in
let b:did_indent = 1
@@ -71,11 +71,10 @@ let s:ecr_control_open = '<%%\@!-\=[=#]\@!'
let s:ecr_comment_open = '<%%\@!-\=#'
let s:ecr_indent_regex =
\ '\<\%(if\|unless\|else\|elsif\|case\|for\|when\|while\|until\|begin\|do\|rescue\|ensure\|' .
\ 'class\|module\|struct\|lib\|enum\|union\)\>'
\ '\<\%(if\|unless\|else\|elsif\|case\|when\|in\|while\|until\|begin\|do\|rescue\|ensure\|\)\>'
let s:ecr_dedent_regex =
\ '\<\%(end\|else\|elsif\|when\|rescue\|ensure\)\>'
\ '\<\%(end\|else\|elsif\|when\|in\|rescue\|ensure\)\>'
" Return the value of a single shift-width
if exists('*shiftwidth')

View File

@@ -835,7 +835,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
endif
elseif stack == ['prev_term_plus']
if token =~# '[a-zA-Z_@]' ||
if token =~# '[a-zA-Z_@#]' ||
\ token ==# '<string>' || token ==# '<string_start>' ||
\ token ==# '<quoted_atom>' || token ==# '<quoted_atom_start>'
call s:Log(' previous token found: curr_vcol + plus = ' .

330
indent/fennel.vim Normal file
View File

@@ -0,0 +1,330 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fennel') == -1
" Vim filetype plugin file
" Language: FENNEL
" Maintainer: Calvin Rose
"
" Modified from vim-clojure-static
" https://github.com/guns/vim-clojure-static/blob/master/indent/clojure.vim
" This should eventually be replaced by a more standard and performant
" indenter.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
let s:save_cpo = &cpo
set cpo&vim
setlocal noautoindent nosmartindent
setlocal softtabstop=2 shiftwidth=2 expandtab
setlocal indentkeys=!,o,O
if exists("*searchpairpos")
if !exists('g:fennel_maxlines')
let g:fennel_maxlines = 100
endif
if !exists('g:fennel_fuzzy_indent')
let g:fennel_fuzzy_indent = 1
endif
if !exists('g:fennel_fuzzy_indent_patterns')
let g:fennel_fuzzy_indent_patterns = ['^def', '^let', '^while', '^if', '^fn$', '^var$', '^case$', '^for$', '^each$', '^local$', '^global$', '^match$', '^macro', '^lambda$']
endif
if !exists('g:fennel_fuzzy_indent_blacklist')
let g:fennel_fuzzy_indent_blacklist = []
endif
if !exists('g:fennel_special_indent_words')
let g:fennel_special_indent_words = ''
endif
if !exists('g:fennel_align_multiline_strings')
let g:fennel_align_multiline_strings = 0
endif
if !exists('g:fennel_align_subforms')
let g:fennel_align_subforms = 0
endif
function! s:syn_id_name()
return synIDattr(synID(line("."), col("."), 0), "name")
endfunction
function! s:ignored_region()
return s:syn_id_name() =~? '\vstring|comment|character'
endfunction
function! s:current_char()
return getline('.')[col('.')-1]
endfunction
function! s:current_word()
return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2]
endfunction
function! s:is_paren()
return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region()
endfunction
" Returns 1 if string matches a pattern in 'patterns', which may be a
" list of patterns, or a comma-delimited string of implicitly anchored
" patterns.
function! s:match_one(patterns, string)
let list = type(a:patterns) == type([])
\ ? a:patterns
\ : map(split(a:patterns, ','), '"^" . v:val . "$"')
for pat in list
if a:string =~# pat | return 1 | endif
endfor
endfunction
function! s:match_pairs(open, close, stopat)
" Stop only on vector and map [ resp. {. Ignore the ones in strings and
" comments.
if a:stopat == 0 && g:fennel_maxlines > 0
let stopat = max([line(".") - g:fennel_maxlines, 0])
else
let stopat = a:stopat
endif
let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat)
return [pos[0], col(pos)]
endfunction
function! s:fennel_check_for_string_worker()
" Check whether there is the last character of the previous line is
" highlighted as a string. If so, we check whether it's a ". In this
" case we have to check also the previous character. The " might be the
" closing one. In case the we are still in the string, we search for the
" opening ". If this is not found we take the indent of the line.
let nb = prevnonblank(v:lnum - 1)
if nb == 0
return -1
endif
call cursor(nb, 0)
call cursor(0, col("$") - 1)
if s:syn_id_name() !~? "string"
return -1
endif
" This will not work for a " in the first column...
if s:current_char() == '"' || s:current_char() == '`'
call cursor(0, col("$") - 2)
if s:syn_id_name() !~? "string"
return -1
endif
if s:current_char() != '\'
return -1
endif
call cursor(0, col("$") - 1)
endif
let p = searchpos('\(^\|[^\\]\)\zs"\`', 'bW')
if p != [0, 0]
return p[1] - 1
endif
return indent(".")
endfunction
function! s:check_for_string()
let pos = getpos('.')
try
let val = s:fennel_check_for_string_worker()
finally
call setpos('.', pos)
endtry
return val
endfunction
" Returns 1 for opening brackets, -1 for _anything else_.
function! s:bracket_type(char)
return stridx('([{', a:char) > -1 ? 1 : -1
endfunction
" Returns: [opening-bracket-lnum, indent]
function! s:fennel_indent_pos()
" Get rid of special case.
if line(".") == 1
return [0, 0]
endif
" We have to apply some heuristics here to figure out, whether to use
" normal lisp indenting or not.
let i = s:check_for_string()
if i > -1
return [0, i + !!g:fennel_align_multiline_strings]
endif
call cursor(0, 1)
" Find the next enclosing [ or {. We can limit the second search
" to the line, where the [ was found. If no [ was there this is
" zero and we search for an enclosing {.
let paren = s:match_pairs('(', ')', 0)
let bracket = s:match_pairs('\[', '\]', paren[0])
let curly = s:match_pairs('{', '}', bracket[0])
" In case the curly brace is on a line later then the [ or - in
" case they are on the same line - in a higher column, we take the
" curly indent.
if curly[0] > bracket[0] || curly[1] > bracket[1]
if curly[0] > paren[0] || curly[1] > paren[1]
return curly
endif
endif
" If the curly was not chosen, we take the bracket indent - if
" there was one.
if bracket[0] > paren[0] || bracket[1] > paren[1]
return bracket
endif
" There are neither { nor [ nor (, ie. we are at the toplevel.
if paren == [0, 0]
return paren
endif
" Now we have to reimplement lispindent. This is surprisingly easy, as
" soon as one has access to syntax items.
"
" - Check whether we are in a special position after a word in
" g:fennel_special_indent_words. These are special cases.
" - Get the next keyword after the (.
" - If its first character is also a (, we have another sexp and align
" one column to the right of the unmatched (.
" - In case it is in lispwords, we indent the next line to the column of
" the ( + sw.
" - If not, we check whether it is last word in the line. In that case
" we again use ( + sw for indent.
" - In any other case we use the column of the end of the word + 2.
call cursor(paren)
" In case we are at the last character, we use the paren position.
if col("$") - 1 == paren[1]
return paren
endif
" In case after the paren is a whitespace, we search for the next word.
call cursor(0, col('.') + 1)
if s:current_char() == ' '
call search('\v\S', 'W')
endif
" If we moved to another line, there is no word after the (. We
" use the ( position for indent.
if line(".") > paren[0]
return paren
endif
" We still have to check, whether the keyword starts with a (, [ or {.
" In that case we use the ( position for indent.
let w = s:current_word()
if s:bracket_type(w[0]) == 1
return paren
endif
let ww = w
if &lispwords =~# '\V\<' . ww . '\>'
return [paren[0], paren[1] + &shiftwidth - 1]
endif
if g:fennel_fuzzy_indent
\ && !s:match_one(g:fennel_fuzzy_indent_blacklist, ww)
\ && s:match_one(g:fennel_fuzzy_indent_patterns, ww)
return [paren[0], paren[1] + &shiftwidth - 1]
endif
call search('\v\_s', 'cW')
call search('\v\S', 'W')
if paren[0] < line(".")
return [paren[0], paren[1] + (g:fennel_align_subforms ? 0 : &shiftwidth - 1)]
endif
call search('\v\S', 'bW')
return [line('.'), col('.') + 1]
endfunction
function! GetFennelIndent()
let lnum = line('.')
let orig_lnum = lnum
let orig_col = col('.')
let [opening_lnum, indent] = s:fennel_indent_pos()
" Account for multibyte characters
if opening_lnum > 0
let indent -= indent - virtcol([opening_lnum, indent])
endif
" Return if there are no previous lines to inherit from
if opening_lnum < 1 || opening_lnum >= lnum - 1
call cursor(orig_lnum, orig_col)
return indent
endif
let bracket_count = 0
" Take the indent of the first previous non-white line that is
" at the same sexp level. cf. src/misc1.c:get_lisp_indent()
while 1
let lnum = prevnonblank(lnum - 1)
let col = 1
if lnum <= opening_lnum
break
endif
call cursor(lnum, col)
" Handle bracket counting edge case
if s:is_paren()
let bracket_count += s:bracket_type(s:current_char())
endif
while 1
if search('\v[(\[{}\])]', '', lnum) < 1
break
elseif !s:ignored_region()
let bracket_count += s:bracket_type(s:current_char())
endif
endwhile
if bracket_count == 0
" Check if this is part of a multiline string
call cursor(lnum, 1)
if s:syn_id_name() !~? '\vString|Buffer'
call cursor(orig_lnum, orig_col)
return indent(lnum)
endif
endif
endwhile
call cursor(orig_lnum, orig_col)
return indent
endfunction
setlocal indentexpr=GetFennelIndent()
else
" In case we have searchpairpos not available we fall back to
" normal lisp indenting.
setlocal indentexpr=
setlocal lisp
let b:undo_indent .= '| setlocal lisp<'
endif
let &cpo = s:save_cpo
unlet! s:save_cpo
endif

View File

@@ -843,12 +843,11 @@ func! HtmlIndent_FindTagStart(lnum)
" - a flag indicating whether we found the end of a tag.
" This method is global so that HTML-like indenters can use it.
" To avoid matching " > " or " < " inside a string require that the opening
" "<" is followed by a word character and the closing ">" comes after a
" non-white character.
" "<" is followed by a word character
let idx = match(getline(a:lnum), '\S>\s*$')
if idx > 0
call cursor(a:lnum, idx)
let lnum = searchpair('<\w', '' , '\S>', 'bW', '', max([a:lnum - b:html_indent_line_limit, 0]))
let lnum = searchpair('<\w', '' , '>', 'bW', '', max([a:lnum - b:html_indent_line_limit, 0]))
if lnum > 0
return [lnum, 1]
endif

View File

@@ -270,6 +270,12 @@ function IsInBrackets(lnum, c)
return len(stack) > 0
endfunction
function IsInDocString(lnum)
let stack = map(synstack(a:lnum, 1), 'synIDattr(v:val, "name")')
call filter(stack, 'v:val =~# "\\<juliaDocString\\>"')
return len(stack) > 0
endfunction
" Auxiliary function to find a line which does not start in the middle of a
" multiline bracketed expression, to be used as reference for block
" indentation.
@@ -290,6 +296,11 @@ function LastBlockIndent(lnum)
endfunction
function GetJuliaIndent()
" Do not alter doctrings indentation
if IsInDocString(v:lnum)
return -1
endif
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)

View File

@@ -31,6 +31,8 @@ let s:close_patt = '\C\%(\<\%(end\|until\)\>\|)\|}\)'
let s:anon_func_start = '\S\+\s*[({].*\<function\s*(.*)\s*$'
let s:anon_func_end = '\<end\%(\s*[)}]\)\+'
let s:chained_func_call = "^\\v\\s*[:.]\\w+[({\"']"
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~# 'luaComment\\|luaString'"
@@ -100,6 +102,16 @@ function GetLuaIndent()
let i += 1
endif
" if the current line chains a function call to previous unchained line
if contents_prev !~# s:chained_func_call && contents_cur =~# s:chained_func_call
let i += 1
endif
" if the current line chains a function call to previous unchained line
if contents_prev =~# s:chained_func_call && contents_cur !~# s:chained_func_call
let i -= 1
endif
" special case: call(with, {anon = function() -- should indent only once
if i > 1 && contents_prev =~# s:anon_func_start
let i = 1

View File

@@ -32,7 +32,8 @@ setlocal nosmartindent
" Comment formatting
if !exists("no_ocaml_comments")
if (has("comments"))
setlocal comments=sr:(*,mb:*,ex:*)
setlocal comments=sr:(*\ ,mb:\ ,ex:*)
setlocal comments^=sr:(**,mb:\ \ ,ex:*)
setlocal fo=cqort
endif
endif

View File

@@ -77,7 +77,7 @@ endfunction
function! s:getIncIndent() abort
" Function to determine the s:incIndent pattern
return
\ '^\s*\%(class\|entity\|object\|interface\|partition\|rectangle\|enum\|namespace\|package\)\>.*{\s*$\|' .
\ '^\s*\%(artifact\|class\|cloud\|database\|entity\|enum\|file\|folder\|frame\|interface\|namespace\|node\|object\|package\|partition\|rectangle\|skinparam\|state\|storage\|together\)\>.*{\s*$\|' .
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\|fork\|split\)\>\|' .
\ '^\s*ref\>[^:]*$\|' .
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .

View File

@@ -28,7 +28,12 @@ endif
if !exists('g:ruby_indent_block_style')
" Possible values: "expression", "do"
let g:ruby_indent_block_style = 'expression'
let g:ruby_indent_block_style = 'do'
endif
if !exists('g:ruby_indent_hanging_elements')
" Non-zero means hanging indents are enabled, zero means disabled
let g:ruby_indent_hanging_elements = 1
endif
setlocal nosmartindent
@@ -323,7 +328,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort
if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0
if closing_bracket == ')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1
if g:ruby_indent_hanging_elements
let ind = virtcol('.') - 1
else
let ind = indent(line('.'))
end
elseif g:ruby_indent_block_style == 'do'
let ind = indent(line('.'))
else " g:ruby_indent_block_style == 'expression'
@@ -548,7 +557,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort
let [opening, closing] = s:ExtraBrackets(info.plnum)
if opening.pos != -1
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if !g:ruby_indent_hanging_elements
return indent(info.plnum) + info.sw
elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
return indent(info.plnum) + info.sw
else

View File

@@ -49,6 +49,16 @@ function! TerraformIndent(lnum)
let thisindent -= &shiftwidth
endif
" If the previous line starts a block comment /*, increase by one
if prevline =~# '/\*'
let thisindent += 1
endif
" If the previous line ends a block comment */, decrease by one
if prevline =~# '\*/'
let thisindent -= 1
endif
return thisindent
endfunction

View File

@@ -51,7 +51,7 @@ let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_st
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
" Regex that defines continuation lines, not including (, {, or [.
let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]=[^=].*,\)' . s:line_term
let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]=[^=]\)' . s:line_term
" Regex that defines continuation lines.
" TODO: this needs to deal with if ...: and so on

View File

@@ -1,4 +1,4 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vm') == -1
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'velocity') == -1
if exists("b:did_indent")
finish

View File

@@ -15,6 +15,7 @@ setlocal nolisp
setlocal autoindent
setlocal indentexpr=VlangIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
setlocal noexpandtab
if exists("*VlangIndent")
finish

80
indent/zig.vim Normal file
View File

@@ -0,0 +1,80 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1
" indent/zig.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
if (!has("cindent") || !has("eval"))
finish
endif
setlocal cindent
" L0 -> 0 indent for jump labels (i.e. case statement in c).
" j1 -> indenting for "javascript object declarations"
" J1 -> see j1
" w1 -> starting a new line with `(` at the same indent as `(`
" m1 -> if `)` starts a line, match its indent with the first char of its
" matching `(` line
" (s -> use one indent, when starting a new line after a trailing `(`
setlocal cinoptions=L0,m1,(s,j1,J1,l1
" cinkeys: controls what keys trigger indent formatting
" 0{ -> {
" 0} -> }
" 0) -> )
" 0] -> ]
" !^F -> make CTRL-F (^F) reindent the current line when typed
" o -> when <CR> or `o` is used
" O -> when the `O` command is used
setlocal cinkeys=0{,0},0),0],!^F,o,O
setlocal indentexpr=GetZigIndent(v:lnum)
function! GetZigIndent(lnum)
let curretLineNum = a:lnum
let currentLine = getline(a:lnum)
" cindent doesn't handle multi-line strings properly, so force no indent
if currentLine =~ '^\s*\\\\.*'
return -1
endif
let prevLineNum = prevnonblank(a:lnum-1)
let prevLine = getline(prevLineNum)
" for lines that look line
" },
" };
" try treat them the same as a }
if prevLine =~ '\v^\s*},$'
if currentLine =~ '\v^\s*};$' || currentLine =~ '\v^\s*}$'
return indent(prevLineNum) - 4
endif
return indent(prevLineNum-1) - 4
endif
if currentLine =~ '\v^\s*},$'
return indent(prevLineNum) - 4
endif
if currentLine =~ '\v^\s*};$'
return indent(prevLineNum) - 4
endif
" cindent doesn't handle this case correctly:
" switch (1): {
" 1 => true,
" ~
" ^---- indents to here
if prevLine =~ '.*=>.*,$' && currentLine !~ '.*}$'
return indent(prevLineNum)
endif
return cindent(a:lnum)
endfunction
endif

1307
packages.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
%%CONTENT%%
endif

317
scripts/build Executable file
View File

@@ -0,0 +1,317 @@
#!/usr/bin/env ruby
require 'open-uri'
require 'open3'
require 'yaml'
require 'fileutils'
require 'set'
Dir.chdir(File.dirname(__dir__))
PACKAGES = YAML.load_stream(File.read('packages.yaml'))
BASE_URL = 'https://raw.githubusercontent.com/github/linguist/master'
DIRS = {
default: %w(syntax indent compiler autoload ftplugin ctags after/syntax after/indent after/ftplugin),
all: %w(syntax indent compiler autoload ftplugin after extras ctags),
basic: %w(syntax compiler indent after/syntax after/indent),
syntax: %w(syntax indent after/syntax after/indent),
noafter: %w(syntax compiler indent autoload ftplugin),
javascript: %w(syntax indent compiler autoload ftplugin ctags after/syntax after/indent after/ftplugin extras),
go: %w(autoload/go/config.vim syntax compiler indent after/syntax after/indent)
}
def parallel(*procs)
threads = procs.map { |p| Thread.new { method(p).call } }
threads.map(&:join).map(&:value)
end
def read_strings(data, keys, print=false)
if data.is_a?(Hash)
data.flat_map do |key, val|
read_strings(val, keys, keys.include?(key))
end
elsif data.is_a?(Array)
data.flat_map { |d| read_strings(d, keys, print) }
elsif data.is_a?(String)
print ? [data] : []
else
[]
end
end
def transform_with(data, keys, transfrom=false, &block)
if data.is_a?(Hash)
Hash[data.map do |key, val|
[key, transform_with(val, keys, keys.include?(key), &block)]
end]
elsif data.is_a?(Array)
data.map { |d| transform_with(d, keys, transfrom, &block) }
elsif data.is_a?(String)
transfrom ? yield(data) : data
else
data
end
end
def each_hash(data, &block)
if data.is_a?(Hash)
yield data
data.each do |key, val|
each_hash(val, &block)
end
elsif data.is_a?(Array)
data.map { |d| each_hash(d, &block) }
end
end
def patterns_to_vim_patterns(patterns)
stdin, stdout, stderr = Open3.popen3('vim', '-V', '--clean', '/dev/stdin', '-es', '-c', "echo expand('%:p:h') | source #{__dir__}/scripts/eregex.vim", '-c', "for line in range(0, line('$')) | call setline(line, ExtendedRegex2VimRegex(getline(line))) | endfor", '-c', ':wq! /dev/stdout', chdir: __dir__)
stdin.write(patterns.join("\n"))
stdin.close
stdout.readlines
end
def transform_patterns(data)
patterns = read_strings(data, ["pattern", "patterns"])
patterns_mapping = Hash[patterns.zip(patterns_to_vim_patterns(patterns))]
transform_with(data, ["pattern", "patterns"]) { |a| patterns_mapping[a] }
end
def load_heuristics
url = "#{BASE_URL}/lib/linguist/heuristics.yml"
data = URI.open(url) { |io| YAML.load(io.read) }
each_hash(data["disambiguations"]) do |h|
if h.has_key?("named_pattern")
h["pattern"] = data["named_patterns"].fetch(h["named_pattern"])
h.delete("named_pattern")
end
end
transform_patterns(data["disambiguations"])
end
def load_languages
url = "#{BASE_URL}/lib/linguist/languages.yml"
data = URI.open(url) { |io| YAML.load(io.read) }
end
def parse_remote(remote)
match = remote.match(/(?<repo>[^@:]+)(?:@(?<branch>[^:]+))?(?::(?<path>.*))?/)
[match[:repo], match[:branch] || "master", match[:path]]
end
def copy_file(package, src, dest)
return unless [".vim", ".ctags", ".vital"].include?(File.extname(src))
FileUtils.mkdir_p(File.dirname(dest))
name = package.fetch("name")
open(src, "r") do |input|
open(dest, "a+") do |output|
if name == "jsx"
output << "if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)\n\n"
else
output << "if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '#{name}') == -1\n\n"
end
IO.copy_stream(input, output)
output << "\nendif\n"
end
end
end
def download
FileUtils.rm_rf('tmp')
PACKAGES.each_slice(20) do |batch|
batch.map do |package|
Thread.new do
repo, branch, path = parse_remote(package.fetch("remote"))
dir = "tmp/" + repo.split('/')[1]
FileUtils.mkdir_p(dir)
url = "https://codeload.github.com/#{repo}/tar.gz/#{branch}"
`curl --silent -fL #{url} | tar -zx -C "#{dir}" --strip 1`
progress
end
end.map(&:join)
end
end
$i = 0
LYRICS = "Never gonna give you up. Never gonna let you down. " +
"Never gonna run around and desert you. " +
"Never gonna make you cry. Never gonna say goodbye. " +
"Never gonna tell a lie and hurt you."
$mutex = Mutex.new
def progress
$mutex.synchronize do
$stdout.write(LYRICS[$i] || ".")
$i += 1
end
end
def extract
FileUtils.rm_rf(DIRS[:all])
output = []
PACKAGES.map do |package|
repo, branch, path = parse_remote(package["remote"])
dir = "tmp/" + repo.split('/')[1]
subdirs = []
dirs = DIRS.fetch(package.fetch("dirs", "default").to_sym)
dirs -= package.fetch("ignored_dirs", [])
dirs |= package.fetch("extra_dirs", [])
for subdir in dirs
subtree = "#{dir}/#{path ? path + "/" : ""}"
subpath = "#{subtree}#{subdir}"
if FileTest.directory?(subpath)
Dir.glob("#{subdir}/**/*", base: subtree).each do |p|
next unless File.file?("#{subtree}/#{p}")
copy_file(package, "#{subtree}/#{p}", p)
end
subdirs << subdir.split("/").last
elsif File.exist?(subpath)
copy_file(package, subpath, subdir)
end
end
output << "- [#{package["name"]}](https://github.com/#{repo}) (#{subdirs.uniq.join(", ")})"
progress
end
readme = File.read('README.md')
readme.gsub!(
%r{(?<=<!--Package Count-->).*?(?=<!--/Package Count-->)},
output.size.to_s
)
readme.gsub!(
%r{(?<=<!--Language Packs-->).*?(?=<!--/Language Packs-->)}m,
"\n" + output.sort.join("\n") + "\n"
)
File.write('README.md', readme)
end
def generate_ftdetect
heuristics, languages = parallel(:load_heuristics, :load_languages)
output = <<~EOS
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
if !exists('g:polyglot_disabled')
let g:polyglot_disabled = []
endif
function! s:SetDefault(name, value)
if !exists(a:name)
let {a:name} = a:value
endif
endfunction
call s:SetDefault('g:markdown_enable_spell_checking', 0)
call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
call s:SetDefault('g:markdown_enable_mappings', 0)
" Enable jsx syntax by default
call s:SetDefault('g:jsx_ext_required', 0)
" Make csv loading faster
call s:SetDefault('g:csv_start', 1)
call s:SetDefault('g:csv_end', 2)
" Disable json concealing by default
call s:SetDefault('g:vim_json_syntax_conceal', 0)
call s:SetDefault('g:filetype_euphoria', 'elixir')
if !exists('g:python_highlight_all')
call s:SetDefault('g:python_highlight_builtins', 1)
call s:SetDefault('g:python_highlight_builtin_objs', 1)
call s:SetDefault('g:python_highlight_builtin_types', 1)
call s:SetDefault('g:python_highlight_builtin_funcs', 1)
call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
call s:SetDefault('g:python_highlight_exceptions', 1)
call s:SetDefault('g:python_highlight_string_formatting', 1)
call s:SetDefault('g:python_highlight_string_format', 1)
call s:SetDefault('g:python_highlight_string_templates', 1)
call s:SetDefault('g:python_highlight_indent_errors', 1)
call s:SetDefault('g:python_highlight_space_errors', 1)
call s:SetDefault('g:python_highlight_doctests', 1)
call s:SetDefault('g:python_highlight_func_calls', 1)
call s:SetDefault('g:python_highlight_class_vars', 1)
call s:SetDefault('g:python_highlight_operators', 1)
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
call s:SetDefault('g:python_slow_sync', 1)
endif
EOS
ambiguous_extensions = languages.flat_map { |_, v| v["extensions"] || [] }
.group_by(&:itself).transform_values(&:count)
.select { |a, b| b > 1 }.keys.map { |a| a[1..] }.to_set
for package in PACKAGES
name = package.fetch("name")
output << if name == "jsx"
"if !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)\n"
else
"if index(g:polyglot_disabled, '#{name}') == -1\n"
end
filetypes = package["filetypes"] or raise "Unknown filetype for: #{package["name"]}"
for filetype in filetypes
syntax = filetype["syntax"] ? " syntax=#{filetype["syntax"]}" : ""
set_command = package.fetch("custom_set", "set ft=#{filetype.fetch("name")}#{syntax}")
linguist = filetype["linguist"] ? languages.fetch(filetype["linguist"]) : {}
extensions = filetype["extensions"] || linguist.fetch("extensions", []).map { |e| e[1..] }
extensions = (extensions | filetype.fetch("extra_extensions", [])) - filetype.fetch("ignored_extensions", [])
filenames = filetype["filenames"] || linguist.fetch("filenames", [])
filenames = (filenames | filetype.fetch("extra_filenames", [])) - filetype.fetch("ignored_filenames", [])
for extension in extensions.sort
outer_filetype = filetype["outer_filetype"]
if outer_filetype
output << " au BufNewFile *.*.#{extension} execute \"do BufNewFile filetypedetect \" . expand(\"<afile>:r\") | #{outer_filetype}"
output << " au BufReadPre *.*#{extension} execute \"do BufRead filetypedetect \" . expand(\"<afile>:r\") | #{outer_filetype}"
end
if ambiguous_extensions.include?(extension)
output << " au BufNewFile,BufRead *.#{extension} setf #{filetype["name"]}\n"
else
output << " au BufNewFile,BufRead *.#{extension} #{set_command}\n"
end
end
for filename in filenames.sort
if filename[0] == "."
filename = "{.,}" + filename[1..]
end
output << " au BufNewFile,BufRead #{filename} #{set_command}\n"
end
end
output << "endif\n\n"
end
output << <<~EOS
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
EOS
File.write('ftdetect/polyglot.vim', output)
end
download
extract
generate_ftdetect
puts(" Bye! Have a wonderful time!")
FileUtils.rm_rf("tmp")

1102
scripts/eregex.vim Normal file

File diff suppressed because it is too large Load Diff

19
scripts/test Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -e
vim -N --startuptime /dev/stdout -u <(
echo "filetype plugin indent on"
echo "syntax enable"
echo "let &rtp='$PWD,'.&rtp"
cat ftdetect/polyglot.vim | grep -E 'set ft=[a-z-]+' -o | sort | uniq | awk -F '=' '{ print $2 }' | while read ft; do
echo "try"
echo " enew"
echo " set ft=$ft"
echo "catch"
echo " echo v:exception"
echo " exec ':cq!'"
echo "endtry"
done
echo "exec ':q!'"
)

View File

@@ -1,28 +0,0 @@
require 'spec_helper'
require 'timeout'
describe "My Vim plugin" do
extensions = `cat ftdetect/polyglot.vim | grep '^au' | tr "\t" ' ' | cut -d ' ' -f 3 | grep -v / | grep -v '^\*$' | grep -v '^$'`.strip
extensions.gsub!(/\[(.).+\]/) { $1 }.gsub!('*', 'test')
extensions = extensions.split(/[\n,]/)
extensions.sort!.uniq!.each do |ext|
if ext.match?(/^[a-z\.]+$/i)
it "should parse #{ext} file" do
Timeout::timeout(20) do
write_file "#{ext}", ""
vim.edit "#{ext}"
vim.insert "sample"
vim.write
end
end
end
end
after(:all) do
vim.kill
end
end

View File

@@ -1,20 +0,0 @@
require 'vimrunner'
require 'vimrunner/rspec'
$plugin_path = File.expand_path('../..', __FILE__)
Vimrunner::RSpec.configure do |config|
config.reuse_server = false
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.
config.start_vim do
vim = Vimrunner.start
# Setup your plugin in the Vim instance
vim.add_plugin($plugin_path)
# The returned value is the Client available in the tests.
vim
end
end

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1
runtime syntax/groovy.vim
syn keyword jenkinsfileBuiltInVariable currentBuild
syn keyword jenkinsfileSection pipeline agent stages steps
syn keyword jenkinsfileSection pipeline agent stages steps post
syn keyword jenkinsfileDirective environment options parameters triggers stage tools input when libraries
@@ -13,7 +13,7 @@ syn region jenkinsfileOptionParams contained start='(' end=')' transparent cont
syn match jenkinsfileOptionO /[a-zA-Z]\+([^)]*)/ contains=jenkinsfileOption,jenkinsfileOptionParams transparent containedin=groovyParenT1
syn keyword jenkinsfileCoreStep checkout
syn keyword jenkinsfileCoreStep docker skipwhite nextgroup=jenkinsFileDockerConfigBlock
syn keyword jenkinsfileCoreStep docker dockerfile skipwhite nextgroup=jenkinsFileDockerConfigBlock
syn keyword jenkinsfileCoreStep node
syn keyword jenkinsfileCoreStep scm
syn keyword jenkinsfileCoreStep sh
@@ -24,10 +24,10 @@ syn keyword jenkinsfileCoreStep step
syn keyword jenkinsfileCoreStep tool
" TODO: These should probably be broken out.
syn keyword jenkinsfileCoreStep post always changed failure success unstable aborted
syn keyword jenkinsfileCoreStep always changed failure success unstable aborted unsuccessful regression fixed cleanup
syn region jenkinsFileDockerConfigBlock contained start='{' end='}' contains=groovyString,jenkinsfileDockerKeyword transparent
syn keyword jenkinsFileDockerKeyword contained image args dockerfile additionalBuildArgs
syn keyword jenkinsFileDockerKeyword contained image args additionalBuildArgs label registryUrl registryCredentialsId alwaysPull filename dir
syn keyword jenkinsfilePipelineStep Applitools ArtifactoryGradleBuild Consul MavenDescriptorStep OneSky VersionNumber
syn keyword jenkinsfilePipelineStep ViolationsToBitbucketServer ViolationsToGitHub ViolationsToGitLab _OcAction _OcContextInit
@@ -112,8 +112,8 @@ syn keyword jenkinsfilePipelineStep walk waptProReport warnings whitesource winR
syn keyword jenkinsfilePipelineStep withCredentials withDockerContainer withDockerRegistry withDockerServer withEnv withKafkaLog
syn keyword jenkinsfilePipelineStep withKubeConfig withMaven withNPM withPod withPythonEnv withSCM withSandbox withSonarQubeEnv
syn keyword jenkinsfilePipelineStep withTypetalk wrap writeFile writeJSON writeMavenPom writeProperties writeXml writeYaml
syn keyword jenkinsfilePipelineStep ws xUnitImporter xUnitUploader xldCreatePackage xldDeploy xldPublishPackage xlrCreateRelease
syn keyword jenkinsfilePipelineStep xrayScanBuild zip
syn keyword jenkinsfilePipelineStep ws xUnitImporter xUnitUploader xunit xldCreatePackage xldDeploy xldPublishPackage
syn keyword jenkinsfilePipelineStep xlrCreateRelease xrayScanBuild zip
hi link jenkinsfileSection Statement
hi link jenkinsfileDirective jenkinsfileSection

View File

@@ -103,6 +103,13 @@ else
highlight default link ansible_with_keywords Statement
endif
execute 'syn keyword ansible_with_keywords loop containedin='.s:yamlKey.' contained'
if exists("g:ansible_with_keywords_highlight")
execute 'highlight link ansible_with_keywords '.g:ansible_with_keywords_highlight
else
highlight default link ansible_with_keywords Statement
endif
let b:current_syntax = "ansible"
endif

View File

@@ -51,7 +51,7 @@ endif
syn keyword arduinoFunc Wire1
"}}}
"C:/Program Files (x86)/Arduino\lib\keywords.txt{{{
syn keyword arduinoConstant HIGH LOW INPUT INPUT_PULLUP OUTPUT DEC BIN HEX OCT PI
syn keyword arduinoConstant HIGH LOW INPUT INPUT_PULLUP INPUT_PULLDOWN OUTPUT DEC BIN HEX OCT PI
syn keyword arduinoConstant HALF_PI TWO_PI LSBFIRST MSBFIRST CHANGE FALLING RISING DEFAULT EXTERNAL INTERNAL
syn keyword arduinoConstant INTERNAL1V1 INTERNAL2V56
syn keyword arduinoType boolean break byte case char class const continue default do

View File

@@ -52,7 +52,7 @@ syntax region typescriptArrowFuncArg contained start=/<\|(/ end=/\ze=>
syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock
syntax region typescriptFuncImpl contained start=/function/ end=/{/me=e-1
syntax region typescriptFuncImpl contained start=/function\>/ end=/{/me=e-1
\ contains=typescriptFuncKeyword
\ nextgroup=typescriptBlock

View File

@@ -30,4 +30,54 @@ syntax region typescriptFuncCallArg contained matchgroup=typescriptPa
syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression
syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events
syntax region typescriptDestructureString
\ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/
\ contains=typescriptASCII
\ nextgroup=typescriptDestructureAs
\ contained skipwhite skipempty
syntax cluster typescriptVariableDeclarations
\ contains=typescriptVariableDeclaration,@typescriptDestructures
syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ contained skipwhite skipempty
syntax cluster typescriptDestructureVariables contains=
\ typescriptRestOrSpread,
\ typescriptDestructureComma,
\ typescriptDestructureLabel,
\ typescriptDestructureVariable,
\ @typescriptDestructures
syntax match typescriptDestructureVariable /[A-Za-z_$]\k*/ contained
\ nextgroup=typescriptDefaultParam
\ contained skipwhite skipempty
syntax match typescriptDestructureLabel /[A-Za-z_$]\k*\ze\_s*:/
\ nextgroup=typescriptDestructureAs
\ contained skipwhite skipempty
syntax match typescriptDestructureAs /:/
\ nextgroup=typescriptDestructureVariable,@typescriptDestructures
\ contained skipwhite skipempty
syntax match typescriptDestructureComma /,/ contained
syntax cluster typescriptDestructures contains=
\ typescriptArrayDestructure,
\ typescriptObjectDestructure
syntax region typescriptArrayDestructure matchgroup=typescriptBraces
\ start=/\[/ end=/]/
\ contains=@typescriptDestructureVariables,@typescriptComments
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ transparent contained skipwhite skipempty fold
syntax region typescriptObjectDestructure matchgroup=typescriptBraces
\ start=/{/ end=/}/
\ contains=typescriptDestructureString,@typescriptDestructureVariables,@typescriptComments
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ transparent contained skipwhite skipempty fold
endif

View File

@@ -29,16 +29,12 @@ syntax keyword typescriptIdentifier arguments this super
\ nextgroup=@afterIdentifier
syntax keyword typescriptVariable let var
\ nextgroup=typescriptVariableDeclaration
\ skipwhite skipempty skipnl
\ nextgroup=@typescriptVariableDeclarations
\ skipwhite skipempty
syntax keyword typescriptVariable const
\ nextgroup=typescriptEnum,typescriptVariableDeclaration
\ skipwhite
syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/
\ nextgroup=typescriptTypeAnnotation,typescriptAssign
\ contained skipwhite skipempty skipnl
\ nextgroup=typescriptEnum,@typescriptVariableDeclarations
\ skipwhite skipempty
syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/
\ nextgroup=typescriptBlock

View File

@@ -16,10 +16,12 @@ syntax match typescriptBinaryOp contained /===\?/ nextgroup=@typescriptValue s
syntax match typescriptBinaryOp contained />\(>>=\|>>\|>=\|>\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
" 4: <<=, <<, <=, <
syntax match typescriptBinaryOp contained /<\(<=\|<\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
" 3: ||, |=, |
syntax match typescriptBinaryOp contained /|\(|\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
" 3: &&, &=, &
syntax match typescriptBinaryOp contained /&\(&\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty
" 3: ||, |=, |, ||=
syntax match typescriptBinaryOp contained /||\?=\?/ nextgroup=@typescriptValue skipwhite skipempty
" 4: &&, &=, &, &&=
syntax match typescriptBinaryOp contained /&&\?=\?/ nextgroup=@typescriptValue skipwhite skipempty
" 2: ??, ??=
syntax match typescriptBinaryOp contained /??=\?/ nextgroup=@typescriptValue skipwhite skipempty
" 2: *=, *
syntax match typescriptBinaryOp contained /\*=\?/ nextgroup=@typescriptValue skipwhite skipempty
" 2: %=, %

View File

@@ -94,9 +94,12 @@ syntax cluster typescriptTypeMember contains=
\ typescriptIndexSignature,
\ @typescriptMembers
syntax match typescriptTupleLable /\K\k*?\?:/
\ contained
syntax region typescriptTupleType matchgroup=typescriptBraces
\ start=/\[/ end=/\]/
\ contains=@typescriptType,@typescriptComments
\ contains=@typescriptType,@typescriptComments,typescriptRestOrSpread,typescriptTupleLable
\ contained skipwhite
syntax cluster typescriptTypeOperator
@@ -158,6 +161,7 @@ syntax match typescriptTypeAnnotation /:/
syntax cluster typescriptParameterList contains=
\ typescriptTypeAnnotation,
\ typescriptAccessibilityModifier,
\ typescriptReadonlyModifier,
\ typescriptOptionalMark,
\ typescriptRestOrSpread,
\ typescriptFuncComma,

View File

@@ -74,6 +74,7 @@ if exists("did_typescript_hilink")
HiLink typescriptStringMember String
HiLink typescriptTemplate String
HiLink typescriptEventString String
HiLink typescriptDestructureString String
HiLink typescriptASCII Special
HiLink typescriptTemplateSB Label
HiLink typescriptRegexpString String
@@ -87,6 +88,7 @@ if exists("did_typescript_hilink")
HiLink typescriptBranch Conditional
HiLink typescriptIdentifier Structure
HiLink typescriptVariable Identifier
HiLink typescriptDestructureVariable PreProc
HiLink typescriptEnumKeyword Identifier
HiLink typescriptRepeat Repeat
HiLink typescriptForOperator Repeat
@@ -100,7 +102,9 @@ if exists("did_typescript_hilink")
HiLink typescriptNumber Number
HiLink typescriptBoolean Boolean
HiLink typescriptObjectLabel typescriptLabel
HiLink typescriptDestructureLabel Function
HiLink typescriptLabel Label
HiLink typescriptTupleLable Label
HiLink typescriptStringProperty String
HiLink typescriptImport Special
HiLink typescriptImportType Special

View File

@@ -1,7 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Language: Crystal
" Maintainer: rhysd <https://rhysd.github.io>
" Maintainer:
" rhysd <https://rhysd.github.io>
" Jeffrey Crochet <jlcrochet@pm.me>
"
" Based on Ruby syntax highlight
" which was made by Mirko Nasato and Doug Kearns
@@ -148,6 +150,7 @@ syn match crystalModuleName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w
syn match crystalStructName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalLibName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalEnumName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalAnnotationName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalConstant "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@="
syn match crystalClassVariable "@@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalInstanceVariable "@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
@@ -180,7 +183,7 @@ syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(STDER
syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
" Normal Regular Expression
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|in\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
" Generalized Regular Expression
@@ -245,53 +248,56 @@ SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\
SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial keepend
" Module, Class, Method, and Alias Declarations
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalFunction,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalFunction
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalTypeName
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalClassName,crystalOperator
syn match crystalModuleDeclaration "[^[:space:];#]\+" contained contains=crystalModuleName,crystalOperator
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalStructName,crystalOperator
syn match crystalLibDeclaration "[^[:space:];#]\+" contained contains=crystalLibName,crystalOperator
syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalFunction,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalFunction
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalTypeName
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalClassName,crystalOperator
syn match crystalModuleDeclaration "[^[:space:];#]\+" contained contains=crystalModuleName,crystalOperator
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalStructName,crystalOperator
syn match crystalLibDeclaration "[^[:space:];#]\+" contained contains=crystalLibName,crystalOperator
syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName
syn match crystalAnnotationDeclaration "[^[:space:];#]\+" contained contains=crystalAnnotationName
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
syn match crystalFunction "\%([[:space:].]\|^\)\@1<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration,crystalAnnotationDeclaration
" Keywords
" Note: the following keywords have already been defined:
" begin case class def do end for if module unless until while
syn match crystalControl "\<\%(break\|next\|rescue\|return\)\>[?!]\@!"
syn match crystalOperator "\<defined?" display
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!"
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
syn match crystalPseudoVariable "\<\%(nil\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
syn match crystalPseudoVariable "\<self\>"
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
" based folding and special highlighting of module/class/method definitions
if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalDefine "\<undef\>" nextgroup=crystalFunction skipwhite skipnl
syn match crystalDefine "\<\%(type\|alias\)\>\%(\s*\h\w*\s*=\)\@=" nextgroup=crystalTypeDeclaration skipwhite skipnl
syn match crystalClass "\<class\>" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalModule "\<module\>" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalStruct "\<struct\>" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalLib "\<lib\>" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalDefine "\<undef\>" nextgroup=crystalFunction skipwhite skipnl
syn match crystalDefine "\<\%(type\|alias\)\>\%(\s*\h\w*\s*=\)\@=" nextgroup=crystalTypeDeclaration skipwhite skipnl
syn match crystalClass "\<class\>" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalModule "\<module\>" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalStruct "\<struct\>" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalLib "\<lib\>" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn match crystalAnnotation "\<annotation\>" nextgroup=crystalAnnotationDeclaration skipwhite skipnl
SynFold 'def' syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=TOP
SynFold 'class' syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=TOP
SynFold 'module' syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=TOP
SynFold 'struct' syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=TOP
SynFold 'lib' syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=TOP
SynFold 'enum' syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=TOP
SynFold 'def' syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=TOP
SynFold 'class' syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=TOP
SynFold 'module' syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=TOP
SynFold 'struct' syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=TOP
SynFold 'lib' syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=TOP
SynFold 'enum' syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=TOP
SynFold 'annotation' syn region crystalBlock start="\<annotation\>" matchgroup=crystalAnnotation end="\<end\>" contains=TOP
" modifiers
syn match crystalConditionalModifier "\<\%(if\|unless\|ifdef\)\>" display
@@ -309,7 +315,7 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
SynFold 'select' syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=TOP
SynFold 'if' syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=TOP
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
syn match crystalConditional "\<\%(then\|else\|when\|in\)\>[?!]\@!" contained containedin=crystalCaseExpression
syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression
syn match crystalConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=crystalConditionalExpression
@@ -324,15 +330,16 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
exec 'syn sync minlines=' . g:crystal_minlines
else
" Non-expensive mode
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalControl "\<fun\>[?!]\@!" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalControl "\<class\>[?!]\@!" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalControl "\<module\>[?!]\@!" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalControl "\<struct\>[?!]\@!" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalControl "\<lib\>[?!]\@!" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalControl "\<macro\>[?!]\@!" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalControl "\<enum\>[?!]\@!" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn match crystalControl "\<\%(case\|begin\|do\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|end\)\>[?!]\@!"
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
syn match crystalControl "\<fun\>[?!]\@!" nextgroup=crystalFunctionDeclaration skipwhite skipnl
syn match crystalControl "\<class\>[?!]\@!" nextgroup=crystalClassDeclaration skipwhite skipnl
syn match crystalControl "\<module\>[?!]\@!" nextgroup=crystalModuleDeclaration skipwhite skipnl
syn match crystalControl "\<struct\>[?!]\@!" nextgroup=crystalStructDeclaration skipwhite skipnl
syn match crystalControl "\<lib\>[?!]\@!" nextgroup=crystalLibDeclaration skipwhite skipnl
syn match crystalControl "\<macro\>[?!]\@!" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalControl "\<enum\>[?!]\@!" nextgroup=crystalEnumDeclaration skipwhite skipnl
syn match crystalControl "\<annotation\>[?!]\@!" nextgroup=crystalAnnotationDeclaration skipwhite skipnl
syn match crystalControl "\<\%(case\|begin\|do\|if\|ifdef\|unless\|while\|until\|else\|elsif\|ensure\|then\|when\|in\|end\)\>[?!]\@!"
syn match crystalKeyword "\<\%(alias\|undef\)\>[?!]\@!"
endif
@@ -356,8 +363,8 @@ endif
" Macro
" Note: This definition must be put after crystalNestedCurlyBraces to give higher priority
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={%" end="%}" oneline display contains=@crystalMacroGroup containedin=ALL
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={{" end="}}" oneline display contains=@crystalMacroGroup containedin=ALL
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={%" end="%}" display oneline contains=@crystalMacroGroup containedin=ALL
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={{" end="}}" display contains=TOP containedin=ALL
" Cluster for groups that can appear inside macro expressions
syn cluster crystalMacroGroup contains=@crystalTop
@@ -373,8 +380,7 @@ syn cluster crystalMacroGroup remove=@crystalExpensive
" Some keywords will have to be redefined for them to be highlighted
" properly
syn keyword crystalMacroKeyword contained
\ if else elsif end for in begin do case when while until loop
\ rescue ensure
\ if unless else elsif end for in do while until loop begin
syn cluster crystalMacroGroup add=crystalMacroKeyword
@@ -396,7 +402,7 @@ SynFold '#' syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|in\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
@@ -412,6 +418,7 @@ hi def link crystalModule crystalDefine
hi def link crystalStruct crystalDefine
hi def link crystalLib crystalDefine
hi def link crystalEnum crystalDefine
hi def link crystalAnnotation crystalDefine
hi def link crystalMethodExceptional crystalDefine
hi def link crystalDefine Define
hi def link crystalFunction Function
@@ -440,6 +447,7 @@ hi def link crystalModuleName crystalConstant
hi def link crystalStructName crystalConstant
hi def link crystalLibName crystalConstant
hi def link crystalEnumName crystalConstant
hi def link crystalAnnotationName crystalConstant
hi def link crystalGlobalVariable crystalIdentifier
hi def link crystalBlockParameter crystalIdentifier
hi def link crystalInstanceVariable crystalIdentifier
@@ -476,7 +484,7 @@ hi def link crystalRegexp crystalString
hi def link crystalMacro PreProc
hi def link crystalMacroDelim crystalMacro
hi def link crystalMacroKeyword crystalKeyword
hi def link crystalLinkAttrDelim crystalMacro
hi def link crystalLinkAttrDelim crystalMacroDelim
hi def link crystalError Error
hi def link crystalInvalidVariable crystalError
hi def link crystalSpaceError crystalError

View File

@@ -54,10 +54,10 @@ syntax match dartMetadata "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
" User Types
syntax match dartUserType "\<_\?\u[[:alnum:]_\$]*\>"
syntax match dartUserType "\<[_$]*\u[a-zA-Z0-9_$]*\>"
" Function highlighting
syntax match dartFunction "\zs\<\(_\?\l[[:alnum:]_\$]*\)\>*\s*\ze("
syntax match dartFunction "\zs\<\([_$]*[a-z][a-zA-Z0-9_$]*\)\ze\(<\|(\|\s\+=>\)"
" SDK libraries
syntax keyword dartSdkClass BidirectionalIterator Comparable DateTime

View File

@@ -6,7 +6,7 @@ if exists('b:current_syntax')
finish
endif
syntax match dhallInterpolation "\v\$\{([^\}]|\\n)*\}"
syntax match dhallInterpolation "\v\$\{([^\}]|\n)*\}"
syntax keyword dhallTodo TODO FIXME
syntax match dhallBrackets "[<>|]"
syntax match dhallOperator "+\|*\|#"
@@ -24,7 +24,7 @@ syntax match dhallLabel "\v[a-z_][A-Za-z0-9\-]*"
syntax match dhallType "\v[a-zA-Z]+\.[A-Z][a-z0-9A-Z_]*"
syntax match dhallParens "(\|)\|\[\|\]\|,"
syntax match dhallRecord "{\|}\|:"
syntax keyword dhallKeyword let in forall constructors if then else merge env as
syntax keyword dhallKeyword let in forall constructors if then else merge env as with
syntax match dhallEsc +\\["\\abfnrtv$/]+
syntax match dhallSingleSpecial +'''+
syntax match dhallSingleSpecial +''${+

View File

@@ -46,7 +46,7 @@ setlocal iskeyword+=$,@-@
" Comments
syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlangTodo
syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained
syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|param\|private\|equiv\|spec\|throws\)' contained
syn match erlangCommentAnnotation /`[^']*'/ contained
syn keyword erlangTodo TODO FIXME XXX contained
@@ -94,7 +94,7 @@ syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary
" Constants and Directives
syn match erlangUnknownAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\l[[:alnum:]_@]*' contains=erlangComment
syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\)\>' contains=erlangComment
syn match erlangAttribute '^\s*-\%(\s\|\n\|%.*\n\)*\%(behaviou\=r\|compile\|export\(_type\)\=\|file\|import\|module\|author\|copyright\|doc\|vsn\|on_load\|optional_callbacks\)\>' contains=erlangComment
syn match erlangInclude '^\s*-\%(\s\|\n\|%.*\n\)*\%(include\|include_lib\)\>' contains=erlangComment
syn match erlangRecordDef '^\s*-\%(\s\|\n\|%.*\n\)*record\>' contains=erlangComment
syn match erlangDefine '^\s*-\%(\s\|\n\|%.*\n\)*\%(define\|undef\)\>' contains=erlangComment

287
syntax/fennel.vim Normal file
View File

@@ -0,0 +1,287 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fennel') == -1
" Vim syntax file
" Language: FENNEL
" Maintainer: Calvin Rose
if exists("b:current_syntax")
finish
endif
let s:cpo_sav = &cpo
set cpo&vim
if has("folding") && exists("g:fennel_fold") && g:fennel_fold > 0
setlocal foldmethod=syntax
endif
syntax keyword FennelCommentTodo contained FIXME XXX TODO FIXME: XXX: TODO:
" FENNEL comments
syn match FennelComment ";.*$" contains=FennelCommentTodo,@Spell
syntax match FennelStringEscape '\v\\%([abfnrtv'"\\]|x[[0-9a-fA-F]]\{2}|25[0-5]|2[0-4][0-9]|[0-1][0-9][0-9])' contained
syntax region FennelString matchgroup=FennelStringDelimiter start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=FennelStringEscape,@Spell
syntax region FennelString matchgroup=FennelStringDelimiter start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=FennelStringEscape,@Spell
syn keyword FennelConstant nil
syn keyword FennelBoolean true
syn keyword FennelBoolean false
" Fennel special forms
syn keyword FennelSpecialForm #
syn keyword FennelSpecialForm %
syn keyword FennelSpecialForm *
syn keyword FennelSpecialForm +
syn keyword FennelSpecialForm -
syn keyword FennelSpecialForm ->
syn keyword FennelSpecialForm ->>
syn keyword FennelSpecialForm -?>
syn keyword FennelSpecialForm -?>>
syn keyword FennelSpecialForm .
syn keyword FennelSpecialForm ..
syn keyword FennelSpecialForm /
syn keyword FennelSpecialForm //
syn keyword FennelSpecialForm :
syn keyword FennelSpecialForm <
syn keyword FennelSpecialForm <=
syn keyword FennelSpecialForm =
syn keyword FennelSpecialForm >
syn keyword FennelSpecialForm >=
syn keyword FennelSpecialForm ^
syn keyword FennelSpecialForm and
syn keyword FennelSpecialForm comment
syn keyword FennelSpecialForm do
syn keyword FennelSpecialForm doc
syn keyword FennelSpecialForm doto
syn keyword FennelSpecialForm each
syn keyword FennelSpecialForm eval-compiler
syn keyword FennelSpecialForm fn
syn keyword FennelSpecialForm for
syn keyword FennelSpecialForm global
syn keyword FennelSpecialForm hashfn
syn keyword FennelSpecialForm if
syn keyword FennelSpecialForm include
syn keyword FennelSpecialForm lambda
syn keyword FennelSpecialForm length
syn keyword FennelSpecialForm let
syn keyword FennelSpecialForm local
syn keyword FennelSpecialForm lua
syn keyword FennelSpecialForm macro
syn keyword FennelSpecialForm macros
syn keyword FennelSpecialForm match
syn keyword FennelSpecialForm not
syn keyword FennelSpecialForm not=
syn keyword FennelSpecialForm or
syn keyword FennelSpecialForm partial
syn keyword FennelSpecialForm quote
syn keyword FennelSpecialForm require-macros
syn keyword FennelSpecialForm set
syn keyword FennelSpecialForm set-forcibly!
syn keyword FennelSpecialForm tset
syn keyword FennelSpecialForm values
syn keyword FennelSpecialForm var
syn keyword FennelSpecialForm when
syn keyword FennelSpecialForm while
syn keyword FennelSpecialForm ~=
syn keyword FennelSpecialForm λ
" Lua keywords
syntax keyword LuaSpecialValue
\ _G
\ _VERSION
\ assert
\ collectgarbage
\ dofile
\ error
\ getmetatable
\ ipairs
\ load
\ loadfile
\ next
\ pairs
\ pcall
\ print
\ rawequal
\ rawget
\ rawlen
\ rawset
\ require
\ select
\ setmetatable
\ tonumber
\ tostring
\ type
\ xpcall
\ coroutine
\ coroutine.create
\ coroutine.isyieldable
\ coroutine.resume
\ coroutine.running
\ coroutine.status
\ coroutine.wrap
\ coroutine.yield
\ debug
\ debug.debug
\ debug.gethook
\ debug.getinfo
\ debug.getlocal
\ debug.getmetatable
\ debug.getregistry
\ debug.getupvalue
\ debug.getuservalue
\ debug.sethook
\ debug.setlocal
\ debug.setmetatable
\ debug.setupvalue
\ debug.setuservalue
\ debug.traceback
\ debug.upvalueid
\ debug.upvaluejoin
\ io
\ io.close
\ io.flush
\ io.input
\ io.lines
\ io.open
\ io.output
\ io.popen
\ io.read
\ io.stderr
\ io.stdin
\ io.stdout
\ io.tmpfile
\ io.type
\ io.write
\ math
\ math.abs
\ math.acos
\ math.asin
\ math.atan
\ math.ceil
\ math.cos
\ math.deg
\ math.exp
\ math.floor
\ math.fmod
\ math.huge
\ math.log
\ math.max
\ math.maxinteger
\ math.min
\ math.mininteger
\ math.modf
\ math.pi
\ math.rad
\ math.random
\ math.randomseed
\ math.sin
\ math.sqrt
\ math.tan
\ math.tointeger
\ math.type
\ math.ult
\ os
\ os.clock
\ os.date
\ os.difftime
\ os.execute
\ os.exit
\ os.getenv
\ os.remove
\ os.rename
\ os.setlocale
\ os.time
\ os.tmpname
\ package
\ package.config
\ package.cpath
\ package.loaded
\ package.loadlib
\ package.path
\ package.preload
\ package.searchers
\ package.searchpath
\ string
\ string.byte
\ string.char
\ string.dump
\ string.find
\ string.format
\ string.gmatch
\ string.gsub
\ string.len
\ string.lower
\ string.match
\ string.pack
\ string.packsize
\ string.rep
\ string.reverse
\ string.sub
\ string.unpack
\ string.upper
\ table
\ table.concat
\ table.insert
\ table.move
\ table.pack
\ table.remove
\ table.sort
\ table.unpack
\ utf8
\ utf8.char
\ utf8.charpattern
\ utf8.codepoint
\ utf8.codes
\ utf8.len
\ utf8.offset
" Fennel Symbols
let s:symcharnodig = '\!\$%\&\#\*\+\-./:<=>?A-Z^_a-z|\x80-\U10FFFF'
let s:symchar = '0-9' . s:symcharnodig
execute 'syn match FennelSymbol "\v<%([' . s:symcharnodig . '])%([' . s:symchar . '])*>"'
execute 'syn match FennelKeyword "\v<:%([' . s:symchar . '])*>"'
unlet! s:symchar s:symcharnodig
syn match FennelQuote "`"
syn match FennelQuote "@"
" FENNEL numbers
syntax match FennelNumber "\v\c<[-+]?\d*\.?\d*%([eE][-+]?\d+)?>"
syntax match FennelNumber "\v\c<[-+]?0x[0-9A-F]*\.?[0-9A-F]*>"
" Grammar root
syntax cluster FennelTop contains=@Spell,FennelComment,FennelConstant,FennelQuote,FennelKeyword,LuaSpecialValue,FennelSymbol,FennelNumber,FennelString,FennelList,FennelArray,FennelTable,FennelSpecialForm,FennelBoolean
syntax region FennelList matchgroup=FennelParen start="(" end=")" contains=@FennelTop fold
syntax region FennelArray matchgroup=FennelParen start="\[" end="]" contains=@FennelTop fold
syntax region FennelTable matchgroup=FennelParen start="{" end="}" contains=@FennelTop fold
" Highlight superfluous closing parens, brackets and braces.
syntax match FennelError "]\|}\|)"
syntax sync fromstart
" Highlighting
hi def link FennelComment Comment
hi def link FennelSymbol Identifier
hi def link FennelNumber Number
hi def link FennelConstant Constant
hi def link FennelKeyword Keyword
hi def link FennelSpecialForm Special
hi def link LuaSpecialValue Special
hi def link FennelString String
hi def link FennelBuffer String
hi def link FennelStringDelimiter String
hi def link FennelBoolean Boolean
hi def link FennelQuote SpecialChar
hi def link FennelParen Delimiter
let b:current_syntax = "fennel"
let &cpo = s:cpo_sav
unlet! s:cpo_sav
endif

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Vim syntax file
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
" Last Change: 2019 Dec 05
if exists("b:current_syntax")
finish
@@ -27,9 +27,9 @@ syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\)
syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
syn match gitDiffAdded "{+.*+}" contained containedin=gitDiff
syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff
syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
syn match gitDiffRemoved "\[-.*-\]" contained containedin=gitDiff
syn match gitDiffRemoved "\[-[^]]*-\]" contained containedin=gitDiff
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.git/COMMIT_EDITMSG
" Last Change: 2016 Aug 29
" Last Change: 2019 Dec 05
if exists("b:current_syntax")
finish
@@ -32,6 +32,7 @@ else
syn match gitcommitComment "^#.*"
endif
syn match gitcommitHash "\<\x\{40,}\>" contains=@NoSpell display
syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
@@ -69,6 +70,7 @@ hi def link gitcommitUntracked gitcommitComment
hi def link gitcommitDiscarded gitcommitComment
hi def link gitcommitSelected gitcommitComment
hi def link gitcommitUnmerged gitcommitComment
hi def link gitcommitHash Identifier
hi def link gitcommitOnBranch Comment
hi def link gitcommitBranch Special
hi def link gitcommitNoBranch gitCommitBranch

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Language: git config file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: gitconfig, .gitconfig, *.git/config
" Last Change: 2019 Sep 27
" Last Change: 2019 Dec 05
if exists("b:current_syntax")
finish

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1
" Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: git-rebase-todo
" Last Change: 2016 Aug 29
" Last Change: 2019 Dec 06
if exists("b:current_syntax")
finish
@@ -25,7 +25,7 @@ syn match gitrebaseDrop "\v^d%(rop)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseNoop "\v^noop>"
syn match gitrebaseMerge "\v^m(erge)=>" nextgroup=gitrebaseMergeOption,gitrebaseName skipwhite
syn match gitrebaseLabel "\v^l(abel)=>" nextgroup=gitrebaseName skipwhite
syn match gitrebaseReset "\v^r(eset)=>" nextgroup=gitrebaseName skipwhite
syn match gitrebaseReset "\v^(t|reset)=>" nextgroup=gitrebaseName skipwhite
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
syn match gitrebaseCommand ".*" contained
syn match gitrebaseComment "^\s*#.*" contains=gitrebaseHash

View File

@@ -131,6 +131,8 @@ syn keyword htmlArg contained prefetch
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

59
syntax/icalendar.vim Normal file
View File

@@ -0,0 +1,59 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'icalendar') == -1
" Vim syntax file
" Language: icalendar <http://www.ietf.org/rfc/rfc2445.txt>
" Maintainer: Steven N. Severinghaus <sns@severinghaus.org>
" Last Modified: 2006-04-17
" Version: 0.3
" Quit if syntax file is already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
command! -nargs=+ IcalHiLink hi def link <args>
syntax case ignore
setlocal iskeyword+=-
syn match icalObject "^\(BEGIN\|END\)"
syn match icalObjectType ":\(VCALENDAR\|VEVENT\|VTODO\|VJOURNAL\|VFREEBUSY\|VTIMEZONE\|VALARM\)$"
syn match icalObjectType ":\(DAYLIGHT\|STANDARD\)$"
syn match icalProperty "^\(DTSTART\|PRODID\|VERSION\|CALSCALE\|METHOD\)"
syn match icalProperty "^\(DTEND\|DTSTAMP\|ORGANIZER\|UID\|CLASS\|CREATED\)"
syn match icalProperty "^\(LOCATION\|SEQUENCE\|STATUS\|SUMMARY\|COMMENT\)"
syn match icalProperty "^\(TRANSP\|ATTENDEE\|ATTACH\|FREEBUSY\|METHOD\|CONTACT\)"
syn match icalProperty "^\(DURATION\|RRULE\|EXDATE\|EXRULE\|URL\|DESCRIPTION\|ACTION\)"
syn match icalProperty "^\(LAST-MODIFIED\|RECURRENCE-ID\|TRIGGER\|RELATED-TO\|RDATE\)"
syn match icalProperty "^\(TZID\|TZOFFSETFROM\|TZOFFSETTO\|TZNAME\|TZURL\)"
syn match icalProperty "^\(PRIORITY\|DUE\|COMPLETED\|PERCENT-COMPLETE\|CATEGORIES\)"
syn match icalProperty "^\(RESOURCES\|REPEAT\|REQUEST-STATUS\)"
syn match icalCustom /^X-[A-Z-]\+/
syn match icalDate "\<\d\{8}\>"
syn match icalDate "[0-9]\{8}T[0-9]\{6}Z\="
syn match icalParameter "[A-Z0-9-]\+=[^;:]\+"
syn keyword icalSetValue CONFIRMED TENTATIVE CANCELLED DELEGATED OPAQUE
syn keyword icalSetValue NEEDS-ACTION ACCEPTED DECLINED IN-PROGRESS
syn keyword icalSetValue PRIVATE PUBLIC PUBLISH GREGORIAN DISPLAY
syn match icalSetValue /:COMPLETED$/
" Types: PreProc Keyword Type String Comment Special
IcalHiLink icalProperty PreProc
IcalHiLink icalObject Label
IcalHiLink icalObjectType Type
IcalHiLink icalDate String
IcalHiLink icalParameter Comment
IcalHiLink icalSetValue Special
IcalHiLink icalCustom Error
delcommand IcalHiLink
let b:current_syntax = "icalendar"
"EOF vim: tw=78:ft=vim:ts=8
endif

134
syntax/jq.vim Normal file
View File

@@ -0,0 +1,134 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jq') == -1
" Vim syntax file
" Language: jq
" Maintainer: Vito C <vito.blog@gmail.com>
" Last Change: 2015 Nov 28
" Quit when a (custom) syntax file was already loaded
if exists('b:current_syntax')
finish
endif
" syn include @jqHtml syntax/html.vim " Doc comment HTML
" jqTodo
syntax keyword jqTodo contained TODO FIXME NOTE XXX
" jqKeywords
syntax keyword jqKeywords and or not empty
syntax keyword jqKeywords try catch
syntax keyword jqKeywords reduce as label break foreach
syntax keyword jqKeywords import include module modulemeta
syntax keyword jqKeywords env nth has in while error stderr debug
" jqConditional
syntax keyword jqConditional if then elif else end
" jqConditions
syntax keyword jqCondtions true false null
" jqSpecials
syntax keyword jqType type
syntax match jqType /[\|;]/ " not really a type I did this for coloring reasons though :help group-name
syntax region jqParentheses start=+(+ end=+)+ fold transparent
" jq Functions
syntax keyword jqFunction add all any arrays ascii_downcase floor
syntax keyword jqFunction ascii_upcase booleans bsearch builtins capture combinations
syntax keyword jqFunction \contains del delpaths endswith explode
syntax keyword jqFunction finites first flatten format from_entries
syntax keyword jqFunction fromdate fromdateiso8601 fromjson fromstream get_jq_origin
syntax keyword jqFunction get_prog_origin get_search_list getpath gmtime group_by
syntax keyword jqFunction gsub halt halt_error implode index indices infinite
syntax keyword jqFunction input input_filename input_line_number inputs inside
syntax keyword jqFunction isempty isfinite isinfinite isnan isnormal iterables
syntax keyword jqFunction join keys keys_unsorted last leaf_paths
syntax keyword jqFunction length limit localtime ltrimstr map map_values
syntax keyword jqFunction match max max_by min min_by
syntax keyword jqFunction mktime nan normals now
syntax keyword jqFunction nulls numbers objects path paths range
syntax keyword jqFunction recurse recurse_down repeat reverse rindex
syntax keyword jqFunction rtrimstr scalars scalars_or_empty scan select
syntax keyword jqFunction setpath sort sort_by split splits with_entries
syntax keyword jqFunction startswith strflocaltime strftime strings strptime sub
syntax keyword jqFunction test to_entries todate todateiso8601 tojson __loc__
syntax keyword jqFunction tonumber tostream tostring transpose truncate_stream
syntax keyword jqFunction unique unique_by until utf8bytelength values walk
" TODO: $__loc__ is going to be a pain
" jq Math Functions
syntax keyword jqFunction acos acosh asin asinh atan atanh cbrt ceil cos cosh
syntax keyword jqFunction erf erfc exp exp10 exp2 expm1 fabs floor gamma j0 j1
syntax keyword jqFunction lgamma lgamma_r log log10 log1p log2 logb nearbyint
syntax keyword jqFunction pow10 rint round significand sin sinh sqrt tan tanh
syntax keyword jqFunction tgamma trunc y0 y1
syntax keyword jqFunction atan2 copysign drem fdim fmax fmin fmod frexp hypot
syntax keyword jqFunction jn ldexp modf nextafter nexttoward pow remainder
syntax keyword jqFunction scalb scalbln yn
syntax keyword jqFunction fma
" jq SQL-style Operators
syntax keyword jqFunction INDEX JOIN IN
" Comments
syntax match jqComment "#.*" contains=jqTodo
" Variables
syn match jqVariables /$[_A-Za-z0-9]\+/
" Definition
syntax keyword jqKeywords def nextgroup=jqNameDefinition skipwhite
syn match jqNameDefinition /\<[_A-Za-z0-9]\+\>/ contained nextgroup=jqPostNameDefinition
syn match jqNameDefinition /`[^`]\+`/ contained nextgroup=jqPostNameDefinition
" Strings
syn region jqError start=+'+ end=+'\|$\|[;)]\@=+
syn region jqString matchgroup=jqQuote
\ start=+"+ skip=+\\"+ end=+"+
\ contains=@Spell,jqInterpolation
syn region jqInterpolation matchgroup=jqInterpolationDelimiter
\ start=+\%([^\\]\%(\\\\\)*\\\)\@<!\\(+ end=+)+
\ contained contains=TOP
" Operators
syn match jqOperator /:\|\([-+*/%<>=]\|\/\/\)=\?\|[!|]=\|?\/\//
"syn region jqRange matchgroup=jqSquareBracket start=+\[+ skip=+:+ end=+\]+
" Errors
syn keyword jqError _assign _flatten _modify _nwise _plus _negate _minus _multiply
syn keyword jqError _divide _mod _strindices _equal _notequal _less _greater _lesseq
syn keyword jqError _greatereq _sort_by_impl _group_by_impl _min_by_impl _max_by_impl _match_impl _input
" TODO: these errors should show up when doing def _flatten: as well
" Numbers
syn match jqNumber /\<0[dDfFlL]\?\>/ " Just a bare 0
syn match jqNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala
if !exists('jq_quote_highlight')
highlight link jqQuote String
else
highlight link jqQuote Type
endif
hi link jqCondtions Boolean
hi link jqVariables Identifier
hi link jqNameDefinition Function
hi link jqTodo Todo
hi link jqComment Comment
hi link jqKeywords Keyword
hi link jqType Type
hi link jqOperator Operator
hi link jqFunction Function
hi link jqError Error
hi link jqString String
hi link jqInterpolationDelimiter Delimiter
"hi link jqStatement Statement
hi link jqConditional Conditional
"hi link jqRepeat Repeat
"hi link jqException Exception
"hi link jqInclude Include
"hi link jqDecorator Define
hi link jqNumber Number
endif

138
syntax/jsonnet.vim Normal file
View File

@@ -0,0 +1,138 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1
" Copyright 2014 Google Inc. All rights reserved.
"
" Licensed under the Apache License, Version 2.0 (the "License");
" you may not use this file except in compliance with the License.
" You may obtain a copy of the License at
"
" http://www.apache.org/licenses/LICENSE-2.0
"
" Unless required by applicable law or agreed to in writing, software
" distributed under the License is distributed on an "AS IS" BASIS,
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" See the License for the specific language governing permissions and
" limitations under the License.
syntax match Number "\<\d*\([Ee][+-]\?\d\+\)\?\>"
syntax match Number "\<\d\+[.]\d*\([Ee][+-]\?\d\+\)\?\>"
syntax match Number "\<[.]\d\+\([Ee][+-]\?\d\+\)\?\>"
" builtins
syn match Constant "std.acos"
syn match Constant "std.asin"
syn match Constant "std.atan"
syn match Constant "std.ceil"
syn match Constant "std.char"
syn match Constant "std.codepoint"
syn match Constant "std.cos"
syn match Constant "std.exp"
syn match Constant "std.exponent"
syn match Constant "std.extVar"
syn match Constant "std.filter"
syn match Constant "std.floor"
syn match Constant "std.force"
syn match Constant "std.length"
syn match Constant "std.log"
syn match Constant "std.makeArray"
syn match Constant "std.mantissa"
syn match Constant "std.md5"
syn match Constant "std.modulo"
syn match Constant "std.native"
syn match Constant "std.objectFieldsEx"
syn match Constant "std.objectHasEx"
syn match Constant "std.pow"
syn match Constant "std.primitiveEquals"
syn match Constant "std.sin"
syn match Constant "std.sqrt"
syn match Constant "std.tan"
syn match Constant "std.thisFile"
syn match Constant "std.type"
" std.jsonnet
syn match Constant "std.abs"
syn match Constant "std.asciiLower"
syn match Constant "std.asciiUpper"
syn match Constant "std.assertEqual"
syn match Constant "std.base64"
syn match Constant "std.base64Decode"
syn match Constant "std.base64DecodeBytes"
syn match Constant "std.count"
syn match Constant "std.endsWith"
syn match Constant "std.equals"
syn match Constant "std.escapeStringBash"
syn match Constant "std.escapeStringDollars"
syn match Constant "std.escapeStringJson"
syn match Constant "std.escapeStringPython"
syn match Constant "std.filterMap"
syn match Constant "std.flattenArrays"
syn match Constant "std.foldl"
syn match Constant "std.foldr"
syn match Constant "std.format"
syn match Constant "std.join"
syn match Constant "std.lines"
syn match Constant "std.manifestIni"
syn match Constant "std.manifestJson"
syn match Constant "std.manifestJsonEx"
syn match Constant "std.manifestPython"
syn match Constant "std.manifestPythonVars"
syn match Constant "std.manifestYamlStream"
syn match Constant "std.map"
syn match Constant "std.mapWithIndex"
syn match Constant "std.max"
syn match Constant "std.mergePatch"
syn match Constant "std.min"
syn match Constant "std.mod"
syn match Constant "std.objectFields"
syn match Constant "std.objectFieldsAll"
syn match Constant "std.objectHas"
syn match Constant "std.objectHasAll"
syn match Constant "std.parseInt"
syn match Constant "std.prune"
syn match Constant "std.range"
syn match Constant "std.resolvePath"
syn match Constant "std.set"
syn match Constant "std.setDiff"
syn match Constant "std.setInter"
syn match Constant "std.setMember"
syn match Constant "std.setUnion"
syn match Constant "std.slice"
syn match Constant "std.sort"
syn match Constant "std.split"
syn match Constant "std.splitLimit"
syn match Constant "std.startsWith"
syn match Constant "std.stringChars"
syn match Constant "std.strReplace"
syn match Constant "std.substr"
syn match Constant "std.toString"
syn match Constant "std.uniq"
syn match Type "\$"
syn region String start='L\="' skip='\\\\\|\\"' end='"'
syn region String start='L\=\'' skip='\\\\\|\\\'' end='\''
syn region String start='|||\s*\n\+\z(\s*\)' end='^\z1\@!\s*|||'
" Highlight python style string formatting.
syn match Special "%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=String
syn match Special "%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=String
syn region Comment start="/[*]" end="[*]/"
syn match Comment "//.*$"
syn match Comment "#.*$"
syn match Keyword "\<[a-zA-Z_][a-z0-9A-Z_]*\s*\(([^)]*)\)\?\s*+\?::\?:\?"
syn region Object start="{" end="}" fold transparent
syntax keyword Include import importstr
syntax keyword Type function self super
syntax keyword Statement assert if then else for in
syntax keyword Special local tailstrict
syntax keyword Constant true false null
syntax keyword Underlined error
endif

View File

@@ -109,11 +109,15 @@ syntax match juliaSemicolon display ";"
syntax match juliaComma display ","
syntax match juliaColon display ":"
" This is really ugly. It would be better to mask most keywords when a dot is
" found, introducing some kind of dot-environment
let s:nodot = '\%(\.\)\@'.s:d(1).'<!'
syntax match juliaErrorPar display "[])}]"
syntax match juliaErrorEnd display "\<end\>"
syntax match juliaErrorElse display "\<\%(else\|elseif\)\>"
syntax match juliaErrorCatch display "\<catch\>"
syntax match juliaErrorFinally display "\<finally\>"
exec 'syntax match juliaErrorEnd display "'.s:nodot.'\<end\>"'
exec 'syntax match juliaErrorElse display "'.s:nodot.'\<\%(else\|elseif\)\>"'
exec 'syntax match juliaErrorCatch display "'.s:nodot.'\<catch\>"'
exec 'syntax match juliaErrorFinally display "'.s:nodot.'\<finally\>"'
syntax match juliaErrorSemicol display contained ";"
syntax region juliaParBlock matchgroup=juliaParDelim start="(" end=")" contains=@juliaExpressions,juliaComprehensionFor
@@ -122,10 +126,6 @@ syntax region juliaSqBraIdxBlock matchgroup=juliaParDelim start="\[" end="\]" c
exec 'syntax region juliaSqBraBlock matchgroup=juliaParDelim start="\%(^\|\s\|' . s:operators . '\)\@'.s:d(3).'<=\[" end="\]" contains=@juliaExpressions,juliaComprehensionFor,juliaSymbolS,juliaQuotedParBlockS,juliaQuotedQMarkParS'
syntax region juliaCurBraBlock matchgroup=juliaParDelim start="{" end="}" contains=@juliaExpressions
" This is really ugly. It would be better to mask most keywords when a dot is
" found, introducing some kind of dot-environment
let s:nodot = '\%(\.\)\@'.s:d(1).'<!'
exec 'syntax match juliaKeyword display "'.s:nodot.'\<\%(return\|local\|global\|import\%(all\)\?\|export\|using\|const\|where\)\>"'
syntax match juliaInfixKeyword display "\%(=\s*\)\@<!\<\%(in\|isa\)\>\S\@!\%(\s*=\)\@!"
exec 'syntax match juliaRepKeyword display "'.s:nodot.'\<\%(break\|continue\)\>"'

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
" Vim syntax file
" Language: Kotlin
" Maintainer: Alexander Udalov
" Latest Revision: 26 May 2019
" Latest Revision: 13 July 2020
if exists('b:current_syntax')
finish
@@ -18,7 +18,33 @@ syn keyword ktException try catch finally throw
syn keyword ktInclude import package
syn keyword ktType Any Boolean Byte Char Double Float Int Long Nothing Short Unit
" The following is generated by generate-stdlib-class-names.main.kts
syn keyword ktType AbstractCollection AbstractCoroutineContextElement AbstractCoroutineContextKey AbstractDoubleTimeSource AbstractIterator AbstractList AbstractLongTimeSource
syn keyword ktType AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractSet AccessDeniedException Accessor Annotation
syn keyword ktType AnnotationRetention AnnotationTarget Any Appendable ArithmeticException Array ArrayDeque ArrayList AssertionError Boolean BooleanArray BooleanIterator
syn keyword ktType BuilderInference Byte ByteArray ByteIterator CallsInPlace CancellationException Char CharArray CharCategory CharDirectionality CharIterator CharProgression
syn keyword ktType CharRange CharSequence CharacterCodingException Charsets ClassCastException Cloneable ClosedFloatingPointRange ClosedRange Collection Comparable Comparator
syn keyword ktType ConcurrentModificationException ConditionalEffect Continuation ContinuationInterceptor ContractBuilder CoroutineContext DeepRecursiveFunction DeepRecursiveScope
syn keyword ktType Delegates Deprecated DeprecatedSinceKotlin DeprecationLevel Destructured Double DoubleArray DoubleIterator DslMarker Duration DurationUnit Effect Element
syn keyword ktType EmptyCoroutineContext Entry Enum Error Exception Experimental ExperimentalContracts ExperimentalJsExport ExperimentalMultiplatform ExperimentalStdlibApi
syn keyword ktType ExperimentalTime ExperimentalTypeInference ExperimentalUnsignedTypes ExtensionFunctionType FileAlreadyExistsException FileSystemException FileTreeWalk
syn keyword ktType FileWalkDirection Float FloatArray FloatIterator Function Function0 Function1 Function10 Function11 Function12 Function13 Function14 Function15 Function16
syn keyword ktType Function17 Function18 Function19 Function2 Function20 Function21 Function22 Function3 Function4 Function5 Function6 Function7 Function8 Function9 FunctionN
syn keyword ktType Getter Grouping HashMap HashSet IllegalArgumentException IllegalStateException IndexOutOfBoundsException IndexedValue Int IntArray IntIterator IntProgression
syn keyword ktType IntRange InvocationKind Iterable Iterator JsExport JsName JvmDefault JvmDefaultWithoutCompatibility JvmField JvmMultifileClass JvmName JvmOverloads JvmStatic
syn keyword ktType JvmSuppressWildcards JvmSynthetic JvmWildcard KAnnotatedElement KCallable KClass KClassifier KDeclarationContainer KFunction KMutableProperty KMutableProperty0
syn keyword ktType KMutableProperty1 KMutableProperty2 KParameter KProperty KProperty0 KProperty1 KProperty2 KType KTypeParameter KTypeProjection KVariance KVisibility Key Kind
syn keyword ktType KotlinNullPointerException KotlinReflectionNotSupportedError KotlinVersion Lazy LazyThreadSafetyMode Level LinkedHashMap LinkedHashSet List ListIterator Long
syn keyword ktType LongArray LongIterator LongProgression LongRange Map MatchGroup MatchGroupCollection MatchNamedGroupCollection MatchResult Metadata Monotonic MustBeDocumented
syn keyword ktType MutableCollection MutableEntry MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet NoSuchElementException NoSuchFileException
syn keyword ktType NoWhenBranchMatchedException NotImplementedError Nothing NullPointerException Number NumberFormatException ObservableProperty OnErrorAction OptIn
syn keyword ktType OptionalExpectation OverloadResolutionByLambdaReturnType Pair ParameterName PropertyDelegateProvider PublishedApi PurelyImplements Random RandomAccess
syn keyword ktType ReadOnlyProperty ReadWriteProperty Regex RegexOption Repeatable ReplaceWith RequiresOptIn RestrictsSuspension Result Retention Returns ReturnsNotNull
syn keyword ktType RuntimeException Sequence SequenceScope Set Setter SharedImmutable Short ShortArray ShortIterator SimpleEffect SinceKotlin Strictfp String StringBuilder Suppress
syn keyword ktType Synchronized Target TestTimeSource ThreadLocal Throwable Throws TimeMark TimeSource TimedValue Transient Triple TypeCastException Typography UByte UByteArray
syn keyword ktType UByteIterator UInt UIntArray UIntIterator UIntProgression UIntRange ULong ULongArray ULongIterator ULongProgression ULongRange UShort UShortArray UShortIterator
syn keyword ktType UninitializedPropertyAccessException Unit UnsafeVariance UnsupportedOperationException UseExperimental Volatile
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual
syn keyword ktStructure class object interface typealias fun val var constructor init

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'log') == -1
" Vim syntax file
" Language: Generic log file
" Maintainer: MTDL9 <https://github.com/MTDL9>
" Latest Revision: 2019-11-24
" Latest Revision: 2020-08-23
if exists('b:current_syntax')
finish
@@ -15,7 +15,7 @@ set cpoptions&vim
" Operators
"---------------------------------------------------------------------------
syn match logOperator display '[;,\?\:\.\<=\>\~\/\@\&\!$\%\&\+\-\|\^(){}\*#]'
syn match logOperator display '[;,\?\:\.\<=\>\~\/\@\!$\%&\+\-\|\^(){}\*#]'
syn match logBrackets display '[\[\]]'
syn match logEmptyLines display '-\{3,}'
syn match logEmptyLines display '\*\{3,}'
@@ -87,7 +87,7 @@ syn match logXmlAttribute contained "\(\n\|\s\)\(\(\w\|-\)\+:\)\?\(\w\|-\)\+\
syn match logXmlNamespace contained "\(\w\|-\)\+:" contains=logOperator
syn region logXmlComment start=/<!--/ end=/-->/
syn match logXmlCData /<!\[CDATA\[.*\]\]>/
syn match logXmlEntity /\&\w\+;/
syn match logXmlEntity /&#\?\w\+;/
" Levels

View File

@@ -13,6 +13,11 @@ if !exists("main_syntax")
let main_syntax = 'lua'
endif
if exists('g:lua_syntax_fancynotequal') && !has('conceal')
unlet g:lua_syntax_fancynotequal
endif
syntax sync fromstart
function! s:FoldableRegion(tag, name, expr)
@@ -40,7 +45,11 @@ syntax region luaBracket transparent matchgroup=luaBrackets start="\[" end="\]"
syntax match luaComma ","
syntax match luaSemiCol ";"
if !exists('g:lua_syntax_nosymboloperator')
syntax match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\."
if exists('g:lua_syntax_fancynotequal')
syntax match luaNotEqOperator "\V~=" conceal cchar=
setlocal conceallevel=2
endi
syntax match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\." contains=luaNotEqOperator
endi
syntax match luaEllipsis "\.\.\."
@@ -229,6 +238,7 @@ if version >= 508 || !exists("did_lua_syn_inits")
HiLink luaLocal Type
HiLink luaNumber Number
HiLink luaSymbolOperator luaOperator
HiLink luaNotEqOperator luaOperator
HiLink luaOperator Operator
HiLink luaRepeat Repeat
HiLink luaSemiCol Delimiter
@@ -240,6 +250,10 @@ if version >= 508 || !exists("did_lua_syn_inits")
HiLink luaStringSpecial SpecialChar
HiLink luaErrHand Exception
if exists('g:lua_syntax_fancynotequal')
hi! link Conceal luaOperator
endi
delcommand HiLink
end

View File

@@ -72,10 +72,10 @@ execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[\ze[^]\n]
" Autolink without angle brackets.
" mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
" ------------ _____________________ ----------------------------- _________________________ ----------------- __
syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?[^] \t]*/
" Autolink with parenthesis.
syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*)\)\@=" end=")"
syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?[^] \t]*)\)\@=" end=")"
" Autolink with angle brackets.
syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@<!<\ze[a-z][a-z0-9,.-]\{1,22}:\/\/[^> ]*>" end=">"
@@ -105,8 +105,8 @@ execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!\~\~/ end=/\(\([^\\]\|^\)\\\)\@<!\~\~/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre[^>]*\\\@<!>" end="</pre>"' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code[^>]*\\\@<!>" end="</code>"' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre\(\|\_s[^>]*\)\\\@<!>" end="</pre>"' . s:concealcode
execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code\(\|\_s[^>]*\)\\\@<!>" end="</code>"' . s:concealcode
syn region mkdFootnote start="\[^" end="\]"
syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/

View File

@@ -34,8 +34,9 @@ set cpo&vim
" http://mesonbuild.com/Syntax.html
syn keyword mesonConditional elif else if endif
syn keyword mesonRepeat foreach endforeach
syn keyword mesonRepeat foreach endforeach
syn keyword mesonOperator and not or in
syn keyword mesonStatement continue break
syn match mesonComment "#.*$" contains=mesonTodo,@Spell
syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained

View File

@@ -109,7 +109,7 @@ syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:/\@!"
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:\([\n ]\)\@="
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr
@@ -149,7 +149,7 @@ syn keyword nixNamespacedBuiltin contained
\ removeAttrs replaceStrings scopedImport seq sort split splitVersion
\ storeDir storePath stringLength sub substring tail throw toFile toJSON
\ toPath toString toXML trace tryEval typeOf unsafeDiscardOutputDependency
\ unsafeDiscardStringContext unsafeGetAttrPos valueSize
\ unsafeDiscardStringContext unsafeGetAttrPos valueSize fromTOML
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More