diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2014-06-15 12:15:39 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2014-06-15 12:15:39 +0900 |
commit | 4a3a5ee70daeca7c9d361ef92bf77305e1927211 (patch) | |
tree | fceb695b05d52ad350c6571915cebf09a2645452 /plugin/fzf.vim | |
parent | f58a53a001732a0e753cef08fe43b4dc5abb518c (diff) |
[vim] External terminal emulator for GVim
Diffstat (limited to 'plugin/fzf.vim')
-rw-r--r-- | plugin/fzf.vim | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 78d8c2e3..919c3f0a 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -24,7 +24,7 @@ let s:min_tmux_width = 10 let s:min_tmux_height = 3 let s:default_tmux_height = '40%' -let s:gui_supported = executable('bash') && executable('xterm') +let s:launcher = 'xterm -e bash -ic %s' let s:cpo_save = &cpo set cpo&vim @@ -68,12 +68,6 @@ function! s:escape(path) endfunction function! fzf#run(...) abort - if has('gui_running') && !s:gui_supported - echohl Error - echo 'bash and xterm required to run fzf in GVim' - return [] - endif - let dict = exists('a:1') ? a:1 : {} let temps = { 'result': tempname() } let optstr = get(dict, 'options', '') @@ -125,14 +119,16 @@ function! s:execute(dict, command, temps) call s:pushd(a:dict) silent !clear if has('gui_running') - let xterm_options = get(a:dict, 'xterm_options', get(g:, 'fzf_xterm_options', '')) - execute "silent !xterm ".xterm_options. - \ " -e bash -ic '".substitute(a:command, "'", "'\"'\"'", 'g')."'" + let launcher = get(a:dict, 'launcher', get(g:, 'fzf_launcher', s:launcher)) + let command = printf(launcher, "'".substitute(a:command, "'", "'\"'\"'", 'g')."'") else - execute 'silent !'.a:command + let command = a:command endif + execute 'silent !'.command redraw! if v:shell_error + echohl Error + echo 'Error running ' . command return [] else return s:callback(a:dict, a:temps, 0) |