Skip to content

Commit fc6d524

Browse files
author
skywind3000
committed
new g:asyncrun_pathfix option to fix quickfix relative path issue
1 parent ecc511c commit fc6d524

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

plugin/asyncrun.vim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016-2022
44
" Homepage: https://github.com/skywind3000/asyncrun.vim
55
"
6-
" Last Modified: 2022/01/02 09:15
6+
" Last Modified: 2022/02/03 22:15
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -407,6 +407,11 @@ function! s:AsyncRun_Job_Update(count, ...)
407407
let &l:efm = s:async_info.errorformat
408408
let &g:efm = s:async_info.errorformat
409409
endif
410+
let pathfix = get(g:, 'asyncrun_pathfix', 0)
411+
if pathfix != 0
412+
let l:previous_cwd = getcwd()
413+
silent! call s:chdir(s:async_info.cwd)
414+
endif
410415
let l:raw = (&efm == '')? 1 : 0
411416
if s:async_info.raw == 1
412417
let l:raw = 1
@@ -469,6 +474,9 @@ function! s:AsyncRun_Job_Update(count, ...)
469474
endif
470475
unlet array
471476
endif
477+
if pathfix != 0
478+
silent! call s:chdir(l:previous_cwd)
479+
endif
472480
if g:asyncrun_local != 0
473481
if l:efm1 != &g:efm | let &g:efm = l:efm1 | endif
474482
if l:efm2 != &l:efm | let &l:efm = l:efm2 | endif
@@ -1700,6 +1708,7 @@ function! s:run(opts)
17001708
let s:async_info.range_buf = opts.range_buf
17011709
let s:async_info.strip = opts.strip
17021710
let s:async_info.append = opts.append
1711+
let s:async_info.cwd = getcwd()
17031712
let s:async_info.once = get(opts, 'once', 0)
17041713
let s:async_info.encoding = get(opts, 'encoding', g:asyncrun_encs)
17051714
if s:AsyncRun_Job_Start(l:command) != 0
@@ -2046,7 +2055,7 @@ endfunc
20462055
" asyncrun - version
20472056
"----------------------------------------------------------------------
20482057
function! asyncrun#version()
2049-
return '2.9.8'
2058+
return '2.9.9'
20502059
endfunc
20512060

20522061

plugin/script_load.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ let g:asyncrun_runner = get(g:, 'asyncrun_runner', {})
1818
let g:asyncrun_program = get(g:, 'asyncrun_program', {})
1919
let s:script_time = {}
2020

21+
let $PYTHONUNBUFFERED = '1'
22+
2123

2224
"----------------------------------------------------------------------
2325
" find script

0 commit comments

Comments
 (0)