fzf-tab icon indicating copy to clipboard operation
fzf-tab copied to clipboard

[BUG] Using `--tmux` in an exported `FZF_DEFAULT_OPTS` breaks `ftb-tmux-popup`

Open andrewbraxton opened this issue 1 year ago • 6 comments

Describe the bug

Using --tmux in an exported FZF_DEFAULT_OPTS breaks ftb-tmux-popup. Weird thing is that it seems to stay broken even if you unset FZF_DEFAULT_OPTS.

I can make sure:

  • [x] I am using the latest version of fzf-tab
  • [x] this is the minimal zshrc which can reproduce this bug
  • [x] fzf-tab is loaded after compinit
  • [x] fzf-tab is loaded after plugins which will wrap Tab, like junegunn/fzf/completion.zsh
  • [x] fzf-tab is loaded before zsh-autosuggestions, zsh-syntax-highlighting and fast-syntax-highlighting.

To Reproduce

  1. Enter tmux
  2. Type ls (or anything)
  3. Press Tab
  4. Popup flashes briefly and disappears

Expected behavior

Popup appears normally and allows selection

Environment:

  • OS: macOS Sonoma 14.5
  • zsh version: 5.9

Minimal zshrc

autoload -Uz compinit
compinit

export FZF_DEFAULT_OPTS='--tmux'

source ~/.fzf-tab/fzf-tab.plugin.zsh
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup

andrewbraxton avatar Jul 13 '24 06:07 andrewbraxton

I am also running into this issue. Removing export FZF_DEFAULT_OPTS='--tmux' and restarting the tmux session fixes ftb-tmux-popup, but this is un-ideal as that (obviously) disables the tmux popup for fzf when doing a deep-fuzzy search (e.g. ls ./fuzz** <tab> will not open a tmux popup and will instead produce output below the prompt).

cameronbrill avatar Jul 15 '24 17:07 cameronbrill

interestingly, if I remove export FZF_DEFAULT_OPTS='--tmux' from my zshrc, start a tmux session, add export FZF_DEFAULT_OPTS='--tmux' to my zshrc, then run zsh to restart the shell, both ftb-tmux-popup and the fzf tmux popup work as intended

cameronbrill avatar Jul 15 '24 17:07 cameronbrill

Yeah, I ran a bunch of the same experiments and got similar confusing results.

andrewbraxton avatar Jul 15 '24 18:07 andrewbraxton

I have the same problem, but I couldn't resolve it even when trying your trick. Did you figure this out?

itahol avatar Aug 05 '24 22:08 itahol

My current workaround is editing ftb-tmux-popup so it runs fzf without "--tmux" in its opts, like so:

echo -E "env SHELL=$ZSH_NAME FZF_DEFAULT_OPTS=$BASE_FZF_DEFAULT_OPTS $commands[fzf] ${(qq)fzf_opts[@]} < $tmp_dir/completions.$$ > $tmp_dir/result-$$" > $tmp_dir/fzf-$$

Seems to do the job.

itahol avatar Aug 05 '24 22:08 itahol

I'm also seeing this issue as well. My current workaround is to alias fzf='fzf --tmux=80%' while keeping the rest of my config defined on FZF_DEFAULT_OPTS

chris4prez avatar Aug 22 '24 20:08 chris4prez