From 3b7a962dc6db227d18faecb25c793431ce7e8640 Mon Sep 17 00:00:00 2001 From: Daniel Zhang Date: Wed, 25 May 2022 08:50:10 +0800 Subject: [PATCH] [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 --- plugin/fzf.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 3c705e91..85d1f2fa 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -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()