From 3e25ca5a5af811709f10dbe943953112e963d144 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 26 Aug 2017 07:58:39 +0200 Subject: [PATCH] async: Check directory before starting the job (Neovim) fixes #1544 --- autoload/airline/async.vim | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/autoload/airline/async.vim b/autoload/airline/async.vim index 1bc298c..24bf319 100644 --- a/autoload/airline/async.vim +++ b/autoload/airline/async.vim @@ -166,10 +166,14 @@ elseif has("nvim") endfunction function! airline#async#nvim_get_mq_async(cmd, file) + let cwd = fnamemodify(a:file, ':p:h') + if empty(cwd) || !isdirectory(cwd) + let cwd = getcwd() + endif let config = { \ 'buf': '', \ 'file': a:file, - \ 'cwd': fnamemodify(a:file, ':p:h'), + \ 'cwd': cwd, \ 'on_stdout': function('s:nvim_mq_job_handler'), \ 'on_exit': function('s:nvim_mq_job_handler') \ } @@ -187,10 +191,14 @@ elseif has("nvim") endfunction function! airline#async#nvim_get_msgfmt_stat(cmd, file) + let cwd = fnamemodify(a:file, ':p:h') + if empty(cwd) || !isdirectory(cwd) + let cwd = getcwd() + endif let config = { \ 'buf': '', \ 'file': a:file, - \ 'cwd': fnamemodify(a:file, ':p:h'), + \ 'cwd': cwd, \ 'on_stdout': function('s:nvim_po_job_handler'), \ 'on_stderr': function('s:nvim_po_job_handler'), \ 'on_exit': function('s:nvim_po_job_handler') @@ -215,12 +223,16 @@ endif function! airline#async#nvim_vcs_untracked(cfg, file, vcs) let cmd = a:cfg.cmd . shellescape(a:file) let id = -1 + let cwd = fnamemodify(a:file, ':p:h') + if empty(cwd) || !isdirectory(cwd) + let cwd = getcwd() + endif let config = { \ 'buf': '', \ 'vcs': a:vcs, \ 'cfg': a:cfg, \ 'file': a:file, - \ 'cwd': fnamemodify(a:file, ':p:h') + \ 'cwd': cwd \ } if has("nvim") call extend(config, {