summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2014-08-08 03:23:24 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2014-08-08 03:23:24 +0900
commit1e07b3b1c2417183f9ee4c019150e8243d1d0d57 (patch)
tree35051bb93d4993a8a22091bf7c5bf9dba01bab22
parent4313c1c25c7223391e04e0edbf1043b061ee71f1 (diff)
[vim] Apply FZF_DEFAULT_{OPTS,COMMAND} when using tmux splits (#87)
Fixed escaping bug of the previous commit
-rw-r--r--plugin/fzf.vim13
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'