diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2014-08-08 03:23:24 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2014-08-08 03:23:24 +0900 |
commit | 1e07b3b1c2417183f9ee4c019150e8243d1d0d57 (patch) | |
tree | 35051bb93d4993a8a22091bf7c5bf9dba01bab22 | |
parent | 4313c1c25c7223391e04e0edbf1043b061ee71f1 (diff) |
[vim] Apply FZF_DEFAULT_{OPTS,COMMAND} when using tmux splits (#87)
Fixed escaping bug of the previous commit
-rw-r--r-- | plugin/fzf.vim | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 1b7a5600..62194709 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -148,11 +148,18 @@ function! s:execute(dict, command, temps) endif endfunction +function! s:env_var(name) + if exists('$'.a:name) + return a:name . "='". substitute(expand('$'.a:name), "'", "'\\\\''", 'g') . "' " + else + return '' + endif +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') - let command = 'cd '.s:escape(a:dict.dir).' && '.a:command - else - let command = a:command + let command = 'cd '.s:escape(a:dict.dir).' && '.command endif let splitopt = '-v' |