[vim] Handle single/double quote characters in 'dir' option

This commit is contained in:
Junegunn Choi 2015-08-16 00:04:45 +09:00
parent c601fc6437
commit 7ae877bd3a

View File

@ -80,7 +80,7 @@ function! s:shellesc(arg)
endfunction endfunction
function! s:escape(path) function! s:escape(path)
return escape(a:path, ' %#\') return escape(a:path, ' %#''"\')
endfunction endfunction
" Upgrade legacy options " Upgrade legacy options
@ -384,7 +384,7 @@ function! s:cmd(bang, ...) abort
let args = extend(['--expect='.join(keys(s:action), ',')], a:000) let args = extend(['--expect='.join(keys(s:action), ',')], a:000)
let opts = {} let opts = {}
if len(args) > 0 && isdirectory(expand(args[-1])) if len(args) > 0 && isdirectory(expand(args[-1]))
let opts.dir = remove(args, -1) let opts.dir = substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g')
endif endif
if !a:bang if !a:bang
let opts.down = get(g:, 'fzf_height', get(g:, 'fzf_tmux_height', s:default_height)) let opts.down = get(g:, 'fzf_height', get(g:, 'fzf_tmux_height', s:default_height))