Skip to content

Commit

Permalink
Store full directory on :FocusDispatch -dir=
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed May 3, 2015
1 parent af2db84 commit 3a9b13c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion autoload/dispatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ function! s:escape_path(path) abort
return substitute(fnameescape(a:path), '^\\\~', '\~', '')
endfunction

function! dispatch#dir_arg(...) abort
let dir = fnamemodify(a:0 ? a:1 : getcwd(), ':p:~:s?[^:]\zs[\\/]$??')
return '-dir=' . s:escape_path(dir) . ' '
endfunction

function! dispatch#cd_helper(dir) abort
let back = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
let back .= ' ' . fnameescape(getcwd())
Expand Down Expand Up @@ -656,7 +661,14 @@ function! dispatch#focus(...) abort
endfunction

function! dispatch#focus_command(bang, args, count) abort
let args = a:args =~# '^:\S' ? a:args : escape(dispatch#expand(a:args), '#%')
let [args, opts] = s:extract_opts(a:args)
let args = escape(dispatch#expand(args), '#%')
if has_key(opts, 'compiler')
let args = '-compiler=' . opts.compiler . ' ' . args
endif
if has_key(opts, 'directory')
let args = dispatch#dir_arg(opts.directory) . args
endif
if empty(a:args) && a:bang
unlet! w:dispatch t:dispatch g:dispatch
let [what, why] = dispatch#focus(a:count)
Expand Down

0 comments on commit 3a9b13c

Please sign in to comment.