[vim] Fix fzf#shellescape when shell=fish (#2828)

`shellescape()` behavior is different when `shell=fish`, so we should set `shell` before calling `shellescape()`, otherwise an unexpected result may occur (e.g. https://github.com/kevinhwang91/nvim-bqf/issues/56).

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This commit is contained in:
Daniel Zhang 2022-05-25 08:50:10 +08:00 committed by GitHub
parent 6dcf5c3d7d
commit 3b7a962dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -96,7 +96,12 @@ function! fzf#shellescape(arg, ...)
if shell =~# 'cmd.exe$'
return s:shellesc_cmd(a:arg)
endif
return s:fzf_call('shellescape', a:arg)
try
let [shell, &shell] = [&shell, shell]
return s:fzf_call('shellescape', a:arg)
finally
let [shell, &shell] = [&shell, shell]
endtry
endfunction
function! s:fzf_getcwd()