1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins and added vim-jade

This commit is contained in:
amix
2016-01-05 15:18:45 -03:00
parent 3aabd8befd
commit 795a8fb80d
35 changed files with 1036 additions and 131 deletions

View File

@ -5,11 +5,11 @@ let s:jobs = {}
" Spawn is a wrapper around s:spawn. It can be executed by other files and
" scripts if needed. Desc defines the description for printing the status
" during the job execution (useful for statusline integration).
function! go#jobcontrol#Spawn(desc, args)
function! go#jobcontrol#Spawn(bang, desc, args)
" autowrite is not enabled for jobs
call go#cmd#autowrite()
let job = s:spawn(a:desc, a:args)
let job = s:spawn(a:bang, a:desc, a:args)
return job.id
endfunction
@ -40,9 +40,10 @@ endfunction
" a job is started a reference will be stored inside s:jobs. spawn changes the
" GOPATH when g:go_autodetect_gopath is enabled. The job is started inside the
" current files folder.
function! s:spawn(desc, args)
function! s:spawn(bang, desc, args)
let job = {
\ 'desc': a:desc,
\ 'bang': a:bang,
\ 'winnr': winnr(),
\ 'importpath': go#package#ImportPath(expand('%:p:h')),
\ 'state': "RUNNING",
@ -68,8 +69,8 @@ function! s:spawn(desc, args)
endfor
let dir = getcwd()
execute cd . fnameescape(expand("%:p:h"))
let jobdir = fnameescape(expand("%:p:h"))
execute cd . jobdir
" append the subcommand, such as 'build'
let argv = ['go'] + a:args
@ -77,6 +78,7 @@ function! s:spawn(desc, args)
" run, forrest, run!
let id = jobstart(argv, job)
let job.id = id
let job.dir = jobdir
let s:jobs[id] = job
execute cd . fnameescape(dir)
@ -91,21 +93,9 @@ endfunction
" references and also displaying errors in the quickfix window collected by
" on_stderr handler. If there are no errors and a quickfix window is open,
" it'll be closed.
function! s:on_exit(job_id, data)
function! s:on_exit(job_id, exit_status)
let std_combined = self.stderr + self.stdout
if empty(std_combined)
call go#list#Clean()
call go#list#Window()
let self.state = "SUCCESS"
return
endif
let errors = go#tool#ParseErrors(std_combined)
let errors = go#tool#FilterValids(errors)
if !len(errors)
" no errors could be past, just return
if a:exit_status == 0
call go#list#Clean()
call go#list#Window()
@ -115,11 +105,29 @@ function! s:on_exit(job_id, data)
let self.state = "FAILED"
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
try
execute cd self.dir
let errors = go#tool#ParseErrors(std_combined)
let errors = go#tool#FilterValids(errors)
finally
execute cd . fnameescape(dir)
endtry
if !len(errors)
" failed to parse errors, output the original content
call go#util#EchoError(std_combined[0])
return
endif
" if we are still in the same windows show the list
if self.winnr == winnr()
call go#list#Populate(errors)
call go#list#Window(len(errors))
call go#list#JumpToFirst()
if !empty(errors) && !self.bang
call go#list#JumpToFirst()
endif
endif
endfunction