Some of my custom keybindings that use fzf in (n)vim were not working properly under some circumstances. I tracked the issue down to the function Invoke-PsFzfRipgrep. It looks like the change to $env:FZF_DEFAULT_COMMAND with for the search string propagates to the call to Invoke-Expression -Command $cmd.
My keybinding was relaying on the $FZF_DEFAULT_COMMAND variable and it was breaking because of the above change.
Proposed solution
Calling $script:OverrideFzfDefaultCommand.Restore() right after the fzf command should prevent this issue and it should be fine to restore the command as the search has already been done.
Current workaround
Explicitly set $FZF_DEFAULT_COMMAND in my vimrc/init.vim to prevent the issue.
Description
Some of my custom keybindings that use
fzf
in (n)vim were not working properly under some circumstances. I tracked the issue down to the functionInvoke-PsFzfRipgrep
. It looks like the change to$env:FZF_DEFAULT_COMMAND
with for the search string propagates to the call toInvoke-Expression -Command $cmd
.My keybinding was relaying on the
$FZF_DEFAULT_COMMAND
variable and it was breaking because of the above change.Proposed solution
Calling
$script:OverrideFzfDefaultCommand.Restore()
right after the fzf command should prevent this issue and it should be fine to restore the command as the search has already been done.Current workaround
Explicitly set
$FZF_DEFAULT_COMMAND
in my vimrc/init.vim to prevent the issue.