[BUG] zsh bad pattern when enabling recommended preview command
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:
- Source the fzf-tab-plugin
- Set the following zstyle line
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
Then, In a new zsh
- Type 'cd'
- Press Tab
- 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

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).
I assume the issue is in this variable declaration: https://github.com/Aloxaf/fzf-tab/blob/14f66e4d3d0b366552c0412eb08ca9e0f7c797bd/lib/-ftb-fzf#L12
How did you install zsh? Compile from source or install from RHEL official repo?
Can you provide the output of fzf --version && zsh --version ?
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.
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.
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.