Aloxaf / fzf-tab

Replace zsh's default completion selection menu with fzf!
MIT License
3.39k stars 96 forks source link

[BUG] #491

Closed quicknir closed 1 day ago

quicknir commented 2 days ago

Describe the bug

A clear and concise description of what the bug is.

I can make sure:

To Reproduce

Steps to reproduce the behavior:

  1. Completion somewhere with a large number of candidates, e.g. git
  2. Press Tab
  3. See enormous amounts of wasted space.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

image

Environment:

Minimal zshrc

autoload -Uz compinit
compinit

zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]'

zstyle ':fzf-tab:*' default-color $'\033[93m'
zstyle ':fzf-tab:*' single-color $'\033[93m'

export FZF_TAB_GROUP_COLORS=($'\033[34m' $'\033[31m' $'\033[32m' $'\033[35m' $'\033[36m'
    $'\033[33m' $'\033[95m' $'\033[91m' $'\033[93m')

zstyle ':fzf-tab:*' group-colors $FZF_TAB_GROUP_COLORS

. "${ZDOTDIR:h}/fzf-tab/fzf-tab.plugin.zsh"
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
zstyle ':fzf-tab:*' fzf-bindings 'ctrl-l:accept'
zstyle ':fzf-tab:*' prefix ''
quicknir commented 1 day ago

It seems like fzf is not using the entire tmux popup, but I just can't explain why; I've tried a whole bunch of things but nothing seems to work. One observation - is there a reason why ftb-tmux-popup doesn't use fzf-tmux? Maybe it predates it? I think that would simplify this code a bit, and in general it's probably safer to just leave it to fzf to correctly handle running itself inside tmux.

quicknir commented 1 day ago

Hmm, okay, I can run something as simple as tmux popup -x 0 -y 34 -w 84 -h 34 -d . "fzf" and fzf is not taking the entire popup. Very odd.

quicknir commented 1 day ago

Okay, this seems to be related to FZF_DEFAULT_OPTS. I had --height 40% in there. When I remove that (and completely restart my shell, tmux, etc), the problem goes away. Unfortunately, I was reading the latest documentation (which says that fzf-tab does not use FZF_DEFAULT_OPTS at all, by default), but I installed the latest release, which does still use them. Upgrading to head of fzf-tab also solves my issue.

I'm going to close this. I think Aloxaf you made the right call in not using FZF_DEFAULT_OPTS at all; I had a comment in my zsh config that said "fzf-tab has a very complex relationship with FZF_DEFAULT_OPTS"; I think in the past I spent hours trying to sort issues relating to that and theming.

Thanks for everything!