[vim] Ignore 'dir' option if empty

This makes it easier to override FZF command like follows:

    autocmd VimEnter * command! -nargs=? -bang -complete=dir FZF call fzf#run({
          \ 'sink': 'tabe',
          \ 'dir': <q-args>,
          \ 'options': '-m',
          \ 'tmux_height': empty('<bang>') ? '40%' : '' })
This commit is contained in:
Junegunn Choi 2014-10-15 13:22:00 +09:00
parent d1387bf512
commit 6fd6fff3a6

View File

@ -113,7 +113,7 @@ function! s:tmux_splittable(dict)
endfunction endfunction
function! s:pushd(dict) function! s:pushd(dict)
if has_key(a:dict, 'dir') if !empty(get(a:dict, 'dir', ''))
let a:dict.prev_dir = getcwd() let a:dict.prev_dir = getcwd()
execute 'chdir '.s:escape(a:dict.dir) execute 'chdir '.s:escape(a:dict.dir)
endif endif
@ -158,7 +158,7 @@ endfunction
function! s:execute_tmux(dict, command, temps) function! s:execute_tmux(dict, command, temps)
let command = s:env_var('FZF_DEFAULT_OPTS').s:env_var('FZF_DEFAULT_COMMAND').a:command let command = s:env_var('FZF_DEFAULT_OPTS').s:env_var('FZF_DEFAULT_COMMAND').a:command
if has_key(a:dict, 'dir') if !empty(get(a:dict, 'dir', ''))
let command = 'cd '.s:escape(a:dict.dir).' && '.command let command = 'cd '.s:escape(a:dict.dir).' && '.command
endif endif