diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-19 02:25:59 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-19 02:25:59 +0200 |
commit | c3e825027ddabecf18370df61c1da4018f017b7b (patch) | |
tree | 8d60a5b049a927d6aedb938e25612aa4e7ba14aa | |
parent | 3618414fad6ac488e89895810d3a3da3c3c1c6fd (diff) | |
download | vim-polyglot-c3e825027ddabecf18370df61c1da4018f017b7b.tar.gz vim-polyglot-c3e825027ddabecf18370df61c1da4018f017b7b.zip |
Allow vim-polyglot to load in non-compatible mode
-rw-r--r-- | autoload/go/config.vim | 6 | ||||
-rw-r--r-- | autoload/polyglot/sleuth.vim | 13 | ||||
-rw-r--r-- | doc/vim-go.txt | 4 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 9 | ||||
-rwxr-xr-x | scripts/build | 10 | ||||
-rwxr-xr-x | scripts/test | 1 |
6 files changed, 28 insertions, 15 deletions
diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 54f94f01..2265608b 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -581,9 +581,9 @@ function! go#config#DiagnosticsEnabled() abort endfunction function! go#config#DiagnosticsLevel() abort - let l:default = 2 - if has_key(g:, 'go_diagnostics_enabled') && !g:go_diagnostics_enabled - let l:default = 0 + let l:default = 0 + if has_key(g:, 'go_diagnostics_enabled') && g:go_diagnostics_enabled + let l:default = 2 endif return get(g:, 'go_diagnostics_level', l:default) diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index db032dd6..b5b30ab8 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -1,3 +1,9 @@ +" Restore 'cpoptions' +let s:cpo_save = &cpo +set cpo&vim + +" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE + let s:globs = { \ '8th': '*.8th', \ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*', @@ -624,6 +630,13 @@ let s:globs = { \ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*', \} + +" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE + func! polyglot#sleuth#GlobForFiletype(type) return get(s:globs, a:type, '') endfunc + +" Restore 'cpoptions' +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/doc/vim-go.txt b/doc/vim-go.txt index 18306a0f..dbb6af1f 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -1948,9 +1948,9 @@ disabled. Specifies the `gopls` diagnostics level. Valid values are 0, 1, and 2. 0 ignores `gopls` diagnostics, 1 is for errors only, and 2 is for errors and -warnings. By default it is 2. +warnings. By default it is 0. > - let g:go_diagnostics_level = 2 + let g:go_diagnostics_level = 0 < *'g:go_template_autocreate'* diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 99fb9413..5bb1bc76 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -10,6 +10,10 @@ endif let did_load_polyglot = 1 +" Switch to compatible mode for the time being +let s:cpo_save = &cpo +set cpo&vim + " It can happen vim filetype.vim loads first, then we need a reset if exists("did_load_filetypes") au! filetypedetect @@ -2625,6 +2629,7 @@ au BufEnter * if &ft == "" && expand("<afile>:e") == "" | augroup END + if !has_key(s:disabled_packages, 'autoindent') " Code below re-implements sleuth for vim-polyglot let g:loaded_sleuth = 1 @@ -3430,3 +3435,7 @@ if exists("did_load_filetypes") && exists("g:polyglot_disabled") unlet did_load_filetypes runtime! extras/filetype.vim endif + +" Restore 'cpoptions' +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/scripts/build b/scripts/build index d77a556a..b3867b97 100755 --- a/scripts/build +++ b/scripts/build @@ -848,15 +848,7 @@ def generate_plugins(packages) end output << " \\}\n\n" - - output << <<~EOS - func! polyglot#sleuth#GlobForFiletype(type) - return get(s:globs, a:type, '') - endfunc - EOS - - - File.write('autoload/polyglot/sleuth.vim', output) + inject_code('autoload/polyglot/sleuth.vim', output) end def process_list(list, extras) diff --git a/scripts/test b/scripts/test index ae408063..f726d226 100755 --- a/scripts/test +++ b/scripts/test @@ -7,7 +7,6 @@ def run_script(src) end def run_vimscript(src) - wrapper = <<~EOF vim --clean --not-a-term -u <(cat <<- "EOM" set nocompatible |