mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
22 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 |
2
Makefile
2
Makefile
@@ -7,4 +7,4 @@ test:
|
|||||||
@ scripts/test
|
@ scripts/test
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
@ echo "polyglot.vim\npackages.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'
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ 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.
|
> 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 **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->201<!--/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).
|
- 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.
|
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
- 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))
|
- 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.
|
- 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
|
## Installation
|
||||||
|
|
||||||
@@ -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)
|
- [clojure](https://github.com/guns/vim-clojure-static)
|
||||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax)
|
- [cmake](https://github.com/pboettch/vim-cmake-syntax)
|
||||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script)
|
- [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)
|
- [cpp-modern](https://github.com/bfrg/vim-cpp-modern)
|
||||||
- [cql](https://github.com/elubow/cql-vim)
|
- [cql](https://github.com/elubow/cql-vim)
|
||||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim)
|
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim)
|
||||||
@@ -152,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)
|
- [julia](https://github.com/JuliaEditorSupport/julia-vim)
|
||||||
- [kotlin](https://github.com/udalov/kotlin-vim)
|
- [kotlin](https://github.com/udalov/kotlin-vim)
|
||||||
- [ledger](https://github.com/ledger/vim-ledger)
|
- [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)
|
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond)
|
||||||
- [livescript](https://github.com/gkz/vim-ls)
|
- [livescript](https://github.com/gkz/vim-ls)
|
||||||
- [llvm](https://github.com/rhysd/vim-llvm)
|
- [llvm](https://github.com/rhysd/vim-llvm)
|
||||||
@@ -210,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)
|
- [slime](https://github.com/slime-lang/vim-slime-syntax)
|
||||||
- [smt2](https://github.com/bohlender/vim-smt2)
|
- [smt2](https://github.com/bohlender/vim-smt2)
|
||||||
- [solidity](https://github.com/tomlion/vim-solidity)
|
- [solidity](https://github.com/tomlion/vim-solidity)
|
||||||
|
- [sql](https://github.com/vim/vim/tree/master/runtime)
|
||||||
- [stylus](https://github.com/wavded/vim-stylus)
|
- [stylus](https://github.com/wavded/vim-stylus)
|
||||||
- [svelte](https://github.com/evanleck/vim-svelte/tree/main)
|
- [svelte](https://github.com/evanleck/vim-svelte/tree/main)
|
||||||
- [svg-indent](https://github.com/jasonshell/vim-svg-indent)
|
- [svg-indent](https://github.com/jasonshell/vim-svg-indent)
|
||||||
|
|||||||
@@ -1,705 +0,0 @@
|
|||||||
" Please do not edit this file directly, instead modify polyglot.vim or scripts/build
|
|
||||||
|
|
||||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
func! polyglot#Shebang()
|
|
||||||
if getline(1) =~# "^#!"
|
|
||||||
let ft = polyglot#ShebangFiletype()
|
|
||||||
if ft != ""
|
|
||||||
let &ft = ft
|
|
||||||
endif
|
|
||||||
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! 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
|
|
||||||
|
|
||||||
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',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
func! polyglot#DetectInpFiletype()
|
|
||||||
let line = getline(nextnonblank(1))
|
|
||||||
if line =~# '^\*'
|
|
||||||
set ft=abaqus | return
|
|
||||||
endif
|
|
||||||
for lnum in range(1, min([line("$"), 500]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~? '^header surface data'
|
|
||||||
set ft=trasys | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectAsaFiletype()
|
|
||||||
if exists("g:filetype_asa")
|
|
||||||
let &ft = g:filetype_asa | return
|
|
||||||
endif
|
|
||||||
set ft=aspvbs | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectAspFiletype()
|
|
||||||
if exists("g:filetype_asp")
|
|
||||||
let &ft = g:filetype_asp | return
|
|
||||||
endif
|
|
||||||
for lnum in range(1, min([line("$"), 3]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~? 'perlscript'
|
|
||||||
set ft=aspperl | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set ft=aspvbs | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectHFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 200]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
|
||||||
if exists("g:c_syntax_for_h")
|
|
||||||
set ft=objc | return
|
|
||||||
endif
|
|
||||||
set ft=objcpp | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:c_syntax_for_h")
|
|
||||||
set ft=c | return
|
|
||||||
endif
|
|
||||||
if exists("g:ch_syntax_for_h")
|
|
||||||
set ft=ch | return
|
|
||||||
endif
|
|
||||||
set ft=cpp | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectMFiletype()
|
|
||||||
let saw_comment = 0
|
|
||||||
for lnum in range(1, min([line("$"), 100]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*/\*'
|
|
||||||
let saw_comment = 1
|
|
||||||
endif
|
|
||||||
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
|
||||||
set ft=objc | return
|
|
||||||
endif
|
|
||||||
if line =~# '^\s*%'
|
|
||||||
set ft=octave | return
|
|
||||||
endif
|
|
||||||
if line =~# '^\s*(\*'
|
|
||||||
set ft=mma | return
|
|
||||||
endif
|
|
||||||
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
|
|
||||||
set ft=murphi | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if saw_comment
|
|
||||||
set ft=objc | return
|
|
||||||
endif
|
|
||||||
if exists("g:filetype_m")
|
|
||||||
let &ft = g:filetype_m | return
|
|
||||||
endif
|
|
||||||
set ft=octave | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectFsFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\(: \|new-device\)'
|
|
||||||
set ft=forth | return
|
|
||||||
endif
|
|
||||||
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
|
|
||||||
set ft=fsharp | return
|
|
||||||
endif
|
|
||||||
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
|
||||||
set ft=glsl | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:filetype_fs")
|
|
||||||
let &ft = g:filetype_fs | return
|
|
||||||
endif
|
|
||||||
set ft=forth | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectReFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
|
|
||||||
set ft=cpp | return
|
|
||||||
endif
|
|
||||||
set ft=reason | return
|
|
||||||
endfor
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectIdrFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 5]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*--.*[Ii]dris \=1'
|
|
||||||
set ft=idris | return
|
|
||||||
endif
|
|
||||||
if line =~# '^\s*--.*[Ii]dris \=2'
|
|
||||||
set ft=idris2 | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
for lnum in range(1, min([line("$"), 30]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^pkgs =.*'
|
|
||||||
set ft=idris | return
|
|
||||||
endif
|
|
||||||
if line =~# '^depends =.*'
|
|
||||||
set ft=idris2 | return
|
|
||||||
endif
|
|
||||||
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
|
|
||||||
set ft=idris | return
|
|
||||||
endif
|
|
||||||
if line =~# '^%language PostfixProjections'
|
|
||||||
set ft=idris2 | return
|
|
||||||
endif
|
|
||||||
if line =~# '^%access .*'
|
|
||||||
set ft=idris | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:filetype_idr")
|
|
||||||
let &ft = g:filetype_idr | return
|
|
||||||
endif
|
|
||||||
set ft=idris2 | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectLidrFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 200]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^>\s*--.*[Ii]dris \=1'
|
|
||||||
set ft=lidris | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set ft=lidris2 | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectBasFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 5]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
|
||||||
set ft=vb | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set ft=basic | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectPmFiletype()
|
|
||||||
let line = getline(nextnonblank(1))
|
|
||||||
if line =~# 'XPM2'
|
|
||||||
set ft=xpm2 | return
|
|
||||||
endif
|
|
||||||
if line =~# 'XPM'
|
|
||||||
set ft=xpm | return
|
|
||||||
endif
|
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
|
||||||
set ft=raku | return
|
|
||||||
endif
|
|
||||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
|
||||||
set ft=perl | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:filetype_pm")
|
|
||||||
let &ft = g:filetype_pm | return
|
|
||||||
endif
|
|
||||||
set ft=perl | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectPlFiletype()
|
|
||||||
let line = getline(nextnonblank(1))
|
|
||||||
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
|
|
||||||
set ft=prolog | return
|
|
||||||
endif
|
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
|
||||||
set ft=raku | return
|
|
||||||
endif
|
|
||||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
|
||||||
set ft=perl | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:filetype_pl")
|
|
||||||
let &ft = g:filetype_pl | return
|
|
||||||
endif
|
|
||||||
set ft=perl | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectTFiletype()
|
|
||||||
for lnum in range(1, min([line("$"), 5]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\.'
|
|
||||||
set ft=nroff | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
for lnum in range(1, min([line("$"), 50]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
|
||||||
set ft=raku | return
|
|
||||||
endif
|
|
||||||
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
|
||||||
set ft=perl | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if exists("g:filetype_t")
|
|
||||||
let &ft = g:filetype_t | return
|
|
||||||
endif
|
|
||||||
set ft=perl | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectTt2Filetype()
|
|
||||||
for lnum in range(1, min([line("$"), 3]))
|
|
||||||
let line = getline(lnum)
|
|
||||||
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
|
|
||||||
set ft=tt2html | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set ft=tt2 | return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func! polyglot#DetectHtmlFiletype()
|
|
||||||
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\)\(\<\|\>\)\|{#\s\+'
|
|
||||||
set ft=htmldjango | return
|
|
||||||
endif
|
|
||||||
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
|
||||||
set ft=xhtml | return
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
set ft=html | au! BufWritePost <buffer> ++once call polyglot#DetectHtmlFiletype()
|
|
||||||
return
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
|
|
||||||
" Restore 'cpoptions'
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
""" ftdetect/polyglot.vim
|
|
||||||
|
|
||||||
" don't spam the user when Vim is started in Vi compatibility mode
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
" Disable all native vim ftdetect
|
|
||||||
if exists('g:polyglot_test')
|
|
||||||
autocmd!
|
|
||||||
endif
|
|
||||||
|
|
||||||
func! s:Observe(fn)
|
|
||||||
let b:polyglot_observe = a:fn
|
|
||||||
augroup polyglot-observer
|
|
||||||
au! CursorHold,CursorHoldI,BufWritePost <buffer>
|
|
||||||
\ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
|
|
||||||
augroup END
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
let s:disabled_packages = {}
|
|
||||||
let s:new_polyglot_disabled = []
|
|
||||||
|
|
||||||
if exists('g:polyglot_disabled')
|
|
||||||
for pkg in g:polyglot_disabled
|
|
||||||
let base = split(pkg, '\.')
|
|
||||||
if len(base) > 0
|
|
||||||
let s:disabled_packages[pkg] = 1
|
|
||||||
call add(s:new_polyglot_disabled, base[0])
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
else
|
|
||||||
let g:polyglot_disabled_not_set = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:SetDefault(name, value)
|
|
||||||
if !exists(a:name)
|
|
||||||
let {a:name} = a:value
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call s:SetDefault('g:markdown_enable_spell_checking', 0)
|
|
||||||
call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
|
|
||||||
call s:SetDefault('g:markdown_enable_mappings', 0)
|
|
||||||
|
|
||||||
" Enable jsx syntax by default
|
|
||||||
call s:SetDefault('g:jsx_ext_required', 0)
|
|
||||||
|
|
||||||
" Needed for sql highlighting
|
|
||||||
call s:SetDefault('g:javascript_sql_dialect', 'sql')
|
|
||||||
|
|
||||||
" Make csv loading faster
|
|
||||||
call s:SetDefault('g:csv_start', 1)
|
|
||||||
call s:SetDefault('g:csv_end', 2)
|
|
||||||
|
|
||||||
" Disable json concealing by default
|
|
||||||
call s:SetDefault('g:vim_json_syntax_conceal', 0)
|
|
||||||
|
|
||||||
call s:SetDefault('g:filetype_euphoria', 'elixir')
|
|
||||||
|
|
||||||
if !exists('g:python_highlight_all')
|
|
||||||
call s:SetDefault('g:python_highlight_builtins', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_objs', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_types', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_funcs', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_exceptions', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_formatting', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_format', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_templates', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_indent_errors', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_space_errors', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_doctests', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_func_calls', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_class_vars', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_operators', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
|
|
||||||
call s:SetDefault('g:python_slow_sync', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" We need it because scripts.vim in vim uses "set ft=" which cannot be
|
|
||||||
" overridden with setf (and we can't use set ft= so our scripts.vim work)
|
|
||||||
func! s:Setf(ft)
|
|
||||||
if &filetype !~# '\<'.a:ft.'\>'
|
|
||||||
let &filetype = a:ft
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Function used for patterns that end in a star: don't set the filetype if the
|
|
||||||
" file name matches ft_ignore_pat.
|
|
||||||
" When using this, the entry should probably be further down below with the
|
|
||||||
" other StarSetf() calls.
|
|
||||||
func! s:StarSetf(ft)
|
|
||||||
if expand("<amatch>") !~ g:ft_ignore_pat && &filetype !~# '\<'.a:ft.'\>'
|
|
||||||
let &filetype = a:ft
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
|
|
||||||
" scripts/build inserts here filetype detection autocommands
|
|
||||||
|
|
||||||
au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat |
|
|
||||||
\ call polyglot#Shebang() | endif
|
|
||||||
|
|
||||||
au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat |
|
|
||||||
\ call s:Observe('Shebang') | endif
|
|
||||||
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
if !has_key(s:disabled_packages, 'autoindent')
|
|
||||||
" Code below re-implements sleuth for vim-polyglot
|
|
||||||
let g:loaded_sleuth = 1
|
|
||||||
let g:loaded_foobar = 1
|
|
||||||
|
|
||||||
" Makes shiftwidth to be synchronized with tabstop by default
|
|
||||||
if &shiftwidth == &tabstop
|
|
||||||
let &shiftwidth = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:guess(lines) abort
|
|
||||||
let options = {}
|
|
||||||
let ccomment = 0
|
|
||||||
let podcomment = 0
|
|
||||||
let triplequote = 0
|
|
||||||
let backtick = 0
|
|
||||||
let xmlcomment = 0
|
|
||||||
let heredoc = ''
|
|
||||||
let minindent = 10
|
|
||||||
let spaces_minus_tabs = 0
|
|
||||||
let i = 0
|
|
||||||
|
|
||||||
for line in a:lines
|
|
||||||
let i += 1
|
|
||||||
|
|
||||||
if !len(line) || line =~# '^\W*$'
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^\s*/\*'
|
|
||||||
let ccomment = 1
|
|
||||||
endif
|
|
||||||
if ccomment
|
|
||||||
if line =~# '\*/'
|
|
||||||
let ccomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^=\w'
|
|
||||||
let podcomment = 1
|
|
||||||
endif
|
|
||||||
if podcomment
|
|
||||||
if line =~# '^=\%(end\|cut\)\>'
|
|
||||||
let podcomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if triplequote
|
|
||||||
if line =~# '^[^"]*"""[^"]*$'
|
|
||||||
let triplequote = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
elseif line =~# '^[^"]*"""[^"]*$'
|
|
||||||
let triplequote = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if backtick
|
|
||||||
if line =~# '^[^`]*`[^`]*$'
|
|
||||||
let backtick = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
elseif &filetype ==# 'go' && line =~# '^[^`]*`[^`]*$'
|
|
||||||
let backtick = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^\s*<\!--'
|
|
||||||
let xmlcomment = 1
|
|
||||||
endif
|
|
||||||
if xmlcomment
|
|
||||||
if line =~# '-->'
|
|
||||||
let xmlcomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
" This is correct order because both "<<EOF" and "EOF" matches end
|
|
||||||
if heredoc != ''
|
|
||||||
if line =~# heredoc
|
|
||||||
let heredoc = ''
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
let herematch = matchlist(line, '\C<<\W*\([A-Z]\+\)\s*$')
|
|
||||||
if len(herematch) > 0
|
|
||||||
let heredoc = herematch[1] . '$'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let spaces_minus_tabs += line[0] == "\t" ? 1 : -1
|
|
||||||
|
|
||||||
if line[0] == "\t"
|
|
||||||
setlocal noexpandtab
|
|
||||||
let &l:shiftwidth=&tabstop
|
|
||||||
let b:sleuth_culprit .= ':' . i
|
|
||||||
return 1
|
|
||||||
elseif line[0] == " "
|
|
||||||
let indent = len(matchstr(line, '^ *'))
|
|
||||||
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent
|
|
||||||
let minindent = indent
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
if minindent < 10
|
|
||||||
setlocal expandtab
|
|
||||||
let &l:shiftwidth=minindent
|
|
||||||
let b:sleuth_culprit .= ':' . i
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:detect_indent() abort
|
|
||||||
if &buftype ==# 'help'
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:sleuth_culprit = expand("<afile>:p")
|
|
||||||
if s:guess(getline(1, 32))
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let pattern = sleuth#GlobForFiletype(&filetype)
|
|
||||||
if len(pattern) == 0
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let pattern = '{' . pattern . ',.git,.svn,.hg}'
|
|
||||||
let dir = expand('%:p:h')
|
|
||||||
let level = 3
|
|
||||||
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
|
|
||||||
" Ignore files from homedir and root
|
|
||||||
if dir == expand('~') || dir == '/'
|
|
||||||
unlet b:sleuth_culprit
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
|
|
||||||
let b:sleuth_culprit = neighbor
|
|
||||||
" Do not consider directories above .git, .svn or .hg
|
|
||||||
if fnamemodify(neighbor, ":h:t")[0] == "."
|
|
||||||
let level = 0
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if neighbor !=# expand('%:p') && filereadable(neighbor)
|
|
||||||
if s:guess(readfile(neighbor, '', 32))
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let dir = fnamemodify(dir, ':h')
|
|
||||||
let level -= 1
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
unlet b:sleuth_culprit
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
setglobal smarttab
|
|
||||||
|
|
||||||
function! SleuthIndicator() abort
|
|
||||||
let sw = &shiftwidth ? &shiftwidth : &tabstop
|
|
||||||
if &expandtab
|
|
||||||
return 'sw='.sw
|
|
||||||
elseif &tabstop == sw
|
|
||||||
return 'ts='.&tabstop
|
|
||||||
else
|
|
||||||
return 'sw='.sw.',ts='.&tabstop
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
augroup polyglot-sleuth
|
|
||||||
au!
|
|
||||||
au FileType * call s:detect_indent()
|
|
||||||
au User Flags call Hoist('buffer', 5, 'SleuthIndicator')
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
command! -bar -bang Sleuth call s:detect_indent()
|
|
||||||
endif
|
|
||||||
|
|
||||||
func! s:verify()
|
|
||||||
if exists("g:polyglot_disabled_not_set")
|
|
||||||
if exists("g:polyglot_disabled")
|
|
||||||
echohl WarningMsg
|
|
||||||
echo "vim-polyglot: g:polyglot_disabled should be defined before loading vim-polyglot"
|
|
||||||
echohl None
|
|
||||||
endif
|
|
||||||
|
|
||||||
unlet g:polyglot_disabled_not_set
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
au VimEnter * call s:verify()
|
|
||||||
|
|
||||||
" Save polyglot_disabled without postfixes
|
|
||||||
if exists('g:polyglot_disabled')
|
|
||||||
let g:polyglot_disabled = s:new_polyglot_disabled
|
|
||||||
endif
|
|
||||||
|
|
||||||
" restore Vi compatibility settings
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
264
autoload/polyglot/detect.vim
Normal file
264
autoload/polyglot/detect.vim
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||||
|
|
||||||
|
func! polyglot#detect#Inp()
|
||||||
|
let line = getline(nextnonblank(1))
|
||||||
|
if line =~# '^\*'
|
||||||
|
set ft=abaqus | return
|
||||||
|
endif
|
||||||
|
for lnum in range(1, min([line("$"), 500]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~? '^header surface data'
|
||||||
|
set ft=trasys | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Asa()
|
||||||
|
if exists("g:filetype_asa")
|
||||||
|
let &ft = g:filetype_asa | return
|
||||||
|
endif
|
||||||
|
set ft=aspvbs | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Asp()
|
||||||
|
if exists("g:filetype_asp")
|
||||||
|
let &ft = g:filetype_asp | return
|
||||||
|
endif
|
||||||
|
for lnum in range(1, min([line("$"), 3]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~? 'perlscript'
|
||||||
|
set ft=aspperl | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
set ft=aspvbs | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#H()
|
||||||
|
for lnum in range(1, min([line("$"), 200]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||||
|
if exists("g:c_syntax_for_h")
|
||||||
|
set ft=objc | return
|
||||||
|
endif
|
||||||
|
set ft=objcpp | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:c_syntax_for_h")
|
||||||
|
set ft=c | return
|
||||||
|
endif
|
||||||
|
if exists("g:ch_syntax_for_h")
|
||||||
|
set ft=ch | return
|
||||||
|
endif
|
||||||
|
set ft=cpp | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#M()
|
||||||
|
let saw_comment = 0
|
||||||
|
for lnum in range(1, min([line("$"), 100]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*/\*'
|
||||||
|
let saw_comment = 1
|
||||||
|
endif
|
||||||
|
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
|
||||||
|
set ft=objc | return
|
||||||
|
endif
|
||||||
|
if line =~# '^\s*%'
|
||||||
|
set ft=octave | return
|
||||||
|
endif
|
||||||
|
if line =~# '^\s*(\*'
|
||||||
|
set ft=mma | return
|
||||||
|
endif
|
||||||
|
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
|
||||||
|
set ft=murphi | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if saw_comment
|
||||||
|
set ft=objc | return
|
||||||
|
endif
|
||||||
|
if exists("g:filetype_m")
|
||||||
|
let &ft = g:filetype_m | return
|
||||||
|
endif
|
||||||
|
set ft=octave | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Fs()
|
||||||
|
for lnum in range(1, min([line("$"), 50]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\(: \|new-device\)'
|
||||||
|
set ft=forth | return
|
||||||
|
endif
|
||||||
|
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
|
||||||
|
set ft=fsharp | return
|
||||||
|
endif
|
||||||
|
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
|
||||||
|
set ft=glsl | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:filetype_fs")
|
||||||
|
let &ft = g:filetype_fs | return
|
||||||
|
endif
|
||||||
|
set ft=forth | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#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*<\)'
|
||||||
|
set ft=cpp | return
|
||||||
|
endif
|
||||||
|
set ft=reason | return
|
||||||
|
endfor
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Idr()
|
||||||
|
for lnum in range(1, min([line("$"), 5]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*--.*[Ii]dris \=1'
|
||||||
|
set ft=idris | return
|
||||||
|
endif
|
||||||
|
if line =~# '^\s*--.*[Ii]dris \=2'
|
||||||
|
set ft=idris2 | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
for lnum in range(1, min([line("$"), 30]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^pkgs =.*'
|
||||||
|
set ft=idris | return
|
||||||
|
endif
|
||||||
|
if line =~# '^depends =.*'
|
||||||
|
set ft=idris2 | return
|
||||||
|
endif
|
||||||
|
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
|
||||||
|
set ft=idris | return
|
||||||
|
endif
|
||||||
|
if line =~# '^%language PostfixProjections'
|
||||||
|
set ft=idris2 | return
|
||||||
|
endif
|
||||||
|
if line =~# '^%access .*'
|
||||||
|
set ft=idris | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:filetype_idr")
|
||||||
|
let &ft = g:filetype_idr | return
|
||||||
|
endif
|
||||||
|
set ft=idris2 | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Lidr()
|
||||||
|
for lnum in range(1, min([line("$"), 200]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^>\s*--.*[Ii]dris \=1'
|
||||||
|
set ft=lidris | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
set ft=lidris2 | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Bas()
|
||||||
|
for lnum in range(1, min([line("$"), 5]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
||||||
|
set ft=vb | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
set ft=basic | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Pm()
|
||||||
|
let line = getline(nextnonblank(1))
|
||||||
|
if line =~# 'XPM2'
|
||||||
|
set ft=xpm2 | return
|
||||||
|
endif
|
||||||
|
if line =~# 'XPM'
|
||||||
|
set ft=xpm | return
|
||||||
|
endif
|
||||||
|
for lnum in range(1, min([line("$"), 50]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||||
|
set ft=raku | return
|
||||||
|
endif
|
||||||
|
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||||
|
set ft=perl | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:filetype_pm")
|
||||||
|
let &ft = g:filetype_pm | return
|
||||||
|
endif
|
||||||
|
if polyglot#shebang#Detect() | return | endif
|
||||||
|
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pm()
|
||||||
|
return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Pl()
|
||||||
|
let line = getline(nextnonblank(1))
|
||||||
|
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
|
||||||
|
set ft=prolog | return
|
||||||
|
endif
|
||||||
|
for lnum in range(1, min([line("$"), 50]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||||
|
set ft=raku | return
|
||||||
|
endif
|
||||||
|
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||||
|
set ft=perl | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:filetype_pl")
|
||||||
|
let &ft = g:filetype_pl | return
|
||||||
|
endif
|
||||||
|
if polyglot#shebang#Detect() | return | endif
|
||||||
|
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pl()
|
||||||
|
return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#T()
|
||||||
|
for lnum in range(1, min([line("$"), 5]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\.'
|
||||||
|
set ft=nroff | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
for lnum in range(1, min([line("$"), 50]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
|
||||||
|
set ft=raku | return
|
||||||
|
endif
|
||||||
|
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
|
||||||
|
set ft=perl | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if exists("g:filetype_t")
|
||||||
|
let &ft = g:filetype_t | return
|
||||||
|
endif
|
||||||
|
if polyglot#shebang#Detect() | return | endif
|
||||||
|
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#T()
|
||||||
|
return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Tt2()
|
||||||
|
for lnum in range(1, min([line("$"), 3]))
|
||||||
|
let line = getline(lnum)
|
||||||
|
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
|
||||||
|
set ft=tt2html | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
set ft=tt2 | return
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func! polyglot#detect#Html()
|
||||||
|
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\)\(\<\|\>\)\|{#\s\+'
|
||||||
|
set ft=htmldjango | return
|
||||||
|
endif
|
||||||
|
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
|
||||||
|
set ft=xhtml | return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
set ft=html | au BufWritePost <buffer> ++once call polyglot#detect#Html()
|
||||||
|
return
|
||||||
|
endfunc
|
||||||
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,3 +1,5 @@
|
|||||||
|
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||||
|
|
||||||
let s:globs = {
|
let s:globs = {
|
||||||
\ '8th': '*.8th',
|
\ '8th': '*.8th',
|
||||||
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
|
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
|
||||||
@@ -45,6 +47,7 @@ let s:globs = {
|
|||||||
\ 'clojure': '*.clj,*.boot,*.cl2,*.cljc,*.cljs,*.cljs.hl,*.cljscm,*.cljx,*.hic,*.edn,riemann.config,build.boot,profile.boot',
|
\ 'clojure': '*.clj,*.boot,*.cl2,*.cljc,*.cljs,*.cljs.hl,*.cljscm,*.cljx,*.hic,*.edn,riemann.config,build.boot,profile.boot',
|
||||||
\ 'cmake': '*.cmake,*.cmake.in,CMakeLists.txt',
|
\ 'cmake': '*.cmake,*.cmake.in,CMakeLists.txt',
|
||||||
\ 'coffee': '*.coffee,*._coffee,*.cake,*.cjsx,*.iced,*.coffeekup,Cakefile',
|
\ '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',
|
\ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp,*.moc,*.tlh',
|
||||||
\ 'cql': '*.cql',
|
\ 'cql': '*.cql',
|
||||||
\ 'cryptol': '*.cry,*.cyl,*.lcry,*.lcyl',
|
\ 'cryptol': '*.cry,*.cyl,*.lcry,*.lcyl',
|
||||||
@@ -94,7 +97,7 @@ let s:globs = {
|
|||||||
\ 'groovy': '*.groovy,*.grt,*.gtpl,*.gvy,*.gradle,Jenkinsfile',
|
\ 'groovy': '*.groovy,*.grt,*.gtpl,*.gvy,*.gradle,Jenkinsfile',
|
||||||
\ 'grub': '',
|
\ 'grub': '',
|
||||||
\ 'haml': '*.haml,*.haml.deface,*.hamlc,*.hamlbars',
|
\ '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',
|
\ 'haskell': '*.hs,*.hs-boot,*.hsc,*.bpk,*.hsig',
|
||||||
\ 'haxe': '*.hx,*.hxsl',
|
\ 'haxe': '*.hx,*.hxsl',
|
||||||
\ 'hcl': '*.hcl,*.nomad,*.workflow,Appfile',
|
\ 'hcl': '*.hcl,*.nomad,*.workflow,Appfile',
|
||||||
@@ -111,7 +114,7 @@ let s:globs = {
|
|||||||
\ 'idris': '*.idr,*.lidr,idris-response',
|
\ 'idris': '*.idr,*.lidr,idris-response',
|
||||||
\ 'idris2': '*.idr,*.ipkg,idris-response',
|
\ 'idris2': '*.idr,*.ipkg,idris-response',
|
||||||
\ 'ion': '*.ion',
|
\ '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',
|
\ 'javascriptreact': '*.jsx',
|
||||||
\ 'jq': '*.jq,.jqrc,.jqrc*',
|
\ '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',
|
\ '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',
|
||||||
@@ -152,19 +155,19 @@ let s:globs = {
|
|||||||
\ 'omake': '*.om,OMakefile,OMakeroot,OMakeroot.in',
|
\ 'omake': '*.om,OMakefile,OMakeroot,OMakeroot.in',
|
||||||
\ 'opam': '*.opam,*.opam.template,opam',
|
\ 'opam': '*.opam,*.opam.template,opam',
|
||||||
\ 'opencl': '*.cl,*.opencl',
|
\ 'opencl': '*.cl,*.opencl',
|
||||||
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile',
|
\ '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,.php,.php_cs,.php_cs.dist,Phakefile',
|
\ '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',
|
\ 'plantuml': '*.puml,*.iuml,*.plantuml,*.uml,*.pu',
|
||||||
\ 'pod': '*.pod',
|
\ 'pod': '*.pod',
|
||||||
\ 'pony': '*.pony',
|
\ 'pony': '*.pony',
|
||||||
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap',
|
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap,*.pdb',
|
||||||
\ 'proto': '*.proto',
|
\ 'proto': '*.proto',
|
||||||
\ 'ps1': '*.ps1,*.psd1,*.psm1,*.pssc',
|
\ 'ps1': '*.ps1,*.psd1,*.psm1,*.pssc',
|
||||||
\ 'ps1xml': '*.ps1xml',
|
\ 'ps1xml': '*.ps1xml',
|
||||||
\ 'pug': '*.jade,*.pug',
|
\ 'pug': '*.jade,*.pug',
|
||||||
\ 'puppet': '*.pp,Modulefile',
|
\ 'puppet': '*.pp,Modulefile',
|
||||||
\ 'purescript': '*.purs',
|
\ 'purescript': '*.purs',
|
||||||
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,.gclient,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',
|
\ 'qmake': '*.pro,*.pri',
|
||||||
\ 'qml': '*.qml,*.qbs',
|
\ 'qml': '*.qml,*.qbs',
|
||||||
\ 'r': '*.r,*.rsx,*.s,*.S,.Rprofile,expr-dist',
|
\ 'r': '*.r,*.rsx,*.s,*.S,.Rprofile,expr-dist',
|
||||||
@@ -183,24 +186,24 @@ let s:globs = {
|
|||||||
\ 'scala': '*.scala,*.kojo,*.sc',
|
\ 'scala': '*.scala,*.kojo,*.sc',
|
||||||
\ 'scss': '*.scss',
|
\ 'scss': '*.scss',
|
||||||
\ 'sexplib': '*.sexp',
|
\ 'sexplib': '*.sexp',
|
||||||
\ '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',
|
\ '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',
|
\ 'slim': '*.slim',
|
||||||
\ 'slime': '*.slime',
|
\ 'slime': '*.slime',
|
||||||
\ 'smt2': '*.smt2,*.smt',
|
\ 'smt2': '*.smt2,*.smt',
|
||||||
\ 'solidity': '*.sol',
|
\ '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',
|
\ 'stylus': '*.styl,*.stylus',
|
||||||
\ 'svelte': '*.svelte',
|
\ 'svelte': '*.svelte',
|
||||||
\ 'svg': '*.svg',
|
\ 'svg': '*.svg',
|
||||||
\ 'swift': '*.swift',
|
\ 'swift': '*.swift',
|
||||||
\ 'sxhkdrc': '*.sxhkdrc,sxhkdrc',
|
\ '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',
|
\ 'tablegen': '*.td',
|
||||||
\ 'tads': '*.t',
|
\ 'tads': '*.t',
|
||||||
\ 'terraform': '*.hcl,*.nomad,*.tf,*.tfvars,*.workflow',
|
\ 'terraform': '*.tf,*.tfvars',
|
||||||
\ 'textile': '*.textile',
|
\ 'textile': '*.textile',
|
||||||
\ 'thrift': '*.thrift',
|
\ 'thrift': '*.thrift',
|
||||||
\ 'tmux': '.tmux.conf',
|
\ 'tmux': '.tmux*.conf',
|
||||||
\ 'toml': '*.toml,Cargo.lock,Gopkg.lock,poetry.lock,Pipfile',
|
\ 'toml': '*.toml,Cargo.lock,Gopkg.lock,poetry.lock,Pipfile',
|
||||||
\ 'tptp': '*.p,*.tptp,*.ax',
|
\ 'tptp': '*.p,*.tptp,*.ax',
|
||||||
\ 'trasys': '*.inp',
|
\ 'trasys': '*.inp',
|
||||||
@@ -218,7 +221,7 @@ let s:globs = {
|
|||||||
\ 'vmasm': '*.mar',
|
\ 'vmasm': '*.mar',
|
||||||
\ 'vue': '*.vue,*.wpy',
|
\ 'vue': '*.vue,*.wpy',
|
||||||
\ 'xdc': '*.xdc',
|
\ '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,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,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',
|
\ 'xml.twig': '*.xml.twig',
|
||||||
\ 'xs': '*.xs',
|
\ 'xs': '*.xs',
|
||||||
\ 'xsl': '*.xslt,*.xsl',
|
\ 'xsl': '*.xslt,*.xsl',
|
||||||
@@ -228,9 +231,9 @@ let s:globs = {
|
|||||||
\ 'zephir': '*.zep',
|
\ 'zephir': '*.zep',
|
||||||
\ 'zig': '*.zig,*.zir',
|
\ 'zig': '*.zig,*.zir',
|
||||||
\ 'zir': '*.zir',
|
\ 'zir': '*.zir',
|
||||||
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout',
|
\ '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, '')
|
return get(s:globs, a:type, '')
|
||||||
endfunc
|
endfunc
|
||||||
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
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
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||||
|
|
||||||
" Vim filetype plugin
|
" Vim filetype plugin
|
||||||
" Language: LessCSS
|
" Language: less
|
||||||
" Author: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
||||||
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
" URL: https://github.com/genoma/vim-less
|
||||||
" Last Change: 2011 Sep 30
|
" Last Change: 2014 November 24
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin")
|
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<"
|
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
|
||||||
|
|
||||||
setlocal iskeyword+=-
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
setlocal commentstring=//%s
|
|
||||||
setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
setlocal comments=:// commentstring=//\ %s
|
||||||
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
|
||||||
setlocal omnifunc=csscomplete#CompleteCSS
|
setlocal omnifunc=csscomplete#CompleteCSS
|
||||||
setlocal suffixesadd=.less
|
setlocal suffixesadd=.less
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,://
|
|
||||||
setlocal fo=croql
|
|
||||||
|
|
||||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
|
||||||
|
|
||||||
" vim:set sw=2:
|
|
||||||
|
|
||||||
endif
|
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
|
filetype: perl
|
||||||
- override: true
|
- override: true
|
||||||
- filetype: perl
|
- filetype: perl
|
||||||
|
shebang: true
|
||||||
|
fallback: true
|
||||||
---
|
---
|
||||||
extensions: [pl]
|
extensions: [pl]
|
||||||
rules:
|
rules:
|
||||||
@@ -149,6 +151,8 @@ rules:
|
|||||||
filetype: perl
|
filetype: perl
|
||||||
- override: true
|
- override: true
|
||||||
- filetype: perl
|
- filetype: perl
|
||||||
|
shebang: true
|
||||||
|
fallback: true
|
||||||
---
|
---
|
||||||
extensions: [t]
|
extensions: [t]
|
||||||
rules:
|
rules:
|
||||||
@@ -166,6 +170,8 @@ rules:
|
|||||||
# filetype: turing
|
# filetype: turing
|
||||||
- override: true
|
- override: true
|
||||||
- filetype: perl
|
- filetype: perl
|
||||||
|
shebang: true
|
||||||
|
fallback: true
|
||||||
---
|
---
|
||||||
extensions: [tt2]
|
extensions: [tt2]
|
||||||
rules:
|
rules:
|
||||||
@@ -182,7 +188,7 @@ rules:
|
|||||||
filetype: mason
|
filetype: mason
|
||||||
- lines: 50
|
- lines: 50
|
||||||
rules:
|
rules:
|
||||||
- pattern: '{{.*}}|{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
|
- pattern: '{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
|
||||||
filetype: htmldjango
|
filetype: htmldjango
|
||||||
- pattern: '\bDTD\s+XHTML\s'
|
- pattern: '\bDTD\s+XHTML\s'
|
||||||
filetype: xhtml
|
filetype: xhtml
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
||||||
|
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: LessCSS
|
" Language: less
|
||||||
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
|
||||||
" Last Change: 2011 Sep 26
|
" URL: https://github.com/genoma/vim-less
|
||||||
|
" Last Change: 2014 November 24
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! indent/css.vim
|
runtime! indent/css.vim
|
||||||
|
|
||||||
|
" vim:set sw=2:
|
||||||
|
|
||||||
endif
|
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
|
||||||
131
packages.yaml
131
packages.yaml
@@ -10,8 +10,6 @@ filetypes:
|
|||||||
name: a2ps
|
name: a2ps
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
glob: '**/a2ps.vim'
|
glob: '**/a2ps.vim'
|
||||||
after:
|
|
||||||
- haproxy
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: a2ps
|
- name: a2ps
|
||||||
filenames:
|
filenames:
|
||||||
@@ -142,7 +140,6 @@ filetypes:
|
|||||||
name: ant
|
name: ant
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
glob: '**/ant.vim'
|
glob: '**/ant.vim'
|
||||||
after: xml
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: ant
|
- name: ant
|
||||||
filenames:
|
filenames:
|
||||||
@@ -210,7 +207,7 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: arduino
|
name: arduino
|
||||||
remote: sudar/vim-arduino-syntax
|
remote: sudar/vim-arduino-syntax
|
||||||
after: c/c++
|
dependencies: c/c++
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: arduino
|
- name: arduino
|
||||||
linguist: Processing
|
linguist: Processing
|
||||||
@@ -240,7 +237,6 @@ filetypes:
|
|||||||
name: automake
|
name: automake
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
glob: '**/automake.vim'
|
glob: '**/automake.vim'
|
||||||
after: elf
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: automake
|
- name: automake
|
||||||
filenames:
|
filenames:
|
||||||
@@ -260,7 +256,6 @@ name: aspvbs
|
|||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
globs:
|
globs:
|
||||||
- '**/aspvbs.vim'
|
- '**/aspvbs.vim'
|
||||||
dependencies:
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: aspvbs
|
- name: aspvbs
|
||||||
extensions:
|
extensions:
|
||||||
@@ -271,7 +266,6 @@ name: aspperl
|
|||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
globs:
|
globs:
|
||||||
- '**/aspperl.vim'
|
- '**/aspperl.vim'
|
||||||
dependencies:
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: aspperl
|
- name: aspperl
|
||||||
extensions:
|
extensions:
|
||||||
@@ -327,8 +321,8 @@ filetypes:
|
|||||||
- ino
|
- ino
|
||||||
ignored_warnings:
|
ignored_warnings:
|
||||||
# TODO: fix these
|
# TODO: fix these
|
||||||
- C
|
- '*.C'
|
||||||
- H
|
- '*.H'
|
||||||
- name: c
|
- name: c
|
||||||
linguist: C
|
linguist: C
|
||||||
extra_extensions:
|
extra_extensions:
|
||||||
@@ -347,7 +341,7 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: cpp-modern
|
name: cpp-modern
|
||||||
remote: bfrg/vim-cpp-modern
|
remote: bfrg/vim-cpp-modern
|
||||||
after: c/c++
|
dependencies: c/c++
|
||||||
filetypes: []
|
filetypes: []
|
||||||
---
|
---
|
||||||
name: carp
|
name: carp
|
||||||
@@ -389,9 +383,9 @@ filetypes:
|
|||||||
# Probably mistake
|
# Probably mistake
|
||||||
- '*Cakefile'
|
- '*Cakefile'
|
||||||
# Used by C#
|
# Used by C#
|
||||||
- csx
|
- '*.csx'
|
||||||
# Used by Chuck
|
# Used by Chuck
|
||||||
- ck
|
- '*.ck'
|
||||||
- name: litcoffee
|
- name: litcoffee
|
||||||
linguist: Literate CoffeeScript
|
linguist: Literate CoffeeScript
|
||||||
extra_extensions:
|
extra_extensions:
|
||||||
@@ -433,7 +427,7 @@ filetypes:
|
|||||||
- tab
|
- tab
|
||||||
ignored_warnings:
|
ignored_warnings:
|
||||||
# This is definitely not csv-only, maybe re-enable when heuristics done
|
# This is definitely not csv-only, maybe re-enable when heuristics done
|
||||||
- dat
|
- '*.dat'
|
||||||
---
|
---
|
||||||
name: cucumber
|
name: cucumber
|
||||||
remote: tpope/vim-cucumber
|
remote: tpope/vim-cucumber
|
||||||
@@ -590,7 +584,6 @@ name: fsharp
|
|||||||
remote: ionide/Ionide-vim
|
remote: ionide/Ionide-vim
|
||||||
ignored_dirs:
|
ignored_dirs:
|
||||||
- ftplugin
|
- ftplugin
|
||||||
after: glsl
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: fsharp
|
- name: fsharp
|
||||||
linguist: F#
|
linguist: F#
|
||||||
@@ -681,7 +674,8 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: graphql
|
name: graphql
|
||||||
remote: jparise/vim-graphql
|
remote: jparise/vim-graphql
|
||||||
after: [javascript, jsx]
|
dependencies: javascript
|
||||||
|
after: jsx
|
||||||
ignored_dirs:
|
ignored_dirs:
|
||||||
# TODO: remove after bug is fixed:
|
# TODO: remove after bug is fixed:
|
||||||
# https://github.com/jparise/vim-graphql/issues/62
|
# https://github.com/jparise/vim-graphql/issues/62
|
||||||
@@ -692,7 +686,7 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: gradle
|
name: gradle
|
||||||
remote: tfnico/vim-gradle
|
remote: tfnico/vim-gradle
|
||||||
after: groovy
|
dependencies: groovy
|
||||||
# Just adds compiler
|
# Just adds compiler
|
||||||
filetypes: []
|
filetypes: []
|
||||||
---
|
---
|
||||||
@@ -708,7 +702,6 @@ filetypes:
|
|||||||
name: grub
|
name: grub
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
glob: '**/grub.vim'
|
glob: '**/grub.vim'
|
||||||
after: dlang
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: grub
|
- name: grub
|
||||||
filenames:
|
filenames:
|
||||||
@@ -747,6 +740,8 @@ filetypes:
|
|||||||
- name: haproxy
|
- name: haproxy
|
||||||
linguist: HAProxy
|
linguist: HAProxy
|
||||||
extra_filenames:
|
extra_filenames:
|
||||||
|
- 'haproxy*.conf*'
|
||||||
|
ignored_warnings:
|
||||||
- 'haproxy*.c*'
|
- 'haproxy*.c*'
|
||||||
---
|
---
|
||||||
name: haskell
|
name: haskell
|
||||||
@@ -850,13 +845,15 @@ ignored_dirs:
|
|||||||
filetypes:
|
filetypes:
|
||||||
- name: javascript
|
- name: javascript
|
||||||
linguist: JavaScript
|
linguist: JavaScript
|
||||||
|
extra_extensions:
|
||||||
|
- javascript
|
||||||
- name: flow
|
- name: flow
|
||||||
extensions:
|
extensions:
|
||||||
- flow
|
- flow
|
||||||
---
|
---
|
||||||
name: javascript-sql
|
name: javascript-sql
|
||||||
remote: statico/vim-javascript-sql
|
remote: statico/vim-javascript-sql
|
||||||
after: javascript
|
dependencies: javascript
|
||||||
filetypes: []
|
filetypes: []
|
||||||
---
|
---
|
||||||
name: jenkins
|
name: jenkins
|
||||||
@@ -924,12 +921,12 @@ filetypes:
|
|||||||
- ect
|
- ect
|
||||||
ignored_warnings:
|
ignored_warnings:
|
||||||
# I haven't found reference to them on github
|
# I haven't found reference to them on github
|
||||||
- djs
|
- '*.djs'
|
||||||
- hamljs
|
- '*.hamljs'
|
||||||
---
|
---
|
||||||
name: jsx
|
name: jsx
|
||||||
remote: MaxMEllon/vim-jsx-pretty
|
remote: MaxMEllon/vim-jsx-pretty
|
||||||
after: javascript
|
dependencies: javascript
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: javascriptreact
|
- name: javascriptreact
|
||||||
linguist: JSX
|
linguist: JSX
|
||||||
@@ -958,10 +955,8 @@ filetypes:
|
|||||||
- journal
|
- journal
|
||||||
---
|
---
|
||||||
name: less
|
name: less
|
||||||
remote: groenewege/vim-less
|
remote: vim/vim:runtime
|
||||||
ignored_dirs:
|
glob: '**/less.vim'
|
||||||
# We don't want to slow down .html files
|
|
||||||
- after
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: less
|
- name: less
|
||||||
linguist: Less
|
linguist: Less
|
||||||
@@ -1042,7 +1037,7 @@ filetypes:
|
|||||||
# Handled by mdx extension
|
# Handled by mdx extension
|
||||||
- mdx
|
- mdx
|
||||||
ignored_warnings:
|
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
|
name: mdx
|
||||||
remote: jxnblk/vim-mdx-js
|
remote: jxnblk/vim-mdx-js
|
||||||
@@ -1158,7 +1153,7 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: octave
|
name: octave
|
||||||
remote: McSinyx/vim-octave
|
remote: McSinyx/vim-octave
|
||||||
after: mathematica
|
dependencies: mathematica
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: octave
|
- name: octave
|
||||||
extensions:
|
extensions:
|
||||||
@@ -1176,6 +1171,9 @@ remote: vim-perl/vim-perl
|
|||||||
filetypes:
|
filetypes:
|
||||||
- name: perl
|
- name: perl
|
||||||
linguist: Perl
|
linguist: Perl
|
||||||
|
extra_filenames:
|
||||||
|
- example.gitolite.rc
|
||||||
|
- .gitolite.rc
|
||||||
- name: pod
|
- name: pod
|
||||||
extensions:
|
extensions:
|
||||||
- pod
|
- pod
|
||||||
@@ -1215,10 +1213,12 @@ remote: StanAngeloff/php.vim
|
|||||||
filetypes:
|
filetypes:
|
||||||
- name: php
|
- name: php
|
||||||
linguist: PHP
|
linguist: PHP
|
||||||
|
extra_extensions:
|
||||||
|
- phtml
|
||||||
---
|
---
|
||||||
name: blade
|
name: blade
|
||||||
remote: jwalton512/vim-blade
|
remote: jwalton512/vim-blade
|
||||||
after: php
|
dependencies: php
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: blade
|
- name: blade
|
||||||
linguist: Blade
|
linguist: Blade
|
||||||
@@ -1240,7 +1240,6 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: powershell
|
name: powershell
|
||||||
remote: PProvost/vim-ps1
|
remote: PProvost/vim-ps1
|
||||||
after: xml
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: ps1
|
- name: ps1
|
||||||
linguist: PowerShell
|
linguist: PowerShell
|
||||||
@@ -1284,6 +1283,11 @@ filetypes:
|
|||||||
linguist: Python
|
linguist: Python
|
||||||
ignored_filenames:
|
ignored_filenames:
|
||||||
- 'lit.*cfg'
|
- 'lit.*cfg'
|
||||||
|
extra_extensions:
|
||||||
|
- ptl
|
||||||
|
extra_filenames:
|
||||||
|
- '.pythonrc'
|
||||||
|
- '.pythonstartup'
|
||||||
---
|
---
|
||||||
name: python-indent
|
name: python-indent
|
||||||
remote: Vimjas/vim-python-pep8-indent
|
remote: Vimjas/vim-python-pep8-indent
|
||||||
@@ -1378,7 +1382,6 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: reason
|
name: reason
|
||||||
remote: reasonml-editor/vim-reason-plus
|
remote: reasonml-editor/vim-reason-plus
|
||||||
after: c/c++
|
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: reason
|
- name: reason
|
||||||
linguist: Reason
|
linguist: Reason
|
||||||
@@ -1487,11 +1490,9 @@ filetypes:
|
|||||||
- '.zlogin'
|
- '.zlogin'
|
||||||
- '.zprofile'
|
- '.zprofile'
|
||||||
- '.zlogout'
|
- '.zlogout'
|
||||||
- 'zshrc'
|
# Udev symlinks config
|
||||||
- 'zshenv'
|
extra_filenames:
|
||||||
- 'zlogin'
|
- '*/etc/udev/cdsymlinks.conf'
|
||||||
- 'zprofile'
|
|
||||||
- 'zlogout'
|
|
||||||
- name: zsh
|
- name: zsh
|
||||||
extensions:
|
extensions:
|
||||||
- zsh
|
- zsh
|
||||||
@@ -1501,6 +1502,10 @@ filetypes:
|
|||||||
- '.zlogin'
|
- '.zlogin'
|
||||||
- '.zprofile'
|
- '.zprofile'
|
||||||
- '.zlogout'
|
- '.zlogout'
|
||||||
|
- '.zlog*'
|
||||||
|
- '.zcompdump*'
|
||||||
|
- '.zfbfmarks'
|
||||||
|
- '.zsh*'
|
||||||
---
|
---
|
||||||
name: zinit
|
name: zinit
|
||||||
remote: zinit-zsh/zplugin-vim-syntax
|
remote: zinit-zsh/zplugin-vim-syntax
|
||||||
@@ -1580,19 +1585,30 @@ filetypes:
|
|||||||
- name: systemd
|
- name: systemd
|
||||||
extensions:
|
extensions:
|
||||||
- automount
|
- automount
|
||||||
|
- dnssd
|
||||||
|
- link
|
||||||
- mount
|
- mount
|
||||||
|
- netdev
|
||||||
|
- network
|
||||||
|
- nspawn
|
||||||
- path
|
- path
|
||||||
- service
|
- service
|
||||||
|
- slice
|
||||||
- socket
|
- socket
|
||||||
- swap
|
- swap
|
||||||
- target
|
- target
|
||||||
- timer
|
- timer
|
||||||
|
filenames:
|
||||||
|
- '*.#*'
|
||||||
|
- '*/systemd/*.conf'
|
||||||
---
|
---
|
||||||
name: terraform
|
name: terraform
|
||||||
remote: hashivim/vim-terraform
|
remote: hashivim/vim-terraform
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: terraform
|
- name: terraform
|
||||||
linguist: HCL
|
extensions:
|
||||||
|
- tf
|
||||||
|
- tfvars
|
||||||
---
|
---
|
||||||
name: textile
|
name: textile
|
||||||
remote: timcharper/textile.vim
|
remote: timcharper/textile.vim
|
||||||
@@ -1611,7 +1627,7 @@ remote: ericpruitt/tmux.vim:vim
|
|||||||
filetypes:
|
filetypes:
|
||||||
- name: tmux
|
- name: tmux
|
||||||
filenames:
|
filenames:
|
||||||
- '.tmux.conf'
|
- '.tmux*.conf'
|
||||||
---
|
---
|
||||||
name: toml
|
name: toml
|
||||||
remote: cespare/vim-toml
|
remote: cespare/vim-toml
|
||||||
@@ -1639,9 +1655,9 @@ filetypes:
|
|||||||
linguist: Twig
|
linguist: Twig
|
||||||
ignored_warnings:
|
ignored_warnings:
|
||||||
# handled by other extension
|
# handled by other extension
|
||||||
- xml.twig
|
- '*.xml.twig'
|
||||||
# already covered by .twig
|
# already covered by .twig
|
||||||
- html.twig
|
- '*.html.twig'
|
||||||
- name: xml.twig
|
- name: xml.twig
|
||||||
extensions:
|
extensions:
|
||||||
- xml.twig
|
- xml.twig
|
||||||
@@ -1728,9 +1744,16 @@ filetypes:
|
|||||||
- tpm
|
- tpm
|
||||||
- csproj.user
|
- csproj.user
|
||||||
- wpl
|
- wpl
|
||||||
|
extra_filenames:
|
||||||
|
- '*/etc/blkid.tab'
|
||||||
|
- '*/etc/blkid.tab.old'
|
||||||
|
- '*/etc/xdg/menus/*.menu'
|
||||||
|
- '*fglrxrc'
|
||||||
ignored_extensions:
|
ignored_extensions:
|
||||||
- ts
|
- ts
|
||||||
- tsx
|
- tsx
|
||||||
|
# handled by powershell plugin
|
||||||
|
- ps1xml
|
||||||
---
|
---
|
||||||
name: xsl
|
name: xsl
|
||||||
remote: vim-scripts/XSLT-syntax
|
remote: vim-scripts/XSLT-syntax
|
||||||
@@ -1754,7 +1777,7 @@ filetypes:
|
|||||||
---
|
---
|
||||||
name: ansible
|
name: ansible
|
||||||
remote: pearofducks/ansible-vim
|
remote: pearofducks/ansible-vim
|
||||||
after: yaml
|
dependencies: yaml
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: yaml.ansible
|
- name: yaml.ansible
|
||||||
filenames:
|
filenames:
|
||||||
@@ -1832,7 +1855,7 @@ filetypes:
|
|||||||
# SaxBasic is close to Visual Basic
|
# SaxBasic is close to Visual Basic
|
||||||
- sba
|
- sba
|
||||||
ignored_warnings:
|
ignored_warnings:
|
||||||
- vb
|
- '*.vb'
|
||||||
---
|
---
|
||||||
name: dosini
|
name: dosini
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
@@ -1849,8 +1872,6 @@ filetypes:
|
|||||||
- '*/etc/yum.repos.d/*'
|
- '*/etc/yum.repos.d/*'
|
||||||
ignored_extensions:
|
ignored_extensions:
|
||||||
- cfg
|
- cfg
|
||||||
ignored_warnings:
|
|
||||||
- php.ini
|
|
||||||
---
|
---
|
||||||
name: odin
|
name: odin
|
||||||
remote: Tetralux/odin.vim
|
remote: Tetralux/odin.vim
|
||||||
@@ -1874,6 +1895,8 @@ glob: '**/prolog.vim'
|
|||||||
filetypes:
|
filetypes:
|
||||||
- name: prolog
|
- name: prolog
|
||||||
linguist: Prolog
|
linguist: Prolog
|
||||||
|
extra_extensions:
|
||||||
|
- pdb
|
||||||
---
|
---
|
||||||
name: tads
|
name: tads
|
||||||
remote: vim/vim:runtime
|
remote: vim/vim:runtime
|
||||||
@@ -1891,3 +1914,25 @@ filetypes:
|
|||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
- '*/.config/git/ignore'
|
- '*/.config/git/ignore'
|
||||||
- '*.git/info/exclude'
|
- '*.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
|
||||||
|
|||||||
379
polyglot.vim
379
polyglot.vim
@@ -1,379 +0,0 @@
|
|||||||
""" autoload/polyglot.vim
|
|
||||||
|
|
||||||
" Line continuation is used here, remove 'C' from 'cpoptions'
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
func! polyglot#Shebang()
|
|
||||||
if getline(1) =~# "^#!"
|
|
||||||
let ft = polyglot#ShebangFiletype()
|
|
||||||
if ft != ""
|
|
||||||
let &ft = ft
|
|
||||||
endif
|
|
||||||
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! 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
|
|
||||||
|
|
||||||
" scripts/build generates heuristics functions here
|
|
||||||
|
|
||||||
" Restore 'cpoptions'
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
unlet s:cpo_save
|
|
||||||
|
|
||||||
""" ftdetect/polyglot.vim
|
|
||||||
|
|
||||||
" don't spam the user when Vim is started in Vi compatibility mode
|
|
||||||
let s:cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
" Disable all native vim ftdetect
|
|
||||||
if exists('g:polyglot_test')
|
|
||||||
autocmd!
|
|
||||||
endif
|
|
||||||
|
|
||||||
func! s:Observe(fn)
|
|
||||||
let b:polyglot_observe = a:fn
|
|
||||||
augroup polyglot-observer
|
|
||||||
au! CursorHold,CursorHoldI,BufWritePost <buffer>
|
|
||||||
\ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
|
|
||||||
augroup END
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
let s:disabled_packages = {}
|
|
||||||
let s:new_polyglot_disabled = []
|
|
||||||
|
|
||||||
if exists('g:polyglot_disabled')
|
|
||||||
for pkg in g:polyglot_disabled
|
|
||||||
let base = split(pkg, '\.')
|
|
||||||
if len(base) > 0
|
|
||||||
let s:disabled_packages[pkg] = 1
|
|
||||||
call add(s:new_polyglot_disabled, base[0])
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
else
|
|
||||||
let g:polyglot_disabled_not_set = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:SetDefault(name, value)
|
|
||||||
if !exists(a:name)
|
|
||||||
let {a:name} = a:value
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call s:SetDefault('g:markdown_enable_spell_checking', 0)
|
|
||||||
call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
|
|
||||||
call s:SetDefault('g:markdown_enable_mappings', 0)
|
|
||||||
|
|
||||||
" Enable jsx syntax by default
|
|
||||||
call s:SetDefault('g:jsx_ext_required', 0)
|
|
||||||
|
|
||||||
" Needed for sql highlighting
|
|
||||||
call s:SetDefault('g:javascript_sql_dialect', 'sql')
|
|
||||||
|
|
||||||
" Make csv loading faster
|
|
||||||
call s:SetDefault('g:csv_start', 1)
|
|
||||||
call s:SetDefault('g:csv_end', 2)
|
|
||||||
|
|
||||||
" Disable json concealing by default
|
|
||||||
call s:SetDefault('g:vim_json_syntax_conceal', 0)
|
|
||||||
|
|
||||||
call s:SetDefault('g:filetype_euphoria', 'elixir')
|
|
||||||
|
|
||||||
if !exists('g:python_highlight_all')
|
|
||||||
call s:SetDefault('g:python_highlight_builtins', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_objs', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_types', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_funcs', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_exceptions', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_formatting', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_format', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_string_templates', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_indent_errors', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_space_errors', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_doctests', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_func_calls', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_class_vars', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_operators', 1)
|
|
||||||
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
|
|
||||||
call s:SetDefault('g:python_slow_sync', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" We need it because scripts.vim in vim uses "set ft=" which cannot be
|
|
||||||
" overridden with setf (and we can't use set ft= so our scripts.vim work)
|
|
||||||
func! s:Setf(ft)
|
|
||||||
if &filetype !~# '\<'.a:ft.'\>'
|
|
||||||
let &filetype = a:ft
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Function used for patterns that end in a star: don't set the filetype if the
|
|
||||||
" file name matches ft_ignore_pat.
|
|
||||||
" When using this, the entry should probably be further down below with the
|
|
||||||
" other StarSetf() calls.
|
|
||||||
func! s:StarSetf(ft)
|
|
||||||
if expand("<amatch>") !~ g:ft_ignore_pat && &filetype !~# '\<'.a:ft.'\>'
|
|
||||||
let &filetype = a:ft
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
augroup filetypedetect
|
|
||||||
|
|
||||||
" scripts/build inserts here filetype detection autocommands
|
|
||||||
|
|
||||||
au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat |
|
|
||||||
\ call polyglot#Shebang() | endif
|
|
||||||
|
|
||||||
au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat |
|
|
||||||
\ call s:Observe('Shebang') | endif
|
|
||||||
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
if !has_key(s:disabled_packages, 'autoindent')
|
|
||||||
" Code below re-implements sleuth for vim-polyglot
|
|
||||||
let g:loaded_sleuth = 1
|
|
||||||
let g:loaded_foobar = 1
|
|
||||||
|
|
||||||
" Makes shiftwidth to be synchronized with tabstop by default
|
|
||||||
if &shiftwidth == &tabstop
|
|
||||||
let &shiftwidth = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:guess(lines) abort
|
|
||||||
let options = {}
|
|
||||||
let ccomment = 0
|
|
||||||
let podcomment = 0
|
|
||||||
let triplequote = 0
|
|
||||||
let backtick = 0
|
|
||||||
let xmlcomment = 0
|
|
||||||
let heredoc = ''
|
|
||||||
let minindent = 10
|
|
||||||
let spaces_minus_tabs = 0
|
|
||||||
let i = 0
|
|
||||||
|
|
||||||
for line in a:lines
|
|
||||||
let i += 1
|
|
||||||
|
|
||||||
if !len(line) || line =~# '^\W*$'
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^\s*/\*'
|
|
||||||
let ccomment = 1
|
|
||||||
endif
|
|
||||||
if ccomment
|
|
||||||
if line =~# '\*/'
|
|
||||||
let ccomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^=\w'
|
|
||||||
let podcomment = 1
|
|
||||||
endif
|
|
||||||
if podcomment
|
|
||||||
if line =~# '^=\%(end\|cut\)\>'
|
|
||||||
let podcomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if triplequote
|
|
||||||
if line =~# '^[^"]*"""[^"]*$'
|
|
||||||
let triplequote = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
elseif line =~# '^[^"]*"""[^"]*$'
|
|
||||||
let triplequote = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if backtick
|
|
||||||
if line =~# '^[^`]*`[^`]*$'
|
|
||||||
let backtick = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
elseif &filetype ==# 'go' && line =~# '^[^`]*`[^`]*$'
|
|
||||||
let backtick = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if line =~# '^\s*<\!--'
|
|
||||||
let xmlcomment = 1
|
|
||||||
endif
|
|
||||||
if xmlcomment
|
|
||||||
if line =~# '-->'
|
|
||||||
let xmlcomment = 0
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
" This is correct order because both "<<EOF" and "EOF" matches end
|
|
||||||
if heredoc != ''
|
|
||||||
if line =~# heredoc
|
|
||||||
let heredoc = ''
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
let herematch = matchlist(line, '\C<<\W*\([A-Z]\+\)\s*$')
|
|
||||||
if len(herematch) > 0
|
|
||||||
let heredoc = herematch[1] . '$'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let spaces_minus_tabs += line[0] == "\t" ? 1 : -1
|
|
||||||
|
|
||||||
if line[0] == "\t"
|
|
||||||
setlocal noexpandtab
|
|
||||||
let &l:shiftwidth=&tabstop
|
|
||||||
let b:sleuth_culprit .= ':' . i
|
|
||||||
return 1
|
|
||||||
elseif line[0] == " "
|
|
||||||
let indent = len(matchstr(line, '^ *'))
|
|
||||||
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent
|
|
||||||
let minindent = indent
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
if minindent < 10
|
|
||||||
setlocal expandtab
|
|
||||||
let &l:shiftwidth=minindent
|
|
||||||
let b:sleuth_culprit .= ':' . i
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:detect_indent() abort
|
|
||||||
if &buftype ==# 'help'
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:sleuth_culprit = expand("<afile>:p")
|
|
||||||
if s:guess(getline(1, 32))
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let pattern = sleuth#GlobForFiletype(&filetype)
|
|
||||||
if len(pattern) == 0
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let pattern = '{' . pattern . ',.git,.svn,.hg}'
|
|
||||||
let dir = expand('%:p:h')
|
|
||||||
let level = 3
|
|
||||||
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
|
|
||||||
" Ignore files from homedir and root
|
|
||||||
if dir == expand('~') || dir == '/'
|
|
||||||
unlet b:sleuth_culprit
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
|
|
||||||
let b:sleuth_culprit = neighbor
|
|
||||||
" Do not consider directories above .git, .svn or .hg
|
|
||||||
if fnamemodify(neighbor, ":h:t")[0] == "."
|
|
||||||
let level = 0
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if neighbor !=# expand('%:p') && filereadable(neighbor)
|
|
||||||
if s:guess(readfile(neighbor, '', 32))
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let dir = fnamemodify(dir, ':h')
|
|
||||||
let level -= 1
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
unlet b:sleuth_culprit
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
setglobal smarttab
|
|
||||||
|
|
||||||
function! SleuthIndicator() abort
|
|
||||||
let sw = &shiftwidth ? &shiftwidth : &tabstop
|
|
||||||
if &expandtab
|
|
||||||
return 'sw='.sw
|
|
||||||
elseif &tabstop == sw
|
|
||||||
return 'ts='.&tabstop
|
|
||||||
else
|
|
||||||
return 'sw='.sw.',ts='.&tabstop
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
augroup polyglot-sleuth
|
|
||||||
au!
|
|
||||||
au FileType * call s:detect_indent()
|
|
||||||
au User Flags call Hoist('buffer', 5, 'SleuthIndicator')
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
command! -bar -bang Sleuth call s:detect_indent()
|
|
||||||
endif
|
|
||||||
|
|
||||||
func! s:verify()
|
|
||||||
if exists("g:polyglot_disabled_not_set")
|
|
||||||
if exists("g:polyglot_disabled")
|
|
||||||
echohl WarningMsg
|
|
||||||
echo "vim-polyglot: g:polyglot_disabled should be defined before loading vim-polyglot"
|
|
||||||
echohl None
|
|
||||||
endif
|
|
||||||
|
|
||||||
unlet g:polyglot_disabled_not_set
|
|
||||||
endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
au VimEnter * call s:verify()
|
|
||||||
|
|
||||||
" Save polyglot_disabled without postfixes
|
|
||||||
if exists('g:polyglot_disabled')
|
|
||||||
let g:polyglot_disabled = s:new_polyglot_disabled
|
|
||||||
endif
|
|
||||||
|
|
||||||
" restore Vi compatibility settings
|
|
||||||
let &cpo = s:cpo_save
|
|
||||||
|
|
||||||
""" end
|
|
||||||
310
scripts/build
310
scripts/build
@@ -12,11 +12,6 @@ Dir.chdir(File.dirname(__dir__))
|
|||||||
|
|
||||||
BASE_URL = 'https://raw.githubusercontent.com/github/linguist/master'
|
BASE_URL = 'https://raw.githubusercontent.com/github/linguist/master'
|
||||||
|
|
||||||
def read_section(name)
|
|
||||||
"\" Please do not edit this file directly, instead modify polyglot.vim or scripts/build\n\n" +
|
|
||||||
File.read('polyglot.vim').match(/""" #{Regexp.escape(name)}\n*(.*)\n(?=\n""")/m)[1]
|
|
||||||
end
|
|
||||||
|
|
||||||
def camelize(str)
|
def camelize(str)
|
||||||
str.split(/[-_\.]/).map { |a| a.capitalize }.join("")
|
str.split(/[-_\.]/).map { |a| a.capitalize }.join("")
|
||||||
end
|
end
|
||||||
@@ -27,23 +22,81 @@ def except(hash, *keys)
|
|||||||
h
|
h
|
||||||
end
|
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()
|
def load_data()
|
||||||
packages = Hash[YAML.load_stream(File.read('packages.yaml'))
|
packages = load_packages
|
||||||
.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) }
|
|
||||||
|
|
||||||
languages = load_languages
|
languages = load_languages
|
||||||
|
heuristics = load_heuristics
|
||||||
|
|
||||||
# Reason can have ocaml as interpreter but let's not depend on it...
|
# Reason can have ocaml as interpreter but let's not depend on it...
|
||||||
languages["Reason"]["interpreters"] -= ["ocaml"]
|
languages["Reason"]["interpreters"] -= ["ocaml"]
|
||||||
|
|
||||||
packages = TSort.tsort(each_node, each_child).map { |a| packages[a] }
|
|
||||||
|
|
||||||
for package in packages
|
for package in packages
|
||||||
for filetype in package["filetypes"]
|
for filetype in package["filetypes"]
|
||||||
if filetype["linguist"]
|
if filetype["linguist"]
|
||||||
@@ -90,7 +143,9 @@ def load_data()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
heuristics = YAML.load_stream(File.read('heuristics.yaml'))
|
verify(packages, heuristics)
|
||||||
|
|
||||||
|
packages = sort_packages(packages)
|
||||||
|
|
||||||
[packages, transform_patterns(heuristics)]
|
[packages, transform_patterns(heuristics)]
|
||||||
end
|
end
|
||||||
@@ -144,6 +199,14 @@ def load_languages
|
|||||||
YAML.load(File.read(file))
|
YAML.load(File.read(file))
|
||||||
end
|
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)
|
def parse_remote(remote)
|
||||||
match = remote.match(/(?<repo>[^@:]+)(?:@(?<branch>[^:]+))?(?::(?<path>.*))?/)
|
match = remote.match(/(?<repo>[^@:]+)(?:@(?<branch>[^:]+))?(?::(?<path>.*))?/)
|
||||||
dir = "tmp/" + match[:repo] + (match[:branch] ? "-#{match[:branch]}" : "")
|
dir = "tmp/" + match[:repo] + (match[:branch] ? "-#{match[:branch]}" : "")
|
||||||
@@ -322,10 +385,17 @@ def rule_to_code(rule)
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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?("filetype")
|
||||||
if rule.has_key?("fallback")
|
if rule.has_key?("fallback")
|
||||||
return <<~EOS
|
return <<~EOS
|
||||||
set ft=#{rule["filetype"]} | au! BufWritePost <buffer> ++once call polyglot#Detect#{camelize(rule["extensions"].first)}Filetype()
|
set ft=#{rule["filetype"]} | au BufWritePost <buffer> ++once call polyglot#detect##{camelize(rule["extensions"].first)}()
|
||||||
return
|
return
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
@@ -353,7 +423,7 @@ def rule_to_code(rule)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def extract(packages)
|
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(
|
default_dirs = %w(
|
||||||
syntax indent doc compiler autoload ftplugin ctags extras
|
syntax indent doc compiler autoload ftplugin ctags extras
|
||||||
@@ -362,6 +432,12 @@ def extract(packages)
|
|||||||
|
|
||||||
FileUtils.rm_rf(all_dirs)
|
FileUtils.rm_rf(all_dirs)
|
||||||
|
|
||||||
|
for dir in Dir.glob("*", base: "autoload")
|
||||||
|
if dir != "polyglot"
|
||||||
|
FileUtils.rm_rf("autoload/" + dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
packages.map do |package|
|
packages.map do |package|
|
||||||
repo, branch, path, dir = parse_remote(package["remote"])
|
repo, branch, path, dir = parse_remote(package["remote"])
|
||||||
@@ -421,21 +497,10 @@ def extract(packages)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generate_ftdetect(packages, heuristics)
|
def generate_ftdetect(packages, heuristics)
|
||||||
|
FileUtils.mkdir_p('autoload/polyglot')
|
||||||
|
|
||||||
output = "\n"
|
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"] || [] }
|
all_filetypes = packages.flat_map { |f| f["filetypes"] || [] }
|
||||||
filetype_names = Set.new(all_filetypes.map { |f| f["name"] })
|
filetype_names = Set.new(all_filetypes.map { |f| f["name"] })
|
||||||
|
|
||||||
@@ -447,43 +512,18 @@ def generate_ftdetect(packages, heuristics)
|
|||||||
native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
|
native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
|
||||||
native_filenames = Set.new(native_filetypes.flat_map { |f| f["filenames"] || [] })
|
native_filenames = Set.new(native_filetypes.flat_map { |f| f["filenames"] || [] })
|
||||||
|
|
||||||
for package in packages
|
# Because we're using setf we need to reverse order
|
||||||
name = package.fetch("name")
|
for package in packages.reverse
|
||||||
|
|
||||||
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
|
|
||||||
filetypes = package["filetypes"] or raise "Unknown filetype for: #{package["name"]}"
|
filetypes = package["filetypes"] or raise "Unknown filetype for: #{package["name"]}"
|
||||||
|
|
||||||
package_heuristics = []
|
package_heuristics = []
|
||||||
|
|
||||||
autocommands = ""
|
autocommands = []
|
||||||
for filetype in filetypes
|
for filetype in filetypes
|
||||||
name = filetype.fetch("name")
|
name = filetype.fetch("name")
|
||||||
syntax = filetype["syntax"] ? " | set syntax=#{filetype["syntax"]}" : ""
|
syntax = filetype["syntax"] ? " | set syntax=#{filetype["syntax"]}" : ""
|
||||||
|
|
||||||
set_command = "set ft=#{name}"
|
set_command = "setf #{name}"
|
||||||
|
|
||||||
if filetype["syntax"]
|
if filetype["syntax"]
|
||||||
set_command = "set ft=#{name} syntax=#{filetype["syntax"]}"
|
set_command = "set ft=#{name} syntax=#{filetype["syntax"]}"
|
||||||
@@ -496,6 +536,8 @@ def generate_ftdetect(packages, heuristics)
|
|||||||
extensions = filetype["extensions"]
|
extensions = filetype["extensions"]
|
||||||
filenames = filetype["filenames"]
|
filenames = filetype["filenames"]
|
||||||
|
|
||||||
|
set_globs = []
|
||||||
|
|
||||||
for extension in extensions.sort
|
for extension in extensions.sort
|
||||||
outer_filetype = filetype["outer_filetype"]
|
outer_filetype = filetype["outer_filetype"]
|
||||||
if outer_filetype
|
if outer_filetype
|
||||||
@@ -507,11 +549,7 @@ def generate_ftdetect(packages, heuristics)
|
|||||||
if heuristic
|
if heuristic
|
||||||
package_heuristics << heuristic
|
package_heuristics << heuristic
|
||||||
else
|
else
|
||||||
# if ambiguous_extensions.include?(extension)
|
set_globs << "*." + extension
|
||||||
# puts "Ambiguous extension without heuristic: #{extension} => #{filetype["name"]}"
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
autocommands << " au BufNewFile,BufRead *.#{extension} #{set_command}\n"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -522,48 +560,52 @@ def generate_ftdetect(packages, heuristics)
|
|||||||
if filename[-1] == "*"
|
if filename[-1] == "*"
|
||||||
autocommands << " au BufNewFile,BufRead #{filename} call s:StarSetf('#{name}')\n"
|
autocommands << " au BufNewFile,BufRead #{filename} call s:StarSetf('#{name}')\n"
|
||||||
else
|
else
|
||||||
autocommands << " au BufNewFile,BufRead #{filename} #{set_command}\n"
|
set_globs << filename
|
||||||
end
|
|
||||||
end
|
end
|
||||||
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
|
for heuristic in package_heuristics.uniq
|
||||||
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
|
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
|
end
|
||||||
|
|
||||||
if autocommands != ""
|
if autocommands != ""
|
||||||
output << "if !has_key(s:disabled_packages, '#{package["name"]}')\n"
|
output << "if !has_key(s:disabled_packages, '#{package["name"]}')\n"
|
||||||
output << autocommands
|
output << autocommands.reverse.join("")
|
||||||
output << "endif\n\n"
|
output << "endif\n\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defined_extensions = all_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
|
show_warnings(all_filetypes, expected_filetypes)
|
||||||
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] } }
|
ftdetect = File.read('filetype.vim')
|
||||||
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] } }
|
|
||||||
|
|
||||||
ignored_warnings = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_warnings", [])).map { |e| [f["name"], e] } + [f, "*"] }
|
starting = '" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE'
|
||||||
|
ending = '" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE'
|
||||||
for name, e in expected_extensions - defined_extensions - ignored_extensions - ignored_warnings
|
|
||||||
puts "Missing extension for #{name}: #{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
for name, e in expected_filenames - defined_filenames - ignored_filenames - ignored_warnings
|
|
||||||
puts "Missing filename for #{name}: #{e}"
|
|
||||||
end
|
|
||||||
|
|
||||||
ftdetect = read_section('ftdetect/polyglot.vim')
|
|
||||||
|
|
||||||
File.write(
|
File.write(
|
||||||
'ftdetect/polyglot.vim',
|
'filetype.vim',
|
||||||
ftdetect.gsub('" scripts/build inserts here filetype detection autocommands') { output }
|
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
|
||||||
|
|
||||||
|
File.write('autoload/polyglot/detect.vim', output.join("\n"))
|
||||||
|
|
||||||
output = <<~EOS
|
output = <<~EOS
|
||||||
let s:interpreters = {
|
let s:interpreters = {
|
||||||
EOS
|
EOS
|
||||||
@@ -574,24 +616,15 @@ def generate_ftdetect(packages, heuristics)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
output << <<~EOS
|
output << " \\ }"
|
||||||
\\ }
|
|
||||||
|
|
||||||
EOS
|
inject_code('autoload/polyglot/shebang.vim', output)
|
||||||
|
end
|
||||||
|
|
||||||
for heuristic in heuristics
|
def inject_code(path, code)
|
||||||
output << <<~EOS
|
header = "\" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE\n"
|
||||||
func! polyglot#Detect#{camelize(heuristic["extensions"].first)}Filetype()
|
normal, generated = File.read(path).split(header)
|
||||||
#{indent(rules_to_code(heuristic), 2)}
|
File.write(path, [normal, generated].join(header))
|
||||||
endfunc
|
|
||||||
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
autoload_script = read_section('autoload/polyglot.vim')
|
|
||||||
autoload_script["\" scripts/build generates heuristics functions here\n"] = output
|
|
||||||
|
|
||||||
File.write('autoload/polyglot.vim', autoload_script)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_tests(packages)
|
def generate_tests(packages)
|
||||||
@@ -650,14 +683,32 @@ def comma_expanson(s)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def expand_all(pattern)
|
def expand_all(pattern, all = false)
|
||||||
|
if !pattern
|
||||||
|
return []
|
||||||
|
end
|
||||||
|
|
||||||
if pattern.is_a?(Array)
|
if pattern.is_a?(Array)
|
||||||
return pattern.flat_map { |p| expand_all(p) }
|
return pattern.flat_map { |p| expand_all(p, all) }
|
||||||
end
|
end
|
||||||
|
|
||||||
comma_expanson(pattern).flat_map do |e|
|
comma_expanson(pattern).flat_map do |e|
|
||||||
brace_expansion(e).flat_map do |e2|
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -690,7 +741,11 @@ def detect_filetypes(glob)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generate_plugins(packages)
|
def generate_plugins(packages)
|
||||||
output = "let s:globs = {\n"
|
output = <<~EOS
|
||||||
|
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
|
||||||
|
|
||||||
|
let s:globs = {
|
||||||
|
EOS
|
||||||
|
|
||||||
patterns = Hash.new { |h, k| h[k] = [] }
|
patterns = Hash.new { |h, k| h[k] = [] }
|
||||||
|
|
||||||
@@ -710,13 +765,46 @@ def generate_plugins(packages)
|
|||||||
|
|
||||||
|
|
||||||
output << <<~EOS
|
output << <<~EOS
|
||||||
func! sleuth#GlobForFiletype(type)
|
func! polyglot#sleuth#GlobForFiletype(type)
|
||||||
return get(s:globs, a:type, '')
|
return get(s:globs, a:type, '')
|
||||||
endfunc
|
endfunc
|
||||||
EOS
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ def run_vimscript(src)
|
|||||||
func! Log(msg)
|
func! Log(msg)
|
||||||
if $DEV != '1'
|
if $DEV != '1'
|
||||||
echo a:msg
|
echo a:msg
|
||||||
else
|
|
||||||
echon '.'
|
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
EOM
|
EOM
|
||||||
|
|||||||
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
|
||||||
@@ -1,68 +1,83 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
|
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")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! syntax/css.vim
|
runtime! syntax/css.vim
|
||||||
runtime! after/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 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 region lessDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
|
||||||
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 match lessOperator "+" contained
|
syn match lessProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=lessCssAttribute contained containedin=lessDefinition
|
||||||
syn match lessOperator "-" contained
|
syn match lessProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
||||||
syn match lessOperator "/" contained
|
syn match lessProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
|
||||||
syn match lessOperator "*" contained
|
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
|
" less variables and media queries
|
||||||
syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
|
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
|
" Less id class visualization
|
||||||
syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
|
syn match lessIdChar "#[[:alnum:]_-]\@=" nextgroup=lessId,lessClassIdCall
|
||||||
|
syn match lessId "[[:alnum:]_-]\+" contained
|
||||||
|
syn match lessClassIdCall "[[:alnum:]_-]\+()" contained
|
||||||
|
|
||||||
|
syn match lessClassChar "\.[[:alnum:]_-]\@=" nextgroup=lessClass,lessClassCall
|
||||||
syn match lessClass "[[:alnum:]_-]\+" contained
|
syn match lessClass "[[:alnum:]_-]\+" contained
|
||||||
|
syn match lessClassCall "[[:alnum:]_-]\+()" contained
|
||||||
|
|
||||||
" functions {{{
|
syn match lessAmpersand "&" contains=lessIdChar,lessClassChar
|
||||||
|
|
||||||
" string functions
|
syn region lessInclude start="@import" end=";\|$" contains=lessComment,cssURL,cssUnicodeEscape,cssMediaType,cssStringQ,cssStringQQ
|
||||||
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 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
|
||||||
|
|
||||||
syn match lessComment "//.*$" contains=@Spell
|
hi def link lessEndOfLineComment lessComment
|
||||||
|
hi def link lessCssComment lessComment
|
||||||
hi def link lessVariable Special
|
|
||||||
hi def link lessVariableValue Constant
|
|
||||||
hi def link lessDefault Special
|
|
||||||
hi def link lessComment Comment
|
hi def link lessComment Comment
|
||||||
hi def link lessFunction Function
|
hi def link lessDefault cssImportant
|
||||||
hi def link lessMixinChar Special
|
hi def link lessVariable Identifier
|
||||||
hi def link lessAmpersandChar Special
|
hi def link lessFunction PreProc
|
||||||
hi def link lessNestedProperty Type
|
hi def link lessTodo Todo
|
||||||
hi def link lessClass PreProc
|
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"
|
let b:current_syntax = "less"
|
||||||
|
|
||||||
|
" vim:set sw=2:
|
||||||
|
|
||||||
endif
|
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 . ')...')
|
call Log('Detecting ' . a:filetype . ' filetype (' . a:filename . ')...')
|
||||||
|
|
||||||
try
|
try
|
||||||
|
set shortmess+=F
|
||||||
let g:message = ""
|
let g:message = ""
|
||||||
exec "noautocmd n " . a:filename
|
exec "noautocmd n " . a:filename
|
||||||
silent put =a:content
|
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", "bash4", "#!/usr/bin/env bash")
|
||||||
call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo")
|
call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo")
|
||||||
call TestExtension("sh", "bash1", "#!/bin/bash")
|
call TestExtension("sh", "bash1", "#!/bin/bash")
|
||||||
|
" This is defined only by vim-native scripts.vim for now
|
||||||
|
call TestExtension("sh", "bash7", ":")
|
||||||
|
|
||||||
" Vim help file
|
" Vim help file
|
||||||
call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "")
|
call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "")
|
||||||
@@ -363,11 +366,22 @@ call TestExtension("tt2html", "html.tt2", "<html>")
|
|||||||
call TestExtension("html", "empty.html", "")
|
call TestExtension("html", "empty.html", "")
|
||||||
call TestExtension("mason", "mason1.html", "% my $planet = 42;")
|
call TestExtension("mason", "mason1.html", "% my $planet = 42;")
|
||||||
call TestExtension("mason", "mason2.html", "<%filter></%filter>")
|
call TestExtension("mason", "mason2.html", "<%filter></%filter>")
|
||||||
call TestExtension("htmldjango", "jinja1.html", "{{ item.href }}")
|
|
||||||
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
|
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
|
||||||
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
|
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
|
||||||
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
||||||
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
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
|
" .gitignore
|
||||||
call TestExtension("gitignore", ".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
|
endfunction
|
||||||
|
|
||||||
call TestFiletype('8th')
|
call TestFiletype('8th')
|
||||||
|
call TestFiletype('conf')
|
||||||
call TestFiletype('haproxy')
|
call TestFiletype('haproxy')
|
||||||
call TestFiletype('a2ps')
|
call TestFiletype('a2ps')
|
||||||
call TestFiletype('a65')
|
call TestFiletype('a65')
|
||||||
@@ -22,6 +23,7 @@ call TestFiletype('aidl')
|
|||||||
call TestFiletype('alsaconf')
|
call TestFiletype('alsaconf')
|
||||||
call TestFiletype('aml')
|
call TestFiletype('aml')
|
||||||
call TestFiletype('ampl')
|
call TestFiletype('ampl')
|
||||||
|
call TestFiletype('csv')
|
||||||
call TestFiletype('xml')
|
call TestFiletype('xml')
|
||||||
call TestFiletype('ant')
|
call TestFiletype('ant')
|
||||||
call TestFiletype('apache')
|
call TestFiletype('apache')
|
||||||
@@ -53,7 +55,6 @@ call TestFiletype('litcoffee')
|
|||||||
call TestFiletype('cryptol')
|
call TestFiletype('cryptol')
|
||||||
call TestFiletype('crystal')
|
call TestFiletype('crystal')
|
||||||
call TestFiletype('ecrystal')
|
call TestFiletype('ecrystal')
|
||||||
call TestFiletype('csv')
|
|
||||||
call TestFiletype('cucumber')
|
call TestFiletype('cucumber')
|
||||||
call TestFiletype('cuesheet')
|
call TestFiletype('cuesheet')
|
||||||
call TestFiletype('dart')
|
call TestFiletype('dart')
|
||||||
@@ -63,6 +64,7 @@ call TestFiletype('dcov')
|
|||||||
call TestFiletype('dd')
|
call TestFiletype('dd')
|
||||||
call TestFiletype('ddoc')
|
call TestFiletype('ddoc')
|
||||||
call TestFiletype('dsdl')
|
call TestFiletype('dsdl')
|
||||||
|
call TestFiletype('yaml')
|
||||||
call TestFiletype('Dockerfile')
|
call TestFiletype('Dockerfile')
|
||||||
call TestFiletype('yaml.docker-compose')
|
call TestFiletype('yaml.docker-compose')
|
||||||
call TestFiletype('elixir')
|
call TestFiletype('elixir')
|
||||||
@@ -76,13 +78,13 @@ call TestFiletype('ferm')
|
|||||||
call TestFiletype('fish')
|
call TestFiletype('fish')
|
||||||
call TestFiletype('fbs')
|
call TestFiletype('fbs')
|
||||||
call TestFiletype('forth')
|
call TestFiletype('forth')
|
||||||
call TestFiletype('glsl')
|
|
||||||
call TestFiletype('fsharp')
|
call TestFiletype('fsharp')
|
||||||
call TestFiletype('gdscript3')
|
call TestFiletype('gdscript3')
|
||||||
call TestFiletype('gitconfig')
|
call TestFiletype('gitconfig')
|
||||||
call TestFiletype('gitrebase')
|
call TestFiletype('gitrebase')
|
||||||
call TestFiletype('gitsendemail')
|
call TestFiletype('gitsendemail')
|
||||||
call TestFiletype('gitcommit')
|
call TestFiletype('gitcommit')
|
||||||
|
call TestFiletype('glsl')
|
||||||
call TestFiletype('gmpl')
|
call TestFiletype('gmpl')
|
||||||
call TestFiletype('gnuplot')
|
call TestFiletype('gnuplot')
|
||||||
call TestFiletype('go')
|
call TestFiletype('go')
|
||||||
@@ -221,7 +223,6 @@ call TestFiletype('vmasm')
|
|||||||
call TestFiletype('vue')
|
call TestFiletype('vue')
|
||||||
call TestFiletype('xdc')
|
call TestFiletype('xdc')
|
||||||
call TestFiletype('xsl')
|
call TestFiletype('xsl')
|
||||||
call TestFiletype('yaml')
|
|
||||||
call TestFiletype('yaml.ansible')
|
call TestFiletype('yaml.ansible')
|
||||||
call TestFiletype('helm')
|
call TestFiletype('helm')
|
||||||
call TestFiletype('help')
|
call TestFiletype('help')
|
||||||
@@ -237,3 +238,4 @@ call TestFiletype('bzl')
|
|||||||
call TestFiletype('prolog')
|
call TestFiletype('prolog')
|
||||||
call TestFiletype('tads')
|
call TestFiletype('tads')
|
||||||
call TestFiletype('gitignore')
|
call TestFiletype('gitignore')
|
||||||
|
call TestFiletype('sql')
|
||||||
|
|||||||
Reference in New Issue
Block a user