summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-23 21:27:29 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-23 21:27:29 +0900
commitc36b846accc36c5a833a8e22d06107b778a4f219 (patch)
treee1cd6fa67aa3924e7a95ee24d9f57be039ffadf2 /plugin
parentd9b5c9b2be50989fdf8d49c3e24e0c06d6aeafcc (diff)
downloadfzf-c36b846accc36c5a833a8e22d06107b778a4f219.tar.gz
[vim] Open cmd.exe window only on mintty < 3.4.5 without winpty
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fzf.vim8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index fc36b8c5..bd436e16 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -490,6 +490,8 @@ function! s:extract_option(opts, name)
return opt
endfunction
+let s:need_cmd_window = has('win32unix') && $TERM_PROGRAM ==# 'mintty' && s:compare_versions($TERM_PROGRAM_VERSION, '3.4.5') < 0 && !executable('winpty')
+
function! fzf#run(...) abort
try
let [shell, shellslash, shellcmdflag, shellxquote] = s:use_sh()
@@ -532,8 +534,8 @@ try
\ executable('tput') && filereadable('/dev/tty')
let has_vim8_term = has('terminal') && has('patch-8.0.995')
let has_nvim_term = has('nvim-0.2.1') || has('nvim') && !s:is_win
- let use_term = has_nvim_term || has_vim8_term
- \ && !(has('win32unix') && $TERM_PROGRAM ==# 'mintty' && !executable('winpty'))
+ let use_term = has_nvim_term || has_vim8_term
+ \ && !s:need_cmd_window
\ && (has('gui_running') || s:is_win || s:present(dict, 'down', 'up', 'left', 'right', 'window'))
let use_tmux = (has_key(dict, 'tmux') || (!use_height && !use_term || prefer_tmux) && !has('win32unix') && s:splittable(dict)) && s:tmux_enabled()
if prefer_tmux && use_tmux
@@ -714,7 +716,7 @@ function! s:execute(dict, command, use_height, temps) abort
call jobstart(cmd, fzf)
return []
endif
- elseif has('win32unix') && $TERM_PROGRAM ==# 'mintty' && !executable('winpty')
+ elseif s:need_cmd_window
let shellscript = s:fzf_tempname()
call s:writefile([command], shellscript)
let command = 'start //WAIT sh -c '.shellscript