Skip to content

Commit

Permalink
don't spam users when Vim is started with Vi compatibility mode
Browse files Browse the repository at this point in the history
Fixes #1982
  • Loading branch information
bhcleek committed Nov 16, 2018
1 parent 192725a commit 4239c43
Show file tree
Hide file tree
Showing 65 changed files with 534 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/ctrlp/decls.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

let s:go_decls_var = {
\ 'init': 'ctrlp#decls#init()',
\ 'exit': 'ctrlp#decls#exit()',
Expand Down Expand Up @@ -143,4 +147,8 @@ function! ctrlp#decls#cmd(mode, ...) abort
return s:id
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/fzf/decls.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! s:code(group, attr) abort
let code = synIDattr(synIDtrans(hlID(a:group)), a:attr, "cterm")
if code =~ '^[0-9]\+$'
Expand Down Expand Up @@ -146,4 +150,8 @@ function! fzf#decls#cmd(...) abort
\ }))
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/alternate.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

" Test alternates between the implementation of code and the test code.
function! go#alternate#Switch(bang, cmd) abort
let file = expand('%')
Expand All @@ -24,4 +28,8 @@ function! go#alternate#Switch(bang, cmd) abort
endif
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/asmfmt.vim
Expand Up @@ -15,6 +15,10 @@
"
" Flag to automatically call :Fmt when file is saved.

" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

let s:got_fmt_error = 0

" This is a trimmed-down version of the logic in fmt.vim.
Expand Down Expand Up @@ -65,4 +69,8 @@ function! go#asmfmt#ToggleAsmFmtAutoSave() abort
call go#util#EchoProgress("auto asmfmt disabled")
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/cmd.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! go#cmd#autowrite() abort
if &autowrite == 1 || &autowriteall == 1
silent! wall
Expand Down Expand Up @@ -282,4 +286,8 @@ function! s:cmd_job(args) abort
call go#job#Spawn(a:args.cmd, a:args)
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/cmd_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

func! Test_GoBuildErrors()
try
let l:filename = 'cmd/bad.go'
Expand Down Expand Up @@ -27,4 +31,8 @@ func! Test_GoBuildErrors()
endtry
endfunc

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/complete.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! s:gocodeCommand(cmd, args) abort
let l:gocode_bin = "gocode"
let l:gomod = go#util#gomod()
Expand Down Expand Up @@ -250,4 +254,8 @@ function! go#complete#ToggleAutoTypeInfo() abort
call go#util#EchoProgress("auto type info enabled")
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/complete_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

func! Test_GetInfo()
let l:filename = 'complete/complete.go'
let l:tmp = gotest#load_fixture(l:filename)
Expand All @@ -17,4 +21,8 @@ func! Test_GetInfo()
unlet g:go_info_mode
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/config.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! go#config#AutodetectGopath() abort
return get(g:, 'go_autodetect_gopath', 0)
endfunction
Expand Down Expand Up @@ -445,4 +449,8 @@ if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1
unlet g:go_gorename_prefill
endif

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/coverage.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

let s:toggle = 0

" Buffer creates a new cover profile with 'go test -coverprofile' and changes
Expand Down Expand Up @@ -286,4 +290,8 @@ function! s:coverage_browser_callback(coverfile, job, exit_status, data)
call delete(a:coverfile)
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/debug.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

scriptencoding utf-8

if !exists('s:state')
Expand Down Expand Up @@ -944,4 +948,8 @@ endfunction
sign define godebugbreakpoint text=> texthl=GoDebugBreakpoint
sign define godebugcurline text== linehl=GoDebugCurrent texthl=GoDebugCurrent

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/decls.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! go#decls#Decls(mode, ...) abort
let decls_mode = go#config#DeclsMode()
if decls_mode == 'ctrlp'
Expand All @@ -15,4 +19,8 @@ function! go#decls#Decls(mode, ...) abort
end
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/def.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

let s:go_stack = []
let s:go_stack_level = 0

Expand Down Expand Up @@ -314,4 +318,8 @@ function s:def_job(args, state) abort
call go#job#Start(a:args.cmd, l:start_options)
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/def_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

func! Test_jump_to_declaration_guru() abort
try
let l:filename = 'def/jump.go'
Expand Down Expand Up @@ -63,4 +67,8 @@ func! Test_Jump_leaves_lists() abort
endtry
endfunc

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/doc.vim
Expand Up @@ -2,6 +2,10 @@
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.

" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

let s:buf_nr = -1

function! go#doc#OpenBrowser(...) abort
Expand Down Expand Up @@ -189,4 +193,8 @@ function! s:godocWord(args) abort
return [pkg, exported_name]
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/fillstruct.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! go#fillstruct#FillStruct() abort
let l:cmd = ['fillstruct',
\ '-file', bufname(''),
Expand Down Expand Up @@ -61,4 +65,8 @@ function! go#fillstruct#FillStruct() abort
endtry
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/fillstruct_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

func! Test_fillstruct() abort
try
let l:tmp = gotest#write_file('a/a.go', [
Expand Down Expand Up @@ -87,4 +91,8 @@ func! Test_fillstruct_two_cursor() abort
endtry
endfunc

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/fmt.vim
Expand Up @@ -5,6 +5,10 @@
" fmt.vim: Vim command to format Go files with gofmt (and gofmt compatible
" toorls, such as goimports).

" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

" we have those problems :
" http://stackoverflow.com/questions/12741977/prevent-vim-from-updating-its-undo-tree
" http://stackoverflow.com/questions/18532692/golang-formatter-and-vim-how-to-destroy-history-record?rq=1
Expand Down Expand Up @@ -211,4 +215,8 @@ function! go#fmt#ToggleFmtAutoSave() abort
call go#util#EchoProgress("auto fmt enabled")
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/fmt_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

func! Test_run_fmt() abort
let actual_file = tempname()
call writefile(readfile("test-fixtures/fmt/hello.go"), actual_file)
Expand Down Expand Up @@ -46,4 +50,8 @@ func! Test_goimports() abort
call assert_equal(expected, actual)
endfunc

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/guru.vim
@@ -1,5 +1,9 @@
" guru.vim -- Vim integration for the Go guru.

" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

" guru_cmd returns a dict that contains the command to execute guru. args
" is dict with following options:
" mode : guru mode, such as 'implements'
Expand Down Expand Up @@ -586,4 +590,8 @@ function! go#guru#Scope(...) abort
endif
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/guru_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function Test_GuruScope_Set() abort
silent call go#guru#Scope("example.com/foo/bar")
let actual = go#config#GuruScope()
Expand All @@ -12,4 +16,8 @@ function Test_GuruScope_Set() abort
endif
endfunction

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et
8 changes: 8 additions & 0 deletions autoload/go/highlight_test.vim
@@ -1,3 +1,7 @@
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim

function! Test_gomodVersion_highlight() abort
try
syntax on
Expand Down Expand Up @@ -92,4 +96,8 @@ function! Test_gomodVersion_incompatible_highlight() abort
endtry
endfunc

" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save

" vim: sw=2 ts=2 et

0 comments on commit 4239c43

Please sign in to comment.