From 6fd6fff3a65ec23cfd84d347d77648fde2b24ee9 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 15 Oct 2014 13:22:00 +0900 Subject: [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': , \ 'options': '-m', \ 'tmux_height': empty('') ? '40%' : '' }) --- plugin/fzf.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 62194709..db3c649b 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -113,7 +113,7 @@ function! s:tmux_splittable(dict) endfunction function! s:pushd(dict) - if has_key(a:dict, 'dir') + if !empty(get(a:dict, 'dir', '')) let a:dict.prev_dir = getcwd() execute 'chdir '.s:escape(a:dict.dir) endif @@ -158,7 +158,7 @@ endfunction function! s:execute_tmux(dict, command, temps) 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 endif -- cgit v1.2.3