Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__fz_filter() fail on Bash #27

Open
svardew opened this issue Apr 1, 2021 · 4 comments
Open

__fz_filter() fail on Bash #27

svardew opened this issue Apr 1, 2021 · 4 comments
Labels

Comments

@svardew
Copy link

svardew commented Apr 1, 2021

Thank you for check issue #26.
I use bash, not familiar with zsh.
Bash don't have word split Parameter Expansion ${=SPEC} syntax.

  • ubuntu 14.04.6 i686
  • GNU bash, version 4.4.19(1)-release (i686-pc-linux-gnu)
  • zsh 5.0.2 (i686-pc-linux-gnu)
  • fzf 0.22.0 (e2ae1b2)
    $ /bin/bash -c 'fzf="fzf-tmux arg1"; echo ${=fzf}'
    #=> /bin/bash: ${=fzf}: bad substitution
    $ /usr/bin/zsh -c 'fzf="fzf-tmux arg1"; echo ${=fzf}'
    #=> fzf-tmux arg1

When fz.sh call __fz_filter(), bash cannot expand ${=fzf} and fail to open fzf window

$ bash --norc
export LANG=C
. ~/.fzf.bash
. ~/.bash_completion/z.sh
. ~/.bash_completion/fz.sh
mv ~/.z{,_bak_bash44}
cd ~/.cargo/bin
cd ~/bin
cd /bin
cd /usr/bin
cd /tmp
z bi[TAB]
#=> ERROR; bash-4.4$ z bibash: ${=fzf}: bad substitution
exit

$ zsh -f
export LANG=C
source ~/.bash_completion/z.sh
source ~/.bash_completion/fz.sh
mv ~/.z{,_bak_zsh501}
cd ~/.cargo/bin
cd ~/bin
cd /bin
cd /usr/bin
cd /tmp
z bi[TAB]
#=> SUCCESS; fzf window appear, select and path completion ok.
exit

My OS and Fzf is old.
But when fz.sh L:173 s/${=fzf}/${fzf}/, __fz_filter() work well in tmux session.

@Konfekt
Copy link

Konfekt commented Oct 23, 2023

This is the same as #29 ?!

@svardew
Copy link
Author

svardew commented Oct 25, 2023

Hi, @Konfekt

I issued #27 after #25.
I think #27 and #29 is same problem, fz.sh not changed since #25 merged.

git log -1 --oneline 2a4c1bc
#=> 2a4c1bc Merge pull request #25 from mike182uk/fzf-tmux
git diff 2a4c1bc...HEAD -- fz.sh
#=> (null)

sorry, I do not use fz.sh lately.
I tested manually :

which fzf #=> ~/bin/fzf
mkdir ~/.bash_completion.d
cp ~/repo/rupa/z/master/z.sh ~/.bash_completion.d/
cp ~/repo/changyuheng/fz/fz.sh ~/.bash_completion.d/zfz.sh
source ~/.bash_completion.d/z.sh
source ~/.bash_completion.d/zfz.sh

apply e096093 to fz.sh work fine for me, both terminal and tmux-pane.

  • ubuntu 16.04
  • bash 4.3.48(1)-release
  • tmux 2.1
  • fzf 0.37.0

@Konfekt
Copy link

Konfekt commented Oct 25, 2023

Somewhat offtopic: For some reason, directory completion works for me in ZSH only with fz.sh but without only erratically. Any ideas?

@svardew
Copy link
Author

svardew commented Oct 27, 2023

sorry, I missunderstand.
In __fz_filter() e096093, eval "fzf" is not valid. This invoke ~/bin/fzf directly.
correct code is eval "$fzf"

bash -c 'fzf="date"; eval "fzf" ' #=> invoke fzf, appear fzf-window
bash -c 'fzf="date"; eval "$fzf" ' #=> Fri Oct 27 11:22:33 JST 2023
zsh  -c 'fzf="date"; eval "fzf" ' #=> ditto. appear fzf-window
zsh  -c 'fzf="date"; eval "$fzf" ' #=> ditto.
# command with option separated space
bash -c 'fzf="date +%j-%Y"; eval "$fzf"  ' #=> 300-2023
zsh  -c 'fzf="date +%j-%Y"; eval "$fzf" ' #=> ditto.
bash -c 'fzf="date +%j-%Y"; $fzf ' #=> ditto. word-split works.
zsh  -c 'fzf="date +%j-%Y"; ${=fzf} ' #=> ditto. ${=spec} works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants