mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
449bb88248 | ||
|
|
7036147860 | ||
|
|
a37e7e2939 | ||
|
|
c1aac2e279 | ||
|
|
543e8c917b | ||
|
|
2f133372bc | ||
|
|
539952f922 | ||
|
|
b5cc8fc336 | ||
|
|
1872af2d5e | ||
|
|
46b09b0d5b | ||
|
|
63f43f3b01 | ||
|
|
046a052f18 | ||
|
|
31409eaafb | ||
|
|
f431aee86e | ||
|
|
6a086b0c79 | ||
|
|
692db4dc29 | ||
|
|
417df69667 | ||
|
|
ae778bdb17 | ||
|
|
b7598ff0c5 | ||
|
|
312e95099d | ||
|
|
63369f98ef | ||
|
|
2116dd281b | ||
|
|
7ec499c19f | ||
|
|
33b86476b6 | ||
|
|
4f36a63813 | ||
|
|
d6479bbf0b | ||
|
|
d53d2189b9 | ||
|
|
a6a6aeab76 | ||
|
|
444e7f184d | ||
|
|
4c028b37bf | ||
|
|
9ff714cb6c | ||
|
|
e2bbed8acc | ||
|
|
6b4da27538 | ||
|
|
c284af58fa |
2
Makefile
2
Makefile
@@ -7,4 +7,4 @@ test:
|
||||
@ scripts/test
|
||||
|
||||
dev:
|
||||
@ echo "packages.yaml\nheuristics.yaml\nscripts/test\nscripts/build\ntests/extensions.vim" | DEV=1 entr bash -c 'make && make test'
|
||||
@ find scripts . -type f -depth 1 | DEV=1 entr bash -c 'make && make test'
|
||||
|
||||
25
README.md
25
README.md
@@ -1,20 +1,20 @@
|
||||

|
||||
|
||||
 []()
|
||||
 []()
|
||||
|
||||
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-->200<!--/Package Count--> packages it consists of.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->203<!--/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).
|
||||
- Automatically detect indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth))
|
||||
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
|
||||
|
||||
\*To be completely honest, optimized `ftdetect` script takes around `20ms` to load.
|
||||
\*To be completely honest, optimized `ftdetect` script takes around `10ms` to load.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -62,7 +62,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [ansible](https://github.com/pearofducks/ansible-vim)
|
||||
- [ant](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [apache](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [apiblueprint](https://github.com/sheerun/apiblueprint.vim)
|
||||
- [apiblueprint](https://github.com/kylef/apiblueprint.vim)
|
||||
- [applescript](https://github.com/mityu/vim-applescript)
|
||||
- [aptconf](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [arch](https://github.com/vim/vim/tree/master/runtime)
|
||||
@@ -89,6 +89,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [clojure](https://github.com/guns/vim-clojure-static)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script)
|
||||
- [conf](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [cpp-modern](https://github.com/bfrg/vim-cpp-modern)
|
||||
- [cql](https://github.com/elubow/cql-vim)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim)
|
||||
@@ -115,6 +116,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [fsharp](https://github.com/ionide/Ionide-vim)
|
||||
- [gdscript](https://github.com/calviken/vim-gdscript3)
|
||||
- [git](https://github.com/tpope/vim-git)
|
||||
- [gitignore](https://github.com/fszymanski/fzf-gitignore)
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl)
|
||||
- [gmpl](https://github.com/maelvalais/gmpl.vim)
|
||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting)
|
||||
@@ -123,8 +125,8 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [graphql](https://github.com/jparise/vim-graphql)
|
||||
- [groovy](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [grub](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [haml](https://github.com/sheerun/vim-haml)
|
||||
- [handlebars](https://github.com/sheerun/vim-mustache-handlebars)
|
||||
- [haml](https://github.com/tpope/vim-haml)
|
||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars)
|
||||
- [haproxy](https://github.com/CH-DanReif/haproxy.vim)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim)
|
||||
- [haxe](https://github.com/yaymukund/vim-haxe)
|
||||
@@ -133,6 +135,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [help](https://github.com/neovim/neovim/tree/master/runtime)
|
||||
- [hive](https://github.com/zebradil/hive.vim)
|
||||
- [html5](https://github.com/othree/html5.vim)
|
||||
- [htmldjango](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [i3](https://github.com/mboughaba/i3config.vim)
|
||||
- [icalendar](https://github.com/chutzpah/icalendar.vim)
|
||||
- [idris2](https://github.com/edwinb/idris2-vim)
|
||||
@@ -141,7 +144,6 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [javascript-sql](https://github.com/statico/vim-javascript-sql)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript)
|
||||
- [jenkins](https://github.com/martinda/Jenkinsfile-vim-syntax)
|
||||
- [jinja](https://github.com/lepture/vim-jinja)
|
||||
- [jq](https://github.com/vito-c/jq.vim)
|
||||
- [json5](https://github.com/GutenYe/json5.vim)
|
||||
- [json](https://github.com/elzr/vim-json)
|
||||
@@ -151,7 +153,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [julia](https://github.com/JuliaEditorSupport/julia-vim)
|
||||
- [kotlin](https://github.com/udalov/kotlin-vim)
|
||||
- [ledger](https://github.com/ledger/vim-ledger)
|
||||
- [less](https://github.com/groenewege/vim-less)
|
||||
- [less](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond)
|
||||
- [livescript](https://github.com/gkz/vim-ls)
|
||||
- [llvm](https://github.com/rhysd/vim-llvm)
|
||||
@@ -209,6 +211,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [slime](https://github.com/slime-lang/vim-slime-syntax)
|
||||
- [smt2](https://github.com/bohlender/vim-smt2)
|
||||
- [solidity](https://github.com/tomlion/vim-solidity)
|
||||
- [sql](https://github.com/vim/vim/tree/master/runtime)
|
||||
- [stylus](https://github.com/wavded/vim-stylus)
|
||||
- [svelte](https://github.com/evanleck/vim-svelte/tree/main)
|
||||
- [svg-indent](https://github.com/jasonshell/vim-svg-indent)
|
||||
@@ -239,7 +242,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [xml](https://github.com/amadeus/vim-xml)
|
||||
- [xsl](https://github.com/vim-scripts/XSLT-syntax)
|
||||
- [yaml](https://github.com/vim/vim/tree/df44a27b53586fccfc6a3aedc89061fdd9a515ff/runtime)
|
||||
- [yard](https://github.com/sheerun/vim-yardoc)
|
||||
- [yard](https://github.com/noprompt/vim-yardoc)
|
||||
- [zephir](https://github.com/xwsoul/vim-zephir)
|
||||
- [zig](https://github.com/ziglang/zig.vim)
|
||||
- [zinit](https://github.com/zinit-zsh/zplugin-vim-syntax)
|
||||
@@ -263,13 +266,13 @@ The list of available languages to disable is shown above.
|
||||
|
||||
*Please declare this variable before polyglot is loaded (at the top of .vimrc)*
|
||||
|
||||
If you wish to use filetype detection by Vim Polyglot but you'd like to use your own syntax-highlighting plugin, you can append `.plugin` to disabled entry, like so:
|
||||
If you wish to use filetype detection by Vim Polyglot but you'd like to use your own syntax-highlighting plugin, you can append `.plugin` to disabled entry, like below. Disabling Vim Polyglot filetype plugin won't disable native Vim filetype plugin.
|
||||
|
||||
```vim
|
||||
let g:polyglot_disabled = ['markdown.plugin']
|
||||
```
|
||||
|
||||
Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are lazily loaded only when they are really needed.
|
||||
Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are lazily loaded only when they are really needed.
|
||||
|
||||
Vim Polyglot tries to automatically detect indentation settings (just like vim-sleuth). If this feature is not working for you for some reason, please file an issue and disable it temporarily with:
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ syn match yardNote "@note" contained
|
||||
syn match yardOption "@option" contained
|
||||
syn match yardOverload "@overload" contained
|
||||
syn match yardParam "@param" contained
|
||||
syn match yardParamName /@param \h\+/hs=s+7 contained contains=yardParam
|
||||
syn match yardPrivate "@private" contained
|
||||
syn match yardRaise "@raise" contained
|
||||
syn match yardReturn "@return" contained
|
||||
@@ -32,7 +33,7 @@ syn match yardVersion "@version" contained
|
||||
syn match yardYield "@yield" contained
|
||||
syn match yardYieldParam "@yieldparam" contained
|
||||
syn match yardYieldReturn "@yieldreturn" contained
|
||||
syn cluster yardTags contains=yardGenericTag,yardAbstract,yardApi,yardAttr,yardAttrReader,yardAttrWriter,yardAuthor,yardDeprecated,yardExample,yardNote,yardOption,yardOverload,yardParam,yardPrivate,yardRaise,yardReturn,yardSee,yardSince,yardTodo,yardVersion,yardYield,yardYieldParam,yardYieldReturn
|
||||
syn cluster yardTags contains=yardGenericTag,yardAbstract,yardApi,yardAttr,yardAttrReader,yardAttrWriter,yardAuthor,yardDeprecated,yardExample,yardNote,yardOption,yardOverload,yardParam,yardParamName,yardPrivate,yardRaise,yardReturn,yardSee,yardSince,yardTodo,yardVersion,yardYield,yardYieldParam,yardYieldReturn
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Directives
|
||||
@@ -81,7 +82,7 @@ syn cluster rubyNotTop add=@yardTags,@yardDirectives,@yardTypes,@yardLists,@yard
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
hi def link yardComment rubyComment
|
||||
" Tags
|
||||
hi def link yardGenericTag rubyKeyword
|
||||
hi def link yardGenericTag rubyTodo
|
||||
hi def link yardAbstract yardGenericTag
|
||||
hi def link yardApi yardGenericTag
|
||||
hi def link yardAttr yardGenericTag
|
||||
@@ -101,11 +102,11 @@ hi def link yardSee yardGenericTag
|
||||
hi def link yardSince yardGenericTag
|
||||
hi def link yardTodo yardGenericTag
|
||||
hi def link yardVersion yardGenericTag
|
||||
hi def link yield yardGenericTag
|
||||
hi def link yieldparam yardGenericTag
|
||||
hi def link yieldreturn yardGenericTag
|
||||
hi def link yardYield yardGenericTag
|
||||
hi def link yardYieldParam yardGenericTag
|
||||
hi def link yardYieldReturn yardGenericTag
|
||||
" Directives
|
||||
hi def link yardGenericDirective rubyKeyword
|
||||
hi def link yardGenericDirective rubyTodo
|
||||
hi def link yardAttribute yardGenericDirective
|
||||
hi def link yardEndGroup yardGenericDirective
|
||||
hi def link yardGroup yardGenericDirective
|
||||
|
||||
@@ -276,12 +276,14 @@ function! elixir#indent#handle_inside_block(context)
|
||||
" hack - handle do: better
|
||||
let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
let block_start_lnum = block_info[0]
|
||||
call s:debug("block_start_lnum=" . block_start_lnum)
|
||||
let block_start_col = block_info[1]
|
||||
if block_start_lnum != 0 || block_start_col != 0
|
||||
let block_text = getline(block_start_lnum)
|
||||
let block_start_char = block_text[block_start_col - 1]
|
||||
call s:debug("block_start_char=" . block_start_char)
|
||||
|
||||
let never_match = '\(a\)\@=b'
|
||||
let never_match = ''
|
||||
let config = {
|
||||
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
@@ -293,17 +295,25 @@ function! elixir#indent#handle_inside_block(context)
|
||||
\'(': {'aligned_clauses': ')', 'pattern_match_clauses': never_match}
|
||||
\}
|
||||
|
||||
" if `with` clause...
|
||||
if block_start_char == 'w'
|
||||
call s:debug("testing s:handle_with")
|
||||
return s:handle_with(block_start_lnum, block_start_col, a:context)
|
||||
else
|
||||
let block_config = config[block_start_char]
|
||||
" if aligned clause (closing tag/`else` clause/etc...) then indent this
|
||||
" at the same level as the block open tag (e.g. `if`/`case`/etc...)
|
||||
if s:starts_with(a:context, block_config.aligned_clauses)
|
||||
call s:debug("clause")
|
||||
return indent(block_start_lnum)
|
||||
else
|
||||
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
|
||||
let relative_lnum = max([clause_lnum, block_start_lnum])
|
||||
if block_config.pattern_match_clauses == never_match
|
||||
let relative_lnum = block_start_lnum
|
||||
else
|
||||
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
|
||||
call s:debug("clause_lum=" . clause_lnum)
|
||||
let relative_lnum = max([clause_lnum, block_start_lnum])
|
||||
end
|
||||
call s:debug("pattern matching relative to lnum " . relative_lnum)
|
||||
return s:do_handle_pattern_match_block(relative_lnum, a:context)
|
||||
endif
|
||||
|
||||
41
autoload/fzf_gitignore.vim
Normal file
41
autoload/fzf_gitignore.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
|
||||
" Use of this source code is governed by an MIT license that can be
|
||||
" found in the LICENSE file.
|
||||
|
||||
function! s:template_sink(templates) abort
|
||||
try
|
||||
let l:lines = _fzf_gitignore_create(a:templates)
|
||||
catch /^Vim(\(let\|return\)):/
|
||||
return
|
||||
endtry
|
||||
|
||||
new
|
||||
setlocal filetype=gitignore
|
||||
|
||||
call setline(1, l:lines)
|
||||
|
||||
$-2,$delete _
|
||||
normal! gg
|
||||
endfunction
|
||||
|
||||
function! fzf_gitignore#run() abort
|
||||
try
|
||||
let l:opts = {
|
||||
\ 'source': _fzf_gitignore_get_all_templates(),
|
||||
\ 'sink*': function('s:template_sink'),
|
||||
\ 'options': '-m --prompt="Template> " --header="gitignore.io"'
|
||||
\ }
|
||||
catch /^Vim(\(let\|return\)):/
|
||||
return
|
||||
endtry
|
||||
|
||||
call fzf#run(fzf#wrap(l:opts))
|
||||
endfunction
|
||||
|
||||
" vim: ts=2 et sw=2
|
||||
|
||||
endif
|
||||
@@ -1,132 +1,6 @@
|
||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
func! polyglot#Shebang()
|
||||
" Try to detect filetype from shebang
|
||||
let ft = polyglot#ShebangFiletype()
|
||||
if ft != ""
|
||||
let &ft = ft
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunc
|
||||
|
||||
let s:interpreters = {
|
||||
\ 'osascript': 'applescript',
|
||||
\ 'tcc': 'c',
|
||||
\ 'coffee': 'coffee',
|
||||
\ 'crystal': 'crystal',
|
||||
\ 'dart': 'dart',
|
||||
\ 'elixir': 'elixir',
|
||||
\ 'escript': 'erlang',
|
||||
\ 'fish': 'fish',
|
||||
\ 'gnuplot': 'gnuplot',
|
||||
\ 'groovy': 'groovy',
|
||||
\ 'runhaskell': 'haskell',
|
||||
\ 'chakra': 'javascript',
|
||||
\ 'd8': 'javascript',
|
||||
\ 'gjs': 'javascript',
|
||||
\ 'js': 'javascript',
|
||||
\ 'node': 'javascript',
|
||||
\ 'nodejs': 'javascript',
|
||||
\ 'qjs': 'javascript',
|
||||
\ 'rhino': 'javascript',
|
||||
\ 'v8': 'javascript',
|
||||
\ 'v8-shell': 'javascript',
|
||||
\ 'julia': 'julia',
|
||||
\ 'lua': 'lua',
|
||||
\ 'moon': 'moon',
|
||||
\ 'ocaml': 'ocaml',
|
||||
\ 'ocamlrun': 'ocaml',
|
||||
\ 'ocamlscript': 'ocaml',
|
||||
\ 'cperl': 'perl',
|
||||
\ 'perl': 'perl',
|
||||
\ 'php': 'php',
|
||||
\ 'swipl': 'prolog',
|
||||
\ 'yap': 'prolog',
|
||||
\ 'pwsh': 'ps1',
|
||||
\ 'python': 'python',
|
||||
\ 'python2': 'python',
|
||||
\ 'python3': 'python',
|
||||
\ 'qmake': 'qmake',
|
||||
\ 'Rscript': 'r',
|
||||
\ 'racket': 'racket',
|
||||
\ 'perl6': 'raku',
|
||||
\ 'raku': 'raku',
|
||||
\ 'rakudo': 'raku',
|
||||
\ 'ruby': 'ruby',
|
||||
\ 'macruby': 'ruby',
|
||||
\ 'rake': 'ruby',
|
||||
\ 'jruby': 'ruby',
|
||||
\ 'rbx': 'ruby',
|
||||
\ 'scala': 'scala',
|
||||
\ 'ash': 'sh',
|
||||
\ 'bash': 'sh',
|
||||
\ 'dash': 'sh',
|
||||
\ 'ksh': 'sh',
|
||||
\ 'mksh': 'sh',
|
||||
\ 'pdksh': 'sh',
|
||||
\ 'rc': 'sh',
|
||||
\ 'sh': 'sh',
|
||||
\ 'zsh': 'sh',
|
||||
\ 'boolector': 'smt2',
|
||||
\ 'cvc4': 'smt2',
|
||||
\ 'mathsat5': 'smt2',
|
||||
\ 'opensmt': 'smt2',
|
||||
\ 'smtinterpol': 'smt2',
|
||||
\ 'smt-rat': 'smt2',
|
||||
\ 'stp': 'smt2',
|
||||
\ 'verit': 'smt2',
|
||||
\ 'yices2': 'smt2',
|
||||
\ 'z3': 'smt2',
|
||||
\ 'deno': 'typescript',
|
||||
\ 'ts-node': 'typescript',
|
||||
\ }
|
||||
|
||||
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
|
||||
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
|
||||
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
|
||||
|
||||
func! polyglot#ShebangFiletype()
|
||||
let l:line1 = getline(1)
|
||||
|
||||
if l:line1 !~# "^#!"
|
||||
return
|
||||
endif
|
||||
|
||||
let l:pathrest = matchlist(l:line1, s:r_hashbang)
|
||||
|
||||
if len(l:pathrest) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let [_, l:path, l:rest; __] = l:pathrest
|
||||
|
||||
let l:script = split(l:path, "/")[-1]
|
||||
|
||||
if l:script == "env"
|
||||
let l:argspath = matchlist(l:rest, s:r_env)
|
||||
if len(l:argspath) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let l:script = l:argspath[1]
|
||||
endif
|
||||
|
||||
if has_key(s:interpreters, l:script)
|
||||
return s:interpreters[l:script]
|
||||
endif
|
||||
|
||||
for interpreter in keys(s:interpreters)
|
||||
if l:script =~# '^' . interpreter
|
||||
return s:interpreters[interpreter]
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectInpFiletype()
|
||||
func! polyglot#detect#Inp()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\*'
|
||||
set ft=abaqus | return
|
||||
@@ -139,14 +13,14 @@ func! polyglot#DetectInpFiletype()
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectAsaFiletype()
|
||||
func! polyglot#detect#Asa()
|
||||
if exists("g:filetype_asa")
|
||||
let &ft = g:filetype_asa | return
|
||||
endif
|
||||
set ft=aspvbs | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectAspFiletype()
|
||||
func! polyglot#detect#Asp()
|
||||
if exists("g:filetype_asp")
|
||||
let &ft = g:filetype_asp | return
|
||||
endif
|
||||
@@ -159,7 +33,7 @@ func! polyglot#DetectAspFiletype()
|
||||
set ft=aspvbs | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectHFiletype()
|
||||
func! polyglot#detect#H()
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||
@@ -178,7 +52,7 @@ func! polyglot#DetectHFiletype()
|
||||
set ft=cpp | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectMFiletype()
|
||||
func! polyglot#detect#M()
|
||||
let saw_comment = 0
|
||||
for lnum in range(1, min([line("$"), 100]))
|
||||
let line = getline(lnum)
|
||||
@@ -207,7 +81,7 @@ func! polyglot#DetectMFiletype()
|
||||
set ft=octave | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectFsFiletype()
|
||||
func! polyglot#detect#Fs()
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\(: \|new-device\)'
|
||||
@@ -226,7 +100,7 @@ func! polyglot#DetectFsFiletype()
|
||||
set ft=forth | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectReFiletype()
|
||||
func! polyglot#detect#Re()
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
|
||||
@@ -236,7 +110,7 @@ func! polyglot#DetectReFiletype()
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectIdrFiletype()
|
||||
func! polyglot#detect#Idr()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\s*--.*[Ii]dris \=1'
|
||||
@@ -270,7 +144,7 @@ func! polyglot#DetectIdrFiletype()
|
||||
set ft=idris2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectLidrFiletype()
|
||||
func! polyglot#detect#Lidr()
|
||||
for lnum in range(1, min([line("$"), 200]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^>\s*--.*[Ii]dris \=1'
|
||||
@@ -280,7 +154,7 @@ func! polyglot#DetectLidrFiletype()
|
||||
set ft=lidris2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectBasFiletype()
|
||||
func! polyglot#detect#Bas()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
||||
@@ -290,7 +164,7 @@ func! polyglot#DetectBasFiletype()
|
||||
set ft=basic | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectPmFiletype()
|
||||
func! polyglot#detect#Pm()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# 'XPM2'
|
||||
set ft=xpm2 | return
|
||||
@@ -310,10 +184,12 @@ func! polyglot#DetectPmFiletype()
|
||||
if exists("g:filetype_pm")
|
||||
let &ft = g:filetype_pm | return
|
||||
endif
|
||||
set ft=perl | return
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pm()
|
||||
return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectPlFiletype()
|
||||
func! polyglot#detect#Pl()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
|
||||
set ft=prolog | return
|
||||
@@ -330,10 +206,12 @@ func! polyglot#DetectPlFiletype()
|
||||
if exists("g:filetype_pl")
|
||||
let &ft = g:filetype_pl | return
|
||||
endif
|
||||
set ft=perl | return
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pl()
|
||||
return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectTFiletype()
|
||||
func! polyglot#detect#T()
|
||||
for lnum in range(1, min([line("$"), 5]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '^\.'
|
||||
@@ -352,10 +230,12 @@ func! polyglot#DetectTFiletype()
|
||||
if exists("g:filetype_t")
|
||||
let &ft = g:filetype_t | return
|
||||
endif
|
||||
set ft=perl | return
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#T()
|
||||
return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectTt2Filetype()
|
||||
func! polyglot#detect#Tt2()
|
||||
for lnum in range(1, min([line("$"), 3]))
|
||||
let line = getline(lnum)
|
||||
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
|
||||
@@ -365,20 +245,20 @@ func! polyglot#DetectTt2Filetype()
|
||||
set ft=tt2 | return
|
||||
endfunc
|
||||
|
||||
func! polyglot#DetectHtmlFiletype()
|
||||
func! polyglot#detect#Html()
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~# '^\(%\|<[%&].*>\)'
|
||||
set ft=mason | return
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 50]))
|
||||
let line = getline(lnum)
|
||||
if line =~# '{{.*}}\|{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)'
|
||||
set ft=jinja.html | return
|
||||
if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'
|
||||
set ft=htmldjango | return
|
||||
endif
|
||||
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
||||
set ft=xhtml | return
|
||||
endif
|
||||
endfor
|
||||
set ft=html | return
|
||||
set ft=html | au BufWritePost <buffer> ++once call polyglot#detect#Html()
|
||||
return
|
||||
endfunc
|
||||
|
||||
" Restore 'cpoptions'
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
127
autoload/polyglot/shebang.vim
Normal file
127
autoload/polyglot/shebang.vim
Normal file
@@ -0,0 +1,127 @@
|
||||
func! polyglot#shebang#Detect()
|
||||
let ft = s:Filetype()
|
||||
if ft != ""
|
||||
let &ft = ft
|
||||
endif
|
||||
|
||||
if &ft == ""
|
||||
runtime! scripts.vim
|
||||
endif
|
||||
|
||||
return &ft != ""
|
||||
endfunc
|
||||
|
||||
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
|
||||
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
|
||||
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
|
||||
|
||||
func! s:Filetype()
|
||||
let l:line1 = getline(1)
|
||||
|
||||
if l:line1 !~# "^#!"
|
||||
return
|
||||
endif
|
||||
|
||||
let l:pathrest = matchlist(l:line1, s:r_hashbang)
|
||||
|
||||
if len(l:pathrest) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let [_, l:path, l:rest; __] = l:pathrest
|
||||
|
||||
let l:script = split(l:path, "/")[-1]
|
||||
|
||||
if l:script == "env"
|
||||
let l:argspath = matchlist(l:rest, s:r_env)
|
||||
if len(l:argspath) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let l:script = l:argspath[1]
|
||||
endif
|
||||
|
||||
if has_key(s:interpreters, l:script)
|
||||
return s:interpreters[l:script]
|
||||
endif
|
||||
|
||||
for interpreter in keys(s:interpreters)
|
||||
if l:script =~# '^' . interpreter
|
||||
return s:interpreters[interpreter]
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
let s:interpreters = {
|
||||
\ 'osascript': 'applescript',
|
||||
\ 'tcc': 'c',
|
||||
\ 'coffee': 'coffee',
|
||||
\ 'crystal': 'crystal',
|
||||
\ 'dart': 'dart',
|
||||
\ 'elixir': 'elixir',
|
||||
\ 'escript': 'erlang',
|
||||
\ 'fish': 'fish',
|
||||
\ 'gnuplot': 'gnuplot',
|
||||
\ 'groovy': 'groovy',
|
||||
\ 'runhaskell': 'haskell',
|
||||
\ 'chakra': 'javascript',
|
||||
\ 'd8': 'javascript',
|
||||
\ 'gjs': 'javascript',
|
||||
\ 'js': 'javascript',
|
||||
\ 'node': 'javascript',
|
||||
\ 'nodejs': 'javascript',
|
||||
\ 'qjs': 'javascript',
|
||||
\ 'rhino': 'javascript',
|
||||
\ 'v8': 'javascript',
|
||||
\ 'v8-shell': 'javascript',
|
||||
\ 'julia': 'julia',
|
||||
\ 'lua': 'lua',
|
||||
\ 'moon': 'moon',
|
||||
\ 'ocaml': 'ocaml',
|
||||
\ 'ocamlrun': 'ocaml',
|
||||
\ 'ocamlscript': 'ocaml',
|
||||
\ 'cperl': 'perl',
|
||||
\ 'perl': 'perl',
|
||||
\ 'php': 'php',
|
||||
\ 'swipl': 'prolog',
|
||||
\ 'yap': 'prolog',
|
||||
\ 'pwsh': 'ps1',
|
||||
\ 'python': 'python',
|
||||
\ 'python2': 'python',
|
||||
\ 'python3': 'python',
|
||||
\ 'qmake': 'qmake',
|
||||
\ 'Rscript': 'r',
|
||||
\ 'racket': 'racket',
|
||||
\ 'perl6': 'raku',
|
||||
\ 'raku': 'raku',
|
||||
\ 'rakudo': 'raku',
|
||||
\ 'ruby': 'ruby',
|
||||
\ 'macruby': 'ruby',
|
||||
\ 'rake': 'ruby',
|
||||
\ 'jruby': 'ruby',
|
||||
\ 'rbx': 'ruby',
|
||||
\ 'scala': 'scala',
|
||||
\ 'ash': 'sh',
|
||||
\ 'bash': 'sh',
|
||||
\ 'dash': 'sh',
|
||||
\ 'ksh': 'sh',
|
||||
\ 'mksh': 'sh',
|
||||
\ 'pdksh': 'sh',
|
||||
\ 'rc': 'sh',
|
||||
\ 'sh': 'sh',
|
||||
\ 'zsh': 'sh',
|
||||
\ 'boolector': 'smt2',
|
||||
\ 'cvc4': 'smt2',
|
||||
\ 'mathsat5': 'smt2',
|
||||
\ 'opensmt': 'smt2',
|
||||
\ 'smtinterpol': 'smt2',
|
||||
\ 'smt-rat': 'smt2',
|
||||
\ 'stp': 'smt2',
|
||||
\ 'verit': 'smt2',
|
||||
\ 'yices2': 'smt2',
|
||||
\ 'z3': 'smt2',
|
||||
\ 'deno': 'typescript',
|
||||
\ 'ts-node': 'typescript',
|
||||
\ }
|
||||
@@ -1,8 +1,10 @@
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
let s:globs = {
|
||||
\ '8th': '*.8th',
|
||||
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
|
||||
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
|
||||
\ 'a2ps': 'a2psrc',
|
||||
\ 'a2ps': 'a2psrc,.a2psrc',
|
||||
\ 'a65': '*.a65',
|
||||
\ 'aap': '*.aap',
|
||||
\ 'abap': '*.abap',
|
||||
@@ -13,15 +15,15 @@ let s:globs = {
|
||||
\ 'ada': '*.adb,*.ads,*.ada,*.adc,*.gpr,*.ada_m',
|
||||
\ 'ahdl': '*.tdf',
|
||||
\ 'aidl': '*.aidl',
|
||||
\ 'alsaconf': '',
|
||||
\ 'alsaconf': '.asoundrc',
|
||||
\ 'aml': '*.aml',
|
||||
\ 'ampl': '*.run',
|
||||
\ 'ant': 'build.xml',
|
||||
\ 'apache': 'access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf*',
|
||||
\ 'apache': '.htaccess,access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf*',
|
||||
\ 'apiblueprint': '*.apib',
|
||||
\ 'applescript': '*.applescript,*.scpt',
|
||||
\ 'aptconf': 'apt.conf',
|
||||
\ 'arch': '=tagging-method',
|
||||
\ 'arch': '.arch-inventory,=tagging-method',
|
||||
\ 'arduino': '*.pde,*.ino',
|
||||
\ 'art': '*.art',
|
||||
\ 'asciidoc': '*.asciidoc,*.adoc,*.asc',
|
||||
@@ -38,13 +40,14 @@ let s:globs = {
|
||||
\ 'basic': '*.basic',
|
||||
\ 'blade': '*.blade,*.blade.php',
|
||||
\ 'brewfile': 'Brewfile',
|
||||
\ 'bzl': '*.bzl,BUCK,BUILD,BUILD.bazel,Tiltfile,WORKSPACE',
|
||||
\ 'bzl': '*.bzl,*.bazel,*.BUILD,BUCK,BUILD,BUILD.bazel,Tiltfile,WORKSPACE',
|
||||
\ 'c': '*.c,*.cats,*.h,*.idc,*.qc',
|
||||
\ 'caddyfile': 'Caddyfile',
|
||||
\ 'carp': '*.carp',
|
||||
\ 'clojure': '*.clj,*.boot,*.cl2,*.cljc,*.cljs,*.cljs.hl,*.cljscm,*.cljx,*.hic,*.edn,riemann.config,build.boot,profile.boot',
|
||||
\ 'cmake': '*.cmake,*.cmake.in,CMakeLists.txt',
|
||||
\ 'coffee': '*.coffee,*._coffee,*.cake,*.cjsx,*.iced,*.coffeekup,Cakefile',
|
||||
\ 'conf': '*.conf,auto.master,config',
|
||||
\ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp,*.moc,*.tlh',
|
||||
\ 'cql': '*.cql',
|
||||
\ 'cryptol': '*.cry,*.cyl,*.lcry,*.lcyl',
|
||||
@@ -58,7 +61,7 @@ let s:globs = {
|
||||
\ 'dd': '*.dd',
|
||||
\ 'ddoc': '*.ddoc',
|
||||
\ 'dhall': '*.dhall',
|
||||
\ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,php.ini-*',
|
||||
\ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,.editorconfig,.npmrc,php.ini-*',
|
||||
\ 'dsdl': '*.sdl',
|
||||
\ 'dune': 'jbuild,dune,dune-project,dune-workspace',
|
||||
\ 'ecrystal': '*.ecr',
|
||||
@@ -80,9 +83,10 @@ let s:globs = {
|
||||
\ 'fsharp': '*.fs,*.fsi,*.fsx',
|
||||
\ 'gdscript3': '*.gd',
|
||||
\ 'gitcommit': 'COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG',
|
||||
\ 'gitconfig': '*.gitconfig',
|
||||
\ 'gitconfig': '*.gitconfig,.gitconfig,.gitmodules',
|
||||
\ 'gitignore': '.gitignore',
|
||||
\ 'gitrebase': 'git-rebase-todo',
|
||||
\ 'gitsendemail': '',
|
||||
\ 'gitsendemail': '.gitsendemail.*',
|
||||
\ 'glsl': '*.glsl,*.fp,*.frag,*.frg,*.fs,*.fsh,*.fshader,*.geo,*.geom,*.glslf,*.glslv,*.gs,*.gshader,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader,*.comp',
|
||||
\ 'gmpl': '*.mod',
|
||||
\ 'gnuplot': '*.gp,*.gnu,*.gnuplot,*.p,*.plot,*.plt,*.gpi',
|
||||
@@ -93,7 +97,7 @@ let s:globs = {
|
||||
\ 'groovy': '*.groovy,*.grt,*.gtpl,*.gvy,*.gradle,Jenkinsfile',
|
||||
\ 'grub': '',
|
||||
\ 'haml': '*.haml,*.haml.deface,*.hamlc,*.hamlbars',
|
||||
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.c*',
|
||||
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.conf*',
|
||||
\ 'haskell': '*.hs,*.hs-boot,*.hsc,*.bpk,*.hsig',
|
||||
\ 'haxe': '*.hx,*.hxsl',
|
||||
\ 'hcl': '*.hcl,*.nomad,*.workflow,Appfile',
|
||||
@@ -101,17 +105,19 @@ let s:globs = {
|
||||
\ 'help': '',
|
||||
\ 'hive': '*.q,*.hql,*.ql',
|
||||
\ 'html': '*.html,*.htm,*.html.hl,*.inc,*.st,*.xht,*.xhtml',
|
||||
\ 'html.handlebars': '*.handlebars,*.hbs,*.hdbs,*.hb',
|
||||
\ 'html.mustache': '*.mustache,*.hogan,*.hulk,*.hjs',
|
||||
\ 'html.twig': '*.twig',
|
||||
\ 'i3config': '*.i3.config,*.i3config,i3.config,i3config',
|
||||
\ 'htmldjango': '*.jinja,*.j2,*.jinja2,*.njk',
|
||||
\ 'i3config': '*.i3.config,*.i3config,i3.config,i3config,.i3.config,.i3config',
|
||||
\ 'icalendar': '*.ics',
|
||||
\ 'idris': '*.idr,*.lidr,idris-response',
|
||||
\ 'idris2': '*.idr,*.ipkg,idris-response',
|
||||
\ 'ion': '*.ion',
|
||||
\ 'javascript': '*.js,*._js,*.bones,*.cjs,*.es,*.es6,*.frag,*.gs,*.jake,*.jsb,*.jscad,*.jsfl,*.jsm,*.jss,*.mjs,*.njs,*.pac,*.sjs,*.ssjs,*.xsjs,*.xsjslib,Jakefile',
|
||||
\ 'javascript': '*.js,*._js,*.bones,*.cjs,*.es,*.es6,*.frag,*.gs,*.jake,*.jsb,*.jscad,*.jsfl,*.jsm,*.jss,*.mjs,*.njs,*.pac,*.sjs,*.ssjs,*.xsjs,*.xsjslib,*.javascript,Jakefile',
|
||||
\ 'javascriptreact': '*.jsx',
|
||||
\ 'jinja.html': '*.jinja,*.j2,*.jinja2',
|
||||
\ 'jq': '*.jq',
|
||||
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,composer.lock,mcmod.info,Pipfile.lock',
|
||||
\ 'jq': '*.jq,.jqrc,.jqrc*',
|
||||
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.htmlhintrc,.tern-config,.tern-project,.watchmanconfig,composer.lock,mcmod.info,Pipfile.lock',
|
||||
\ 'json5': '*.json5',
|
||||
\ 'jsonnet': '*.jsonnet,*.libsonnet',
|
||||
\ 'jst': '*.ejs,*.ect,*.jst',
|
||||
@@ -125,7 +131,7 @@ let s:globs = {
|
||||
\ 'livescript': '*.ls,*._ls,Slakefile',
|
||||
\ 'llvm': '*.ll',
|
||||
\ 'log': '*.log,*.LOG,*_log,*_LOG',
|
||||
\ 'lua': '*.lua,*.fcgi,*.nse,*.p8,*.pd_lua,*.rbxs,*.rockspec,*.wlua',
|
||||
\ 'lua': '*.lua,*.fcgi,*.nse,*.p8,*.pd_lua,*.rbxs,*.rockspec,*.wlua,.luacheckrc',
|
||||
\ 'm4': '*.m4,*.at',
|
||||
\ 'mako': '*.mako,*.mao',
|
||||
\ 'markdown': '*.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr',
|
||||
@@ -135,13 +141,12 @@ let s:globs = {
|
||||
\ 'mma': '*.mathematica,*.cdf,*.m,*.ma,*.mt,*.nb,*.nbp,*.wl,*.wlt,*.wls,*.mma',
|
||||
\ 'moon': '*.moon',
|
||||
\ 'murphi': '*.m',
|
||||
\ 'mustache': '*.handlebars,*.hbs,*.hulk,*.hjs,*.mustache,*.njk,*.hogan,*.hdbs,*.hb',
|
||||
\ 'nginx': '*.nginx,*.nginxconf,*.vhost,nginx.conf,nginx*.conf,*nginx.conf',
|
||||
\ 'nim': '*.nim,*.nim.cfg,*.nimble,*.nimrod,*.nims,nim.cfg',
|
||||
\ 'nix': '*.nix',
|
||||
\ 'oasis': '_oasis',
|
||||
\ 'objc': '*.m,*.h',
|
||||
\ 'ocaml': '*.ml,*.eliom,*.eliomi,*.ml4,*.mli,*.mll,*.mly,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo',
|
||||
\ 'ocaml': '*.ml,*.eliom,*.eliomi,*.ml4,*.mli,*.mll,*.mly,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo,.ocamlinit',
|
||||
\ 'ocamlbuild_tags': '_tags',
|
||||
\ 'ocpbuild': '*.ocp',
|
||||
\ 'ocpbuildroot': '*.root',
|
||||
@@ -150,22 +155,22 @@ let s:globs = {
|
||||
\ 'omake': '*.om,OMakefile,OMakeroot,OMakeroot.in',
|
||||
\ 'opam': '*.opam,*.opam.template,opam',
|
||||
\ 'opencl': '*.cl,*.opencl',
|
||||
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile',
|
||||
\ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,Phakefile',
|
||||
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc,.gitolite.rc',
|
||||
\ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,*.phtml,.php,.php_cs,.php_cs.dist,Phakefile',
|
||||
\ 'plantuml': '*.puml,*.iuml,*.plantuml,*.uml,*.pu',
|
||||
\ 'pod': '*.pod',
|
||||
\ 'pony': '*.pony',
|
||||
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap',
|
||||
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap,*.pdb',
|
||||
\ 'proto': '*.proto',
|
||||
\ 'ps1': '*.ps1,*.psd1,*.psm1,*.pssc',
|
||||
\ 'ps1xml': '*.ps1xml',
|
||||
\ 'pug': '*.jade,*.pug',
|
||||
\ 'puppet': '*.pp,Modulefile',
|
||||
\ 'purescript': '*.purs',
|
||||
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,DEPS,SConscript,SConstruct,Snakefile,wscript',
|
||||
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,*.ptl,.gclient,DEPS,SConscript,SConstruct,Snakefile,wscript,.pythonrc,.pythonstartup',
|
||||
\ 'qmake': '*.pro,*.pri',
|
||||
\ 'qml': '*.qml,*.qbs',
|
||||
\ 'r': '*.r,*.rsx,*.s,*.S,expr-dist',
|
||||
\ 'r': '*.r,*.rsx,*.s,*.S,.Rprofile,expr-dist',
|
||||
\ 'racket': '*.rkt,*.rktd,*.rktl,*.scrbl',
|
||||
\ 'ragel': '*.rl',
|
||||
\ 'raku': '*.6pl,*.6pm,*.nqp,*.p6,*.p6l,*.p6m,*.pl,*.pl6,*.pm,*.pm6,*.t,*.rakudoc,*.rakutest,*.raku,*.rakumod,*.pod6,*.t6',
|
||||
@@ -175,30 +180,30 @@ let s:globs = {
|
||||
\ 'requirements': '*.pip,*requirements.{txt,in},*require.{txt,in},constraints.{txt,in}',
|
||||
\ 'rhelp': '*.rd',
|
||||
\ 'rst': '*.rst,*.rest,*.rest.txt,*.rst.txt',
|
||||
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,Rantfile,Cheffile,KitchenSink,Routefile,vagrantfile,[Rr]akefile*,*_spec.rb',
|
||||
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,Rantfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb',
|
||||
\ 'rust': '*.rs,*.rs.in',
|
||||
\ 'sbt.scala': '*.sbt',
|
||||
\ 'scala': '*.scala,*.kojo,*.sc',
|
||||
\ 'scss': '*.scss',
|
||||
\ 'sexplib': '*.sexp',
|
||||
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile',
|
||||
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,.bash_aliases,.bash_history,.bash_logout,.bash_profile,.bashrc,.cshrc,.env,.env.example,.flaskenv,.login,.profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile,zlogin,zlogout,zprofile,zshenv,zshrc',
|
||||
\ 'slim': '*.slim',
|
||||
\ 'slime': '*.slime',
|
||||
\ 'smt2': '*.smt2,*.smt',
|
||||
\ 'solidity': '*.sol',
|
||||
\ 'sql': '*.pgsql',
|
||||
\ 'sql': '*.pgsql,*.pls,*.bdy,*.ddl,*.fnc,*.pck,*.pkb,*.pks,*.plb,*.plsql,*.prc,*.spc,*.sql,*.tpb,*.tps,*.trg,*.vw,*.tyb,*.typ,*.tyc',
|
||||
\ 'stylus': '*.styl,*.stylus',
|
||||
\ 'svelte': '*.svelte',
|
||||
\ 'svg': '*.svg',
|
||||
\ 'swift': '*.swift',
|
||||
\ 'sxhkdrc': '*.sxhkdrc,sxhkdrc',
|
||||
\ 'systemd': '*.automount,*.mount,*.path,*.service,*.socket,*.swap,*.target,*.timer',
|
||||
\ 'systemd': '*.automount,*.dnssd,*.link,*.mount,*.netdev,*.network,*.nspawn,*.path,*.service,*.slice,*.socket,*.swap,*.target,*.timer,*.#*',
|
||||
\ 'tablegen': '*.td',
|
||||
\ 'tads': '*.t',
|
||||
\ 'terraform': '*.hcl,*.nomad,*.tf,*.tfvars,*.workflow',
|
||||
\ 'terraform': '*.tf,*.tfvars',
|
||||
\ 'textile': '*.textile',
|
||||
\ 'thrift': '*.thrift',
|
||||
\ 'tmux': '',
|
||||
\ 'tmux': '.tmux*.conf',
|
||||
\ 'toml': '*.toml,Cargo.lock,Gopkg.lock,poetry.lock,Pipfile',
|
||||
\ 'tptp': '*.p,*.tptp,*.ax',
|
||||
\ 'trasys': '*.inp',
|
||||
@@ -216,19 +221,19 @@ let s:globs = {
|
||||
\ 'vmasm': '*.mar',
|
||||
\ 'vue': '*.vue,*.wpy',
|
||||
\ 'xdc': '*.xdc',
|
||||
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.ps1xml,*.psc1,*.pt,*.rdf,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config',
|
||||
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config,*fglrxrc',
|
||||
\ 'xml.twig': '*.xml.twig',
|
||||
\ 'xs': '*.xs',
|
||||
\ 'xsl': '*.xslt,*.xsl',
|
||||
\ 'yaml': '*.yml,*.mir,*.reek,*.rviz,*.sublime-syntax,*.syntax,*.yaml,*.yaml-tmlanguage,*.yaml.sed,*.yml.mysql,glide.lock,yarn.lock,fish_history,fish_read_history',
|
||||
\ 'yaml': '*.yml,*.mir,*.reek,*.rviz,*.sublime-syntax,*.syntax,*.yaml,*.yaml-tmlanguage,*.yaml.sed,*.yml.mysql,.clang-format,.clang-tidy,.gemrc,glide.lock,yarn.lock,fish_history,fish_read_history',
|
||||
\ 'yaml.ansible': 'playbook.y{a,}ml,site.y{a,}ml,main.y{a,}ml,local.y{a,}ml,requirements.y{a,}ml,tasks.*.y{a,}ml,roles.*.y{a,}ml,handlers.*.y{a,}ml',
|
||||
\ 'yaml.docker-compose': 'docker-compose*.yaml,docker-compose*.yml',
|
||||
\ 'zephir': '*.zep',
|
||||
\ 'zig': '*.zig,*.zir',
|
||||
\ 'zir': '*.zir',
|
||||
\ 'zsh': '*.zsh',
|
||||
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*',
|
||||
\}
|
||||
|
||||
func! sleuth#GlobForFiletype(type)
|
||||
func! polyglot#sleuth#GlobForFiletype(type)
|
||||
return get(s:globs, a:type, '')
|
||||
endfunc
|
||||
85
doc/fzf_gitignore.txt
Normal file
85
doc/fzf_gitignore.txt
Normal file
@@ -0,0 +1,85 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||
|
||||
*fzf_gitignore.txt* Create useful .gitignore files for your project
|
||||
|
||||
Author: Filip Szymański <fszymanski.pl@gmail.com>
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *fzf-gitignore-contents*
|
||||
|
||||
1. Introduction |fzf-gitignore-introduction|
|
||||
2. Configuration |fzf-gitignore-configuration|
|
||||
3. Commands |fzf-gitignore-commands|
|
||||
4. Mappings |fzf-gitignore-mappings|
|
||||
5. License |fzf-gitignore-license|
|
||||
6. Bugs |fzf-gitignore-bugs|
|
||||
7. Contributing |fzf-gitignore-contributing|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *fzf-gitignore-introduction*
|
||||
|
||||
fzf[1] interface for creating .gitignore files using the gitignore.io[2] API.
|
||||
|
||||
Note: This plugin was inspired by helm-gitignore[3].
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *fzf-gitignore-configuration*
|
||||
|
||||
*g:fzf_gitignore_no_maps*
|
||||
Set this option to disable all key mappings.
|
||||
>
|
||||
let g:fzf_gitignore_no_maps = 1
|
||||
<
|
||||
Default: Not defined (number)
|
||||
|
||||
*g:fzf_gitignore_map*
|
||||
Set this option to change the |<Plug>(fzf-gitignore)| key mapping.
|
||||
>
|
||||
let g:fzf_gitignore_map = '<Leader>i'
|
||||
<
|
||||
Default: '<Leader>gi' (string)
|
||||
|
||||
==============================================================================
|
||||
COMMANDS *fzf-gitignore-commands*
|
||||
|
||||
*:FzfGitignore*
|
||||
Create .gitignore file.
|
||||
|
||||
==============================================================================
|
||||
MAPPINGS *fzf-gitignore-mappings*
|
||||
|
||||
-----------------------------------+----------------------------------------
|
||||
Mapping | Description ~
|
||||
-----------------------------------+----------------------------------------
|
||||
<Plug>(fzf-gitignore) | Create .gitignore file
|
||||
-----------------------------------+----------------------------------------
|
||||
|
||||
==============================================================================
|
||||
LICENSE *fzf-gitignore-license*
|
||||
|
||||
MIT
|
||||
|
||||
==============================================================================
|
||||
BUGS *fzf-gitignore-bugs*
|
||||
|
||||
If you find a bug please create an issue on GitHub.
|
||||
|
||||
https://github.com/fszymanski/fzf-gitignore/issues
|
||||
|
||||
==============================================================================
|
||||
CONTRIBUTING *fzf-gitignore-contributing*
|
||||
|
||||
Think you can make this plugin better? Awesome. Fork it on GitHub and create
|
||||
a pull request.
|
||||
|
||||
https://github.com/fszymanski/fzf-gitignore
|
||||
|
||||
==============================================================================
|
||||
|
||||
[1] https://github.com/junegunn/fzf
|
||||
[2] https://www.gitignore.io/
|
||||
[3] https://github.com/jupl/helm-gitignore
|
||||
|
||||
vim: tw=78 ts=8 ft=help norl
|
||||
|
||||
endif
|
||||
1215
filetype.vim
Normal file
1215
filetype.vim
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
64
ftplugin/aspvbs.vim
Normal file
64
ftplugin/aspvbs.vim
Normal file
@@ -0,0 +1,64 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'aspvbs') == -1
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: aspvbs
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Last Changed: 20 Jan 2009
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
|
||||
" Make sure the continuation lines below do not cause problems in
|
||||
" compatibility mode.
|
||||
let s:save_cpo = &cpo
|
||||
set cpo-=C
|
||||
|
||||
" Define some defaults in case the included ftplugins don't set them.
|
||||
let s:undo_ftplugin = ""
|
||||
let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
let s:match_words = ""
|
||||
|
||||
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
" Override our defaults if these were set by an included ftplugin.
|
||||
if exists("b:undo_ftplugin")
|
||||
let s:undo_ftplugin = b:undo_ftplugin
|
||||
endif
|
||||
if exists("b:browsefilter")
|
||||
let s:browsefilter = b:browsefilter
|
||||
endif
|
||||
if exists("b:match_words")
|
||||
let s:match_words = b:match_words
|
||||
endif
|
||||
|
||||
" ASP: Active Server Pages (with Visual Basic Script)
|
||||
" thanks to Gontran BAERTS
|
||||
if exists("loaded_matchit")
|
||||
let s:notend = '\%(\<end\s\+\)\@<!'
|
||||
let b:match_ignorecase = 1
|
||||
let b:match_words =
|
||||
\ s:notend . '\<if\>\%(.\{-}then\s\+\w\)\@!:\<elseif\>:^\s*\<else\>:\<end\s\+\<if\>,' .
|
||||
\ s:notend . '\<select\s\+case\>:\<case\>:\<case\s\+else\>:\<end\s\+select\>,' .
|
||||
\ '^\s*\<sub\>:\<end\s\+sub\>,' .
|
||||
\ '^\s*\<function\>:\<end\s\+function\>,' .
|
||||
\ '\<class\>:\<end\s\+class\>,' .
|
||||
\ '^\s*\<do\>:\<loop\>,' .
|
||||
\ '^\s*\<for\>:\<next\>,' .
|
||||
\ '\<while\>:\<wend\>,' .
|
||||
\ s:match_words
|
||||
endif
|
||||
|
||||
" Change the :browse e filter to primarily show ASP-related files.
|
||||
if has("gui_win32")
|
||||
let b:browsefilter="ASP Files (*.asp)\t*.asp\n" . s:browsefilter
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "unlet! b:match_words b:match_ignorecase b:browsefilter | " . s:undo_ftplugin
|
||||
|
||||
" Restore the saved compatibility options.
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
endif
|
||||
23
ftplugin/conf.vim
Normal file
23
ftplugin/conf.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'conf') == -1
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: generic configuration file
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2008-07-09
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:undo_ftplugin = "setl com< cms< fo<"
|
||||
|
||||
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
endif
|
||||
20
ftplugin/gitignore.vim
Normal file
20
ftplugin/gitignore.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
|
||||
" Use of this source code is governed by an MIT license that can be
|
||||
" found in the LICENSE file.
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
let b:undo_ftplugin = 'setlocal commentstring<'
|
||||
|
||||
" vim: ts=2 et sw=2
|
||||
|
||||
endif
|
||||
127
ftplugin/handlebars.vim
Normal file
127
ftplugin/handlebars.vim
Normal file
@@ -0,0 +1,127 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
if exists('b:loaded_mustache_handlebars')
|
||||
finish
|
||||
endif
|
||||
let b:loaded_mustache_handlebars = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Matchit support for Mustache & Handlebars
|
||||
" extending HTML matchit groups
|
||||
if exists("loaded_matchit") && exists("b:match_words")
|
||||
let b:match_words = b:match_words
|
||||
\ . ',{:},[:],(:),'
|
||||
\ . '\%({{\)\@<=#\s*\%(if\|unless\)\s*.\{-}}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=\s*else\s*}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=/\s*\%(if\|unless\)\s*}},'
|
||||
\ . '\%({{\)\@<=[#^]\s*\([-0-9a-zA-Z_?!/.]\+\).\{-}}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=/\s*\1\s*}}'
|
||||
endif
|
||||
|
||||
" Set template for comment
|
||||
setlocal commentstring={{!--\ %s\ --}}
|
||||
|
||||
if exists("g:mustache_abbreviations")
|
||||
inoremap <buffer> {{{ {{{}}}<left><left><left>
|
||||
inoremap <buffer> {{ {{}}<left><left>
|
||||
inoremap <buffer> {{! {{!}}<left><left>
|
||||
inoremap <buffer> {{< {{<}}<left><left>
|
||||
inoremap <buffer> {{> {{>}}<left><left>
|
||||
inoremap <buffer> {{# {{#}}<cr>{{/}}<up><left><left>
|
||||
inoremap <buffer> {{if {{#if }}<cr>{{/if}}<up><left>
|
||||
inoremap <buffer> {{ife {{#if }}<cr>{{else}}<cr>{{/if}}<up><up><left>
|
||||
endif
|
||||
|
||||
|
||||
" Section movement
|
||||
" Adapted from vim-ruby - many thanks to the maintainers of that plugin
|
||||
|
||||
function! s:sectionmovement(pattern,flags,mode,count)
|
||||
norm! m'
|
||||
if a:mode ==# 'v'
|
||||
norm! gv
|
||||
endif
|
||||
let i = 0
|
||||
while i < a:count
|
||||
let i = i + 1
|
||||
" saving current position
|
||||
let line = line('.')
|
||||
let col = col('.')
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
" if there's no more matches, return to last position
|
||||
if pos == 0
|
||||
call cursor(line,col)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>sectionmovement('{{','b','n',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>sectionmovement('{{','' ,'n',v:count1)<CR>
|
||||
xnoremap <silent> <buffer> [[ :<C-U>call <SID>sectionmovement('{{','b','v',v:count1)<CR>
|
||||
xnoremap <silent> <buffer> ]] :<C-U>call <SID>sectionmovement('{{','' ,'v',v:count1)<CR>
|
||||
|
||||
|
||||
" Operator pending mappings
|
||||
|
||||
" Operators are available by default. Set `let g:mustache_operators = 0` in
|
||||
" your .vimrc to disable them.
|
||||
if ! exists("g:mustache_operators")
|
||||
let g:mustache_operators = 1
|
||||
endif
|
||||
|
||||
if exists("g:mustache_operators") && g:mustache_operators
|
||||
onoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR>
|
||||
onoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR>
|
||||
xnoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR>
|
||||
xnoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR>
|
||||
endif
|
||||
|
||||
function! s:wrap_around()
|
||||
" If the cursor is at the end of the tag element, move back
|
||||
" so that the end tag can be detected.
|
||||
while getline('.')[col('.')-1] ==# '}'
|
||||
execute 'norm h'
|
||||
endwhile
|
||||
|
||||
" Moves to the end of the closing tag
|
||||
let pos = search('}}','We')
|
||||
if pos != 0
|
||||
if getline('.')[col('.')] ==# '}'
|
||||
" Ending tag contains 3 closing brackets '}}}',
|
||||
" move to the last bracket.
|
||||
execute 'norm l'
|
||||
endif
|
||||
|
||||
" select the whole tag
|
||||
execute 'norm v%'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:wrap_inside()
|
||||
" If the cursor is at the end of the tag element, move back
|
||||
" so that the end tag can be detected.
|
||||
while getline('.')[col('.')-1] ==# '}'
|
||||
execute 'norm h'
|
||||
endwhile
|
||||
|
||||
" Moves to the end of the closing tag
|
||||
let pos = search('}}','W')
|
||||
if pos != 0
|
||||
" select only inside the tag
|
||||
execute 'norm v%loho'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nofoldenable
|
||||
|
||||
endif
|
||||
17
ftplugin/htmldjango.vim
Normal file
17
ftplugin/htmldjango.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'htmldjango') == -1
|
||||
|
||||
" Vim filetype plugin file
|
||||
" Language: Django HTML template
|
||||
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
|
||||
" Last Change: 2007 Jan 25
|
||||
|
||||
" Only use this filetype plugin when no other was loaded.
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use HTML and Django template ftplugins.
|
||||
runtime! ftplugin/html.vim
|
||||
runtime! ftplugin/django.vim
|
||||
|
||||
endif
|
||||
@@ -1,10 +1,10 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: LessCSS
|
||||
" Author: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Last Change: 2011 Sep 30
|
||||
" Language: less
|
||||
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
||||
" URL: https://github.com/genoma/vim-less
|
||||
" Last Change: 2014 November 24
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -14,17 +14,11 @@ let b:did_ftplugin = 1
|
||||
|
||||
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
|
||||
|
||||
setlocal iskeyword+=-
|
||||
setlocal commentstring=//%s
|
||||
setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
||||
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal comments=:// commentstring=//\ %s
|
||||
|
||||
setlocal omnifunc=csscomplete#CompleteCSS
|
||||
setlocal suffixesadd=.less
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,://
|
||||
setlocal fo=croql
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,127 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
if exists('b:loaded_mustache_handlebars')
|
||||
finish
|
||||
endif
|
||||
let b:loaded_mustache_handlebars = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Matchit support for Mustache & Handlebars
|
||||
" extending HTML matchit groups
|
||||
if exists("loaded_matchit") && exists("b:match_words")
|
||||
let b:match_words = b:match_words
|
||||
\ . ',{:},[:],(:),'
|
||||
\ . '\%({{\)\@<=#\s*\%(if\|unless\)\s*.\{-}}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=\s*else\s*}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=/\s*\%(if\|unless\)\s*}},'
|
||||
\ . '\%({{\)\@<=[#^]\s*\([-0-9a-zA-Z_?!/.]\+\).\{-}}}'
|
||||
\ . ':'
|
||||
\ . '\%({{\)\@<=/\s*\1\s*}}'
|
||||
endif
|
||||
|
||||
" Set template for comment
|
||||
setlocal commentstring={{!--\ %s\ --}}
|
||||
|
||||
if exists("g:mustache_abbreviations")
|
||||
inoremap <buffer> {{{ {{{}}}<left><left><left>
|
||||
inoremap <buffer> {{ {{}}<left><left>
|
||||
inoremap <buffer> {{! {{!}}<left><left>
|
||||
inoremap <buffer> {{< {{<}}<left><left>
|
||||
inoremap <buffer> {{> {{>}}<left><left>
|
||||
inoremap <buffer> {{# {{#}}<cr>{{/}}<up><left><left>
|
||||
inoremap <buffer> {{if {{#if }}<cr>{{/if}}<up><left>
|
||||
inoremap <buffer> {{ife {{#if }}<cr>{{else}}<cr>{{/if}}<up><up><left>
|
||||
endif
|
||||
|
||||
|
||||
" Section movement
|
||||
" Adapted from vim-ruby - many thanks to the maintainers of that plugin
|
||||
|
||||
function! s:sectionmovement(pattern,flags,mode,count)
|
||||
norm! m'
|
||||
if a:mode ==# 'v'
|
||||
norm! gv
|
||||
endif
|
||||
let i = 0
|
||||
while i < a:count
|
||||
let i = i + 1
|
||||
" saving current position
|
||||
let line = line('.')
|
||||
let col = col('.')
|
||||
let pos = search(a:pattern,'W'.a:flags)
|
||||
" if there's no more matches, return to last position
|
||||
if pos == 0
|
||||
call cursor(line,col)
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>sectionmovement('{{','b','n',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>sectionmovement('{{','' ,'n',v:count1)<CR>
|
||||
xnoremap <silent> <buffer> [[ :<C-U>call <SID>sectionmovement('{{','b','v',v:count1)<CR>
|
||||
xnoremap <silent> <buffer> ]] :<C-U>call <SID>sectionmovement('{{','' ,'v',v:count1)<CR>
|
||||
|
||||
|
||||
" Operator pending mappings
|
||||
|
||||
" Operators are available by default. Set `let g:mustache_operators = 0` in
|
||||
" your .vimrc to disable them.
|
||||
if ! exists("g:mustache_operators")
|
||||
let g:mustache_operators = 1
|
||||
endif
|
||||
|
||||
if exists("g:mustache_operators") && g:mustache_operators
|
||||
onoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR>
|
||||
onoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR>
|
||||
xnoremap <silent> <buffer> ie :<C-U>call <SID>wrap_inside()<CR>
|
||||
xnoremap <silent> <buffer> ae :<C-U>call <SID>wrap_around()<CR>
|
||||
endif
|
||||
|
||||
function! s:wrap_around()
|
||||
" If the cursor is at the end of the tag element, move back
|
||||
" so that the end tag can be detected.
|
||||
while getline('.')[col('.')-1] ==# '}'
|
||||
execute 'norm h'
|
||||
endwhile
|
||||
|
||||
" Moves to the end of the closing tag
|
||||
let pos = search('}}','We')
|
||||
if pos != 0
|
||||
if getline('.')[col('.')] ==# '}'
|
||||
" Ending tag contains 3 closing brackets '}}}',
|
||||
" move to the last bracket.
|
||||
execute 'norm l'
|
||||
endif
|
||||
|
||||
" select the whole tag
|
||||
execute 'norm v%'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:wrap_inside()
|
||||
" If the cursor is at the end of the tag element, move back
|
||||
" so that the end tag can be detected.
|
||||
while getline('.')[col('.')-1] ==# '}'
|
||||
execute 'norm h'
|
||||
endwhile
|
||||
|
||||
" Moves to the end of the closing tag
|
||||
let pos = search('}}','W')
|
||||
if pos != 0
|
||||
" select only inside the tag
|
||||
execute 'norm v%loho'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nofoldenable
|
||||
runtime! ftplugin/handlebars*.vim ftplugin/handlebars/*.vim
|
||||
|
||||
endif
|
||||
|
||||
552
ftplugin/sql.vim
Normal file
552
ftplugin/sql.vim
Normal file
@@ -0,0 +1,552 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
|
||||
|
||||
" SQL filetype plugin file
|
||||
" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
|
||||
" Version: 12.0
|
||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||
" Last Change: 2017 Mar 07
|
||||
" Download: http://vim.sourceforge.net/script.php?script_id=454
|
||||
|
||||
" For more details please use:
|
||||
" :h sql.txt
|
||||
"
|
||||
" This file should only contain values that are common to all SQL languages
|
||||
" Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on
|
||||
" If additional features are required create:
|
||||
" vimfiles/after/ftplugin/sql.vim (Windows)
|
||||
" .vim/after/ftplugin/sql.vim (Unix)
|
||||
" to override and add any of your own settings.
|
||||
|
||||
|
||||
" This file also creates a command, SQLSetType, which allows you to change
|
||||
" SQL dialects on the fly. For example, if I open an Oracle SQL file, it
|
||||
" is color highlighted appropriately. If I open an Informix SQL file, it
|
||||
" will still be highlighted according to Oracles settings. By running:
|
||||
" :SQLSetType sqlinformix
|
||||
"
|
||||
" All files called sqlinformix.vim will be loaded from the indent and syntax
|
||||
" directories. This allows you to easily flip SQL dialects on a per file
|
||||
" basis. NOTE: you can also use completion:
|
||||
" :SQLSetType <tab>
|
||||
"
|
||||
" To change the default dialect, add the following to your vimrc:
|
||||
" let g:sql_type_default = 'sqlanywhere'
|
||||
"
|
||||
" This file also creates a command, SQLGetType, which allows you to
|
||||
" determine what the current dialect is in use.
|
||||
" :SQLGetType
|
||||
"
|
||||
" History
|
||||
"
|
||||
" Version 12.0 (April 2013)
|
||||
"
|
||||
" NF: Added support for "BEGIN TRY ... END TRY ... BEGIN CATCH ... END CATCH
|
||||
" BF: This plugin is designed to be used with other plugins to enable the
|
||||
" SQL completion with Perl, Python, Java, ... The loading mechanism
|
||||
" was not checking if the SQL objects were created, which can lead to
|
||||
" the plugin not loading the SQL support.
|
||||
"
|
||||
" Version 11.0 (May 2013)
|
||||
"
|
||||
" NF: Updated to use SyntaxComplete's new regex support for syntax groups.
|
||||
"
|
||||
" Version 10.0 (Dec 2012)
|
||||
"
|
||||
" NF: Changed all maps to use noremap instead of must map
|
||||
" NF: Changed all visual maps to use xnoremap instead of vnoremap as they
|
||||
" should only be used in visual mode and not select mode.
|
||||
" BF: Most of the maps were using doubled up backslashes before they were
|
||||
" changed to using the search() function, which meant they no longer
|
||||
" worked.
|
||||
"
|
||||
" Version 9.0
|
||||
"
|
||||
" NF: Completes 'b:undo_ftplugin'
|
||||
" BF: Correctly set cpoptions when creating script
|
||||
"
|
||||
" Version 8.0
|
||||
"
|
||||
" NF: Improved the matchit plugin regex (Talek)
|
||||
"
|
||||
" Version 7.0
|
||||
"
|
||||
" NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling
|
||||
" SQLSetType.
|
||||
"
|
||||
" Version 6.0
|
||||
"
|
||||
" NF: Adds the command SQLGetType
|
||||
"
|
||||
" Version 5.0
|
||||
"
|
||||
" NF: Adds the ability to choose the keys to control SQL completion, just add
|
||||
" the following to your .vimrc:
|
||||
" let g:ftplugin_sql_omni_key = '<C-C>'
|
||||
" let g:ftplugin_sql_omni_key_right = '<Right>'
|
||||
" let g:ftplugin_sql_omni_key_left = '<Left>'
|
||||
"
|
||||
" BF: format-options - Auto-wrap comments using textwidth was turned off
|
||||
" by mistake.
|
||||
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
" This ftplugin can be used with other ftplugins. So ensure loading
|
||||
" happens if all elements of this plugin have not yet loaded.
|
||||
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" Disable autowrapping for code, but enable for comments
|
||||
" t Auto-wrap text using textwidth
|
||||
" c Auto-wrap comments using textwidth, inserting the current comment
|
||||
" leader automatically.
|
||||
setlocal formatoptions-=t
|
||||
setlocal formatoptions+=c
|
||||
|
||||
" Functions/Commands to allow the user to change SQL syntax dialects
|
||||
" through the use of :SQLSetType <tab> for completion.
|
||||
" This works with both Vim 6 and 7.
|
||||
|
||||
if !exists("*SQL_SetType")
|
||||
" NOTE: You cannot use function! since this file can be
|
||||
" sourced from within this function. That will result in
|
||||
" an error reported by Vim.
|
||||
function SQL_GetList(ArgLead, CmdLine, CursorPos)
|
||||
|
||||
if !exists('s:sql_list')
|
||||
" Grab a list of files that contain "sql" in their names
|
||||
let list_indent = globpath(&runtimepath, 'indent/*sql*')
|
||||
let list_syntax = globpath(&runtimepath, 'syntax/*sql*')
|
||||
let list_ftplugin = globpath(&runtimepath, 'ftplugin/*sql*')
|
||||
|
||||
let sqls = "\n".list_indent."\n".list_syntax."\n".list_ftplugin."\n"
|
||||
|
||||
" Strip out everything (path info) but the filename
|
||||
" Regex
|
||||
" From between two newline characters
|
||||
" Non-greedily grab all characters
|
||||
" Followed by a valid filename \w\+\.\w\+ (sql.vim)
|
||||
" Followed by a newline, but do not include the newline
|
||||
"
|
||||
" Replace it with just the filename (get rid of PATH)
|
||||
"
|
||||
" Recursively, since there are many filenames that contain
|
||||
" the word SQL in the indent, syntax and ftplugin directory
|
||||
let sqls = substitute( sqls,
|
||||
\ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=',
|
||||
\ '\1\n',
|
||||
\ 'g'
|
||||
\ )
|
||||
|
||||
" Remove duplicates, since sqlanywhere.vim can exist in the
|
||||
" sytax, indent and ftplugin directory, yet we only want
|
||||
" to display the option once
|
||||
let index = match(sqls, '.\{-}\ze\n')
|
||||
while index > -1
|
||||
" Get the first filename
|
||||
let file = matchstr(sqls, '.\{-}\ze\n', index)
|
||||
" Recursively replace any *other* occurrence of that
|
||||
" filename with nothing (ie remove it)
|
||||
let sqls = substitute(sqls, '\%>'.(index+strlen(file)).'c\<'.file.'\>\n', '', 'g')
|
||||
" Move on to the next filename
|
||||
let index = match(sqls, '.\{-}\ze\n', (index+strlen(file)+1))
|
||||
endwhile
|
||||
|
||||
" Sort the list if using version 7
|
||||
if v:version >= 700
|
||||
let mylist = split(sqls, "\n")
|
||||
let mylist = sort(mylist)
|
||||
let sqls = join(mylist, "\n")
|
||||
endif
|
||||
|
||||
let s:sql_list = sqls
|
||||
endif
|
||||
|
||||
return s:sql_list
|
||||
|
||||
endfunction
|
||||
|
||||
function SQL_SetType(name)
|
||||
|
||||
" User has decided to override default SQL scripts and
|
||||
" specify a vendor specific version
|
||||
" (ie Oracle, Informix, SQL Anywhere, ...)
|
||||
" So check for an remove any settings that prevent the
|
||||
" scripts from being executed, and then source the
|
||||
" appropriate Vim scripts.
|
||||
if exists("b:did_ftplugin")
|
||||
unlet b:did_ftplugin
|
||||
endif
|
||||
if exists("b:current_syntax")
|
||||
" echomsg 'SQLSetType - clearing syntax'
|
||||
syntax clear
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
endif
|
||||
if exists("b:did_indent")
|
||||
" echomsg 'SQLSetType - clearing indent'
|
||||
unlet b:did_indent
|
||||
" Set these values to their defaults
|
||||
setlocal indentkeys&
|
||||
setlocal indentexpr&
|
||||
endif
|
||||
|
||||
" Ensure the name is in the correct format
|
||||
let new_sql_type = substitute(a:name,
|
||||
\ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '')
|
||||
|
||||
" Do not specify a buffer local variable if it is
|
||||
" the default value
|
||||
if new_sql_type == 'sql'
|
||||
let new_sql_type = 'sqloracle'
|
||||
endif
|
||||
let b:sql_type_override = new_sql_type
|
||||
|
||||
" Remove any cached SQL since a new sytax will have different
|
||||
" items and groups
|
||||
if !exists('g:loaded_sql_completion') || g:loaded_sql_completion >= 100
|
||||
call sqlcomplete#ResetCacheSyntax()
|
||||
endif
|
||||
|
||||
" Vim will automatically source the correct files if we
|
||||
" change the filetype. You cannot do this with setfiletype
|
||||
" since that command will only execute if a filetype has
|
||||
" not already been set. In this case we want to override
|
||||
" the existing filetype.
|
||||
let &filetype = 'sql'
|
||||
|
||||
if b:sql_compl_savefunc != ""
|
||||
" We are changing the filetype to SQL from some other filetype
|
||||
" which had OMNI completion defined. We need to activate the
|
||||
" SQL completion plugin in order to cache some of the syntax items
|
||||
" while the syntax rules for SQL are active.
|
||||
call sqlcomplete#PreCacheSyntax()
|
||||
endif
|
||||
endfunction
|
||||
command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>)
|
||||
|
||||
endif
|
||||
|
||||
" Functions/Commands to allow the user determine current SQL syntax dialect
|
||||
" This works with both Vim 6 and 7.
|
||||
|
||||
if !exists("*SQL_GetType")
|
||||
function SQL_GetType()
|
||||
if exists('b:sql_type_override')
|
||||
echomsg "Current SQL dialect in use:".b:sql_type_override
|
||||
else
|
||||
echomsg "Current SQL dialect in use:".g:sql_type_default
|
||||
endif
|
||||
endfunction
|
||||
command! -nargs=0 SQLGetType :call SQL_GetType()
|
||||
endif
|
||||
|
||||
if exists("b:sql_type_override")
|
||||
" echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim'
|
||||
if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != ''
|
||||
exec 'runtime ftplugin/'.b:sql_type_override.'.vim'
|
||||
" else
|
||||
" echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default'
|
||||
endif
|
||||
elseif exists("g:sql_type_default")
|
||||
" echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim'
|
||||
if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != ''
|
||||
exec 'runtime ftplugin/'.g:sql_type_default.'.vim'
|
||||
" else
|
||||
" echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default'
|
||||
endif
|
||||
endif
|
||||
|
||||
" If the above runtime command succeeded, do not load the default settings
|
||||
" as they should have already been loaded from a previous run.
|
||||
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
|
||||
finish
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" .
|
||||
\ " | unlet! b:browsefilter b:match_words"
|
||||
|
||||
" Don't load another plugin for this buffer
|
||||
let b:did_ftplugin = 1
|
||||
let b:current_ftplugin = 'sql'
|
||||
|
||||
" Win32 can filter files in the browse dialog
|
||||
if has("gui_win32") && !exists("b:browsefilter")
|
||||
let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
" Some standard expressions for use with the matchit strings
|
||||
let s:notend = '\%(\<end\s\+\)\@<!'
|
||||
let s:when_no_matched_or_others = '\%(\<when\>\%(\s\+\%(\%(\<not\>\s\+\)\?<matched\>\)\|\<others\>\)\@!\)'
|
||||
let s:or_replace = '\%(or\s\+replace\s\+\)\?'
|
||||
|
||||
" Define patterns for the matchit macro
|
||||
if !exists("b:match_words")
|
||||
" SQL is generally case insensitive
|
||||
let b:match_ignorecase = 1
|
||||
|
||||
" Handle the following:
|
||||
" if
|
||||
" elseif | elsif
|
||||
" else [if]
|
||||
" end if
|
||||
"
|
||||
" [while condition] loop
|
||||
" leave
|
||||
" break
|
||||
" continue
|
||||
" exit
|
||||
" end loop
|
||||
"
|
||||
" for
|
||||
" leave
|
||||
" break
|
||||
" continue
|
||||
" exit
|
||||
" end loop
|
||||
"
|
||||
" do
|
||||
" statements
|
||||
" doend
|
||||
"
|
||||
" case
|
||||
" when
|
||||
" when
|
||||
" default
|
||||
" end case
|
||||
"
|
||||
" merge
|
||||
" when not matched
|
||||
" when matched
|
||||
"
|
||||
" EXCEPTION
|
||||
" WHEN column_not_found THEN
|
||||
" WHEN OTHERS THEN
|
||||
"
|
||||
" begin try
|
||||
" end try
|
||||
" begin catch
|
||||
" end catch
|
||||
"
|
||||
" create[ or replace] procedure|function|event
|
||||
" \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'.
|
||||
|
||||
" For ColdFusion support
|
||||
setlocal matchpairs+=<:>
|
||||
let b:match_words = &matchpairs .
|
||||
\ ',\%(\<begin\)\%(\s\+\%(try\|catch\)\>\)\@!:\<end\>\W*$,'.
|
||||
\
|
||||
\ '\<begin\s\+try\>:'.
|
||||
\ '\<end\s\+try\>:'.
|
||||
\ '\<begin\s\+catch\>:'.
|
||||
\ '\<end\s\+catch\>,'.
|
||||
\
|
||||
\ s:notend . '\<if\>:'.
|
||||
\ '\<elsif\>\|\<elseif\>\|\<else\>:'.
|
||||
\ '\<end\s\+if\>,'.
|
||||
\
|
||||
\ '\(^\s*\)\@<=\(\<\%(do\|for\|while\|loop\)\>.*\):'.
|
||||
\ '\%(\<exit\>\|\<leave\>\|\<break\>\|\<continue\>\):'.
|
||||
\ '\%(\<doend\>\|\%(\<end\s\+\%(for\|while\|loop\>\)\)\),'.
|
||||
\
|
||||
\ '\%('. s:notend . '\<case\>\):'.
|
||||
\ '\%('.s:when_no_matched_or_others.'\):'.
|
||||
\ '\%(\<when\s\+others\>\|\<end\s\+case\>\),' .
|
||||
\
|
||||
\ '\<merge\>:' .
|
||||
\ '\<when\s\+not\s\+matched\>:' .
|
||||
\ '\<when\s\+matched\>,' .
|
||||
\
|
||||
\ '\%(\<create\s\+' . s:or_replace . '\)\?'.
|
||||
\ '\%(function\|procedure\|event\):'.
|
||||
\ '\<returns\?\>'
|
||||
" \ '\<begin\>\|\<returns\?\>:'.
|
||||
" \ '\<end\>\(;\)\?\s*$'
|
||||
" \ '\<exception\>:'.s:when_no_matched_or_others.
|
||||
" \ ':\<when\s\+others\>,'.
|
||||
"
|
||||
" \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'.
|
||||
" \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'.
|
||||
" \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' .
|
||||
endif
|
||||
|
||||
" Define how to find the macro definition of a variable using the various
|
||||
" [d, [D, [_CTRL_D and so on features
|
||||
" Match these values ignoring case
|
||||
" ie DECLARE varname INTEGER
|
||||
let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>'
|
||||
|
||||
|
||||
" Mappings to move to the next BEGIN ... END block
|
||||
" \W - no characters or digits
|
||||
nnoremap <buffer> <silent> ]] :call search('\c^\s*begin\>', 'W' )<CR>
|
||||
nnoremap <buffer> <silent> [[ :call search('\c^\s*begin\>', 'bW' )<CR>
|
||||
nnoremap <buffer> <silent> ][ :call search('\c^\s*end\W*$', 'W' )<CR>
|
||||
nnoremap <buffer> <silent> [] :call search('\c^\s*end\W*$', 'bW' )<CR>
|
||||
xnoremap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'W' )<CR>
|
||||
xnoremap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'bW' )<CR>
|
||||
xnoremap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'W' )<CR>
|
||||
xnoremap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'bW' )<CR>
|
||||
|
||||
|
||||
" By default only look for CREATE statements, but allow
|
||||
" the user to override
|
||||
if !exists('g:ftplugin_sql_statements')
|
||||
let g:ftplugin_sql_statements = 'create'
|
||||
endif
|
||||
|
||||
" Predefined SQL objects what are used by the below mappings using
|
||||
" the ]} style maps.
|
||||
" This global variable allows the users to override its value
|
||||
" from within their vimrc.
|
||||
" Note, you cannot use \?, since these patterns can be used to search
|
||||
" backwards, you must use \{,1}
|
||||
if !exists('g:ftplugin_sql_objects')
|
||||
let g:ftplugin_sql_objects = 'function,procedure,event,' .
|
||||
\ '\(existing\\|global\s\+temporary\s\+\)\{,1}' .
|
||||
\ 'table,trigger' .
|
||||
\ ',schema,service,publication,database,datatype,domain' .
|
||||
\ ',index,subscription,synchronization,view,variable'
|
||||
endif
|
||||
|
||||
" Key to trigger SQL completion
|
||||
if !exists('g:ftplugin_sql_omni_key')
|
||||
let g:ftplugin_sql_omni_key = '<C-C>'
|
||||
endif
|
||||
" Key to trigger drill into column list
|
||||
if !exists('g:ftplugin_sql_omni_key_right')
|
||||
let g:ftplugin_sql_omni_key_right = '<Right>'
|
||||
endif
|
||||
" Key to trigger drill out of column list
|
||||
if !exists('g:ftplugin_sql_omni_key_left')
|
||||
let g:ftplugin_sql_omni_key_left = '<Left>'
|
||||
endif
|
||||
|
||||
" Replace all ,'s with bars, except ones with numbers after them.
|
||||
" This will most likely be a \{,1} string.
|
||||
let s:ftplugin_sql_objects =
|
||||
\ '\c^\s*' .
|
||||
\ '\(\(' .
|
||||
\ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\|', 'g') .
|
||||
\ '\)\s\+\(or\s\+replace\s\+\)\{,1}\)\{,1}' .
|
||||
\ '\<\(' .
|
||||
\ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\|', 'g') .
|
||||
\ '\)\>'
|
||||
|
||||
" Mappings to move to the next CREATE ... block
|
||||
exec "nnoremap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>"
|
||||
exec "nnoremap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>"
|
||||
" Could not figure out how to use a :call search() string in visual mode
|
||||
" without it ending visual mode
|
||||
" Unfortunately, this will add a entry to the search history
|
||||
exec 'xnoremap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
|
||||
exec 'xnoremap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>'
|
||||
|
||||
" Mappings to move to the next COMMENT
|
||||
"
|
||||
" Had to double the \ for the \| separator since this has a special
|
||||
" meaning on maps
|
||||
let b:comment_leader = '\(--\\|\/\/\\|\*\\|\/\*\\|\*\/\)'
|
||||
" Find the start of the next comment
|
||||
let b:comment_start = '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
||||
\ '\(\s*'.b:comment_leader.'\)'
|
||||
" Find the end of the previous comment
|
||||
let b:comment_end = '\(^\s*'.b:comment_leader.'.*\n\)'.
|
||||
\ '\(^\s*'.b:comment_leader.'\)\@!'
|
||||
" Skip over the comment
|
||||
let b:comment_jump_over = "call search('".
|
||||
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
||||
\ "', 'W')"
|
||||
let b:comment_skip_back = "call search('".
|
||||
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
||||
\ "', 'bW')"
|
||||
" Move to the start and end of comments
|
||||
exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>'
|
||||
exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>'
|
||||
exec 'xnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>'
|
||||
exec 'xnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>'
|
||||
|
||||
" Comments can be of the form:
|
||||
" /*
|
||||
" *
|
||||
" */
|
||||
" or
|
||||
" --
|
||||
" or
|
||||
" //
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,:--,://
|
||||
|
||||
" Set completion with CTRL-X CTRL-O to autoloaded function.
|
||||
if exists('&omnifunc')
|
||||
" Since the SQL completion plugin can be used in conjunction
|
||||
" with other completion filetypes it must record the previous
|
||||
" OMNI function prior to setting up the SQL OMNI function
|
||||
let b:sql_compl_savefunc = &omnifunc
|
||||
|
||||
" Source it to determine its version
|
||||
runtime autoload/sqlcomplete.vim
|
||||
" This is used by the sqlcomplete.vim plugin
|
||||
" Source it for its global functions
|
||||
runtime autoload/syntaxcomplete.vim
|
||||
|
||||
setlocal omnifunc=sqlcomplete#Complete
|
||||
" Prevent the intellisense plugin from loading
|
||||
let b:sql_vis = 1
|
||||
if !exists('g:omni_sql_no_default_maps')
|
||||
let regex_extra = ''
|
||||
if exists('g:loaded_syntax_completion') && exists('g:loaded_sql_completion')
|
||||
if g:loaded_syntax_completion > 120 && g:loaded_sql_completion > 140
|
||||
let regex_extra = '\\w*'
|
||||
endif
|
||||
endif
|
||||
" Static maps which use populate the completion list
|
||||
" using Vim's syntax highlighting rules
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'a <C-\><C-O>:call sqlcomplete#Map("syntax")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword'.regex_extra.'")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'f <C-\><C-O>:call sqlcomplete#Map("sqlFunction'.regex_extra.'")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'o <C-\><C-O>:call sqlcomplete#Map("sqlOption'.regex_extra.'")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'T <C-\><C-O>:call sqlcomplete#Map("sqlType'.regex_extra.'")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'s <C-\><C-O>:call sqlcomplete#Map("sqlStatement'.regex_extra.'")<CR><C-X><C-O>'
|
||||
" Dynamic maps which use populate the completion list
|
||||
" using the dbext.vim plugin
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'t <C-\><C-O>:call sqlcomplete#Map("table")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'p <C-\><C-O>:call sqlcomplete#Map("procedure")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'v <C-\><C-O>:call sqlcomplete#Map("view")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'c <C-\><C-O>:call sqlcomplete#Map("column")<CR><C-X><C-O>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'l <C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
|
||||
" The next 3 maps are only to be used while the completion window is
|
||||
" active due to the <CR> at the beginning of the map
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
|
||||
" <C-Right> is not recognized on most Unix systems, so only create
|
||||
" these additional maps on the Windows platform.
|
||||
" If you would like to use these maps, choose a different key and make
|
||||
" the same map in your vimrc.
|
||||
" if has('win32')
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>'
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_left.' <C-R>=sqlcomplete#DrillOutOfColumns()<CR>'
|
||||
" endif
|
||||
" Remove any cached items useful for schema changes
|
||||
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>'
|
||||
endif
|
||||
|
||||
if b:sql_compl_savefunc != ""
|
||||
" We are changing the filetype to SQL from some other filetype
|
||||
" which had OMNI completion defined. We need to activate the
|
||||
" SQL completion plugin in order to cache some of the syntax items
|
||||
" while the syntax rules for SQL are active.
|
||||
call sqlcomplete#ResetCacheSyntax()
|
||||
call sqlcomplete#PreCacheSyntax()
|
||||
endif
|
||||
endif
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:sw=4:
|
||||
|
||||
endif
|
||||
@@ -132,6 +132,8 @@ rules:
|
||||
filetype: perl
|
||||
- override: true
|
||||
- filetype: perl
|
||||
shebang: true
|
||||
fallback: true
|
||||
---
|
||||
extensions: [pl]
|
||||
rules:
|
||||
@@ -149,6 +151,8 @@ rules:
|
||||
filetype: perl
|
||||
- override: true
|
||||
- filetype: perl
|
||||
shebang: true
|
||||
fallback: true
|
||||
---
|
||||
extensions: [t]
|
||||
rules:
|
||||
@@ -166,6 +170,8 @@ rules:
|
||||
# filetype: turing
|
||||
- override: true
|
||||
- filetype: perl
|
||||
shebang: true
|
||||
fallback: true
|
||||
---
|
||||
extensions: [tt2]
|
||||
rules:
|
||||
@@ -181,7 +187,10 @@ rules:
|
||||
pattern: '^(%|<[%&].*>)'
|
||||
filetype: mason
|
||||
- lines: 50
|
||||
pattern: '{{.*}}|{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b'
|
||||
filetype: jinja.html
|
||||
rules:
|
||||
- pattern: '{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
|
||||
filetype: htmldjango
|
||||
- pattern: '\bDTD\s+XHTML\s'
|
||||
filetype: xhtml
|
||||
- filetype: html
|
||||
|
||||
fallback: true
|
||||
|
||||
129
indent/handlebars.vim
Normal file
129
indent/handlebars.vim
Normal file
@@ -0,0 +1,129 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
" Mustache & Handlebars syntax
|
||||
" Language: Mustache, Handlebars
|
||||
" Maintainer: Juvenn Woo <machese@gmail.com>
|
||||
" Screenshot: http://imgur.com/6F408
|
||||
" Version: 3
|
||||
" Last Change: 26 Nov 2018
|
||||
" Remarks: based on eruby indent plugin by tpope
|
||||
" References:
|
||||
" [Mustache](http://github.com/defunkt/mustache)
|
||||
" [Handlebars](https://github.com/wycats/handlebars.js)
|
||||
" [ctemplate](http://code.google.com/p/google-ctemplate/)
|
||||
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
|
||||
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
|
||||
|
||||
if exists("b:did_indent_hbs")
|
||||
finish
|
||||
endif
|
||||
|
||||
unlet! b:did_indent
|
||||
setlocal indentexpr=
|
||||
|
||||
runtime! indent/html.vim
|
||||
unlet! b:did_indent
|
||||
|
||||
" Force HTML indent to not keep state.
|
||||
let b:html_indent_usestate = 0
|
||||
|
||||
if &l:indentexpr == ''
|
||||
if &l:cindent
|
||||
let &l:indentexpr = 'cindent(v:lnum)'
|
||||
else
|
||||
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||
endif
|
||||
endif
|
||||
let b:handlebars_subtype_indentexpr = &l:indentexpr
|
||||
|
||||
let b:did_indent = 1
|
||||
let b:did_indent_hbs = 1
|
||||
|
||||
setlocal indentexpr=GetHandlebarsIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetHandlebarsIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetHandlebarsIndent(...)
|
||||
" The value of a single shift-width
|
||||
if exists('*shiftwidth')
|
||||
let sw = shiftwidth()
|
||||
else
|
||||
let sw = &sw
|
||||
endif
|
||||
|
||||
if a:0 && a:1 == '.'
|
||||
let v:lnum = line('.')
|
||||
elseif a:0 && a:1 =~ '^\d'
|
||||
let v:lnum = a:1
|
||||
endif
|
||||
let vcol = col('.')
|
||||
call cursor(v:lnum,1)
|
||||
call cursor(v:lnum,vcol)
|
||||
exe "let ind = ".b:handlebars_subtype_indentexpr
|
||||
|
||||
" Workaround for Andy Wokula's HTML indent. This should be removed after
|
||||
" some time, since the newest version is fixed in a different way.
|
||||
if b:handlebars_subtype_indentexpr =~# '^HtmlIndent('
|
||||
\ && exists('b:indent')
|
||||
\ && type(b:indent) == type({})
|
||||
\ && has_key(b:indent, 'lnum')
|
||||
" Force HTML indent to not keep state
|
||||
let b:indent.lnum = -1
|
||||
endif
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let prevLine = getline(lnum)
|
||||
let currentLine = getline(v:lnum)
|
||||
|
||||
" all indent rules only apply if the block opening/closing
|
||||
" tag is on a separate line
|
||||
|
||||
" indent after block {{#block
|
||||
if prevLine =~# '\v\s*\{\{[#^].*\s*'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
" but not if the block ends on the same line
|
||||
if prevLine =~# '\v\s*\{\{\#(.+)(\s+|\}\}).*\{\{\/\1'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" unindent after block close {{/block}}
|
||||
if currentLine =~# '\v^\s*\{\{\/\S*\}\}\s*'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" indent after component block {{a-component
|
||||
if prevLine =~# '\v\s*\{\{\w'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
" but not if the component block ends on the same line
|
||||
if prevLine =~# '\v\s*\{\{\w(.+)\}\}'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" unindent }} lines, and following lines if not inside a block expression
|
||||
let savedPos = getpos('.')
|
||||
if currentLine =~# '\v^\s*\}\}\s*$' || (currentLine !~# '\v^\s*\{\{\/' && prevLine =~# '\v^\s*[^\{\} \t]+\}\}\s*$')
|
||||
let closingLnum = search('}}\s*$', 'Wbc', lnum)
|
||||
let [openingLnum, col] = searchpairpos('{{', '', '}}', 'Wb')
|
||||
if openingLnum > 0 && closingLnum > 0
|
||||
if strpart(getline(openingLnum), col - 1, 3) !~ '{{[#^]'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
else
|
||||
call setpos('.', savedPos)
|
||||
endif
|
||||
endif
|
||||
" unindent {{else}}
|
||||
if currentLine =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" indent again after {{else}}
|
||||
if prevLine =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
endif
|
||||
16
indent/htmldjango.vim
Normal file
16
indent/htmldjango.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'htmldjango') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Django HTML template
|
||||
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
|
||||
" Last Change: 2007 Jan 25
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use HTML formatting rules.
|
||||
runtime! indent/html.vim
|
||||
|
||||
endif
|
||||
@@ -1,84 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Jinja HTML template
|
||||
" Maintainer: Evan Hammer <evan@evanhammer.com>
|
||||
" Last Change: 2013 Jan 26
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Use HTML formatting rules.
|
||||
setl indentkeys=o,O,<Return>,<>>,!^F
|
||||
runtime! indent/html.vim +setl nosmartindent
|
||||
let b:did_indent = 1
|
||||
|
||||
" Indent within the jinja tags
|
||||
" Made by Steve Losh <steve@stevelosh.com>
|
||||
if &l:indentexpr == ''
|
||||
if &l:cindent
|
||||
let &l:indentexpr = 'cindent(v:lnum)'
|
||||
else
|
||||
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||
endif
|
||||
endif
|
||||
let b:html_indentexpr = &l:indentexpr
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetDjangoIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,{,},o,O,!^F,<>>
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetDjangoIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetDjangoIndent(...)
|
||||
if a:0 && a:1 == '.'
|
||||
let v:lnum = line('.')
|
||||
elseif a:0 && a:1 =~ '^\d'
|
||||
let v:lnum = a:1
|
||||
endif
|
||||
let vcol = col('.')
|
||||
|
||||
call cursor(v:lnum,vcol)
|
||||
|
||||
exe "let ind = ".b:html_indentexpr
|
||||
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let pnb = getline(lnum)
|
||||
let cur = getline(v:lnum)
|
||||
|
||||
let tagstart = '.*' . '{%\s*'
|
||||
let tagend = '.*%}' . '.*'
|
||||
|
||||
let blocktags = '\(block\|for\|if\|with\|autoescape\|comment\|filter\|spaceless\)'
|
||||
let midtags = '\(empty\|else\|elif\)'
|
||||
|
||||
let pnb_blockstart = pnb =~# tagstart . blocktags . tagend
|
||||
let pnb_blockend = pnb =~# tagstart . 'end' . blocktags . tagend
|
||||
let pnb_blockmid = pnb =~# tagstart . midtags . tagend
|
||||
|
||||
let cur_blockstart = cur =~# tagstart . blocktags . tagend
|
||||
let cur_blockend = cur =~# tagstart . 'end' . blocktags . tagend
|
||||
let cur_blockmid = cur =~# tagstart . midtags . tagend
|
||||
|
||||
if pnb_blockstart && !pnb_blockend
|
||||
let ind = ind + &sw
|
||||
elseif pnb_blockmid && !pnb_blockend
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
|
||||
if cur_blockend && !cur_blockstart
|
||||
let ind = ind - &sw
|
||||
elseif cur_blockmid
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
endif
|
||||
@@ -1,13 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: LessCSS
|
||||
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Last Change: 2011 Sep 26
|
||||
" Language: less
|
||||
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
||||
" URL: https://github.com/genoma/vim-less
|
||||
" Last Change: 2014 November 24
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/css.vim
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,129 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
" Mustache & Handlebars syntax
|
||||
" Language: Mustache, Handlebars
|
||||
" Maintainer: Juvenn Woo <machese@gmail.com>
|
||||
" Screenshot: http://imgur.com/6F408
|
||||
" Version: 3
|
||||
" Last Change: 26 Nov 2018
|
||||
" Remarks: based on eruby indent plugin by tpope
|
||||
" References:
|
||||
" [Mustache](http://github.com/defunkt/mustache)
|
||||
" [Handlebars](https://github.com/wycats/handlebars.js)
|
||||
" [ctemplate](http://code.google.com/p/google-ctemplate/)
|
||||
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
|
||||
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
|
||||
|
||||
if exists("b:did_indent_hbs")
|
||||
finish
|
||||
endif
|
||||
|
||||
unlet! b:did_indent
|
||||
setlocal indentexpr=
|
||||
|
||||
runtime! indent/html.vim
|
||||
unlet! b:did_indent
|
||||
|
||||
" Force HTML indent to not keep state.
|
||||
let b:html_indent_usestate = 0
|
||||
|
||||
if &l:indentexpr == ''
|
||||
if &l:cindent
|
||||
let &l:indentexpr = 'cindent(v:lnum)'
|
||||
else
|
||||
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||
endif
|
||||
endif
|
||||
let b:handlebars_subtype_indentexpr = &l:indentexpr
|
||||
|
||||
let b:did_indent = 1
|
||||
let b:did_indent_hbs = 1
|
||||
|
||||
setlocal indentexpr=GetHandlebarsIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=else,=elsif,=rescue,=ensure,=when
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetHandlebarsIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! GetHandlebarsIndent(...)
|
||||
" The value of a single shift-width
|
||||
if exists('*shiftwidth')
|
||||
let sw = shiftwidth()
|
||||
else
|
||||
let sw = &sw
|
||||
endif
|
||||
|
||||
if a:0 && a:1 == '.'
|
||||
let v:lnum = line('.')
|
||||
elseif a:0 && a:1 =~ '^\d'
|
||||
let v:lnum = a:1
|
||||
endif
|
||||
let vcol = col('.')
|
||||
call cursor(v:lnum,1)
|
||||
call cursor(v:lnum,vcol)
|
||||
exe "let ind = ".b:handlebars_subtype_indentexpr
|
||||
|
||||
" Workaround for Andy Wokula's HTML indent. This should be removed after
|
||||
" some time, since the newest version is fixed in a different way.
|
||||
if b:handlebars_subtype_indentexpr =~# '^HtmlIndent('
|
||||
\ && exists('b:indent')
|
||||
\ && type(b:indent) == type({})
|
||||
\ && has_key(b:indent, 'lnum')
|
||||
" Force HTML indent to not keep state
|
||||
let b:indent.lnum = -1
|
||||
endif
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let prevLine = getline(lnum)
|
||||
let currentLine = getline(v:lnum)
|
||||
|
||||
" all indent rules only apply if the block opening/closing
|
||||
" tag is on a separate line
|
||||
|
||||
" indent after block {{#block
|
||||
if prevLine =~# '\v\s*\{\{[#^].*\s*'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
" but not if the block ends on the same line
|
||||
if prevLine =~# '\v\s*\{\{\#(.+)(\s+|\}\}).*\{\{\/\1'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" unindent after block close {{/block}}
|
||||
if currentLine =~# '\v^\s*\{\{\/\S*\}\}\s*'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" indent after component block {{a-component
|
||||
if prevLine =~# '\v\s*\{\{\w'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
" but not if the component block ends on the same line
|
||||
if prevLine =~# '\v\s*\{\{\w(.+)\}\}'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" unindent }} lines, and following lines if not inside a block expression
|
||||
let savedPos = getpos('.')
|
||||
if currentLine =~# '\v^\s*\}\}\s*$' || (currentLine !~# '\v^\s*\{\{\/' && prevLine =~# '\v^\s*[^\{\} \t]+\}\}\s*$')
|
||||
let closingLnum = search('}}\s*$', 'Wbc', lnum)
|
||||
let [openingLnum, col] = searchpairpos('{{', '', '}}', 'Wb')
|
||||
if openingLnum > 0 && closingLnum > 0
|
||||
if strpart(getline(openingLnum), col - 1, 3) !~ '{{[#^]'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
else
|
||||
call setpos('.', savedPos)
|
||||
endif
|
||||
endif
|
||||
" unindent {{else}}
|
||||
if currentLine =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind - sw
|
||||
endif
|
||||
" indent again after {{else}}
|
||||
if prevLine =~# '\v^\s*\{\{else.*\}\}\s*$'
|
||||
let ind = ind + sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
runtime! indent/handlebars.vim
|
||||
|
||||
endif
|
||||
|
||||
43
indent/sql.vim
Normal file
43
indent/sql.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
|
||||
|
||||
" Vim indent file loader
|
||||
" Language: SQL
|
||||
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||
" Last Change: Thu Sep 15 2005 10:27:51 AM
|
||||
" Version: 1.0
|
||||
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
||||
|
||||
" Description: Checks for a:
|
||||
" buffer local variable,
|
||||
" global variable,
|
||||
" If the above exist, it will source the type specified.
|
||||
" If none exist, it will source the default sqlanywhere.vim file.
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Default to the standard Vim distribution file
|
||||
let filename = 'sqlanywhere'
|
||||
|
||||
" Check for overrides. Buffer variables have the highest priority.
|
||||
if exists("b:sql_type_override")
|
||||
" Check the runtimepath to see if the file exists
|
||||
if globpath(&runtimepath, 'indent/'.b:sql_type_override.'.vim') != ''
|
||||
let filename = b:sql_type_override
|
||||
endif
|
||||
elseif exists("g:sql_type_default")
|
||||
if globpath(&runtimepath, 'indent/'.g:sql_type_default.'.vim') != ''
|
||||
let filename = g:sql_type_default
|
||||
endif
|
||||
endif
|
||||
|
||||
" Source the appropriate file
|
||||
exec 'runtime indent/'.filename.'.vim'
|
||||
|
||||
|
||||
" vim:sw=4:
|
||||
|
||||
endif
|
||||
186
packages.yaml
186
packages.yaml
@@ -10,8 +10,6 @@ filetypes:
|
||||
name: a2ps
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/a2ps.vim'
|
||||
after:
|
||||
- haproxy
|
||||
filetypes:
|
||||
- name: a2ps
|
||||
filenames:
|
||||
@@ -142,7 +140,6 @@ filetypes:
|
||||
name: ant
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/ant.vim'
|
||||
after: xml
|
||||
filetypes:
|
||||
- name: ant
|
||||
filenames:
|
||||
@@ -169,7 +166,7 @@ filetypes:
|
||||
- '*/etc/httpd/conf.d/*.conf*'
|
||||
---
|
||||
name: apiblueprint
|
||||
remote: sheerun/apiblueprint.vim
|
||||
remote: kylef/apiblueprint.vim
|
||||
filetypes:
|
||||
- name: apiblueprint
|
||||
linguist: API Blueprint
|
||||
@@ -210,7 +207,7 @@ filetypes:
|
||||
---
|
||||
name: arduino
|
||||
remote: sudar/vim-arduino-syntax
|
||||
after: c/c++
|
||||
dependencies: c/c++
|
||||
filetypes:
|
||||
- name: arduino
|
||||
linguist: Processing
|
||||
@@ -240,7 +237,6 @@ filetypes:
|
||||
name: automake
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/automake.vim'
|
||||
after: elf
|
||||
filetypes:
|
||||
- name: automake
|
||||
filenames:
|
||||
@@ -260,7 +256,6 @@ name: aspvbs
|
||||
remote: vim/vim:runtime
|
||||
globs:
|
||||
- '**/aspvbs.vim'
|
||||
dependencies:
|
||||
filetypes:
|
||||
- name: aspvbs
|
||||
extensions:
|
||||
@@ -271,7 +266,6 @@ name: aspperl
|
||||
remote: vim/vim:runtime
|
||||
globs:
|
||||
- '**/aspperl.vim'
|
||||
dependencies:
|
||||
filetypes:
|
||||
- name: aspperl
|
||||
extensions:
|
||||
@@ -327,8 +321,8 @@ filetypes:
|
||||
- ino
|
||||
ignored_warnings:
|
||||
# TODO: fix these
|
||||
- C
|
||||
- H
|
||||
- '*.C'
|
||||
- '*.H'
|
||||
- name: c
|
||||
linguist: C
|
||||
extra_extensions:
|
||||
@@ -347,7 +341,7 @@ filetypes:
|
||||
---
|
||||
name: cpp-modern
|
||||
remote: bfrg/vim-cpp-modern
|
||||
after: c/c++
|
||||
dependencies: c/c++
|
||||
filetypes: []
|
||||
---
|
||||
name: carp
|
||||
@@ -389,9 +383,9 @@ filetypes:
|
||||
# Probably mistake
|
||||
- '*Cakefile'
|
||||
# Used by C#
|
||||
- csx
|
||||
- '*.csx'
|
||||
# Used by Chuck
|
||||
- ck
|
||||
- '*.ck'
|
||||
- name: litcoffee
|
||||
linguist: Literate CoffeeScript
|
||||
extra_extensions:
|
||||
@@ -433,16 +427,13 @@ filetypes:
|
||||
- tab
|
||||
ignored_warnings:
|
||||
# This is definitely not csv-only, maybe re-enable when heuristics done
|
||||
- dat
|
||||
- '*.dat'
|
||||
---
|
||||
name: cucumber
|
||||
remote: tpope/vim-cucumber
|
||||
filetypes:
|
||||
- name: cucumber
|
||||
linguist: Gherkin
|
||||
extra_extensions:
|
||||
# https://github.com/search?q=extension%3Astory+when&type=Code
|
||||
- story
|
||||
---
|
||||
name: cue
|
||||
remote: mgrabovsky/vim-cuesheet
|
||||
@@ -593,7 +584,6 @@ name: fsharp
|
||||
remote: ionide/Ionide-vim
|
||||
ignored_dirs:
|
||||
- ftplugin
|
||||
after: glsl
|
||||
filetypes:
|
||||
- name: fsharp
|
||||
linguist: F#
|
||||
@@ -684,7 +674,8 @@ filetypes:
|
||||
---
|
||||
name: graphql
|
||||
remote: jparise/vim-graphql
|
||||
after: [javascript, jsx]
|
||||
dependencies: javascript
|
||||
after: jsx
|
||||
ignored_dirs:
|
||||
# TODO: remove after bug is fixed:
|
||||
# https://github.com/jparise/vim-graphql/issues/62
|
||||
@@ -695,7 +686,7 @@ filetypes:
|
||||
---
|
||||
name: gradle
|
||||
remote: tfnico/vim-gradle
|
||||
after: groovy
|
||||
dependencies: groovy
|
||||
# Just adds compiler
|
||||
filetypes: []
|
||||
---
|
||||
@@ -711,7 +702,6 @@ filetypes:
|
||||
name: grub
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/grub.vim'
|
||||
after: dlang
|
||||
filetypes:
|
||||
- name: grub
|
||||
filenames:
|
||||
@@ -720,7 +710,8 @@ filetypes:
|
||||
- '*/etc/grub.conf'
|
||||
---
|
||||
name: haml
|
||||
remote: sheerun/vim-haml
|
||||
remote: tpope/vim-haml
|
||||
glob: '**/haml.vim'
|
||||
filetypes:
|
||||
- name: haml
|
||||
linguist: Haml
|
||||
@@ -729,16 +720,17 @@ filetypes:
|
||||
- hamlbars
|
||||
---
|
||||
name: handlebars
|
||||
remote: sheerun/vim-mustache-handlebars
|
||||
remote: mustache/vim-mustache-handlebars
|
||||
filetypes:
|
||||
- name: mustache
|
||||
linguist: Handlebars
|
||||
- name: html.mustache
|
||||
linguist: Mustache
|
||||
extra_extensions:
|
||||
- hogan
|
||||
- hulk
|
||||
- hjs
|
||||
- mustache
|
||||
- njk
|
||||
- hogan
|
||||
- name: html.handlebars
|
||||
linguist: Handlebars
|
||||
extra_extensions:
|
||||
- hdbs
|
||||
- hb
|
||||
---
|
||||
@@ -748,6 +740,8 @@ filetypes:
|
||||
- name: haproxy
|
||||
linguist: HAProxy
|
||||
extra_filenames:
|
||||
- 'haproxy*.conf*'
|
||||
ignored_warnings:
|
||||
- 'haproxy*.c*'
|
||||
---
|
||||
name: haskell
|
||||
@@ -770,8 +764,6 @@ remote: b4b4r07/vim-hcl
|
||||
filetypes:
|
||||
- name: hcl
|
||||
linguist: HCL
|
||||
extra_extensions:
|
||||
- nomad
|
||||
extra_filenames:
|
||||
- Appfile
|
||||
ignored_extensions:
|
||||
@@ -853,13 +845,15 @@ ignored_dirs:
|
||||
filetypes:
|
||||
- name: javascript
|
||||
linguist: JavaScript
|
||||
extra_extensions:
|
||||
- javascript
|
||||
- name: flow
|
||||
extensions:
|
||||
- flow
|
||||
---
|
||||
name: javascript-sql
|
||||
remote: statico/vim-javascript-sql
|
||||
after: javascript
|
||||
dependencies: javascript
|
||||
filetypes: []
|
||||
---
|
||||
name: jenkins
|
||||
@@ -873,15 +867,14 @@ filetypes:
|
||||
- Jenkinsfile
|
||||
- Jenkinsfile*
|
||||
---
|
||||
name: jinja
|
||||
remote: lepture/vim-jinja
|
||||
name: htmldjango
|
||||
remote: vim/vim:runtime
|
||||
globs:
|
||||
- '**/django.vim'
|
||||
- '**/htmldjango.vim'
|
||||
filetypes:
|
||||
- name: jinja.html
|
||||
- name: htmldjango
|
||||
linguist: HTML+Django
|
||||
extra_extensions:
|
||||
- j2
|
||||
ignored_extensions:
|
||||
- njk
|
||||
ignore_warnings:
|
||||
# handled by mustache plugin
|
||||
- mustache
|
||||
@@ -928,12 +921,12 @@ filetypes:
|
||||
- ect
|
||||
ignored_warnings:
|
||||
# I haven't found reference to them on github
|
||||
- djs
|
||||
- hamljs
|
||||
- '*.djs'
|
||||
- '*.hamljs'
|
||||
---
|
||||
name: jsx
|
||||
remote: MaxMEllon/vim-jsx-pretty
|
||||
after: javascript
|
||||
dependencies: javascript
|
||||
filetypes:
|
||||
- name: javascriptreact
|
||||
linguist: JSX
|
||||
@@ -962,10 +955,8 @@ filetypes:
|
||||
- journal
|
||||
---
|
||||
name: less
|
||||
remote: groenewege/vim-less
|
||||
ignored_dirs:
|
||||
# We don't want to slow down .html files
|
||||
- after
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/less.vim'
|
||||
filetypes:
|
||||
- name: less
|
||||
linguist: Less
|
||||
@@ -1046,7 +1037,7 @@ filetypes:
|
||||
# Handled by mdx extension
|
||||
- mdx
|
||||
ignored_warnings:
|
||||
- '{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx}'
|
||||
- '*.{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx}'
|
||||
---
|
||||
name: mdx
|
||||
remote: jxnblk/vim-mdx-js
|
||||
@@ -1162,7 +1153,7 @@ filetypes:
|
||||
---
|
||||
name: octave
|
||||
remote: McSinyx/vim-octave
|
||||
after: mathematica
|
||||
dependencies: mathematica
|
||||
filetypes:
|
||||
- name: octave
|
||||
extensions:
|
||||
@@ -1180,6 +1171,9 @@ remote: vim-perl/vim-perl
|
||||
filetypes:
|
||||
- name: perl
|
||||
linguist: Perl
|
||||
extra_filenames:
|
||||
- example.gitolite.rc
|
||||
- .gitolite.rc
|
||||
- name: pod
|
||||
extensions:
|
||||
- pod
|
||||
@@ -1219,10 +1213,12 @@ remote: StanAngeloff/php.vim
|
||||
filetypes:
|
||||
- name: php
|
||||
linguist: PHP
|
||||
extra_extensions:
|
||||
- phtml
|
||||
---
|
||||
name: blade
|
||||
remote: jwalton512/vim-blade
|
||||
after: php
|
||||
dependencies: php
|
||||
filetypes:
|
||||
- name: blade
|
||||
linguist: Blade
|
||||
@@ -1244,7 +1240,6 @@ filetypes:
|
||||
---
|
||||
name: powershell
|
||||
remote: PProvost/vim-ps1
|
||||
after: xml
|
||||
filetypes:
|
||||
- name: ps1
|
||||
linguist: PowerShell
|
||||
@@ -1288,6 +1283,11 @@ filetypes:
|
||||
linguist: Python
|
||||
ignored_filenames:
|
||||
- 'lit.*cfg'
|
||||
extra_extensions:
|
||||
- ptl
|
||||
extra_filenames:
|
||||
- '.pythonrc'
|
||||
- '.pythonstartup'
|
||||
---
|
||||
name: python-indent
|
||||
remote: Vimjas/vim-python-pep8-indent
|
||||
@@ -1382,7 +1382,6 @@ filetypes:
|
||||
---
|
||||
name: reason
|
||||
remote: reasonml-editor/vim-reason-plus
|
||||
after: c/c++
|
||||
filetypes:
|
||||
- name: reason
|
||||
linguist: Reason
|
||||
@@ -1437,7 +1436,9 @@ filetypes:
|
||||
- '*_spec.rb'
|
||||
---
|
||||
name: yard
|
||||
remote: sheerun/vim-yardoc
|
||||
remote: noprompt/vim-yardoc
|
||||
patches:
|
||||
- 'https://github.com/sheerun/vim-yardoc/commit/173924ec12a66e26a886e80431b92cc9bda578d4.patch'
|
||||
# just adds to ruby
|
||||
filetypes: []
|
||||
---
|
||||
@@ -1489,11 +1490,9 @@ filetypes:
|
||||
- '.zlogin'
|
||||
- '.zprofile'
|
||||
- '.zlogout'
|
||||
- 'zshrc'
|
||||
- 'zshenv'
|
||||
- 'zlogin'
|
||||
- 'zprofile'
|
||||
- 'zlogout'
|
||||
# Udev symlinks config
|
||||
extra_filenames:
|
||||
- '*/etc/udev/cdsymlinks.conf'
|
||||
- name: zsh
|
||||
extensions:
|
||||
- zsh
|
||||
@@ -1503,6 +1502,10 @@ filetypes:
|
||||
- '.zlogin'
|
||||
- '.zprofile'
|
||||
- '.zlogout'
|
||||
- '.zlog*'
|
||||
- '.zcompdump*'
|
||||
- '.zfbfmarks'
|
||||
- '.zsh*'
|
||||
---
|
||||
name: zinit
|
||||
remote: zinit-zsh/zplugin-vim-syntax
|
||||
@@ -1582,19 +1585,30 @@ filetypes:
|
||||
- name: systemd
|
||||
extensions:
|
||||
- automount
|
||||
- dnssd
|
||||
- link
|
||||
- mount
|
||||
- netdev
|
||||
- network
|
||||
- nspawn
|
||||
- path
|
||||
- service
|
||||
- slice
|
||||
- socket
|
||||
- swap
|
||||
- target
|
||||
- timer
|
||||
filenames:
|
||||
- '*.#*'
|
||||
- '*/systemd/*.conf'
|
||||
---
|
||||
name: terraform
|
||||
remote: hashivim/vim-terraform
|
||||
filetypes:
|
||||
- name: terraform
|
||||
linguist: HCL
|
||||
extensions:
|
||||
- tf
|
||||
- tfvars
|
||||
---
|
||||
name: textile
|
||||
remote: timcharper/textile.vim
|
||||
@@ -1613,7 +1627,7 @@ remote: ericpruitt/tmux.vim:vim
|
||||
filetypes:
|
||||
- name: tmux
|
||||
filenames:
|
||||
- '.tmux.conf'
|
||||
- '.tmux*.conf'
|
||||
---
|
||||
name: toml
|
||||
remote: cespare/vim-toml
|
||||
@@ -1641,9 +1655,9 @@ filetypes:
|
||||
linguist: Twig
|
||||
ignored_warnings:
|
||||
# handled by other extension
|
||||
- xml.twig
|
||||
- '*.xml.twig'
|
||||
# already covered by .twig
|
||||
- html.twig
|
||||
- '*.html.twig'
|
||||
- name: xml.twig
|
||||
extensions:
|
||||
- xml.twig
|
||||
@@ -1727,9 +1741,19 @@ filetypes:
|
||||
linguist: XML
|
||||
extra_extensions:
|
||||
- cdxml
|
||||
- tpm
|
||||
- csproj.user
|
||||
- wpl
|
||||
extra_filenames:
|
||||
- '*/etc/blkid.tab'
|
||||
- '*/etc/blkid.tab.old'
|
||||
- '*/etc/xdg/menus/*.menu'
|
||||
- '*fglrxrc'
|
||||
ignored_extensions:
|
||||
- ts
|
||||
- tsx
|
||||
# handled by powershell plugin
|
||||
- ps1xml
|
||||
---
|
||||
name: xsl
|
||||
remote: vim-scripts/XSLT-syntax
|
||||
@@ -1753,7 +1777,7 @@ filetypes:
|
||||
---
|
||||
name: ansible
|
||||
remote: pearofducks/ansible-vim
|
||||
after: yaml
|
||||
dependencies: yaml
|
||||
filetypes:
|
||||
- name: yaml.ansible
|
||||
filenames:
|
||||
@@ -1831,7 +1855,7 @@ filetypes:
|
||||
# SaxBasic is close to Visual Basic
|
||||
- sba
|
||||
ignored_warnings:
|
||||
- vb
|
||||
- '*.vb'
|
||||
---
|
||||
name: dosini
|
||||
remote: vim/vim:runtime
|
||||
@@ -1848,8 +1872,6 @@ filetypes:
|
||||
- '*/etc/yum.repos.d/*'
|
||||
ignored_extensions:
|
||||
- cfg
|
||||
ignored_warnings:
|
||||
- php.ini
|
||||
---
|
||||
name: odin
|
||||
remote: Tetralux/odin.vim
|
||||
@@ -1863,6 +1885,9 @@ glob: '**/bzl.vim'
|
||||
filetypes:
|
||||
- name: bzl
|
||||
linguist: Starlark
|
||||
extra_extensions:
|
||||
- bazel
|
||||
- BUILD
|
||||
---
|
||||
name: prolog
|
||||
remote: vim/vim:runtime
|
||||
@@ -1870,6 +1895,8 @@ glob: '**/prolog.vim'
|
||||
filetypes:
|
||||
- name: prolog
|
||||
linguist: Prolog
|
||||
extra_extensions:
|
||||
- pdb
|
||||
---
|
||||
name: tads
|
||||
remote: vim/vim:runtime
|
||||
@@ -1878,3 +1905,34 @@ filetypes:
|
||||
- name: tads
|
||||
extensions:
|
||||
- t
|
||||
---
|
||||
name: gitignore
|
||||
remote: fszymanski/fzf-gitignore
|
||||
filetypes:
|
||||
- name: gitignore
|
||||
filenames:
|
||||
- '.gitignore'
|
||||
- '*/.config/git/ignore'
|
||||
- '*.git/info/exclude'
|
||||
---
|
||||
name: sql
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/sql.vim'
|
||||
filetypes:
|
||||
- name: sql
|
||||
linguist: PLSQL
|
||||
extra_extensions:
|
||||
- tyb
|
||||
- typ
|
||||
- tyc
|
||||
---
|
||||
name: conf
|
||||
remote: vim/vim:runtime
|
||||
glob: '**/conf.vim'
|
||||
filetypes:
|
||||
- name: conf
|
||||
extensions:
|
||||
- conf
|
||||
filenames:
|
||||
- auto.master
|
||||
- config
|
||||
|
||||
404
scripts/build
404
scripts/build
@@ -22,23 +22,81 @@ def except(hash, *keys)
|
||||
h
|
||||
end
|
||||
|
||||
def verify(packages, heuristics)
|
||||
extensions_with_heuristics = Set.new(heuristics.flat_map { |e| e["extensions"] })
|
||||
no_heuristics = Hash.new { |a, b| a[b] = [] }
|
||||
|
||||
for p in packages
|
||||
for f in p["filetypes"]
|
||||
for e in f["extensions"]
|
||||
if !extensions_with_heuristics.include?(e)
|
||||
no_heuristics[e] << p["name"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
no_heuristics.select! { |a, b| b.size > 1}
|
||||
|
||||
for e, names in no_heuristics
|
||||
if ENV["DEV"]
|
||||
puts "No heuristics for .#{e} extension (#{names.join(", ")})"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sort_packages(packages)
|
||||
implicit_dependencies = Hash.new { |h, k| h[k] = [] }
|
||||
by_extension = Hash.new { |h, k| h[k] = [] }
|
||||
|
||||
for p in packages
|
||||
for f in p["filetypes"]
|
||||
for e in f["extensions"]
|
||||
by_extension[e] << p["name"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for p in packages
|
||||
for f in p["filetypes"]
|
||||
for t in f["filenames"]
|
||||
filename = t.split('/').last
|
||||
if filename.include?(".")
|
||||
ext = filename.split(".").last.gsub('*', '')
|
||||
if by_extension[ext]
|
||||
for name in by_extension[ext]
|
||||
if p["name"] != name
|
||||
implicit_dependencies[p["name"]] |= [name]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
packages = Hash[packages.group_by { |a| a.fetch("name") }.map { |a, b| [a, b.first] }]
|
||||
|
||||
each_node = lambda { |&b| packages.keys.each(&b) }
|
||||
each_child = lambda { |n, &b|
|
||||
[
|
||||
implicit_dependencies[n] || [],
|
||||
packages[n]["dependencies"] || [],
|
||||
packages[n]["after"] || []
|
||||
].flatten.each(&b)
|
||||
}
|
||||
|
||||
TSort.tsort(each_node, each_child).map { |a| packages[a] }
|
||||
end
|
||||
|
||||
def load_data()
|
||||
packages = Hash[YAML.load_stream(File.read('packages.yaml'))
|
||||
.group_by { |a| a.fetch("name") }
|
||||
.map { |a, b| [a, b.first] }]
|
||||
|
||||
deps = Hash.new { |h, k| h[k] = [] }
|
||||
|
||||
each_node = lambda {|&b| packages.keys.each(&b) }
|
||||
each_child = lambda {|n, &b| [packages[n]["after"] || []].flatten.each(&b) }
|
||||
|
||||
packages = load_packages
|
||||
languages = load_languages
|
||||
heuristics = load_heuristics
|
||||
|
||||
# Reason can have ocaml as interpreter but let's not depend on it...
|
||||
languages["Reason"]["interpreters"] -= ["ocaml"]
|
||||
|
||||
packages = TSort.tsort(each_node, each_child).map { |a| packages[a] }
|
||||
|
||||
for package in packages
|
||||
for filetype in package["filetypes"]
|
||||
if filetype["linguist"]
|
||||
@@ -85,7 +143,9 @@ def load_data()
|
||||
end
|
||||
end
|
||||
|
||||
heuristics = YAML.load_stream(File.read('heuristics.yaml'))
|
||||
verify(packages, heuristics)
|
||||
|
||||
packages = sort_packages(packages)
|
||||
|
||||
[packages, transform_patterns(heuristics)]
|
||||
end
|
||||
@@ -139,6 +199,14 @@ def load_languages
|
||||
YAML.load(File.read(file))
|
||||
end
|
||||
|
||||
def load_packages
|
||||
YAML.load_stream(File.read('packages.yaml'))
|
||||
end
|
||||
|
||||
def load_heuristics
|
||||
YAML.load_stream(File.read('heuristics.yaml'))
|
||||
end
|
||||
|
||||
def parse_remote(remote)
|
||||
match = remote.match(/(?<repo>[^@:]+)(?:@(?<branch>[^:]+))?(?::(?<path>.*))?/)
|
||||
dir = "tmp/" + match[:repo] + (match[:branch] ? "-#{match[:branch]}" : "")
|
||||
@@ -317,10 +385,27 @@ def rule_to_code(rule)
|
||||
EOS
|
||||
end
|
||||
|
||||
if (rule.keys - ["filetype", "override", "set", "extensions"]).size > 0
|
||||
raise "Unknown rule: #{JSON.generate(rule)}"
|
||||
if rule.has_key?("shebang")
|
||||
return <<~EOS
|
||||
if polyglot#shebang#Detect() | return | endif
|
||||
#{indent(rule_to_code(except(rule, "shebang")), 0)}
|
||||
EOS
|
||||
end
|
||||
|
||||
|
||||
if rule.has_key?("filetype")
|
||||
if rule.has_key?("fallback")
|
||||
return <<~EOS
|
||||
set ft=#{rule["filetype"]} | au BufWritePost <buffer> ++once call polyglot#detect##{camelize(rule["extensions"].first)}()
|
||||
return
|
||||
EOS
|
||||
end
|
||||
|
||||
return <<~EOS
|
||||
set ft=#{rule["filetype"]} | return
|
||||
#{indent(rule_to_code(except(rule, "filetype")), 0)}
|
||||
EOS
|
||||
end
|
||||
|
||||
if rule.has_key?("override")
|
||||
variable = "g:filetype_#{rule["extensions"].first}"
|
||||
return <<~EOS
|
||||
@@ -330,23 +415,15 @@ def rule_to_code(rule)
|
||||
EOS
|
||||
end
|
||||
|
||||
if rule.has_key?("filetype")
|
||||
return "set ft=#{rule["filetype"]} | return"
|
||||
if (rule.keys - ["extensions"]).size > 0
|
||||
raise "Unknown rule: #{JSON.generate(rule)}"
|
||||
end
|
||||
|
||||
if rule.has_key?("filetype")
|
||||
return "set ft=#{rule["filetype"]} | return"
|
||||
end
|
||||
|
||||
if rule.has_key?("extensions")
|
||||
return ""
|
||||
end
|
||||
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
def extract(packages)
|
||||
all_dirs = %w(syntax indent doc compiler autoload ftplugin ctags extras after)
|
||||
all_dirs = %w(syntax indent doc compiler ftplugin ctags extras after)
|
||||
|
||||
default_dirs = %w(
|
||||
syntax indent doc compiler autoload ftplugin ctags extras
|
||||
@@ -355,6 +432,12 @@ def extract(packages)
|
||||
|
||||
FileUtils.rm_rf(all_dirs)
|
||||
|
||||
for dir in Dir.glob("*", base: "autoload")
|
||||
if dir != "polyglot"
|
||||
FileUtils.rm_rf("autoload/" + dir)
|
||||
end
|
||||
end
|
||||
|
||||
output = []
|
||||
packages.map do |package|
|
||||
repo, branch, path, dir = parse_remote(package["remote"])
|
||||
@@ -371,13 +454,15 @@ def extract(packages)
|
||||
if repo == "vim/vim" && (["glob", "globs"] & package.keys).size == 0
|
||||
raise "Package from vim/vim should define glob or globs: #{package["name"]}"
|
||||
end
|
||||
glob = package.fetch("glob", package.fetch('globs', '**/*.{vim,ctags,vital,txt}'))
|
||||
Dir.glob("#{subdir}/#{glob}", base: subtree).each do |p|
|
||||
next unless File.file?("#{subtree}/#{p}")
|
||||
if p.include?("samba")
|
||||
raise package["name"]
|
||||
globs = [package.fetch("glob", package.fetch('globs', '**/*.{vim,ctags,vital,txt}'))].flatten
|
||||
globs.each do |glob|
|
||||
Dir.glob("#{subdir}/#{glob}", base: subtree).each do |p|
|
||||
next unless File.file?("#{subtree}/#{p}")
|
||||
if p.include?("samba")
|
||||
raise package["name"]
|
||||
end
|
||||
copy_file(package, "#{subtree}/#{p}", p)
|
||||
end
|
||||
copy_file(package, "#{subtree}/#{p}", p)
|
||||
end
|
||||
elsif File.exist?(subpath)
|
||||
copy_file(package, subpath, subdir)
|
||||
@@ -412,21 +497,10 @@ def extract(packages)
|
||||
end
|
||||
|
||||
def generate_ftdetect(packages, heuristics)
|
||||
FileUtils.mkdir_p('autoload/polyglot')
|
||||
|
||||
output = "\n"
|
||||
|
||||
extensions = Hash.new { |h, k| h[k] = [] }
|
||||
|
||||
for package in packages
|
||||
for filetype in package["filetypes"]
|
||||
for ext in filetype["extensions"]
|
||||
extensions[ext] << filetype["name"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ambiguous_extensions = extensions
|
||||
.select { |a, b| b.uniq.size > 1 }.keys.sort
|
||||
|
||||
all_filetypes = packages.flat_map { |f| f["filetypes"] || [] }
|
||||
filetype_names = Set.new(all_filetypes.map { |f| f["name"] })
|
||||
|
||||
@@ -438,43 +512,18 @@ def generate_ftdetect(packages, heuristics)
|
||||
native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
|
||||
native_filenames = Set.new(native_filetypes.flat_map { |f| f["filenames"] || [] })
|
||||
|
||||
for package in packages
|
||||
name = package.fetch("name")
|
||||
|
||||
to_disable = []
|
||||
|
||||
for filetype in package["filetypes"]
|
||||
for extension in filetype["extensions"]
|
||||
if native_extensions.include?(extension)
|
||||
to_disable << "*." + extension
|
||||
end
|
||||
end
|
||||
|
||||
for filename in filetype["filenames"]
|
||||
if native_filenames.include?(filename)
|
||||
to_disable << filename
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if to_disable.size > 0
|
||||
output << "if !has_key(s:disabled_packages, '#{name}')\n"
|
||||
output << " au! BufRead,BufNewFile #{to_disable.join(",")}\n"
|
||||
output << "endif\n\n"
|
||||
end
|
||||
end
|
||||
|
||||
for package in packages
|
||||
# Because we're using setf we need to reverse order
|
||||
for package in packages.reverse
|
||||
filetypes = package["filetypes"] or raise "Unknown filetype for: #{package["name"]}"
|
||||
|
||||
package_heuristics = []
|
||||
|
||||
autocommands = ""
|
||||
autocommands = []
|
||||
for filetype in filetypes
|
||||
name = filetype.fetch("name")
|
||||
syntax = filetype["syntax"] ? " | set syntax=#{filetype["syntax"]}" : ""
|
||||
|
||||
set_command = "set ft=#{name}"
|
||||
set_command = "setf #{name}"
|
||||
|
||||
if filetype["syntax"]
|
||||
set_command = "set ft=#{name} syntax=#{filetype["syntax"]}"
|
||||
@@ -487,6 +536,8 @@ def generate_ftdetect(packages, heuristics)
|
||||
extensions = filetype["extensions"]
|
||||
filenames = filetype["filenames"]
|
||||
|
||||
set_globs = []
|
||||
|
||||
for extension in extensions.sort
|
||||
outer_filetype = filetype["outer_filetype"]
|
||||
if outer_filetype
|
||||
@@ -498,11 +549,7 @@ def generate_ftdetect(packages, heuristics)
|
||||
if heuristic
|
||||
package_heuristics << heuristic
|
||||
else
|
||||
# if ambiguous_extensions.include?(extension)
|
||||
# puts "Ambiguous extension without heuristic: #{extension} => #{filetype["name"]}"
|
||||
# end
|
||||
#
|
||||
autocommands << " au BufNewFile,BufRead *.#{extension} #{set_command}\n"
|
||||
set_globs << "*." + extension
|
||||
end
|
||||
end
|
||||
|
||||
@@ -513,60 +560,53 @@ def generate_ftdetect(packages, heuristics)
|
||||
if filename[-1] == "*"
|
||||
autocommands << " au BufNewFile,BufRead #{filename} call s:StarSetf('#{name}')\n"
|
||||
else
|
||||
autocommands << " au BufNewFile,BufRead #{filename} #{set_command}\n"
|
||||
set_globs << filename
|
||||
end
|
||||
end
|
||||
|
||||
if set_globs.size > 0
|
||||
autocommands << " au BufNewFile,BufRead #{set_globs.join(",")} #{set_command}\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for heuristic in package_heuristics.uniq
|
||||
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
|
||||
autocommands << " au! BufNewFile,BufRead #{extensions.join(",")} call polyglot#Detect#{camelize(heuristic["extensions"].first)}Filetype()\n"
|
||||
autocommands << " au! BufNewFile,BufRead #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()\n"
|
||||
end
|
||||
|
||||
if autocommands != ""
|
||||
output << "if !has_key(s:disabled_packages, '#{package["name"]}')\n"
|
||||
output << autocommands
|
||||
output << autocommands.reverse.join("")
|
||||
output << "endif\n\n"
|
||||
end
|
||||
end
|
||||
|
||||
defined_extensions = all_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
|
||||
expected_extensions = expected_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
|
||||
ignored_extensions = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_extensions", [])).map { |e| [f["name"], e] } }
|
||||
|
||||
defined_filenames = all_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
|
||||
expected_filenames = expected_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
|
||||
ignored_filenames = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_filenames", [])).map { |e| [f["name"], e] } }
|
||||
show_warnings(all_filetypes, expected_filetypes)
|
||||
|
||||
ignored_warnings = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_warnings", [])).map { |e| [f["name"], e] } + [f, "*"] }
|
||||
ftdetect = File.read('filetype.vim')
|
||||
|
||||
for name, e in expected_extensions - defined_extensions - ignored_extensions - ignored_warnings
|
||||
puts "Missing extension for #{name}: #{e}"
|
||||
starting = '" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE'
|
||||
ending = '" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE'
|
||||
|
||||
File.write(
|
||||
'filetype.vim',
|
||||
ftdetect.gsub(/(?<=#{starting}\n)(.*)(?=#{ending})/m) { output }
|
||||
)
|
||||
|
||||
output = ["\" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE\n"]
|
||||
|
||||
for heuristic in heuristics
|
||||
output << <<~EOS
|
||||
func! polyglot#detect##{camelize(heuristic["extensions"].first)}()
|
||||
#{indent(rules_to_code(heuristic), 2)}
|
||||
endfunc
|
||||
EOS
|
||||
end
|
||||
|
||||
for name, e in expected_filenames - defined_filenames - ignored_filenames - ignored_warnings
|
||||
puts "Missing filename for #{name}: #{e}"
|
||||
end
|
||||
|
||||
ftdetect = File.read('ftdetect/polyglot.vim')
|
||||
File.write('ftdetect/polyglot.vim', ftdetect.gsub(/(?<=" filetypes\n).*(?=\n" end filetypes)/m, output))
|
||||
File.write('autoload/polyglot/detect.vim', output.join("\n"))
|
||||
|
||||
output = <<~EOS
|
||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
func! polyglot#Shebang()
|
||||
" Try to detect filetype from shebang
|
||||
let ft = polyglot#ShebangFiletype()
|
||||
if ft != ""
|
||||
let &ft = ft
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunc
|
||||
|
||||
let s:interpreters = {
|
||||
EOS
|
||||
|
||||
@@ -576,68 +616,15 @@ def generate_ftdetect(packages, heuristics)
|
||||
end
|
||||
end
|
||||
|
||||
output << <<~EOS
|
||||
\\ }
|
||||
output << " \\ }"
|
||||
|
||||
let s:r_hashbang = '^#!\\s*\\(\\S\\+\\)\\s*\\(.*\\)\\s*'
|
||||
let s:r_envflag = '%(\\S\\+=\\S\\+\\|-[iS]\\|--ignore-environment\\|--split-string\\)'
|
||||
let s:r_env = '^\\%(\\' . s:r_envflag . '\\s\\+\\)*\\(\\S\\+\\)'
|
||||
inject_code('autoload/polyglot/shebang.vim', output)
|
||||
end
|
||||
|
||||
func! polyglot#ShebangFiletype()
|
||||
let l:line1 = getline(1)
|
||||
|
||||
if l:line1 !~# "^#!"
|
||||
return
|
||||
endif
|
||||
|
||||
let l:pathrest = matchlist(l:line1, s:r_hashbang)
|
||||
|
||||
if len(l:pathrest) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let [_, l:path, l:rest; __] = l:pathrest
|
||||
|
||||
let l:script = split(l:path, "/")[-1]
|
||||
|
||||
if l:script == "env"
|
||||
let l:argspath = matchlist(l:rest, s:r_env)
|
||||
if len(l:argspath) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let l:script = l:argspath[1]
|
||||
endif
|
||||
|
||||
if has_key(s:interpreters, l:script)
|
||||
return s:interpreters[l:script]
|
||||
endif
|
||||
|
||||
for interpreter in keys(s:interpreters)
|
||||
if l:script =~# '^' . interpreter
|
||||
return s:interpreters[interpreter]
|
||||
endif
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
EOS
|
||||
|
||||
for heuristic in heuristics
|
||||
output << <<~EOS
|
||||
func! polyglot#Detect#{camelize(heuristic["extensions"].first)}Filetype()
|
||||
#{indent(rules_to_code(heuristic), 2)}
|
||||
endfunc
|
||||
|
||||
EOS
|
||||
end
|
||||
|
||||
output << <<~EOS
|
||||
" Restore 'cpoptions'
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
EOS
|
||||
|
||||
File.write('autoload/polyglot.vim', output)
|
||||
def inject_code(path, code)
|
||||
header = "\" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE\n"
|
||||
normal, generated = File.read(path).split(header)
|
||||
File.write(path, [normal, generated].join(header))
|
||||
end
|
||||
|
||||
def generate_tests(packages)
|
||||
@@ -696,14 +683,32 @@ def comma_expanson(s)
|
||||
end
|
||||
end
|
||||
|
||||
def expand_all(pattern)
|
||||
def expand_all(pattern, all = false)
|
||||
if !pattern
|
||||
return []
|
||||
end
|
||||
|
||||
if pattern.is_a?(Array)
|
||||
return pattern.flat_map { |p| expand_all(p) }
|
||||
return pattern.flat_map { |p| expand_all(p, all) }
|
||||
end
|
||||
|
||||
comma_expanson(pattern).flat_map do |e|
|
||||
brace_expansion(e).flat_map do |e2|
|
||||
square_expansion(e2)
|
||||
square_expansion(e2).flat_map do |e3|
|
||||
results = [e3]
|
||||
if all
|
||||
if e3[0] == "."
|
||||
results << e3[1..-1]
|
||||
end
|
||||
if e3.include?("*")
|
||||
results.concat(results.map { |e4| e4.gsub("*", "") })
|
||||
end
|
||||
if e3.match(/\*\.[a-z]/)
|
||||
results << "*." + e3[2].upcase + e3[3..-1]
|
||||
end
|
||||
end
|
||||
results
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -736,16 +741,18 @@ def detect_filetypes(glob)
|
||||
end
|
||||
|
||||
def generate_plugins(packages)
|
||||
FileUtils.mkdir_p('autoload/polyglot')
|
||||
output = <<~EOS
|
||||
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
output = "let s:globs = {\n"
|
||||
let s:globs = {
|
||||
EOS
|
||||
|
||||
patterns = Hash.new { |h, k| h[k] = [] }
|
||||
|
||||
for package in packages
|
||||
for filetype in package["filetypes"]
|
||||
extensions = (filetype["extensions"] || []).map { |e| "*.#{e}" }
|
||||
files = (filetype["filenames"] || []).reject { |e| e.match(/\*\*|\//) || e[0] == "." }
|
||||
files = (filetype["filenames"] || []).reject { |e| e.match(/\*\*|\//) }
|
||||
patterns[filetype["name"]].concat(extensions)
|
||||
patterns[filetype["name"]].concat(files)
|
||||
end
|
||||
@@ -758,13 +765,46 @@ def generate_plugins(packages)
|
||||
|
||||
|
||||
output << <<~EOS
|
||||
func! sleuth#GlobForFiletype(type)
|
||||
func! polyglot#sleuth#GlobForFiletype(type)
|
||||
return get(s:globs, a:type, '')
|
||||
endfunc
|
||||
EOS
|
||||
|
||||
|
||||
File.write('autoload/sleuth.vim', output)
|
||||
File.write('autoload/polyglot/sleuth.vim', output)
|
||||
end
|
||||
|
||||
def process_list(list, extras)
|
||||
list.flat_map do |f|
|
||||
expand_all(yield(f), extras).uniq.map { |e| [f["name"], e] }
|
||||
end
|
||||
end
|
||||
|
||||
def show_warnings(all_filetypes, expected_filetypes)
|
||||
if !ENV["DEV"]
|
||||
return
|
||||
end
|
||||
|
||||
all_expected = process_list(expected_filetypes, false) do |f|
|
||||
(f["extensions"] || []).map { |e| "*." + e } + (f["filenames"] || [])
|
||||
end
|
||||
|
||||
|
||||
all_handled = process_list(all_filetypes, all_expected) do |f|
|
||||
[f["filenames"], f["ignored_filenames"], f["ignored_warnings"], f["extra_filenames"]].compact.flatten +
|
||||
[f["extensions"], f["ignored_extensions"], f["extra_extensions"]].compact.flatten.map { |e| "*." + e }
|
||||
end
|
||||
|
||||
all_handled_regexps = Hash[all_handled.group_by { |a, b| a }.map do |a, b|
|
||||
[a, Regexp.union(b.map { |x| Regexp.new(Regexp.escape(x[1]).gsub('\\*', '.*')) })]
|
||||
end]
|
||||
|
||||
for name, e in all_expected - all_handled
|
||||
if all_handled_regexps[name].match?(e) || e == "*"
|
||||
next
|
||||
end
|
||||
puts "Missing for #{name}: #{e}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ def run_vimscript(src)
|
||||
func! Log(msg)
|
||||
if $DEV != '1'
|
||||
echo a:msg
|
||||
else
|
||||
echon '.'
|
||||
endif
|
||||
endfunc
|
||||
EOM
|
||||
|
||||
29
syntax/aspperl.vim
Normal file
29
syntax/aspperl.vim
Normal file
@@ -0,0 +1,29 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'aspperl') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Active State's PerlScript (ASP)
|
||||
" Maintainer: Aaron Hope <edh@brioforge.com>
|
||||
" URL: http://nim.dhs.org/~edh/aspperl.vim
|
||||
" Last Change: 2001 May 09
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'perlscript'
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
syn include @AspPerlScript syntax/perl.vim
|
||||
|
||||
syn cluster htmlPreproc add=AspPerlScriptInsideHtmlTags
|
||||
|
||||
syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<%=\=+ skip=+".*%>.*"+ end=+%>+ contains=@AspPerlScript
|
||||
syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<script\s\+language="\=perlscript"\=[^>]*>+ end=+</script>+ contains=@AspPerlScript
|
||||
|
||||
let b:current_syntax = "aspperl"
|
||||
|
||||
endif
|
||||
186
syntax/aspvbs.vim
Normal file
186
syntax/aspvbs.vim
Normal file
@@ -0,0 +1,186 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'aspvbs') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Microsoft VBScript Web Content (ASP)
|
||||
" Maintainer: Devin Weaver <ktohg@tritarget.com> (non-functional)
|
||||
" URL: http://tritarget.com/pub/vim/syntax/aspvbs.vim (broken)
|
||||
" Last Change: 2006 Jun 19
|
||||
" by Dan Casey
|
||||
" Version: $Revision: 1.3 $
|
||||
" Thanks to Jay-Jay <vim@jay-jay.net> for a syntax sync hack, hungarian
|
||||
" notation, and extra highlighting.
|
||||
" Thanks to patrick dehne <patrick@steidle.net> for the folding code.
|
||||
" Thanks to Dean Hall <hall@apt7.com> for testing the use of classes in
|
||||
" VBScripts which I've been too scared to do.
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'aspvbs'
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
syn cluster htmlPreProc add=AspVBScriptInsideHtmlTags
|
||||
|
||||
|
||||
" Colored variable names, if written in hungarian notation
|
||||
hi def AspVBSVariableSimple term=standout ctermfg=3 guifg=#99ee99
|
||||
hi def AspVBSVariableComplex term=standout ctermfg=3 guifg=#ee9900
|
||||
syn match AspVBSVariableSimple contained "\<\(bln\|byt\|dtm\=\|dbl\|int\|str\)\u\w*"
|
||||
syn match AspVBSVariableComplex contained "\<\(arr\|ary\|obj\)\u\w*"
|
||||
|
||||
|
||||
" Functions and methods that are in VB but will cause errors in an ASP page
|
||||
" This is helpfull if your porting VB code to ASP
|
||||
" I removed (Count, Item) because these are common variable names in AspVBScript
|
||||
syn keyword AspVBSError contained Val Str CVar CVDate DoEvents GoSub Return GoTo
|
||||
syn keyword AspVBSError contained Stop LinkExecute Add Type LinkPoke
|
||||
syn keyword AspVBSError contained LinkRequest LinkSend Declare Optional Sleep
|
||||
syn keyword AspVBSError contained ParamArray Static Erl TypeOf Like LSet RSet Mid StrConv
|
||||
" It may seem that most of these can fit into a keyword clause but keyword takes
|
||||
" priority over all so I can't get the multi-word matches
|
||||
syn match AspVBSError contained "\<Def[a-zA-Z0-9_]\+\>"
|
||||
syn match AspVBSError contained "^\s*Open\s\+"
|
||||
syn match AspVBSError contained "Debug\.[a-zA-Z0-9_]*"
|
||||
syn match AspVBSError contained "^\s*[a-zA-Z0-9_]\+:"
|
||||
syn match AspVBSError contained "[a-zA-Z0-9_]\+![a-zA-Z0-9_]\+"
|
||||
syn match AspVBSError contained "^\s*#.*$"
|
||||
syn match AspVBSError contained "\<As\s\+[a-zA-Z0-9_]*"
|
||||
syn match AspVBSError contained "\<End\>\|\<Exit\>"
|
||||
syn match AspVBSError contained "\<On\s\+Error\>\|\<On\>\|\<Error\>\|\<Resume\s\+Next\>\|\<Resume\>"
|
||||
syn match AspVBSError contained "\<Option\s\+\(Base\|Compare\|Private\s\+Module\)\>"
|
||||
" This one I want 'cause I always seem to mis-spell it.
|
||||
syn match AspVBSError contained "Respon\?ce\.\S*"
|
||||
syn match AspVBSError contained "Respose\.\S*"
|
||||
" When I looked up the VBScript syntax it mentioned that Property Get/Set/Let
|
||||
" statements are illegal, however, I have recived reports that they do work.
|
||||
" So I commented it out for now.
|
||||
" syn match AspVBSError contained "\<Property\s\+\(Get\|Let\|Set\)\>"
|
||||
|
||||
" AspVBScript Reserved Words.
|
||||
syn match AspVBSStatement contained "\<On\s\+Error\s\+\(Resume\s\+Next\|goto\s\+0\)\>\|\<Next\>"
|
||||
syn match AspVBSStatement contained "\<End\s\+\(If\|For\|Select\|Class\|Function\|Sub\|With\|Property\)\>"
|
||||
syn match AspVBSStatement contained "\<Exit\s\+\(Do\|For\|Sub\|Function\)\>"
|
||||
syn match AspVBSStatement contained "\<Exit\s\+\(Do\|For\|Sub\|Function\|Property\)\>"
|
||||
syn match AspVBSStatement contained "\<Option\s\+Explicit\>"
|
||||
syn match AspVBSStatement contained "\<For\s\+Each\>\|\<For\>"
|
||||
syn match AspVBSStatement contained "\<Set\>"
|
||||
syn keyword AspVBSStatement contained Call Class Const Default Dim Do Loop Erase And
|
||||
syn keyword AspVBSStatement contained Function If Then Else ElseIf Or
|
||||
syn keyword AspVBSStatement contained Private Public Randomize ReDim
|
||||
syn keyword AspVBSStatement contained Select Case Sub While With Wend Not
|
||||
|
||||
" AspVBScript Functions
|
||||
syn keyword AspVBSFunction contained Abs Array Asc Atn CBool CByte CCur CDate CDbl
|
||||
syn keyword AspVBSFunction contained Chr CInt CLng Cos CreateObject CSng CStr Date
|
||||
syn keyword AspVBSFunction contained DateAdd DateDiff DatePart DateSerial DateValue
|
||||
syn keyword AspVBSFunction contained Date Day Exp Filter Fix FormatCurrency
|
||||
syn keyword AspVBSFunction contained FormatDateTime FormatNumber FormatPercent
|
||||
syn keyword AspVBSFunction contained GetObject Hex Hour InputBox InStr InStrRev Int
|
||||
syn keyword AspVBSFunction contained IsArray IsDate IsEmpty IsNull IsNumeric
|
||||
syn keyword AspVBSFunction contained IsObject Join LBound LCase Left Len LoadPicture
|
||||
syn keyword AspVBSFunction contained Log LTrim Mid Minute Month MonthName MsgBox Now
|
||||
syn keyword AspVBSFunction contained Oct Replace RGB Right Rnd Round RTrim
|
||||
syn keyword AspVBSFunction contained ScriptEngine ScriptEngineBuildVersion
|
||||
syn keyword AspVBSFunction contained ScriptEngineMajorVersion
|
||||
syn keyword AspVBSFunction contained ScriptEngineMinorVersion Second Sgn Sin Space
|
||||
syn keyword AspVBSFunction contained Split Sqr StrComp StrReverse String Tan Time Timer
|
||||
syn keyword AspVBSFunction contained TimeSerial TimeValue Trim TypeName UBound UCase
|
||||
syn keyword AspVBSFunction contained VarType Weekday WeekdayName Year
|
||||
|
||||
" AspVBScript Methods
|
||||
syn keyword AspVBSMethods contained Add AddFolders BuildPath Clear Close Copy
|
||||
syn keyword AspVBSMethods contained CopyFile CopyFolder CreateFolder CreateTextFile
|
||||
syn keyword AspVBSMethods contained Delete DeleteFile DeleteFolder DriveExists
|
||||
syn keyword AspVBSMethods contained Exists FileExists FolderExists
|
||||
syn keyword AspVBSMethods contained GetAbsolutePathName GetBaseName GetDrive
|
||||
syn keyword AspVBSMethods contained GetDriveName GetExtensionName GetFile
|
||||
syn keyword AspVBSMethods contained GetFileName GetFolder GetParentFolderName
|
||||
syn keyword AspVBSMethods contained GetSpecialFolder GetTempName Items Keys Move
|
||||
syn keyword AspVBSMethods contained MoveFile MoveFolder OpenAsTextStream
|
||||
syn keyword AspVBSMethods contained OpenTextFile Raise Read ReadAll ReadLine Remove
|
||||
syn keyword AspVBSMethods contained RemoveAll Skip SkipLine Write WriteBlankLines
|
||||
syn keyword AspVBSMethods contained WriteLine
|
||||
syn match AspVBSMethods contained "Response\.\w*"
|
||||
" Colorize boolean constants:
|
||||
syn keyword AspVBSMethods contained true false
|
||||
|
||||
" AspVBScript Number Contstants
|
||||
" Integer number, or floating point number without a dot.
|
||||
syn match AspVBSNumber contained "\<\d\+\>"
|
||||
" Floating point number, with dot
|
||||
syn match AspVBSNumber contained "\<\d\+\.\d*\>"
|
||||
" Floating point number, starting with a dot
|
||||
syn match AspVBSNumber contained "\.\d\+\>"
|
||||
|
||||
" String and Character Contstants
|
||||
" removed (skip=+\\\\\|\\"+) because VB doesn't have backslash escaping in
|
||||
" strings (or does it?)
|
||||
syn region AspVBSString contained start=+"+ end=+"+ keepend
|
||||
|
||||
" AspVBScript Comments
|
||||
syn region AspVBSComment contained start="^REM\s\|\sREM\s" end="$" contains=AspVBSTodo keepend
|
||||
syn region AspVBSComment contained start="^'\|\s'" end="$" contains=AspVBSTodo keepend
|
||||
" misc. Commenting Stuff
|
||||
syn keyword AspVBSTodo contained TODO FIXME
|
||||
|
||||
" Cosmetic syntax errors commanly found in VB but not in AspVBScript
|
||||
" AspVBScript doesn't use line numbers
|
||||
syn region AspVBSError contained start="^\d" end="\s" keepend
|
||||
" AspVBScript also doesn't have type defining variables
|
||||
syn match AspVBSError contained "[a-zA-Z0-9_][\$&!#]"ms=s+1
|
||||
" Since 'a%' is a VB variable with a type and in AspVBScript you can have 'a%>'
|
||||
" I have to make a special case so 'a%>' won't show as an error.
|
||||
syn match AspVBSError contained "[a-zA-Z0-9_]%\($\|[^>]\)"ms=s+1
|
||||
|
||||
" Top Cluster
|
||||
syn cluster AspVBScriptTop contains=AspVBSStatement,AspVBSFunction,AspVBSMethods,AspVBSNumber,AspVBSString,AspVBSComment,AspVBSError,AspVBSVariableSimple,AspVBSVariableComplex
|
||||
|
||||
" Folding
|
||||
syn region AspVBSFold start="^\s*\(class\)\s\+.*$" end="^\s*end\s\+\(class\)\>.*$" fold contained transparent keepend
|
||||
syn region AspVBSFold start="^\s*\(private\|public\)\=\(\s\+default\)\=\s\+\(sub\|function\)\s\+.*$" end="^\s*end\s\+\(function\|sub\)\>.*$" fold contained transparent keepend
|
||||
|
||||
" Define AspVBScript delimeters
|
||||
" <%= func("string_with_%>_in_it") %> This is illegal in ASP syntax.
|
||||
syn region AspVBScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<%=\=+ end=+%>+ contains=@AspVBScriptTop, AspVBSFold
|
||||
syn region AspVBScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<script\s\+language="\=vbscript"\=[^>]*\s\+runatserver[^>]*>+ end=+</script>+ contains=@AspVBScriptTop
|
||||
|
||||
|
||||
" Synchronization
|
||||
" syn sync match AspVBSSyncGroup grouphere AspVBScriptInsideHtmlTags "<%"
|
||||
" This is a kludge so the HTML will sync properly
|
||||
syn sync match htmlHighlight grouphere htmlTag "%>"
|
||||
|
||||
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only when an item doesn't have highlighting yet
|
||||
|
||||
"hi def link AspVBScript Special
|
||||
hi def link AspVBSLineNumber Comment
|
||||
hi def link AspVBSNumber Number
|
||||
hi def link AspVBSError Error
|
||||
hi def link AspVBSStatement Statement
|
||||
hi def link AspVBSString String
|
||||
hi def link AspVBSComment Comment
|
||||
hi def link AspVBSTodo Todo
|
||||
hi def link AspVBSFunction Identifier
|
||||
hi def link AspVBSMethods PreProc
|
||||
hi def link AspVBSEvents Special
|
||||
hi def link AspVBSTypeSpecifier Type
|
||||
|
||||
|
||||
let b:current_syntax = "aspvbs"
|
||||
|
||||
if main_syntax == 'aspvbs'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
" vim: ts=8:sw=2:sts=0:noet
|
||||
|
||||
endif
|
||||
@@ -56,6 +56,7 @@ syntax cluster typescriptPrimaryType contains=
|
||||
\ typescriptTupleType,
|
||||
\ typescriptTypeQuery,
|
||||
\ typescriptStringLiteralType,
|
||||
\ typescriptTemplateLiteralType,
|
||||
\ typescriptReadonlyArrayKeyword,
|
||||
\ typescriptAssertType
|
||||
|
||||
@@ -64,6 +65,17 @@ syntax region typescriptStringLiteralType contained
|
||||
\ nextgroup=typescriptUnion
|
||||
\ skipwhite skipempty
|
||||
|
||||
syntax region typescriptTemplateLiteralType contained
|
||||
\ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/
|
||||
\ contains=typescriptTemplateSubstitutionType
|
||||
\ nextgroup=typescriptTypeOperator
|
||||
\ skipwhite skipempty
|
||||
|
||||
syntax region typescriptTemplateSubstitutionType matchgroup=typescriptTemplateSB
|
||||
\ start=/\${/ end=/}/
|
||||
\ contains=@typescriptType
|
||||
\ contained
|
||||
|
||||
syntax region typescriptParenthesizedType matchgroup=typescriptParens
|
||||
\ start=/(/ end=/)/
|
||||
\ contains=@typescriptType
|
||||
@@ -103,10 +115,12 @@ syntax region typescriptTupleType matchgroup=typescriptBraces
|
||||
\ contained skipwhite
|
||||
|
||||
syntax cluster typescriptTypeOperator
|
||||
\ contains=typescriptUnion,typescriptTypeBracket
|
||||
\ contains=typescriptUnion,typescriptTypeBracket,typescriptConstraint,typescriptConditionalType
|
||||
|
||||
syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
|
||||
|
||||
syntax match typescriptConditionalType /?\|:/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
|
||||
|
||||
syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType
|
||||
syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets
|
||||
\ start=/</ end=/>/
|
||||
|
||||
@@ -71,6 +71,7 @@ if exists("did_typescript_hilink")
|
||||
HiLink typescriptString String
|
||||
HiLink typescriptSpecial Special
|
||||
HiLink typescriptStringLiteralType String
|
||||
HiLink typescriptTemplateLiteralType String
|
||||
HiLink typescriptStringMember String
|
||||
HiLink typescriptTemplate String
|
||||
HiLink typescriptEventString String
|
||||
|
||||
30
syntax/conf.vim
Normal file
30
syntax/conf.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'conf') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: generic configure file
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2005 Jun 20
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn keyword confTodo contained TODO FIXME XXX
|
||||
" Avoid matching "text#text", used in /etc/disktab and /etc/gettytab
|
||||
syn match confComment "^#.*" contains=confTodo
|
||||
syn match confComment "\s#.*"ms=s+1 contains=confTodo
|
||||
syn region confString start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
|
||||
syn region confString start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link confComment Comment
|
||||
hi def link confTodo Todo
|
||||
hi def link confString String
|
||||
|
||||
let b:current_syntax = "conf"
|
||||
|
||||
" vim: ts=8 sw=2
|
||||
|
||||
endif
|
||||
87
syntax/django.vim
Normal file
87
syntax/django.vim
Normal file
@@ -0,0 +1,87 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'htmldjango') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Django template
|
||||
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
|
||||
" Last Change: 2014 Jul 13
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax case match
|
||||
|
||||
" Mark illegal characters
|
||||
syn match djangoError "%}\|}}\|#}"
|
||||
|
||||
" Django template built-in tags and parameters
|
||||
" 'comment' doesn't appear here because it gets special treatment
|
||||
syn keyword djangoStatement contained autoescape csrf_token empty
|
||||
" FIXME ==, !=, <, >, <=, and >= should be djangoStatements:
|
||||
" syn keyword djangoStatement contained == != < > <= >=
|
||||
syn keyword djangoStatement contained and as block endblock by cycle debug else elif
|
||||
syn keyword djangoStatement contained extends filter endfilter firstof for
|
||||
syn keyword djangoStatement contained endfor if endif ifchanged endifchanged
|
||||
syn keyword djangoStatement contained ifequal endifequal ifnotequal
|
||||
syn keyword djangoStatement contained endifnotequal in include load not now or
|
||||
syn keyword djangoStatement contained parsed regroup reversed spaceless
|
||||
syn keyword djangoStatement contained endspaceless ssi templatetag openblock
|
||||
syn keyword djangoStatement contained closeblock openvariable closevariable
|
||||
syn keyword djangoStatement contained openbrace closebrace opencomment
|
||||
syn keyword djangoStatement contained closecomment widthratio url with endwith
|
||||
syn keyword djangoStatement contained get_current_language trans noop blocktrans
|
||||
syn keyword djangoStatement contained endblocktrans get_available_languages
|
||||
syn keyword djangoStatement contained get_current_language_bidi plural
|
||||
|
||||
" Django templete built-in filters
|
||||
syn keyword djangoFilter contained add addslashes capfirst center cut date
|
||||
syn keyword djangoFilter contained default default_if_none dictsort
|
||||
syn keyword djangoFilter contained dictsortreversed divisibleby escape escapejs
|
||||
syn keyword djangoFilter contained filesizeformat first fix_ampersands
|
||||
syn keyword djangoFilter contained floatformat get_digit join last length length_is
|
||||
syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust
|
||||
syn keyword djangoFilter contained lower make_list phone2numeric pluralize
|
||||
syn keyword djangoFilter contained pprint random removetags rjust slice slugify
|
||||
syn keyword djangoFilter contained safe safeseq stringformat striptags
|
||||
syn keyword djangoFilter contained time timesince timeuntil title truncatechars
|
||||
syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode
|
||||
syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno
|
||||
|
||||
" Keywords to highlight within comments
|
||||
syn keyword djangoTodo contained TODO FIXME XXX
|
||||
|
||||
" Django template constants (always surrounded by double quotes)
|
||||
syn region djangoArgument contained start=/"/ skip=/\\"/ end=/"/
|
||||
|
||||
" Mark illegal characters within tag and variables blocks
|
||||
syn match djangoTagError contained "#}\|{{\|[^%]}}\|[&#]"
|
||||
syn match djangoVarError contained "#}\|{%\|%}\|[<>!&#%]"
|
||||
|
||||
" Django template tag and variable blocks
|
||||
syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display
|
||||
syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display
|
||||
|
||||
" Django template 'comment' tag and comment block
|
||||
syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomment\s*%}" contains=djangoTodo
|
||||
syn region djangoComBlock start="{#" end="#}" contains=djangoTodo
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only when an item doesn't have highlighting yet
|
||||
|
||||
hi def link djangoTagBlock PreProc
|
||||
hi def link djangoVarBlock PreProc
|
||||
hi def link djangoStatement Statement
|
||||
hi def link djangoFilter Identifier
|
||||
hi def link djangoArgument Constant
|
||||
hi def link djangoTagError Error
|
||||
hi def link djangoVarError Error
|
||||
hi def link djangoError Error
|
||||
hi def link djangoComment Comment
|
||||
hi def link djangoComBlock Comment
|
||||
hi def link djangoTodo Todo
|
||||
|
||||
|
||||
let b:current_syntax = "django"
|
||||
|
||||
endif
|
||||
@@ -20,10 +20,6 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||
|
||||
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable
|
||||
|
||||
syn match elixirFunctionCall '\<[a-z_]\w*[!?]\?\(\s*\.\?\s*(\|\s\+[a-zA-Z0-9@:\'\"\[]\)\@='
|
||||
syn match elixirFunctionCall '\(:\w\+\s*\.\s*\|[A-Z]\w*\s*\.\s*\)\@<=[a-z_]\w*[!?]\?'
|
||||
syn match elixirFunctionCall '\(>\s+\)\<[a-z_]\w*[!?]\?'
|
||||
|
||||
syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!'
|
||||
|
||||
syn keyword elixirInclude import require alias use
|
||||
@@ -48,7 +44,7 @@ syn match elixirOperator '\~>\|\~>>\|<\~\|<<\~\|<\~>'
|
||||
|
||||
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'
|
||||
|
||||
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
|
||||
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_*]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
|
||||
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
|
||||
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"
|
||||
|
||||
|
||||
33
syntax/gitignore.vim
Normal file
33
syntax/gitignore.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
|
||||
" Use of this source code is governed by an MIT license that can be
|
||||
" found in the LICENSE file.
|
||||
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
" https://git-scm.com/docs/gitignore#_pattern_format
|
||||
syntax keyword gitignoreTodo TODO FIXME XXX NOTE SEE contained
|
||||
syntax match gitignoreComment '^#.*' contains=gitignoreTodo
|
||||
syntax match gitignoreComment '\s#.*'ms=s+1 contains=gitignoreTodo
|
||||
syntax match gitignoreNegation '^!'
|
||||
syntax match gitignoreSeparator '/'
|
||||
syntax match gitignoreWildcard '\(\\\)\@<![*?]'
|
||||
syntax region gitignoreSet start='\[' skip='\\\]' end='\]'
|
||||
|
||||
highlight default link gitignoreTodo Todo
|
||||
highlight default link gitignoreComment Comment
|
||||
highlight default link gitignoreNegation Exception
|
||||
highlight default link gitignoreSeparator Constant
|
||||
highlight default link gitignoreWildcard Special
|
||||
highlight default link gitignoreSet Character
|
||||
|
||||
let b:current_syntax = 'gitignore'
|
||||
|
||||
" vim: ts=2 et sw=2
|
||||
|
||||
endif
|
||||
110
syntax/handlebars.vim
Normal file
110
syntax/handlebars.vim
Normal file
@@ -0,0 +1,110 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
" Mustache & Handlebars syntax
|
||||
" Language: Mustache, Handlebars
|
||||
" Maintainer: Juvenn Woo <machese@gmail.com>
|
||||
" Screenshot: http://imgur.com/6F408
|
||||
" Version: 6
|
||||
" Last Change: Jul 16 2019
|
||||
" Remark:
|
||||
" It lexically hilights embedded mustaches (exclusively) in html file.
|
||||
" While it was written for Ruby-based Mustache template system, it should
|
||||
" work for Google's C-based *ctemplate* as well as Erlang-based *et*. All
|
||||
" of them are, AFAIK, based on the idea of ctemplate.
|
||||
" References:
|
||||
" [Mustache](http://github.com/defunkt/mustache)
|
||||
" [Handlebars](https://github.com/wycats/handlebars.js)
|
||||
" [ctemplate](http://code.google.com/p/google-ctemplate/)
|
||||
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
|
||||
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
|
||||
" TODO: Feedback is welcomed.
|
||||
|
||||
|
||||
" Read the HTML syntax to start with
|
||||
if version < 600
|
||||
so <sfile>:p:h/html.vim
|
||||
else
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Standard HiLink will not work with included syntax files
|
||||
if version < 508
|
||||
command! -nargs=+ HtmlHiLink hi link <args>
|
||||
else
|
||||
command! -nargs=+ HtmlHiLink hi def link <args>
|
||||
endif
|
||||
|
||||
syntax match mustacheError '}}}\?'
|
||||
syntax match mustacheInsideError '{{[{$#<>=!\/]\?'
|
||||
|
||||
" Ember angle bracket syntax syntax starts with a capital letter:
|
||||
" https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
|
||||
syntax case match
|
||||
syntax region mustacheAngleComponent start=/<\/\?[[:upper:]]/ end=/>/ keepend containedin=TOP,@htmlMustacheContainer
|
||||
syntax case ignore
|
||||
syntax match mustacheAngleBrackets '</\?\|/\?>' contained containedin=mustacheAngleComponent
|
||||
syntax match mustacheAngleComponentName '</[[:alnum:]]\+'hs=s+2 contained containedin=mustacheAngleBrackets
|
||||
syntax match mustacheAngleComponentName '<[[:alnum:]]\+'hs=s+1 contained containedin=mustacheAngleBrackets
|
||||
|
||||
syntax region mustacheHbsComponent start=/{{[^!][$#^/]\?/ end=/}}}\?/ keepend containedin=TOP,@htmlMustacheContainer
|
||||
|
||||
syntax cluster mustacheInside add=mustacheHbsComponent,mustacheAngleComponent
|
||||
|
||||
syntax match mustacheOperators '=\|\.\|/^>' contained containedin=@mustacheInside,mustacheParam
|
||||
syntax region mustacheHtmlValue start=/={{[^!][$#^/]\?/rs=s+1,hs=s+1 end=/}}/ oneline keepend contained containedin=htmlTag contains=@mustacheInside
|
||||
syntax region mustachePartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=@mustacheInside,@htmlMustacheContainer
|
||||
syntax match mustacheHandlebars '{{\|}}' contained containedin=@mustacheInside
|
||||
syntax match mustacheUnescape '{{{\|}}}' contained containedin=@mustacheInside
|
||||
syntax match mustacheConditionals '\([/#]\?\<\(if\|unless\)\|\<else\)\>' contained containedin=@mustacheInside
|
||||
syntax match mustacheHelpers '[/#]\?\<\(with\|link\-to\|each\(\-in\)\?\|let\)\>' contained containedin=@mustacheInside
|
||||
syntax match mustacheHelpers 'else \(if\|unless\|with\|link\-to\|each\(\-in\)\?\)' contained containedin=@mustacheInside
|
||||
syntax match mustacheParam /[a-z@_-]\+=/he=e-1 contained containedin=@mustacheInside
|
||||
syntax region mustacheComment start=/{{!/rs=s+2 skip=/{{.\{-}}}/ end=/}}/re=e-2 contains=Todo contained containedin=TOP,@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=TOP,@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheQString start=/'/ skip=/\\'/ end=/'/ contained containedin=@mustacheInside
|
||||
syntax region mustacheDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=@mustacheInside
|
||||
|
||||
" Clustering
|
||||
syntax cluster htmlMustacheContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlLink,htmlBold,htmlUnderline,htmlItalic,htmlValue
|
||||
|
||||
|
||||
" Hilighting
|
||||
" mustacheInside hilighted as Number, which is rarely used in html
|
||||
" you might like change it to Function or Identifier
|
||||
HtmlHiLink mustacheVariable Number
|
||||
HtmlHiLink mustacheVariableUnescape Number
|
||||
HtmlHiLink mustachePartial Number
|
||||
HtmlHiLink mustacheMarkerSet Number
|
||||
HtmlHiLink mustacheParam htmlArg
|
||||
HtmlHiLink mustacheAngleComponentName htmlTag
|
||||
|
||||
HtmlHiLink mustacheComment Comment
|
||||
HtmlHiLink mustacheBlockComment Comment
|
||||
HtmlHiLink mustacheError Error
|
||||
HtmlHiLink mustacheInsideError Error
|
||||
|
||||
HtmlHiLink mustacheHandlebars Special
|
||||
HtmlHiLink mustacheAngleBrackets htmlTagName
|
||||
HtmlHiLink mustacheUnescape Identifier
|
||||
HtmlHiLink mustacheOperators Operator
|
||||
HtmlHiLink mustacheConditionals Conditional
|
||||
HtmlHiLink mustacheHelpers Repeat
|
||||
HtmlHiLink mustacheQString String
|
||||
HtmlHiLink mustacheDQString String
|
||||
|
||||
syn region mustacheScriptTemplate start=+<script [^>]*type *=[^>]*text/\(mustache\|x-handlebars-template\)[^>]*>+
|
||||
\ end=+</script>+me=s-1 keepend
|
||||
\ contains=mustacheInside,@htmlMustacheContainer,htmlTag,htmlEndTag,htmlTagName,htmlSpecialChar
|
||||
|
||||
let b:current_syntax = "handlebars"
|
||||
delcommand HtmlHiLink
|
||||
|
||||
endif
|
||||
@@ -1,196 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: HTML (version 5.1)
|
||||
" SVG (SVG 1.1 Second Edition)
|
||||
" MathML (MathML 3.0 Second Edition)
|
||||
" Last Change: 2017 Mar 07
|
||||
" License: Public domain
|
||||
" (but let me know if you like :) )
|
||||
"
|
||||
" Note: This file just add new tags from HTML 5
|
||||
" and don't replace default html.vim syntax file
|
||||
"
|
||||
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||
" Changes: update to Draft 2016 Jan 13
|
||||
" add microdata Attributes
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Modified: htdebeer <H.T.de.Beer@gmail.com>
|
||||
" Changes: add common SVG elements and attributes for inline SVG
|
||||
|
||||
" Patch 7.4.1142
|
||||
if has("patch-7.4-1142")
|
||||
if has("win32")
|
||||
syn iskeyword @,48-57,_,128-167,224-235,-
|
||||
else
|
||||
syn iskeyword @,48-57,_,192-255,-
|
||||
endif
|
||||
endif
|
||||
|
||||
" HTML 5 tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu menuitem nav output
|
||||
syn keyword htmlTagName contained progress ruby rt rp rb rtc section source summary time track video data
|
||||
syn keyword htmlTagName contained template content shadow slot
|
||||
syn keyword htmlTagName contained wbr bdi
|
||||
syn keyword htmlTagName contained picture
|
||||
|
||||
" SVG tags
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" as found in http://www.w3.org/TR/SVG/eltindex.html
|
||||
syn keyword htmlTagName contained svg
|
||||
syn keyword htmlTagName contained altGlyph altGlyphDef altGlyphItem
|
||||
syn keyword htmlTagName contained animate animateColor animateMotion animateTransform
|
||||
syn keyword htmlTagName contained circle ellipse rect line polyline polygon image path
|
||||
syn keyword htmlTagName contained clipPath color-profile cursor
|
||||
syn keyword htmlTagName contained defs desc g symbol view use switch foreignObject
|
||||
syn keyword htmlTagName contained filter feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence
|
||||
syn keyword htmlTagName contained font font-face font-face-format font-face-name font-face-src font-face-uri
|
||||
syn keyword htmlTagName contained glyph glyphRef hkern
|
||||
syn keyword htmlTagName contained linearGradient marker mask pattern radialGradient set stop
|
||||
syn keyword htmlTagName contained missing-glyph mpath
|
||||
syn keyword htmlTagName contained text textPath tref tspan vkern
|
||||
syn keyword htmlTagName contained metadata title
|
||||
|
||||
" MathML tags
|
||||
" https://www.w3.org/TR/MathML3/appendixi.html#index.elem
|
||||
syn keyword htmlTagName contained abs and annotation annotation-xml apply approx arccos arccosh arccot arccoth
|
||||
syn keyword htmlTagName contained arccsc arccsch arcsec arcsech arcsin arcsinh arctan arctanh arg bind
|
||||
syn keyword htmlTagName contained bvar card cartesianproduct cbytes ceiling cerror ci cn codomain complexes
|
||||
syn keyword htmlTagName contained compose condition conjugate cos cosh cot coth cs csc csch
|
||||
syn keyword htmlTagName contained csymbol curl declare degree determinant diff divergence divide domain domainofapplication
|
||||
syn keyword htmlTagName contained emptyset eq equivalent eulergamma exists exp exponentiale factorial factorof false
|
||||
syn keyword htmlTagName contained floor fn forall gcd geq grad gt ident image imaginary
|
||||
syn keyword htmlTagName contained imaginaryi implies in infinity int integers intersect interval inverse lambda
|
||||
syn keyword htmlTagName contained laplacian lcm leq limit list ln log logbase lowlimit lt
|
||||
syn keyword htmlTagName contained maction maligngroup malignmark math matrix matrixrow max mean median menclose
|
||||
syn keyword htmlTagName contained merror mfenced mfrac mglyph mi mi" min minus mlabeledtr mlongdiv
|
||||
syn keyword htmlTagName contained mmultiscripts mn mo mode moment momentabout mover mpadded mphantom mprescripts
|
||||
syn keyword htmlTagName contained mroot mrow ms mscarries mscarry msgroup msline mspace msqrt msrow
|
||||
syn keyword htmlTagName contained mstack mstyle msub msubsup msup mtable mtd mtext mtr munder
|
||||
syn keyword htmlTagName contained munderover naturalnumbers neq none not notanumber notin notprsubset notsubset or
|
||||
syn keyword htmlTagName contained otherwise outerproduct partialdiff pi piece piecewise plus power primes product
|
||||
syn keyword htmlTagName contained prsubset quotient rationals real reals reln rem root scalarproduct sdev
|
||||
syn keyword htmlTagName contained sec sech selector semantics sep set setdiff share sin sinh
|
||||
syn keyword htmlTagName contained span subset sum tan tanh tendsto times transpose true union
|
||||
syn keyword htmlTagName contained uplimit variance vector vectorproduct xor
|
||||
|
||||
" Custom Element
|
||||
syn match htmlTagName contained "\<[a-z][-.0-9_a-z]*-[-.0-9_a-z]*\>"
|
||||
syn match htmlTagName contained "[.0-9_a-z]\@<=-[-.0-9_a-z]*\>"
|
||||
|
||||
" HTML 5 arguments
|
||||
" Core Attributes
|
||||
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
|
||||
syn keyword htmlArg contained draggable hidden id is lang spellcheck style tabindex title translate
|
||||
" Event-handler Attributes
|
||||
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
|
||||
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
|
||||
syn keyword htmlArg contained ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange
|
||||
syn keyword htmlArg contained onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata
|
||||
syn keyword htmlArg contained onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup
|
||||
syn keyword htmlArg contained onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange
|
||||
syn keyword htmlArg contained onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate
|
||||
syn keyword htmlArg contained onvolumechange onwaiting
|
||||
" XML Attributes
|
||||
syn keyword htmlArg contained xml:lang xml:space xml:base xmlns
|
||||
" new features
|
||||
" <body>
|
||||
syn keyword htmlArg contained onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload
|
||||
syn keyword htmlArg contained onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload
|
||||
" <video>, <audio>, <source>, <track>
|
||||
syn keyword htmlArg contained autoplay preload controls loop poster media kind charset srclang track playsinline
|
||||
" <form>, <input>, <button>
|
||||
syn keyword htmlArg contained form autocomplete autofocus list min max step
|
||||
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
|
||||
syn keyword htmlArg contained required placeholder pattern
|
||||
" <command>, <details>, <time>
|
||||
syn keyword htmlArg contained label icon open datetime-local pubdate
|
||||
" <script>
|
||||
syn keyword htmlArg contained async
|
||||
" <content>
|
||||
syn keyword htmlArg contained select
|
||||
" <iframe>
|
||||
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest allowpresentation
|
||||
" <picture>
|
||||
syn keyword htmlArg contained srcset sizes
|
||||
" <a>
|
||||
syn keyword htmlArg contained download media
|
||||
" <script>, <style>
|
||||
syn keyword htmlArg contained nonce
|
||||
" <area>, <a>, <img>, <iframe>, <link>
|
||||
syn keyword htmlArg contained referrerpolicy
|
||||
" https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
|
||||
syn keyword htmlArg contained integrity crossorigin
|
||||
" <link>
|
||||
syn keyword htmlArg contained prefetch
|
||||
" syn keyword htmlArg contained preload
|
||||
" <img>
|
||||
syn keyword htmlArg contained decoding
|
||||
" https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers
|
||||
syn keyword htmlArg contained onselectstart onselectionchange
|
||||
" https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading
|
||||
syn keyword htmlArg contained loading
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
||||
syn match htmlArg "\<data[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Vendor Extension Attributes
|
||||
" http://w3c.github.io/html/single-page.html#conformance-requirements-extensibility
|
||||
syn match htmlArg "\<x[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Microdata
|
||||
" http://dev.w3.org/html5/md/
|
||||
syn keyword htmlArg contained itemid itemscope itemtype itemprop itemref
|
||||
|
||||
" SVG
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" Some common attributes from http://www.w3.org/TR/SVG/attindex.html
|
||||
syn keyword htmlArg contained accent-height accumulate additive alphabetic amplitude arabic-form ascent attributeName attributeType azimuth
|
||||
syn keyword htmlArg contained baseFrequency baseProfile bbox begin bias by
|
||||
syn keyword htmlArg contained calcMode cap-height class clipPathUnits contentScriptType contentStyleType cx cy
|
||||
syn keyword htmlArg contained d descent diffuseConstant divisor dur dx dy
|
||||
syn keyword htmlArg contained edgeMode elevation end exponent externalResourcesRequired
|
||||
syn keyword htmlArg contained fill filterRes filterUnits font-family font-size font-stretch font-style font-variant font-weight format format from fx fy
|
||||
syn keyword htmlArg contained g1 g2 glyph-name glyphRef gradientTransform gradientUnits
|
||||
syn keyword htmlArg contained hanging height horiz-adv-x horiz-origin-x horiz-origin-y
|
||||
syn keyword htmlArg contained id ideographic in in2 intercept
|
||||
syn keyword htmlArg contained k k1 k2 k3 k4 kernelMatrix kernelUnitLength keyPoints keySplines keyTimes
|
||||
syn keyword htmlArg contained lang lengthAdjust limitingConeAngle local
|
||||
syn keyword htmlArg contained markerHeight markerUnits markerWidth maskContentUnits maskUnits mathematical max media method min mode name
|
||||
syn keyword htmlArg contained numOctaves
|
||||
syn keyword htmlArg contained offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload onzoom operator order orient orientation origin overline-position overline-thickness
|
||||
syn keyword htmlArg contained panose-1 path pathLength patternContentUnits patternTransform patternUnits points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits
|
||||
syn keyword htmlArg contained r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry
|
||||
syn keyword htmlArg contained scale seed slope spacing specularConstant specularExponent spreadMethod startOffset stdDeviation stemh stemv stitchTiles strikethrough-position strikethrough-thickness string surfaceScale systemLanguage
|
||||
syn keyword htmlArg contained tableValues target targetX targetY textLength title to transform type
|
||||
syn keyword htmlArg contained u1 u2 underline-position underline-thickness unicode unicode-range units-per-em
|
||||
syn keyword htmlArg contained v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget
|
||||
syn keyword htmlArg contained width widths
|
||||
syn keyword htmlArg contained x x-height x1 x2 xChannelSelector xlink:actuate xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space
|
||||
syn keyword htmlArg contained y y1 y2 yChannelSelector
|
||||
syn keyword htmlArg contained z zoomAndPan
|
||||
syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode
|
||||
|
||||
" MathML attributes
|
||||
" https://www.w3.org/TR/MathML3/chapter2.html#interf.toplevel.atts
|
||||
syn keyword htmlArg contained accent accentunder actiontype align alignmentscope altimg altimg-height altimg-valign altimg-width alttext
|
||||
syn keyword htmlArg contained annotation-xml background base baseline bevelled cd cdgroup charalign charspacing close
|
||||
syn keyword htmlArg contained closure color columnalign columnalignment columnlines columnspacing columnspan columnwidth crossout decimalpoint
|
||||
syn keyword htmlArg contained definitionURL denomalign depth display displaystyle edge encoding equalcolumns equalrows fence
|
||||
syn keyword htmlArg contained fontfamily fontsize fontstyle fontweight form frame framespacing groupalign height indentalign
|
||||
syn keyword htmlArg contained indentalignfirst indentalignlast indentshift indentshiftfirst indentshiftlast indenttarget index infixlinebreakstyle integer largeop
|
||||
syn keyword htmlArg contained leftoverhang length linebreak linebreakmultchar linebreakstyle lineleading linethickness location longdivstyle lquote
|
||||
syn keyword htmlArg contained lspace ltr macros math mathbackground mathcolor mathsize mathvariant maxsize maxwidth
|
||||
syn keyword htmlArg contained mediummathspace menclose minlabelspacing minsize mode movablelimits msgroup mslinethickness name nargs
|
||||
syn keyword htmlArg contained newline notation numalign number occurrence open order other overflow position
|
||||
syn keyword htmlArg contained rightoverhang role rowalign rowlines rowspacing rowspan rquote rspace schemaLocation scope
|
||||
syn keyword htmlArg contained scriptlevel scriptminsize scriptsize scriptsizemultiplier selection separator separators shift side stackalign
|
||||
syn keyword htmlArg contained stretchy subscriptshift superscriptshift symmetric thickmathspace thinmathspace type valign verythickmathspace verythinmathspace
|
||||
syn keyword htmlArg contained veryverythickmathspace veryverythinmathspace voffset width xref
|
||||
|
||||
|
||||
endif
|
||||
@@ -1,94 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: HTML (version 5)
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Last Change: 2009 Aug 19
|
||||
" License: Public domain
|
||||
" (but let me know if you like :) )
|
||||
"
|
||||
" Note: This file just adds the new tags from HTML 5
|
||||
" and don't replace default html.vim syntax file
|
||||
"
|
||||
" Modified: othree <othree@gmail.com>
|
||||
" Changes: update to Draft 28 August 2010
|
||||
" add complete new attributes
|
||||
" add wai-aria attributes
|
||||
" add microdata attributes
|
||||
" add rdfa attributes
|
||||
|
||||
|
||||
syn keyword htmlTagName contained script
|
||||
" HTML 5 tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen mark meter menu nav output
|
||||
syn keyword htmlTagName contained progress time ruby rt rp section source summary time track video wbr
|
||||
|
||||
" HTML 5 arguments
|
||||
" Core Attributes
|
||||
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
|
||||
syn keyword htmlArg contained draggable hidden id lang spellcheck style tabindex title
|
||||
" Event-handler Attributes
|
||||
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
|
||||
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
|
||||
syn keyword htmlArg contained ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange
|
||||
syn keyword htmlArg contained onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata
|
||||
syn keyword htmlArg contained onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup
|
||||
syn keyword htmlArg contained onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange
|
||||
syn keyword htmlArg contained onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate
|
||||
syn keyword htmlArg contained onvolumechange onwaiting
|
||||
" XML Attributes
|
||||
syn keyword htmlArg contained xml:lang xml:space xml:base
|
||||
" new features
|
||||
" <body>
|
||||
syn keyword htmlArg contained onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload
|
||||
syn keyword htmlArg contained onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload
|
||||
" <video>, <audio>, <source>, <track>
|
||||
syn keyword htmlArg contained autoplay preload controls loop poster media kind charset srclang track
|
||||
" <form>, <input>, <button>
|
||||
syn keyword htmlArg contained form autocomplete autofocus list min max step
|
||||
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
|
||||
" <command>, <details>, <time>
|
||||
syn keyword htmlArg contained label icon open datetime pubdate
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://dev.w3.org/html5/spec/Overview.html#custom-data-attribute
|
||||
syn match htmlArg "\<\(data(\-[a-z]\+)\+\)=" contained
|
||||
|
||||
" Microdata
|
||||
" http://dev.w3.org/html5/md/
|
||||
syn keyword htmlArg contained item itemid itemscope itemtype itemprop
|
||||
|
||||
" RDFa
|
||||
" http://www.w3.org/TR/rdfa-syntax/#a_xhtmlrdfa_dtd
|
||||
syn keyword htmlArg contained about typeof property resource content datatype rel rev
|
||||
|
||||
" WAI-ARIA States and Properties
|
||||
" http://www.w3.org/TR/wai-aria/states_and_properties
|
||||
syn keyword htmlArg contained role
|
||||
" Global States and Properties
|
||||
syn match htmlArg contained "\<aria-\(atomic\|busy\|controls\|describedby\)\>"
|
||||
syn match htmlArg contained "\<aria-\(disabled\|dropeffect\|flowto\|grabbed\)\>"
|
||||
syn match htmlArg contained "\<aria-\(haspopup\|hidden\|invalid\|label\)\>"
|
||||
syn match htmlArg contained "\<aria-\(labelledby\|live\|owns\|relevant\)\>"
|
||||
|
||||
" Widget Attributes
|
||||
syn match htmlArg contained "\<aria-\(autocomplete\|checked\|disabled\|expanded\)\>"
|
||||
syn match htmlArg contained "\<aria-\(haspopup\|hidden\|invalid\|label\)\>"
|
||||
syn match htmlArg contained "\<aria-\(level\|multiline\|multiselectable\|orientation\)\>"
|
||||
syn match htmlArg contained "\<aria-\(pressed\|readonly\|required\|selected\)\>"
|
||||
syn match htmlArg contained "\<aria-\(sort\|valuemax\|valuemin\|valuenow\|valuetext\|\)\>"
|
||||
|
||||
" Live Region Attributes
|
||||
syn match htmlArg contained "\<aria-\(atomic\|busy\|live\|relevant\|\)\>"
|
||||
|
||||
" Drag-and-Drop attributes
|
||||
syn match htmlArg contained "\<aria-\(dropeffect\|grabbed\)\>"
|
||||
|
||||
" Relationship Attributes
|
||||
syn match htmlArg contained "\<aria-\(activedescendant\|controls\|describedby\|flowto\|\)\>"
|
||||
syn match htmlArg contained "\<aria-\(labelledby\|owns\|posinset\|setsize\|\)\>"
|
||||
|
||||
endif
|
||||
199
syntax/html.vim
199
syntax/html.vim
@@ -1,3 +1,196 @@
|
||||
" Polyglot metafile
|
||||
source <sfile>:h/html-1.vim
|
||||
source <sfile>:h/html-2.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: HTML (version 5.1)
|
||||
" SVG (SVG 1.1 Second Edition)
|
||||
" MathML (MathML 3.0 Second Edition)
|
||||
" Last Change: 2017 Mar 07
|
||||
" License: Public domain
|
||||
" (but let me know if you like :) )
|
||||
"
|
||||
" Note: This file just add new tags from HTML 5
|
||||
" and don't replace default html.vim syntax file
|
||||
"
|
||||
" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
|
||||
" Changes: update to Draft 2016 Jan 13
|
||||
" add microdata Attributes
|
||||
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
|
||||
" URL: http://rm.blog.br/vim/syntax/html.vim
|
||||
" Modified: htdebeer <H.T.de.Beer@gmail.com>
|
||||
" Changes: add common SVG elements and attributes for inline SVG
|
||||
|
||||
" Patch 7.4.1142
|
||||
if has("patch-7.4-1142")
|
||||
if has("win32")
|
||||
syn iskeyword @,48-57,_,128-167,224-235,-
|
||||
else
|
||||
syn iskeyword @,48-57,_,192-255,-
|
||||
endif
|
||||
endif
|
||||
|
||||
" HTML 5 tags
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu menuitem nav output
|
||||
syn keyword htmlTagName contained progress ruby rt rp rb rtc section source summary time track video data
|
||||
syn keyword htmlTagName contained template content shadow slot
|
||||
syn keyword htmlTagName contained wbr bdi
|
||||
syn keyword htmlTagName contained picture
|
||||
|
||||
" SVG tags
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" as found in http://www.w3.org/TR/SVG/eltindex.html
|
||||
syn keyword htmlTagName contained svg
|
||||
syn keyword htmlTagName contained altGlyph altGlyphDef altGlyphItem
|
||||
syn keyword htmlTagName contained animate animateColor animateMotion animateTransform
|
||||
syn keyword htmlTagName contained circle ellipse rect line polyline polygon image path
|
||||
syn keyword htmlTagName contained clipPath color-profile cursor
|
||||
syn keyword htmlTagName contained defs desc g symbol view use switch foreignObject
|
||||
syn keyword htmlTagName contained filter feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence
|
||||
syn keyword htmlTagName contained font font-face font-face-format font-face-name font-face-src font-face-uri
|
||||
syn keyword htmlTagName contained glyph glyphRef hkern
|
||||
syn keyword htmlTagName contained linearGradient marker mask pattern radialGradient set stop
|
||||
syn keyword htmlTagName contained missing-glyph mpath
|
||||
syn keyword htmlTagName contained text textPath tref tspan vkern
|
||||
syn keyword htmlTagName contained metadata title
|
||||
|
||||
" MathML tags
|
||||
" https://www.w3.org/TR/MathML3/appendixi.html#index.elem
|
||||
syn keyword htmlTagName contained abs and annotation annotation-xml apply approx arccos arccosh arccot arccoth
|
||||
syn keyword htmlTagName contained arccsc arccsch arcsec arcsech arcsin arcsinh arctan arctanh arg bind
|
||||
syn keyword htmlTagName contained bvar card cartesianproduct cbytes ceiling cerror ci cn codomain complexes
|
||||
syn keyword htmlTagName contained compose condition conjugate cos cosh cot coth cs csc csch
|
||||
syn keyword htmlTagName contained csymbol curl declare degree determinant diff divergence divide domain domainofapplication
|
||||
syn keyword htmlTagName contained emptyset eq equivalent eulergamma exists exp exponentiale factorial factorof false
|
||||
syn keyword htmlTagName contained floor fn forall gcd geq grad gt ident image imaginary
|
||||
syn keyword htmlTagName contained imaginaryi implies in infinity int integers intersect interval inverse lambda
|
||||
syn keyword htmlTagName contained laplacian lcm leq limit list ln log logbase lowlimit lt
|
||||
syn keyword htmlTagName contained maction maligngroup malignmark math matrix matrixrow max mean median menclose
|
||||
syn keyword htmlTagName contained merror mfenced mfrac mglyph mi mi" min minus mlabeledtr mlongdiv
|
||||
syn keyword htmlTagName contained mmultiscripts mn mo mode moment momentabout mover mpadded mphantom mprescripts
|
||||
syn keyword htmlTagName contained mroot mrow ms mscarries mscarry msgroup msline mspace msqrt msrow
|
||||
syn keyword htmlTagName contained mstack mstyle msub msubsup msup mtable mtd mtext mtr munder
|
||||
syn keyword htmlTagName contained munderover naturalnumbers neq none not notanumber notin notprsubset notsubset or
|
||||
syn keyword htmlTagName contained otherwise outerproduct partialdiff pi piece piecewise plus power primes product
|
||||
syn keyword htmlTagName contained prsubset quotient rationals real reals reln rem root scalarproduct sdev
|
||||
syn keyword htmlTagName contained sec sech selector semantics sep set setdiff share sin sinh
|
||||
syn keyword htmlTagName contained span subset sum tan tanh tendsto times transpose true union
|
||||
syn keyword htmlTagName contained uplimit variance vector vectorproduct xor
|
||||
|
||||
" Custom Element
|
||||
syn match htmlTagName contained "\<[a-z][-.0-9_a-z]*-[-.0-9_a-z]*\>"
|
||||
syn match htmlTagName contained "[.0-9_a-z]\@<=-[-.0-9_a-z]*\>"
|
||||
|
||||
" HTML 5 arguments
|
||||
" Core Attributes
|
||||
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
|
||||
syn keyword htmlArg contained draggable hidden id is lang spellcheck style tabindex title translate
|
||||
" Event-handler Attributes
|
||||
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
|
||||
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
|
||||
syn keyword htmlArg contained ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange
|
||||
syn keyword htmlArg contained onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata
|
||||
syn keyword htmlArg contained onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup
|
||||
syn keyword htmlArg contained onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange
|
||||
syn keyword htmlArg contained onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate
|
||||
syn keyword htmlArg contained onvolumechange onwaiting
|
||||
" XML Attributes
|
||||
syn keyword htmlArg contained xml:lang xml:space xml:base xmlns
|
||||
" new features
|
||||
" <body>
|
||||
syn keyword htmlArg contained onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload
|
||||
syn keyword htmlArg contained onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload
|
||||
" <video>, <audio>, <source>, <track>
|
||||
syn keyword htmlArg contained autoplay preload controls loop poster media kind charset srclang track playsinline
|
||||
" <form>, <input>, <button>
|
||||
syn keyword htmlArg contained form autocomplete autofocus list min max step
|
||||
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
|
||||
syn keyword htmlArg contained required placeholder pattern
|
||||
" <command>, <details>, <time>
|
||||
syn keyword htmlArg contained label icon open datetime-local pubdate
|
||||
" <script>
|
||||
syn keyword htmlArg contained async
|
||||
" <content>
|
||||
syn keyword htmlArg contained select
|
||||
" <iframe>
|
||||
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest allowpresentation
|
||||
" <picture>
|
||||
syn keyword htmlArg contained srcset sizes
|
||||
" <a>
|
||||
syn keyword htmlArg contained download media
|
||||
" <script>, <style>
|
||||
syn keyword htmlArg contained nonce
|
||||
" <area>, <a>, <img>, <iframe>, <link>
|
||||
syn keyword htmlArg contained referrerpolicy
|
||||
" https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
|
||||
syn keyword htmlArg contained integrity crossorigin
|
||||
" <link>
|
||||
syn keyword htmlArg contained prefetch
|
||||
" syn keyword htmlArg contained preload
|
||||
" <img>
|
||||
syn keyword htmlArg contained decoding
|
||||
" https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers
|
||||
syn keyword htmlArg contained onselectstart onselectionchange
|
||||
" https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading
|
||||
syn keyword htmlArg contained loading
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://w3c.github.io/html/single-page.html#embedding-custom-non-visible-data-with-the-data-attributes
|
||||
syn match htmlArg "\<data[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Vendor Extension Attributes
|
||||
" http://w3c.github.io/html/single-page.html#conformance-requirements-extensibility
|
||||
syn match htmlArg "\<x[-.0-9_a-z]*-[-.0-9_a-z]*\>" contained
|
||||
|
||||
" Microdata
|
||||
" http://dev.w3.org/html5/md/
|
||||
syn keyword htmlArg contained itemid itemscope itemtype itemprop itemref
|
||||
|
||||
" SVG
|
||||
" http://www.w3.org/TR/SVG/
|
||||
" Some common attributes from http://www.w3.org/TR/SVG/attindex.html
|
||||
syn keyword htmlArg contained accent-height accumulate additive alphabetic amplitude arabic-form ascent attributeName attributeType azimuth
|
||||
syn keyword htmlArg contained baseFrequency baseProfile bbox begin bias by
|
||||
syn keyword htmlArg contained calcMode cap-height class clipPathUnits contentScriptType contentStyleType cx cy
|
||||
syn keyword htmlArg contained d descent diffuseConstant divisor dur dx dy
|
||||
syn keyword htmlArg contained edgeMode elevation end exponent externalResourcesRequired
|
||||
syn keyword htmlArg contained fill filterRes filterUnits font-family font-size font-stretch font-style font-variant font-weight format format from fx fy
|
||||
syn keyword htmlArg contained g1 g2 glyph-name glyphRef gradientTransform gradientUnits
|
||||
syn keyword htmlArg contained hanging height horiz-adv-x horiz-origin-x horiz-origin-y
|
||||
syn keyword htmlArg contained id ideographic in in2 intercept
|
||||
syn keyword htmlArg contained k k1 k2 k3 k4 kernelMatrix kernelUnitLength keyPoints keySplines keyTimes
|
||||
syn keyword htmlArg contained lang lengthAdjust limitingConeAngle local
|
||||
syn keyword htmlArg contained markerHeight markerUnits markerWidth maskContentUnits maskUnits mathematical max media method min mode name
|
||||
syn keyword htmlArg contained numOctaves
|
||||
syn keyword htmlArg contained offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload onzoom operator order orient orientation origin overline-position overline-thickness
|
||||
syn keyword htmlArg contained panose-1 path pathLength patternContentUnits patternTransform patternUnits points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits
|
||||
syn keyword htmlArg contained r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry
|
||||
syn keyword htmlArg contained scale seed slope spacing specularConstant specularExponent spreadMethod startOffset stdDeviation stemh stemv stitchTiles strikethrough-position strikethrough-thickness string surfaceScale systemLanguage
|
||||
syn keyword htmlArg contained tableValues target targetX targetY textLength title to transform type
|
||||
syn keyword htmlArg contained u1 u2 underline-position underline-thickness unicode unicode-range units-per-em
|
||||
syn keyword htmlArg contained v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget
|
||||
syn keyword htmlArg contained width widths
|
||||
syn keyword htmlArg contained x x-height x1 x2 xChannelSelector xlink:actuate xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space
|
||||
syn keyword htmlArg contained y y1 y2 yChannelSelector
|
||||
syn keyword htmlArg contained z zoomAndPan
|
||||
syn keyword htmlArg contained alignment-baseline baseline-shift clip-path clip-rule clip color-interpolation-filters color-interpolation color-profile color-rendering color cursor direction display dominant-baseline enable-background fill-opacity fill-rule fill filter flood-color flood-opacity font-family font-size-adjust font-size font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering stop-color stop-opacity stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width stroke text-anchor text-decoration text-rendering unicode-bidi visibility word-spacing writing-mode
|
||||
|
||||
" MathML attributes
|
||||
" https://www.w3.org/TR/MathML3/chapter2.html#interf.toplevel.atts
|
||||
syn keyword htmlArg contained accent accentunder actiontype align alignmentscope altimg altimg-height altimg-valign altimg-width alttext
|
||||
syn keyword htmlArg contained annotation-xml background base baseline bevelled cd cdgroup charalign charspacing close
|
||||
syn keyword htmlArg contained closure color columnalign columnalignment columnlines columnspacing columnspan columnwidth crossout decimalpoint
|
||||
syn keyword htmlArg contained definitionURL denomalign depth display displaystyle edge encoding equalcolumns equalrows fence
|
||||
syn keyword htmlArg contained fontfamily fontsize fontstyle fontweight form frame framespacing groupalign height indentalign
|
||||
syn keyword htmlArg contained indentalignfirst indentalignlast indentshift indentshiftfirst indentshiftlast indenttarget index infixlinebreakstyle integer largeop
|
||||
syn keyword htmlArg contained leftoverhang length linebreak linebreakmultchar linebreakstyle lineleading linethickness location longdivstyle lquote
|
||||
syn keyword htmlArg contained lspace ltr macros math mathbackground mathcolor mathsize mathvariant maxsize maxwidth
|
||||
syn keyword htmlArg contained mediummathspace menclose minlabelspacing minsize mode movablelimits msgroup mslinethickness name nargs
|
||||
syn keyword htmlArg contained newline notation numalign number occurrence open order other overflow position
|
||||
syn keyword htmlArg contained rightoverhang role rowalign rowlines rowspacing rowspan rquote rspace schemaLocation scope
|
||||
syn keyword htmlArg contained scriptlevel scriptminsize scriptsize scriptsizemultiplier selection separator separators shift side stackalign
|
||||
syn keyword htmlArg contained stretchy subscriptshift superscriptshift symmetric thickmathspace thinmathspace type valign verythickmathspace verythinmathspace
|
||||
syn keyword htmlArg contained veryverythickmathspace veryverythinmathspace voffset width xref
|
||||
|
||||
|
||||
endif
|
||||
|
||||
30
syntax/htmldjango.vim
Normal file
30
syntax/htmldjango.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'htmldjango') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Django HTML template
|
||||
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
|
||||
" Last Change: 2014 Jul 13
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'html'
|
||||
endif
|
||||
|
||||
runtime! syntax/django.vim
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock
|
||||
|
||||
syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display containedin=ALLBUT,@djangoBlocks
|
||||
syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display containedin=ALLBUT,@djangoBlocks
|
||||
syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomment\s*%}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
|
||||
syn region djangoComBlock start="{#" end="#}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
|
||||
|
||||
let b:current_syntax = "htmldjango"
|
||||
|
||||
endif
|
||||
@@ -1,90 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jinja') == -1
|
||||
|
||||
" jinja syntax file
|
||||
" Language: Jinja HTML template
|
||||
" Maintainer: Hsiaoming Yang <lepture@me.com>
|
||||
" Last Change: Sep 13, 2012
|
||||
|
||||
" only support 6.x+
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'html'
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
syntax case match
|
||||
|
||||
" jinja template built-in tags and parameters
|
||||
" 'comment' doesn't appear here because it gets special treatment
|
||||
syn keyword jinjaStatement contained if else elif endif is not
|
||||
syn keyword jinjaStatement contained for in recursive endfor
|
||||
syn keyword jinjaStatement contained raw endraw
|
||||
syn keyword jinjaStatement contained block endblock extends super scoped
|
||||
syn keyword jinjaStatement contained macro endmacro call endcall
|
||||
syn keyword jinjaStatement contained from import as do continue break
|
||||
syn keyword jinjaStatement contained filter endfilter set
|
||||
syn keyword jinjaStatement contained include ignore missing
|
||||
syn keyword jinjaStatement contained with without context endwith
|
||||
syn keyword jinjaStatement contained trans endtrans pluralize
|
||||
syn keyword jinjaStatement contained autoescape endautoescape
|
||||
|
||||
" jinja templete built-in filters
|
||||
syn keyword jinjaFilter contained abs attr batch capitalize center default
|
||||
syn keyword jinjaFilter contained dictsort escape filesizeformat first
|
||||
syn keyword jinjaFilter contained float forceescape format groupby indent
|
||||
syn keyword jinjaFilter contained int join last length list lower pprint
|
||||
syn keyword jinjaFilter contained random replace reverse round safe slice
|
||||
syn keyword jinjaFilter contained sort string striptags sum
|
||||
syn keyword jinjaFilter contained title trim truncate upper urlize
|
||||
syn keyword jinjaFilter contained wordcount wordwrap
|
||||
|
||||
" jinja template built-in tests
|
||||
syn keyword jinjaTest contained callable defined divisibleby escaped
|
||||
syn keyword jinjaTest contained even iterable lower mapping none number
|
||||
syn keyword jinjaTest contained odd sameas sequence string undefined upper
|
||||
|
||||
syn keyword jinjaFunction contained range lipsum dict cycler joiner
|
||||
|
||||
|
||||
" Keywords to highlight within comments
|
||||
syn keyword jinjaTodo contained TODO FIXME XXX
|
||||
|
||||
" jinja template constants (always surrounded by double quotes)
|
||||
syn region jinjaArgument contained start=/"/ skip=/\\"/ end=/"/
|
||||
syn region jinjaArgument contained start=/'/ skip=/\\'/ end=/'/
|
||||
syn keyword jinjaArgument contained true false
|
||||
|
||||
" Mark illegal characters within tag and variables blocks
|
||||
syn match jinjaTagError contained "#}\|{{\|[^%]}}\|[&#]"
|
||||
syn match jinjaVarError contained "#}\|{%\|%}\|[<>!&#%]"
|
||||
syn cluster jinjaBlocks add=jinjaTagBlock,jinjaVarBlock,jinjaComBlock,jinjaComment
|
||||
|
||||
" jinja template tag and variable blocks
|
||||
syn region jinjaTagBlock start="{%" end="%}" contains=jinjaStatement,jinjaFilter,jinjaArgument,jinjaFilter,jinjaTest,jinjaTagError display containedin=ALLBUT,@jinjaBlocks
|
||||
syn region jinjaVarBlock start="{{" end="}}" contains=jinjaFilter,jinjaArgument,jinjaVarError display containedin=ALLBUT,@jinjaBlocks
|
||||
syn region jinjaComBlock start="{#" end="#}" contains=jinjaTodo containedin=ALLBUT,@jinjaBlocks
|
||||
|
||||
|
||||
hi def link jinjaTagBlock PreProc
|
||||
hi def link jinjaVarBlock PreProc
|
||||
hi def link jinjaStatement Statement
|
||||
hi def link jinjaFunction Function
|
||||
hi def link jinjaTest Type
|
||||
hi def link jinjaFilter Identifier
|
||||
hi def link jinjaArgument Constant
|
||||
hi def link jinjaTagError Error
|
||||
hi def link jinjaVarError Error
|
||||
hi def link jinjaError Error
|
||||
hi def link jinjaComment Comment
|
||||
hi def link jinjaComBlock Comment
|
||||
hi def link jinjaTodo Todo
|
||||
|
||||
let b:current_syntax = "jinja"
|
||||
|
||||
endif
|
||||
101
syntax/less.vim
101
syntax/less.vim
@@ -1,68 +1,83 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: less
|
||||
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
||||
" URL: https://github.com/genoma/vim-less
|
||||
" Last Change: 2014 November 24
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/css.vim
|
||||
runtime! after/syntax/css.vim
|
||||
" load files from vim-css3-syntax plugin (https://github.com/hail2u/vim-css3-syntax)
|
||||
runtime! after/syntax/css/*.vim
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold
|
||||
syn cluster lessCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
|
||||
syn cluster lessCssAttributes contains=css.*Attr,lessEndOfLineComment,lessComment,cssValue.*,cssColor,cssURL,lessDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
|
||||
|
||||
syn match lessVariable "@[[:alnum:]_-]\+" contained
|
||||
syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite
|
||||
syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite
|
||||
syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted
|
||||
syn region lessDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
|
||||
|
||||
syn match lessOperator "+" contained
|
||||
syn match lessOperator "-" contained
|
||||
syn match lessOperator "/" contained
|
||||
syn match lessOperator "*" contained
|
||||
syn match lessProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=lessCssAttribute contained containedin=lessDefinition
|
||||
syn match lessProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
||||
syn match lessProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
||||
syn match lessCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@lessCssAttributes,lessVariable,lessFunction,lessInterpolation
|
||||
syn match lessDefault "!default\>" contained
|
||||
|
||||
syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty
|
||||
syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
|
||||
" less variables and media queries
|
||||
syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessCssAttribute skipwhite
|
||||
syn match lessMedia "@media" nextgroup=lessCssAttribute skipwhite
|
||||
|
||||
syn match lessDefault "!default" contained
|
||||
" Less functions
|
||||
syn match lessFunction "\<\%(escape\|e\|unit\)\>(\@=" contained
|
||||
syn match lessFunction "\<\%(ceil\|floor\|percentage\|round\|sqrt\|abs\|sin\|asin\|cos\|acos\|tan\|atan\|pi\|pow\|min\|max\)\>(\@=" contained
|
||||
syn match lessFunction "\<\%(rgb\|rgba\|argb\|argb\|hsl\|hsla\|hsv\|hsva\)\>(\@=" contained
|
||||
syn match lessFunction "\<\%(hue\|saturation\|lightness\|red\|green\|blue\|alpha\|luma\)\>(\@=" contained
|
||||
syn match lessFunction "\<\%(saturate\|desaturate\|lighten\|darken\|fadein\|fadeout\|fade\|spin\|mix\|greyscale\|contrast\)\>(\@=" contained
|
||||
syn match lessFunction "\<\%(multiply\|screen\|overlay\|softlight\|hardlight\|difference\|exclusion\|average\|negation\)\>(\@=" contained
|
||||
|
||||
syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass
|
||||
syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
|
||||
syn match lessClass "[[:alnum:]_-]\+" contained
|
||||
" Less id class visualization
|
||||
syn match lessIdChar "#[[:alnum:]_-]\@=" nextgroup=lessId,lessClassIdCall
|
||||
syn match lessId "[[:alnum:]_-]\+" contained
|
||||
syn match lessClassIdCall "[[:alnum:]_-]\+()" contained
|
||||
|
||||
" functions {{{
|
||||
syn match lessClassChar "\.[[:alnum:]_-]\@=" nextgroup=lessClass,lessClassCall
|
||||
syn match lessClass "[[:alnum:]_-]\+" contained
|
||||
syn match lessClassCall "[[:alnum:]_-]\+()" contained
|
||||
|
||||
" string functions
|
||||
syn keyword lessFunction escape e % containedin=cssDefinition contained
|
||||
" misc functions
|
||||
syn keyword lessFunction unit containedin=cssDefinition contained
|
||||
" math functions
|
||||
syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
|
||||
" color definition
|
||||
syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained
|
||||
" color channel information
|
||||
syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained
|
||||
" color operations
|
||||
syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained
|
||||
" color blending
|
||||
syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained
|
||||
syn match lessAmpersand "&" contains=lessIdChar,lessClassChar
|
||||
|
||||
" }}}
|
||||
syn region lessInclude start="@import" end=";\|$" contains=lessComment,cssURL,cssUnicodeEscape,cssMediaType,cssStringQ,cssStringQQ
|
||||
|
||||
syn match lessComment "//.*$" contains=@Spell
|
||||
syn keyword lessTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
||||
syn region lessComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
|
||||
syn region lessCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
|
||||
syn match lessEndOfLineComment "//.*" contains=lessComment,lessTodo,@Spell
|
||||
|
||||
hi def link lessVariable Special
|
||||
hi def link lessVariableValue Constant
|
||||
hi def link lessDefault Special
|
||||
hi def link lessComment Comment
|
||||
hi def link lessFunction Function
|
||||
hi def link lessMixinChar Special
|
||||
hi def link lessAmpersandChar Special
|
||||
hi def link lessNestedProperty Type
|
||||
hi def link lessClass PreProc
|
||||
hi def link lessEndOfLineComment lessComment
|
||||
hi def link lessCssComment lessComment
|
||||
hi def link lessComment Comment
|
||||
hi def link lessDefault cssImportant
|
||||
hi def link lessVariable Identifier
|
||||
hi def link lessFunction PreProc
|
||||
hi def link lessTodo Todo
|
||||
hi def link lessInclude Include
|
||||
hi def link lessIdChar Special
|
||||
hi def link lessClassChar Special
|
||||
hi def link lessAmpersand Character
|
||||
hi def link lessId Identifier
|
||||
hi def link lessClass Type
|
||||
hi def link lessCssAttribute PreProc
|
||||
hi def link lessClassCall Type
|
||||
hi def link lessClassIdCall Type
|
||||
hi def link lessTagName cssTagName
|
||||
hi def link lessDeprecated cssDeprecated
|
||||
hi def link lessMedia cssMedia
|
||||
|
||||
let b:current_syntax = "less"
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,110 +1,5 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'handlebars') == -1
|
||||
|
||||
" Mustache & Handlebars syntax
|
||||
" Language: Mustache, Handlebars
|
||||
" Maintainer: Juvenn Woo <machese@gmail.com>
|
||||
" Screenshot: http://imgur.com/6F408
|
||||
" Version: 6
|
||||
" Last Change: Jul 16 2019
|
||||
" Remark:
|
||||
" It lexically hilights embedded mustaches (exclusively) in html file.
|
||||
" While it was written for Ruby-based Mustache template system, it should
|
||||
" work for Google's C-based *ctemplate* as well as Erlang-based *et*. All
|
||||
" of them are, AFAIK, based on the idea of ctemplate.
|
||||
" References:
|
||||
" [Mustache](http://github.com/defunkt/mustache)
|
||||
" [Handlebars](https://github.com/wycats/handlebars.js)
|
||||
" [ctemplate](http://code.google.com/p/google-ctemplate/)
|
||||
" [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
|
||||
" [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
|
||||
" TODO: Feedback is welcomed.
|
||||
|
||||
|
||||
" Read the HTML syntax to start with
|
||||
if version < 600
|
||||
so <sfile>:p:h/html.vim
|
||||
else
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Standard HiLink will not work with included syntax files
|
||||
if version < 508
|
||||
command! -nargs=+ HtmlHiLink hi link <args>
|
||||
else
|
||||
command! -nargs=+ HtmlHiLink hi def link <args>
|
||||
endif
|
||||
|
||||
syntax match mustacheError '}}}\?'
|
||||
syntax match mustacheInsideError '{{[{$#<>=!\/]\?'
|
||||
|
||||
" Ember angle bracket syntax syntax starts with a capital letter:
|
||||
" https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
|
||||
syntax case match
|
||||
syntax region mustacheAngleComponent start=/<\/\?[[:upper:]]/ end=/>/ keepend containedin=TOP,@htmlMustacheContainer
|
||||
syntax case ignore
|
||||
syntax match mustacheAngleBrackets '</\?\|/\?>' contained containedin=mustacheAngleComponent
|
||||
syntax match mustacheAngleComponentName '</[[:alnum:]]\+'hs=s+2 contained containedin=mustacheAngleBrackets
|
||||
syntax match mustacheAngleComponentName '<[[:alnum:]]\+'hs=s+1 contained containedin=mustacheAngleBrackets
|
||||
|
||||
syntax region mustacheHbsComponent start=/{{[^!][$#^/]\?/ end=/}}}\?/ keepend containedin=TOP,@htmlMustacheContainer
|
||||
|
||||
syntax cluster mustacheInside add=mustacheHbsComponent,mustacheAngleComponent
|
||||
|
||||
syntax match mustacheOperators '=\|\.\|/^>' contained containedin=@mustacheInside,mustacheParam
|
||||
syntax region mustacheHtmlValue start=/={{[^!][$#^/]\?/rs=s+1,hs=s+1 end=/}}/ oneline keepend contained containedin=htmlTag contains=@mustacheInside
|
||||
syntax region mustachePartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=@mustacheInside,@htmlMustacheContainer
|
||||
syntax match mustacheHandlebars '{{\|}}' contained containedin=@mustacheInside
|
||||
syntax match mustacheUnescape '{{{\|}}}' contained containedin=@mustacheInside
|
||||
syntax match mustacheConditionals '\([/#]\?\<\(if\|unless\)\|\<else\)\>' contained containedin=@mustacheInside
|
||||
syntax match mustacheHelpers '[/#]\?\<\(with\|link\-to\|each\(\-in\)\?\|let\)\>' contained containedin=@mustacheInside
|
||||
syntax match mustacheHelpers 'else \(if\|unless\|with\|link\-to\|each\(\-in\)\?\)' contained containedin=@mustacheInside
|
||||
syntax match mustacheParam /[a-z@_-]\+=/he=e-1 contained containedin=@mustacheInside
|
||||
syntax region mustacheComment start=/{{!/rs=s+2 skip=/{{.\{-}}}/ end=/}}/re=e-2 contains=Todo contained containedin=TOP,@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=TOP,@mustacheInside,@htmlMustacheContainer
|
||||
syntax region mustacheQString start=/'/ skip=/\\'/ end=/'/ contained containedin=@mustacheInside
|
||||
syntax region mustacheDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=@mustacheInside
|
||||
|
||||
" Clustering
|
||||
syntax cluster htmlMustacheContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlLink,htmlBold,htmlUnderline,htmlItalic,htmlValue
|
||||
|
||||
|
||||
" Hilighting
|
||||
" mustacheInside hilighted as Number, which is rarely used in html
|
||||
" you might like change it to Function or Identifier
|
||||
HtmlHiLink mustacheVariable Number
|
||||
HtmlHiLink mustacheVariableUnescape Number
|
||||
HtmlHiLink mustachePartial Number
|
||||
HtmlHiLink mustacheMarkerSet Number
|
||||
HtmlHiLink mustacheParam htmlArg
|
||||
HtmlHiLink mustacheAngleComponentName htmlTag
|
||||
|
||||
HtmlHiLink mustacheComment Comment
|
||||
HtmlHiLink mustacheBlockComment Comment
|
||||
HtmlHiLink mustacheError Error
|
||||
HtmlHiLink mustacheInsideError Error
|
||||
|
||||
HtmlHiLink mustacheHandlebars Special
|
||||
HtmlHiLink mustacheAngleBrackets htmlTagName
|
||||
HtmlHiLink mustacheUnescape Identifier
|
||||
HtmlHiLink mustacheOperators Operator
|
||||
HtmlHiLink mustacheConditionals Conditional
|
||||
HtmlHiLink mustacheHelpers Repeat
|
||||
HtmlHiLink mustacheQString String
|
||||
HtmlHiLink mustacheDQString String
|
||||
|
||||
syn region mustacheScriptTemplate start=+<script [^>]*type *=[^>]*text/\(mustache\|x-handlebars-template\)[^>]*>+
|
||||
\ end=+</script>+me=s-1 keepend
|
||||
\ contains=mustacheInside,@htmlMustacheContainer,htmlTag,htmlEndTag,htmlTagName,htmlSpecialChar
|
||||
|
||||
let b:current_syntax = "mustache"
|
||||
delcommand HtmlHiLink
|
||||
runtime! syntax/handlebars.vim
|
||||
|
||||
endif
|
||||
|
||||
40
syntax/sql.vim
Normal file
40
syntax/sql.vim
Normal file
@@ -0,0 +1,40 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
|
||||
|
||||
" Vim syntax file loader
|
||||
" Language: SQL
|
||||
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||
" Last Change: Thu Sep 15 2005 10:30:02 AM
|
||||
" Version: 1.0
|
||||
|
||||
" Description: Checks for a:
|
||||
" buffer local variable,
|
||||
" global variable,
|
||||
" If the above exist, it will source the type specified.
|
||||
" If none exist, it will source the default sql.vim file.
|
||||
"
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Default to the standard Vim distribution file
|
||||
let filename = 'sqloracle'
|
||||
|
||||
" Check for overrides. Buffer variables have the highest priority.
|
||||
if exists("b:sql_type_override")
|
||||
" Check the runtimepath to see if the file exists
|
||||
if globpath(&runtimepath, 'syntax/'.b:sql_type_override.'.vim') != ''
|
||||
let filename = b:sql_type_override
|
||||
endif
|
||||
elseif exists("g:sql_type_default")
|
||||
if globpath(&runtimepath, 'syntax/'.g:sql_type_default.'.vim') != ''
|
||||
let filename = g:sql_type_default
|
||||
endif
|
||||
endif
|
||||
|
||||
" Source the appropriate file
|
||||
exec 'runtime syntax/'.filename.'.vim'
|
||||
|
||||
" vim:sw=4:
|
||||
|
||||
endif
|
||||
@@ -2,6 +2,7 @@ function! TestExtension(filetype, filename, content)
|
||||
call Log('Detecting ' . a:filetype . ' filetype (' . a:filename . ')...')
|
||||
|
||||
try
|
||||
set shortmess+=F
|
||||
let g:message = ""
|
||||
exec "noautocmd n " . a:filename
|
||||
silent put =a:content
|
||||
@@ -29,6 +30,8 @@ call TestExtension("sh", "bash3", "#! /bin/bash2.3")
|
||||
call TestExtension("sh", "bash4", "#!/usr/bin/env bash")
|
||||
call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo")
|
||||
call TestExtension("sh", "bash1", "#!/bin/bash")
|
||||
" This is defined only by vim-native scripts.vim for now
|
||||
call TestExtension("sh", "bash7", ":")
|
||||
|
||||
" Vim help file
|
||||
call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "")
|
||||
@@ -201,6 +204,13 @@ call TestExtension("cpp", "foobar.moc", "")
|
||||
call TestExtension("cpp", "foobar.tcc", "")
|
||||
call TestExtension("cpp", "foobar.inl", "")
|
||||
|
||||
" Django
|
||||
|
||||
call TestExtension("htmldjango", "foobar.j2", "")
|
||||
call TestExtension("htmldjango", "foobar.jinja", "")
|
||||
call TestExtension("htmldjango", "foobar.jinja2", "")
|
||||
call TestExtension("htmldjango", "foobar.njk", "")
|
||||
|
||||
" vim-polyglot only
|
||||
call TestExtension("blade", "test.blade.php", "")
|
||||
call TestExtension("yaml.ansible", "playbook.yml", "")
|
||||
@@ -356,6 +366,22 @@ call TestExtension("tt2html", "html.tt2", "<html>")
|
||||
call TestExtension("html", "empty.html", "")
|
||||
call TestExtension("mason", "mason1.html", "% my $planet = 42;")
|
||||
call TestExtension("mason", "mason2.html", "<%filter></%filter>")
|
||||
call TestExtension("jinja.html", "jinja.html", "{{ item.href }}")
|
||||
call TestExtension("jinja.html", "jinja.html", "{% for item in navigation %}{% endfor %}")
|
||||
call TestExtension("jinja.html", "jinja.html", "{% block head %}")
|
||||
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
|
||||
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
|
||||
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
||||
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
||||
|
||||
" many html templates use {{ }}, e.g. Angular, we should not assume django
|
||||
call TestExtension("html", "template.html", "{{ item.href }}")
|
||||
|
||||
" .gitignore
|
||||
call TestExtension("gitignore", ".gitignore", "")
|
||||
|
||||
" .xml
|
||||
call TestExtension("xml", ".fglrxrc", "")
|
||||
call TestExtension("xml", "fglrxrc", "")
|
||||
|
||||
" .conf
|
||||
call TestExtension("conf", "foo.conf", "")
|
||||
call TestExtension("conf", "config", "")
|
||||
call TestExtension("conf", "auto.master", "")
|
||||
|
||||
@@ -6,6 +6,7 @@ function! TestFiletype(filetype)
|
||||
endfunction
|
||||
|
||||
call TestFiletype('8th')
|
||||
call TestFiletype('conf')
|
||||
call TestFiletype('haproxy')
|
||||
call TestFiletype('a2ps')
|
||||
call TestFiletype('a65')
|
||||
@@ -22,6 +23,7 @@ call TestFiletype('aidl')
|
||||
call TestFiletype('alsaconf')
|
||||
call TestFiletype('aml')
|
||||
call TestFiletype('ampl')
|
||||
call TestFiletype('csv')
|
||||
call TestFiletype('xml')
|
||||
call TestFiletype('ant')
|
||||
call TestFiletype('apache')
|
||||
@@ -53,7 +55,6 @@ call TestFiletype('litcoffee')
|
||||
call TestFiletype('cryptol')
|
||||
call TestFiletype('crystal')
|
||||
call TestFiletype('ecrystal')
|
||||
call TestFiletype('csv')
|
||||
call TestFiletype('cucumber')
|
||||
call TestFiletype('cuesheet')
|
||||
call TestFiletype('dart')
|
||||
@@ -63,6 +64,7 @@ call TestFiletype('dcov')
|
||||
call TestFiletype('dd')
|
||||
call TestFiletype('ddoc')
|
||||
call TestFiletype('dsdl')
|
||||
call TestFiletype('yaml')
|
||||
call TestFiletype('Dockerfile')
|
||||
call TestFiletype('yaml.docker-compose')
|
||||
call TestFiletype('elixir')
|
||||
@@ -76,13 +78,13 @@ call TestFiletype('ferm')
|
||||
call TestFiletype('fish')
|
||||
call TestFiletype('fbs')
|
||||
call TestFiletype('forth')
|
||||
call TestFiletype('glsl')
|
||||
call TestFiletype('fsharp')
|
||||
call TestFiletype('gdscript3')
|
||||
call TestFiletype('gitconfig')
|
||||
call TestFiletype('gitrebase')
|
||||
call TestFiletype('gitsendemail')
|
||||
call TestFiletype('gitcommit')
|
||||
call TestFiletype('glsl')
|
||||
call TestFiletype('gmpl')
|
||||
call TestFiletype('gnuplot')
|
||||
call TestFiletype('go')
|
||||
@@ -95,7 +97,8 @@ call TestFiletype('graphql')
|
||||
call TestFiletype('groovy')
|
||||
call TestFiletype('grub')
|
||||
call TestFiletype('haml')
|
||||
call TestFiletype('mustache')
|
||||
call TestFiletype('html.mustache')
|
||||
call TestFiletype('html.handlebars')
|
||||
call TestFiletype('haskell')
|
||||
call TestFiletype('haxe')
|
||||
call TestFiletype('hcl')
|
||||
@@ -108,7 +111,7 @@ call TestFiletype('idris2')
|
||||
call TestFiletype('lidris2')
|
||||
call TestFiletype('ion')
|
||||
call TestFiletype('Jenkinsfile')
|
||||
call TestFiletype('jinja.html')
|
||||
call TestFiletype('htmldjango')
|
||||
call TestFiletype('jq')
|
||||
call TestFiletype('json5')
|
||||
call TestFiletype('json')
|
||||
@@ -220,7 +223,6 @@ call TestFiletype('vmasm')
|
||||
call TestFiletype('vue')
|
||||
call TestFiletype('xdc')
|
||||
call TestFiletype('xsl')
|
||||
call TestFiletype('yaml')
|
||||
call TestFiletype('yaml.ansible')
|
||||
call TestFiletype('helm')
|
||||
call TestFiletype('help')
|
||||
@@ -235,3 +237,5 @@ call TestFiletype('odin')
|
||||
call TestFiletype('bzl')
|
||||
call TestFiletype('prolog')
|
||||
call TestFiletype('tads')
|
||||
call TestFiletype('gitignore')
|
||||
call TestFiletype('sql')
|
||||
|
||||
Reference in New Issue
Block a user