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

[BUG] zsh bad pattern when enabling recommended preview command

Open de846 opened this issue 3 years ago • 5 comments

Describe the bug

Configuring the provided example zstyle option for previewing with cd command results in zsh bad pattern error message.

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

Steps to reproduce the behavior: First-time setup:

  1. Source the fzf-tab-plugin
  2. Set the following zstyle line zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'

Then, In a new zsh

  1. Type 'cd'
  2. Press Tab
  3. See error:
zsh:3: bad pattern: _ftb_compcap=(Desktop^B<^@>^@group^@1^@realdir^@^@args^@-Q^A-s^A^A-W^A^A-M^Ar:|/=* r:|=*^A-p^A^A-f^@word^@Desktop

Expected behavior

I expect the preview window to display the output of the command set by the zstyle command.

Screenshots

image

Environment:

  • OS: [RHEL 7]
  • zsh version: [5.9]

Minimal zshrc

source ~/.oh-my-zsh/custom/plugins/fzf-tab/fzf-tab.plugin.zsh
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
HISTSIZE=500000
SAVEHIST=500000

Log

If applicable, use C-x . to trigger completion and provide the log.

tags in context :completion::complete:cd::
    local-directories  (_cd)

If there are only three lines in your log, please make sure your fzf-tab is loaded with the correct order (see the checklist above).

de846 avatar Oct 31 '22 17:10 de846

I assume the issue is in this variable declaration: https://github.com/Aloxaf/fzf-tab/blob/14f66e4d3d0b366552c0412eb08ca9e0f7c797bd/lib/-ftb-fzf#L12

ayroblu avatar Nov 17 '22 16:11 ayroblu

How did you install zsh? Compile from source or install from RHEL official repo?

Can you provide the output of fzf --version && zsh --version ?

Aloxaf avatar Nov 24 '22 06:11 Aloxaf

For me personally I'm using a standalone zsh + 0.30.0 fzf, but I'm wondering if it's possible to use a standard fzf completion here? Like I was really just trying to have tab trigger fzf in the same way that ctrl-t does, and there's a bunch of extra stuff happening.

ayroblu avatar Nov 25 '22 10:11 ayroblu

How did you install zsh? Compile from source or install from RHEL official repo?

Can you provide the output of fzf --version && zsh --version ?

❯ fzf --version
0.33.0 (0.33.0)

❯ zsh --version
zsh 5.9 (x86_64-pc-linux-gnu)

I'm using Nix packaged versions of fzf and zsh from Nixpkgs.

de846 avatar Nov 28 '22 22:11 de846

Figured this out for my use case, because I was using this on a corp, I had copied my macOS plugin to the centos box. By remaking in docker, and copying the output of that, this resolved the issue.

ayroblu avatar Dec 29 '22 13:12 ayroblu