diff options
Diffstat (limited to 'autoload')
60 files changed, 123 insertions, 468 deletions
diff --git a/autoload/LaTeXtoUnicode.vim b/autoload/LaTeXtoUnicode.vim index f498e5df..bf0c7cc2 100644 --- a/autoload/LaTeXtoUnicode.vim +++ b/autoload/LaTeXtoUnicode.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/LaTeXtoUnicode.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('julia', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Support for LaTex-to-Unicode conversion as in the Julia REPL " @@ -659,5 +654,3 @@ function! LaTeXtoUnicode#Toggle() endif return '' endfunction - -endif diff --git a/autoload/RstFold.vim b/autoload/RstFold.vim index 926bc1b9..f340565b 100644 --- a/autoload/RstFold.vim +++ b/autoload/RstFold.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/RstFold.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rst', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1 " Author: Antony Lee <anntzer.lee@gmail.com> " Description: Helper functions for reStructuredText syntax folding @@ -69,5 +64,3 @@ function RstFold#GetRstFoldText() let text = thisline =~ '^\([=`:.''"~^_*+#-]\)\1\+$' ? getline(v:foldstart + 1) : thisline return indent . text endfunction - -endif diff --git a/autoload/ada.vim b/autoload/ada.vim index 9a01456c..e54d05e2 100644 --- a/autoload/ada.vim +++ b/autoload/ada.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/ada.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('ada', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ada') == -1 "------------------------------------------------------------------------------ " Description: Perform Ada specific completion & tagging. @@ -644,5 +639,3 @@ finish " 1}}} "------------------------------------------------------------------------------ " vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab " vim: foldmethod=marker - -endif diff --git a/autoload/cargo.vim b/autoload/cargo.vim index 068cfa89..232dca79 100644 --- a/autoload/cargo.vim +++ b/autoload/cargo.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/cargo.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 function! cargo#Load() " Utility call to get this script loaded, for debugging @@ -154,5 +149,3 @@ function! cargo#runtarget(args) endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/cargo/quickfix.vim b/autoload/cargo/quickfix.vim index 7f3fffa1..536e09e8 100644 --- a/autoload/cargo/quickfix.vim +++ b/autoload/cargo/quickfix.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/cargo/quickfix.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 function! cargo#quickfix#CmdPre() abort if &filetype ==# 'rust' && get(b:, 'current_compiler', '') ==# 'cargo' && @@ -34,5 +29,3 @@ function! cargo#quickfix#CmdPost() abort endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/clojurecomplete.vim b/autoload/clojurecomplete.vim index 02857c7b..ebecd5cd 100644 --- a/autoload/clojurecomplete.vim +++ b/autoload/clojurecomplete.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/clojurecomplete.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('clojure', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1 " Vim completion script " Language: Clojure @@ -29,5 +24,3 @@ function! clojurecomplete#Complete(findstart, base) endfunction " vim:sts=8:sw=8:ts=8:noet - -endif diff --git a/autoload/coffee.vim b/autoload/coffee.vim index 0388a589..12ea3f97 100644 --- a/autoload/coffee.vim +++ b/autoload/coffee.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/coffee.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('coffee-script', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'coffee-script') == -1 " Language: CoffeeScript " Maintainer: Mick Koch <mick@kochm.co> @@ -61,5 +56,3 @@ function! coffee#CoffeeSetUpErrorFormat() \%f:%l:%c:\ error:\ %m, \%-G%.%# endfunction - -endif diff --git a/autoload/crystal/indent.vim b/autoload/crystal/indent.vim index fbbf91fd..48887469 100644 --- a/autoload/crystal/indent.vim +++ b/autoload/crystal/indent.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/crystal/indent.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " Variables {{{1 " ========= @@ -1047,5 +1042,4 @@ endfunction " }}}1 -" vim:sw=2 sts=2 ts=8 fdm=marker et: -endif +" vim:sw=2 sts=2 ts=8 fdm=marker et:
\ No newline at end of file diff --git a/autoload/crystal_lang.vim b/autoload/crystal_lang.vim index 1a1ad421..87060a64 100644 --- a/autoload/crystal_lang.vim +++ b/autoload/crystal_lang.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/crystal_lang.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 let s:V = vital#crystal#new() let s:P = s:V.import('Process') @@ -370,5 +365,3 @@ function! crystal_lang#expand(file, pos, ...) abort endfunction " vim: sw=2 sts=2 et: - -endif diff --git a/autoload/csv.vim b/autoload/csv.vim index 692ec2a3..20b51923 100644 --- a/autoload/csv.vim +++ b/autoload/csv.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/csv.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('csv', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'csv') == -1 " Filetype plugin for editing CSV files. "{{{1 " Author: Christian Brabandt <cb@256bit.org> @@ -3203,5 +3198,3 @@ endfun " Vim Modeline " {{{2 " vim: set foldmethod=marker et sw=0 sts=-1 ts=4: - -endif diff --git a/autoload/dart.vim b/autoload/dart.vim index ccd29b44..1e2c0e07 100644 --- a/autoload/dart.vim +++ b/autoload/dart.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/dart.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('dart', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1 function! s:error(text) abort @@ -190,5 +185,3 @@ function! dart#setModifiable() abort setlocal nomodifiable endif endfunction - -endif diff --git a/autoload/db/adapter/ecto.vim b/autoload/db/adapter/ecto.vim index 7eca1262..af5da6ae 100644 --- a/autoload/db/adapter/ecto.vim +++ b/autoload/db/adapter/ecto.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/db/adapter/ecto.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('elixir', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 let s:path = expand('<sfile>:h') let s:cmd = join(['mix', 'run', '--no-start', '--no-compile', shellescape(s:path.'/get_repos.exs')]) @@ -27,5 +22,3 @@ endfunction function! db#adapter#ecto#complete_opaque(url) abort return map(s:repo_list(), 'v:val[0]') endfunction - -endif diff --git a/autoload/ecrystal.vim b/autoload/ecrystal.vim index 5225c753..43a49edd 100644 --- a/autoload/ecrystal.vim +++ b/autoload/ecrystal.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/ecrystal.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 let s:ecrystal_extensions = { \ 'cr': 'crystal', @@ -39,5 +34,3 @@ function! ecrystal#SetSubtype() abort endfunction " vim: sw=2 sts=2 et: - -endif diff --git a/autoload/elixir/indent.vim b/autoload/elixir/indent.vim index ccd02881..7286de16 100644 --- a/autoload/elixir/indent.vim +++ b/autoload/elixir/indent.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/elixir/indent.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('elixir', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 if !exists("g:elixir_indent_max_lookbehind") let g:elixir_indent_max_lookbehind = 30 @@ -378,5 +373,3 @@ function! elixir#indent#handle_inside_generic_block(context) return -1 endif endfunction - -endif diff --git a/autoload/elixir/util.vim b/autoload/elixir/util.vim index 7acc8814..e5c660f3 100644 --- a/autoload/elixir/util.vim +++ b/autoload/elixir/util.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/elixir/util.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('elixir', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 function! elixir#util#get_filename(word) abort let word = a:word @@ -31,5 +26,3 @@ function! elixir#util#get_filename(word) abort return word endfunction - -endif diff --git a/autoload/fish.vim b/autoload/fish.vim index fb2dda13..c9b498a8 100644 --- a/autoload/fish.vim +++ b/autoload/fish.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/fish.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('fish', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1 function! fish#Indent() let l:prevlnum = prevnonblank(v:lnum - 1) @@ -92,5 +87,3 @@ endfunction function! fish#errorformat() return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s' endfunction - -endif diff --git a/autoload/fsharp.vim b/autoload/fsharp.vim index 0331814c..525952ba 100644 --- a/autoload/fsharp.vim +++ b/autoload/fsharp.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/fsharp.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('fsharp', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fsharp') == -1 " Vim autoload functions @@ -520,5 +515,3 @@ let &cpo = s:cpo_save unlet s:cpo_save " vim: sw=4 et sts=4 - -endif diff --git a/autoload/fzf_gitignore.vim b/autoload/fzf_gitignore.vim index bd90be48..f7914f24 100644 --- a/autoload/fzf_gitignore.vim +++ b/autoload/fzf_gitignore.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/fzf_gitignore.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('gitignore', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1 scriptencoding utf-8 @@ -44,5 +39,3 @@ function! fzf_gitignore#run() abort endfunction " vim: ts=2 et sw=2 - -endif diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 3ddde740..d11bc8d9 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/go/config.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('go', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 " don't spam the user when Vim is started in Vi compatibility mode let s:cpo_save = &cpo @@ -630,5 +625,3 @@ let &cpo = s:cpo_save unlet s:cpo_save " vim: sw=2 ts=2 et - -endif diff --git a/autoload/graphql.vim b/autoload/graphql.vim index b5ddd9fa..b92751bb 100644 --- a/autoload/graphql.vim +++ b/autoload/graphql.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/graphql.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('graphql', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org> " @@ -42,5 +37,3 @@ endfunction function! graphql#javascript_tags() abort return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL']) endfunction - -endif diff --git a/autoload/htmlcomplete.vim b/autoload/htmlcomplete.vim index 7db1fdb9..5b1b4ac5 100644 --- a/autoload/htmlcomplete.vim +++ b/autoload/htmlcomplete.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/htmlcomplete.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('html5', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 " Vim completion script " Language: HTML and XHTML @@ -848,5 +843,3 @@ function! htmlcomplete#CheckDoctype() " {{{ endfunction " }}} " vim:set foldmethod=marker: - -endif diff --git a/autoload/jsonnet.vim b/autoload/jsonnet.vim index c05e2f86..b9386463 100644 --- a/autoload/jsonnet.vim +++ b/autoload/jsonnet.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/jsonnet.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('jsonnet', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jsonnet') == -1 @@ -132,5 +127,3 @@ function! jsonnet#Format() endfunction - -endif diff --git a/autoload/jsx_pretty/comment.vim b/autoload/jsx_pretty/comment.vim index 5a9db367..44dbf803 100644 --- a/autoload/jsx_pretty/comment.vim +++ b/autoload/jsx_pretty/comment.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/jsx_pretty/comment.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('jsx', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) function! jsx_pretty#comment#update_commentstring(original) let line = getline(".") @@ -44,5 +39,3 @@ function! s:syn_contains(lnum, cnum, syn_name) let syn_names = map(stack, 'synIDattr(v:val, "name")') return index(syn_names, a:syn_name) >= 0 endfunction - -endif diff --git a/autoload/jsx_pretty/indent.vim b/autoload/jsx_pretty/indent.vim index 34f88db0..3c5585a8 100644 --- a/autoload/jsx_pretty/indent.vim +++ b/autoload/jsx_pretty/indent.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/jsx_pretty/indent.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('jsx', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || (index(g:polyglot_disabled, 'javascript') == -1 && index(g:polyglot_disabled, 'jsx') == -1) if exists('*shiftwidth') function! s:sw() @@ -309,5 +304,3 @@ function! jsx_pretty#indent#get(js_indent) return a:js_indent() endfunction - -endif diff --git a/autoload/julia.vim b/autoload/julia.vim index d76454a4..e747028a 100644 --- a/autoload/julia.vim +++ b/autoload/julia.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/julia.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('julia', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 function! julia#set_syntax_version(jvers) echo "The julia#set_syntax_version function is deprecated" @@ -172,5 +167,3 @@ function! julia#gotodefinition() endfunction endif - -endif diff --git a/autoload/julia/doc.vim b/autoload/julia/doc.vim index e9e77d8c..258c0064 100644 --- a/autoload/julia/doc.vim +++ b/autoload/julia/doc.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/julia/doc.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('julia', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 " path to the julia binary to communicate with if has('win32') || has('win64') @@ -249,5 +244,3 @@ function! s:likely(str) abort let output = systemlist(cmd) return split(matchstr(output[0], '\C^search: \zs.*')) endfunction - -endif diff --git a/autoload/julia_blocks.vim b/autoload/julia_blocks.vim index 7dd87df9..6be2ba79 100644 --- a/autoload/julia_blocks.vim +++ b/autoload/julia_blocks.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/julia_blocks.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('julia', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 " Facilities for moving around Julia blocks (e.g. if/end, function/end etc.) " (AKA a collection of horrible hacks) @@ -801,5 +796,3 @@ function! s:cursor_moved(...) let b:jlblk_did_select = b:jlblk_doing_select let b:jlblk_doing_select = 0 endfunction - -endif diff --git a/autoload/julia_latex_symbols.vim b/autoload/julia_latex_symbols.vim index 5f4c9890..7f6fe007 100644 --- a/autoload/julia_latex_symbols.vim +++ b/autoload/julia_latex_symbols.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/julia_latex_symbols.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('julia', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 " This file is autogenerated from the script 'generate_latex_symbols_table.jl' " The symbols are based on Julia version 1.5.0-DEV.67 @@ -3339,5 +3334,3 @@ function! julia_latex_symbols#get_dict() \ '\:baggage_claim:': '🛄', \ '\:left_luggage:': '🛅'} endfunction - -endif diff --git a/autoload/ledger.vim b/autoload/ledger.vim index badcb175..5b3f2203 100644 --- a/autoload/ledger.vim +++ b/autoload/ledger.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/ledger.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('ledger', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ledger') == -1 scriptencoding utf-8 " vim:ts=2:sw=2:sts=2:foldmethod=marker @@ -747,5 +742,3 @@ function! ledger#show_balance(file, ...) abort endif endf " }}} - -endif diff --git a/autoload/nim.vim b/autoload/nim.vim index fdf990fc..7bdfa867 100644 --- a/autoload/nim.vim +++ b/autoload/nim.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/nim.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('nim', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1 let g:nim_log = [] let s:plugin_path = escape(expand('<sfile>:p:h'), '\') @@ -245,5 +240,3 @@ if exists('g:SyntasticRegistry') \ 'filetype': 'nim', \ 'name': 'nim'}) endif - -endif diff --git a/autoload/polyglot/util.vim b/autoload/polyglot/util.vim new file mode 100644 index 00000000..6d5caf88 --- /dev/null +++ b/autoload/polyglot/util.vim @@ -0,0 +1,64 @@ +" Restore 'cpoptions' +let s:cpo_save = &cpo +set cpo&vim + +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 + + +let s:base = expand('<sfile>:p:h:h:h') + +func polyglot#util#Filter(idx, val) + let val = fnamemodify(a:val . '/', ':p:h') + return resolve(val) !=? s:base && stridx(val, $VIMRUNTIME) == -1 && val !~? '/after$' +endfunc + +let s:rtp = join(filter(split(&rtp, ','), function('polyglot#util#Filter')), ',') + +func polyglot#util#IsEnabled(type, file) + if a:file != "ftdetect" + let file = a:file[len(s:base) + 1:] + let files = globpath(s:rtp, file, 1, 1) + if !empty(files) + exec 'source' files[0] + return 0 + endif + endif + if a:type == "jsx" + return !has_key(s:disabled_packages, "jsx") && !has_key(s:disabled_packages, "javascript") + endif + return !has_key(s:disabled_packages, a:type) +endfunc + +func! polyglot#util#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 + +" Save polyglot_disabled without postfixes +if exists('g:polyglot_disabled') + let g:polyglot_disabled = s:new_polyglot_disabled +endif + +" Restore 'cpoptions' +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/autoload/pony.vim b/autoload/pony.vim index 5f26c52b..78386b6b 100644 --- a/autoload/pony.vim +++ b/autoload/pony.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/pony.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('pony', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'pony') == -1 " Vim plugin file " Language: Pony @@ -539,5 +534,3 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save - -endif diff --git a/autoload/puppet/align.vim b/autoload/puppet/align.vim index 4fafac3d..51254120 100644 --- a/autoload/puppet/align.vim +++ b/autoload/puppet/align.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/puppet/align.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('puppet', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1 function! puppet#align#IndentLevel(lnum) return indent(a:lnum) / &shiftwidth @@ -75,5 +70,3 @@ function! puppet#align#AlignHashrockets(...) abort endif endfor endfunction - -endif diff --git a/autoload/puppet/ctags.vim b/autoload/puppet/ctags.vim index fad4f87a..a1d1577a 100644 --- a/autoload/puppet/ctags.vim +++ b/autoload/puppet/ctags.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/puppet/ctags.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('puppet', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1 if !exists('s:ctags_type') @@ -43,5 +38,3 @@ function! puppet#ctags#Type() return s:ctags_type endfunction - -endif diff --git a/autoload/puppet/format.vim b/autoload/puppet/format.vim index 94fe42e7..96b447b6 100644 --- a/autoload/puppet/format.vim +++ b/autoload/puppet/format.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/puppet/format.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('puppet', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1 " " Simple format using puppet's l:indents and align hashrockets function @@ -77,5 +72,3 @@ function! puppet#format#Fallback(start_lnum, end_lnum) abort endfunction - -endif diff --git a/autoload/python/utils.vim b/autoload/python/utils.vim index 4a02520d..4517f00d 100644 --- a/autoload/python/utils.vim +++ b/autoload/python/utils.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/python/utils.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('python-compiler', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'python-compiler') == -1 " Sometimes Python issues debugging messages " which don't belong to a call stack context @@ -24,5 +19,3 @@ function! python#utils#fix_qflist() " {{{ call setqflist(l:traceback) endif endfunction " }}} - -endif diff --git a/autoload/requirements.vim b/autoload/requirements.vim index e945a652..ad2e747a 100644 --- a/autoload/requirements.vim +++ b/autoload/requirements.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/requirements.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('requirements', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'requirements') == -1 " the Requirements File Format syntax support for Vim " Version: 1.5.3 @@ -39,5 +34,3 @@ set cpo&vim let &cpo = s:save_cpo unlet s:save_cpo " vim: et sw=4 ts=4 sts=4: - -endif diff --git a/autoload/rubycomplete.vim b/autoload/rubycomplete.vim index 0b8871cb..9551c965 100644 --- a/autoload/rubycomplete.vim +++ b/autoload/rubycomplete.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rubycomplete.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('ruby', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 " Vim completion script " Language: Ruby @@ -878,5 +873,3 @@ call s:DefRuby() "}}} ruby-side code " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: - -endif diff --git a/autoload/rust.vim b/autoload/rust.vim index b8bef48d..a8f5bfa3 100644 --- a/autoload/rust.vim +++ b/autoload/rust.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rust.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Description: Helper functions for Rust commands/mappings " Last Modified: May 27, 2014 @@ -577,5 +572,3 @@ endfunction " }}}1 " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/rust/debugging.vim b/autoload/rust/debugging.vim index d16380b5..9096333b 100644 --- a/autoload/rust/debugging.vim +++ b/autoload/rust/debugging.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rust/debugging.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " For debugging, inspired by https://github.com/w0rp/rust/blob/master/autoload/rust/debugging.vim @@ -110,5 +105,3 @@ function! rust#debugging#InfoToFile(filename) abort endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/rust/delimitmate.vim b/autoload/rust/delimitmate.vim index a60dece7..7d2d1817 100644 --- a/autoload/rust/delimitmate.vim +++ b/autoload/rust/delimitmate.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rust/delimitmate.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' @@ -51,5 +46,3 @@ endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/rust/tags.vim b/autoload/rust/tags.vim index 84388174..8ffa4d51 100644 --- a/autoload/rust/tags.vim +++ b/autoload/rust/tags.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rust/tags.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Tagbar support code, for the sake of not automatically overriding its " configuration in case Universal Ctags is detected. @@ -25,5 +20,3 @@ function! rust#tags#IsUCtags() abort endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim index 2e2a10da..81ebe56e 100644 --- a/autoload/rustfmt.vim +++ b/autoload/rustfmt.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/rustfmt.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('rust', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Author: Stephen Sugden <stephen@stephensugden.com> " @@ -267,5 +262,3 @@ endfunction " vim: set et sw=4 sts=4 ts=8: - -endif diff --git a/autoload/smt2.vim b/autoload/smt2.vim index 7a9fa7f8..0d328529 100644 --- a/autoload/smt2.vim +++ b/autoload/smt2.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/smt2.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('smt2', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'smt2') == -1 " Invokes the solver on current file function! smt2#RunSolver() @@ -37,5 +32,3 @@ function! smt2#PrintSolverVersion() silent !clear execute "!" . g:smt2_solver_command . " " . g:smt2_solver_version_switch endfunction - -endif diff --git a/autoload/terraform.vim b/autoload/terraform.vim index e780440b..7c4e33da 100644 --- a/autoload/terraform.vim +++ b/autoload/terraform.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/terraform.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('terraform', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1 let s:cpo_save = &cpoptions set cpoptions&vim @@ -86,5 +81,3 @@ endfunction let &cpoptions = s:cpo_save unlet s:cpo_save - -endif diff --git a/autoload/vital/_crystal.vim b/autoload/vital/_crystal.vim index b8ac5d32..b328af90 100644 --- a/autoload/vital/_crystal.vim +++ b/autoload/vital/_crystal.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 let s:_plugin_name = expand('<sfile>:t:r') @@ -16,5 +11,3 @@ endfunction function! vital#{s:_plugin_name}#function(funcname) abort silent! return function(a:funcname) endfunction - -endif diff --git a/autoload/vital/_crystal/ColorEcho.vim b/autoload/vital/_crystal/ColorEcho.vim index 59c0ec88..7180dce6 100644 --- a/autoload/vital/_crystal/ColorEcho.vim +++ b/autoload/vital/_crystal/ColorEcho.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal/ColorEcho.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " ___vital___ " NOTE: lines between '" ___vital___' is generated by :Vitalize. @@ -189,5 +184,3 @@ function! s:echo(str) abort let echorizer = s:get_echorizer(a:str) call echorizer.echo() endfunction - -endif diff --git a/autoload/vital/_crystal/Data/List.vim b/autoload/vital/_crystal/Data/List.vim index b2045a2a..68f87490 100644 --- a/autoload/vital/_crystal/Data/List.vim +++ b/autoload/vital/_crystal/Data/List.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal/Data/List.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " ___vital___ " NOTE: lines between '" ___vital___' is generated by :Vitalize. @@ -465,5 +460,3 @@ function! s:combinations(list, r) abort endfunction " vim:set et ts=2 sts=2 sw=2 tw=0: - -endif diff --git a/autoload/vital/_crystal/Data/String.vim b/autoload/vital/_crystal/Data/String.vim index 8f6ddf3e..67cd217c 100644 --- a/autoload/vital/_crystal/Data/String.vim +++ b/autoload/vital/_crystal/Data/String.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal/Data/String.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " ___vital___ " NOTE: lines between '" ___vital___' is generated by :Vitalize. @@ -629,5 +624,3 @@ function! s:split_posix_text(text, ...) abort endfunction " vim:set et ts=2 sts=2 sw=2 tw=0: - -endif diff --git a/autoload/vital/_crystal/Process.vim b/autoload/vital/_crystal/Process.vim index 315a4343..2da1a016 100644 --- a/autoload/vital/_crystal/Process.vim +++ b/autoload/vital/_crystal/Process.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal/Process.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " ___vital___ " NOTE: lines between '" ___vital___' is generated by :Vitalize. @@ -174,5 +169,3 @@ endif " vim:set et ts=2 sts=2 sw=2 tw=0: - -endif diff --git a/autoload/vital/_crystal/Web/JSON.vim b/autoload/vital/_crystal/Web/JSON.vim index c17269cf..a1d01238 100644 --- a/autoload/vital/_crystal/Web/JSON.vim +++ b/autoload/vital/_crystal/Web/JSON.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/_crystal/Web/JSON.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 " ___vital___ " NOTE: lines between '" ___vital___' is generated by :Vitalize. @@ -180,5 +175,3 @@ endfunction " @vimlint(EVL102, 0, l:ns) " vim:set et ts=2 sts=2 sw=2 tw=0: - -endif diff --git a/autoload/vital/crystal.vim b/autoload/vital/crystal.vim index 7674c4ef..68938d83 100644 --- a/autoload/vital/crystal.vim +++ b/autoload/vital/crystal.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/vital/crystal.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('crystal', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 let s:plugin_name = expand('<sfile>:t:r') let s:vital_base_dir = expand('<sfile>:h') @@ -335,5 +330,3 @@ else return a:list endfunction endif - -endif diff --git a/autoload/vital/crystal.vital b/autoload/vital/crystal.vital index 4a13eb01..0ad94eb5 100644 --- a/autoload/vital/crystal.vital +++ b/autoload/vital/crystal.vital @@ -1,10 +1,6 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 - crystal bee84ae23effb0510137ad177e98c94d8b3657a6 Process Web.JSON ColorEcho - -endif diff --git a/autoload/xml/aria.vim b/autoload/xml/aria.vim index ff8a071c..7a106e0a 100644 --- a/autoload/xml/aria.vim +++ b/autoload/xml/aria.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/xml/aria.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('html5', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 " Vim completion for WAI-ARIA data file " Language: HTML + WAI-ARIA @@ -464,5 +459,3 @@ let g:xmldata_aria = { \ 'default_role': default_role, \ 'vimariaattrinfo': aria_attributes_value \ } - -endif diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 7bbc9586..a88808e0 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/xml/html5.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('html5', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'html5') == -1 " Vim completion for HTML5 data file " Language: HTML (version 5.1 Draft 2016 Jan 13) @@ -882,5 +877,3 @@ let g:xmldata_html5 = { \ 'wbr': ['/>', ''], \ }, \ } - -endif diff --git a/autoload/xml/xsd.vim b/autoload/xml/xsd.vim index 5757ae84..71b0ec89 100644 --- a/autoload/xml/xsd.vim +++ b/autoload/xml/xsd.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/xml/xsd.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('xsd', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xsd') == -1 " Author: Thomas Barthel " Last change: 2007 May 8 @@ -137,5 +132,3 @@ let g:xmldata_xsd = { \ [], \ {'source' : [], 'id' : [], 'xml' : []} ] \ } - -endif diff --git a/autoload/zig/config.vim b/autoload/zig/config.vim index a35e73e8..ed373f56 100644 --- a/autoload/zig/config.vim +++ b/autoload/zig/config.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/zig/config.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('zig', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1 function! zig#config#ListTypeCommands() abort return get(g:, 'zig_list_type_commands', {}) @@ -46,5 +41,3 @@ endfunction function! zig#config#Debug() abort return get(g:, 'zig_debug', []) endfunction - -endif diff --git a/autoload/zig/fmt.vim b/autoload/zig/fmt.vim index c148ca2b..bdc21290 100644 --- a/autoload/zig/fmt.vim +++ b/autoload/zig/fmt.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/zig/fmt.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('zig', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1 " Adapted from fatih/vim-go: autoload/go/fmt.vim " @@ -173,5 +168,3 @@ function! zig#fmt#ToggleFmtAutoSave() abort endfunction " vim: sw=2 ts=2 et - -endif diff --git a/autoload/zig/list.vim b/autoload/zig/list.vim index 382a9882..d09dd76e 100644 --- a/autoload/zig/list.vim +++ b/autoload/zig/list.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/zig/list.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('zig', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1 " Adapted from fatih/vim-go: autoload/go/list.vim " @@ -165,5 +160,3 @@ function! zig#list#Type(for) abort endfunction " vim: sw=2 ts=2 et - -endif diff --git a/autoload/zig/util.vim b/autoload/zig/util.vim index 0c803802..baa2d32c 100644 --- a/autoload/zig/util.vim +++ b/autoload/zig/util.vim @@ -1,11 +1,6 @@ -let s:base = expand("<sfile>:h:h") -let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" } -let files = filter(globpath(&rtp, 'autoload/zig/util.vim', 1, 1), Filter) -if len(files) > 0 - exec 'source ' . files[0] +if !polyglot#util#IsEnabled('zig', expand('<sfile>:p')) finish endif -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1 " Adapted from vim-go: autoload/go/util.vim " @@ -397,5 +392,3 @@ function! zig#util#HasDebug(flag) endfunction " vim: sw=2 ts=2 et - -endif |