Skip to content

Commit

Permalink
Previous attempts failed. Scope the change more tightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnn committed Oct 19, 2022
1 parent ab0ba4f commit f729a56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin/fzf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ if exists('g:loaded_fzf')
endif
let g:loaded_fzf = 1

let s:is_win = has('win32') || has('win64')
" On Windows, cmd.exe does not define a `SHELL` env var, whereas git-bash does.
" Treat git-bash environment like a Unix shell.
let s:is_win = (has('win32') || has('win64')) && !exists('$SHELL')
let s:is_win_cmd = s:is_win && !exists('$SHELL')
if s:is_win && &shellslash
set noshellslash
let s:base_dir = expand('<sfile>:h:h')
Expand Down Expand Up @@ -94,7 +94,7 @@ function! s:shellesc_cmd(arg)
endfunction

function! fzf#shellescape(arg, ...)
let shell = get(a:000, 0, s:is_win ? 'cmd.exe' : 'sh')
let shell = get(a:000, 0, s:is_win_cmd ? 'cmd.exe' : 'sh')
if shell =~# 'cmd.exe$'
return s:shellesc_cmd(a:arg)
endif
Expand Down Expand Up @@ -486,7 +486,7 @@ try
elseif type == 3
let temps.input = s:fzf_tempname()
call s:writefile(source, temps.input)
let source_command = (s:is_win ? 'type ' : 'cat ').fzf#shellescape(temps.input)
let source_command = (s:is_win_cmd ? 'type ' : 'cat ').fzf#shellescape(temps.input)
else
throw 'Invalid source type'
endif
Expand Down

0 comments on commit f729a56

Please sign in to comment.