mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vim plugins
This commit is contained in:
@ -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
|
||||
|
||||
@ -10,21 +14,18 @@ function! go#def#Jump(mode) abort
|
||||
" covers all edge cases, but now anyone can switch to godef if they wish
|
||||
let bin_name = go#config#DefMode()
|
||||
if bin_name == 'godef'
|
||||
if &modified
|
||||
" Write current unsaved buffer to a temp file and use the modified content
|
||||
let l:tmpname = tempname()
|
||||
call writefile(go#util#GetLines(), l:tmpname)
|
||||
let fname = l:tmpname
|
||||
endif
|
||||
|
||||
let [l:out, l:err] = go#util#Exec(['godef',
|
||||
let l:cmd = ['godef',
|
||||
\ '-f=' . l:fname,
|
||||
\ '-o=' . go#util#OffsetCursor(),
|
||||
\ '-t'])
|
||||
if exists("l:tmpname")
|
||||
call delete(l:tmpname)
|
||||
endif
|
||||
\ '-t']
|
||||
|
||||
if &modified
|
||||
let l:stdin_content = join(go#util#GetLines(), "\n")
|
||||
call add(l:cmd, "-i")
|
||||
let [l:out, l:err] = go#util#Exec(l:cmd, l:stdin_content)
|
||||
else
|
||||
let [l:out, l:err] = go#util#Exec(l:cmd)
|
||||
endif
|
||||
elseif bin_name == 'guru'
|
||||
let cmd = [go#path#CheckBinPath(bin_name)]
|
||||
let buildtags = go#config#BuildTags()
|
||||
@ -35,7 +36,7 @@ function! go#def#Jump(mode) abort
|
||||
let stdin_content = ""
|
||||
|
||||
if &modified
|
||||
let content = join(go#util#GetLines(), "\n")
|
||||
let content = join(go#util#GetLines(), "\n")
|
||||
let stdin_content = fname . "\n" . strlen(content) . "\n" . content
|
||||
call add(cmd, "-modified")
|
||||
endif
|
||||
@ -317,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
|
||||
|
Reference in New Issue
Block a user