mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -14,8 +14,6 @@ endfunction
|
||||
" logic.
|
||||
"
|
||||
" args is a dictionary with the these keys:
|
||||
" 'cmd':
|
||||
" The value to pass to job_start().
|
||||
" 'bang':
|
||||
" Set to 0 to jump to the first error in the error list.
|
||||
" Defaults to 0.
|
||||
@ -24,6 +22,7 @@ endfunction
|
||||
" See statusline.vim.
|
||||
" 'for':
|
||||
" The g:go_list_type_command key to use to get the error list type to use.
|
||||
" Errors will not be handled when the value is '_'.
|
||||
" Defaults to '_job'
|
||||
" 'errorformat':
|
||||
" The errorformat string to use when parsing errors. Defaults to
|
||||
@ -32,9 +31,9 @@ endfunction
|
||||
" 'complete':
|
||||
" A function to call after the job exits and the channel is closed. The
|
||||
" function will be passed three arguments: the job, its exit code, and the
|
||||
" list of messages received from the channel. The default value will
|
||||
" process the messages and manage the error list after the job exits and
|
||||
" the channel is closed.
|
||||
" list of messages received from the channel. The default is a no-op. A
|
||||
" custom value can modify the messages before they are processed by the
|
||||
" returned exit_cb and close_cb callbacks.
|
||||
|
||||
" The return value is a dictionary with these keys:
|
||||
" 'callback':
|
||||
@ -47,7 +46,9 @@ endfunction
|
||||
" A function suitable to be passed as a job close_cb handler. See
|
||||
" job-close_cb.
|
||||
" 'cwd':
|
||||
" The path to the directory which contains the current buffer.
|
||||
" The path to the directory which contains the current buffer. The
|
||||
" callbacks are configured to expect this directory is the working
|
||||
" directory for the job; it should not be modified by callers.
|
||||
function! go#job#Options(args)
|
||||
let cbs = {}
|
||||
let state = {
|
||||
@ -184,7 +185,15 @@ function! go#job#Options(args)
|
||||
let cbs.close_cb = function('s:close_cb', [], state)
|
||||
|
||||
function state.show_errors(job, exit_status, data)
|
||||
if self.for == '_'
|
||||
return
|
||||
endif
|
||||
|
||||
let l:winid = win_getid(winnr())
|
||||
" Always set the active window to the window that was active when the job
|
||||
" was started. Among other things, this makes sure that the correct
|
||||
" window's location list will be populated when the list type is
|
||||
" 'location' and the user has moved windows since starting the job.
|
||||
call win_gotoid(self.winid)
|
||||
|
||||
let l:listtype = go#list#Type(self.for)
|
||||
@ -221,6 +230,8 @@ function! go#job#Options(args)
|
||||
return
|
||||
endif
|
||||
|
||||
" only open the error window if user was still in the window from which
|
||||
" the job was started.
|
||||
if self.winid == l:winid
|
||||
call go#list#Window(l:listtype, len(errors))
|
||||
if !self.bang
|
||||
@ -229,17 +240,20 @@ function! go#job#Options(args)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if has('nvim')
|
||||
return s:neooptions(cbs)
|
||||
endif
|
||||
|
||||
return cbs
|
||||
endfunction
|
||||
|
||||
" go#job#Start runs a job. The options are expected to be the options
|
||||
" suitable for Vim8 jobs. When called from Neovim, Vim8 options will be
|
||||
" transformed to their Neovim equivalents.
|
||||
function! go#job#Start(cmd, options)
|
||||
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
|
||||
let l:options = copy(a:options)
|
||||
|
||||
if has('nvim')
|
||||
let l:options = s:neooptions(l:options)
|
||||
endif
|
||||
|
||||
if !has_key(l:options, 'cwd')
|
||||
" pre start
|
||||
let dir = getcwd()
|
||||
@ -249,10 +263,11 @@ function! go#job#Start(cmd, options)
|
||||
if has_key(l:options, '_start')
|
||||
call l:options._start()
|
||||
" remove _start to play nicely with vim (when vim encounters an unexpected
|
||||
" job option it reports an "E475: invalid argument" error.
|
||||
" job option it reports an "E475: invalid argument" error).
|
||||
unlet l:options._start
|
||||
endif
|
||||
|
||||
|
||||
if has('nvim')
|
||||
let l:input = []
|
||||
if has_key(l:options, 'in_io') && l:options.in_io ==# 'file' && !empty(l:options.in_name)
|
||||
@ -286,6 +301,11 @@ function! s:neooptions(options)
|
||||
let l:options['stderr_buf'] = ''
|
||||
|
||||
for key in keys(a:options)
|
||||
if key == 'cwd'
|
||||
let l:options['cwd'] = a:options['cwd']
|
||||
continue
|
||||
endif
|
||||
|
||||
if key == 'callback'
|
||||
let l:options['callback'] = a:options['callback']
|
||||
|
||||
@ -402,5 +422,4 @@ function! s:neooptions(options)
|
||||
return l:options
|
||||
endfunction
|
||||
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user