Allow vim-polyglot to load in non-compatible mode

This commit is contained in:
Adam Stankiewicz
2020-10-19 02:25:59 +02:00
parent 3618414fad
commit c3e825027d
6 changed files with 28 additions and 15 deletions

View File

@@ -581,9 +581,9 @@ function! go#config#DiagnosticsEnabled() abort
endfunction endfunction
function! go#config#DiagnosticsLevel() abort function! go#config#DiagnosticsLevel() abort
let l:default = 2 let l:default = 0
if has_key(g:, 'go_diagnostics_enabled') && !g:go_diagnostics_enabled if has_key(g:, 'go_diagnostics_enabled') && g:go_diagnostics_enabled
let l:default = 0 let l:default = 2
endif endif
return get(g:, 'go_diagnostics_level', l:default) return get(g:, 'go_diagnostics_level', l:default)

View File

@@ -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 = { let s:globs = {
\ '8th': '*.8th', \ '8th': '*.8th',
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*', \ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
@@ -624,6 +630,13 @@ let s:globs = {
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*', \ '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) func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '') return get(s:globs, a:type, '')
endfunc endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1948,9 +1948,9 @@ disabled.
Specifies the `gopls` diagnostics level. Valid values are 0, 1, and 2. 0 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 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'* *'g:go_template_autocreate'*

View File

@@ -10,6 +10,10 @@ endif
let did_load_polyglot = 1 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 " It can happen vim filetype.vim loads first, then we need a reset
if exists("did_load_filetypes") if exists("did_load_filetypes")
au! filetypedetect au! filetypedetect
@@ -2625,6 +2629,7 @@ au BufEnter * if &ft == "" && expand("<afile>:e") == "" |
augroup END augroup END
if !has_key(s:disabled_packages, 'autoindent') if !has_key(s:disabled_packages, 'autoindent')
" Code below re-implements sleuth for vim-polyglot " Code below re-implements sleuth for vim-polyglot
let g:loaded_sleuth = 1 let g:loaded_sleuth = 1
@@ -3430,3 +3435,7 @@ if exists("did_load_filetypes") && exists("g:polyglot_disabled")
unlet did_load_filetypes unlet did_load_filetypes
runtime! extras/filetype.vim runtime! extras/filetype.vim
endif endif
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -848,15 +848,7 @@ def generate_plugins(packages)
end end
output << " \\}\n\n" output << " \\}\n\n"
inject_code('autoload/polyglot/sleuth.vim', output)
output << <<~EOS
func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '')
endfunc
EOS
File.write('autoload/polyglot/sleuth.vim', output)
end end
def process_list(list, extras) def process_list(list, extras)

View File

@@ -7,7 +7,6 @@ def run_script(src)
end end
def run_vimscript(src) def run_vimscript(src)
wrapper = <<~EOF wrapper = <<~EOF
vim --clean --not-a-term -u <(cat <<- "EOM" vim --clean --not-a-term -u <(cat <<- "EOM"
set nocompatible set nocompatible