Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugin/fzf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ endif
if s:is_win
let s:term_marker = '&::FZF'

" This is not bulletproof, but cmd.exe does not have SHELL env var.
let s:is_gitbash = has_key(environ(), 'SHELL')

function! s:fzf_call(fn, ...)
let shellslash = &shellslash
try
Expand Down Expand Up @@ -484,7 +487,8 @@ 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 && !s:is_gitbash ? 'type ' : 'cat ')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, environ() is a recent addition to Vim (after Vim 8), so it's probably safer to use exists('$VARNAME') not to break this on older Vim versions.

Suggested change
let source_command = (s:is_win && !s:is_gitbash ? 'type ' : 'cat ')
let source_command = (s:is_win && !exists('$SHELL') ? 'type ' : 'cat ')

\.(s:is_gitbash ? substitute(temps.input, '\', '/', 'g') : fzf#shellescape(temps.input))
else
throw 'Invalid source type'
endif
Expand Down