Aloxaf / fzf-tab

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

[BUG] Completing dd if= results in wrong $realpath #254

Open FalcoGer opened 2 years ago

FalcoGer commented 2 years ago

Describe the bug

When completing dd if=[TAB] $realpath is if=/path/to/file instead of /path/to/file

I can make sure:

To Reproduce

Steps to reproduce the behavior:

  1. Type dd if=
  2. Press Tab
  3. Check what $realpath is with `zstyle ':fzf-tab:complete:*' fzf-preview 'echo $realpath'
  4. See that it is if=/path/to/file rather than just the path

Expected behavior

$realpath should be the path only, without anything attached to the path, such as if=

Screenshots

image

Environment:

Minimal zshrc

export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="agnoster"
HYPHEN_INSENSITIVE="true"
DISABLE_UPDATE_PROMPT="true"
export UPDATE_ZSH_DAYS=1
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
HIST_STAMPS="dd.mm.yyyy"
plugins=(
    fzf                     # fuzzy search in history (ctrl+r)
    fzf-tab                 # fzf support in tab complete
    zsh-autosuggestions     # provide automatic suggestions based on history and completion
    fast-syntax-highlighting
)

# fzf-tab
# https://github.com/Aloxaf/fzf-tab
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:complete:*' fzf-preview 'echo Realpath is: $realpath'

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#104010,underline"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
ZSH_AUTOSUGGEST_USE_ASYNC=true

source $ZSH/oh-my-zsh.sh
export EDITOR='vim'

# autocomplete stuff
# The following lines were added by compinstall
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _complete _ignored _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort name
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' ignore-parents parent pwd .. directory
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' menu select=4
zstyle ':completion:*' original false
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*' use-compctl true
zstyle ':completion:*' verbose true
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
# End of lines added by compinstall

# Lines configured by zsh-newuser-install
HISTFILE="$ZSH_CACHE_DIR/.zsh_history"
HISTSIZE=4096
SAVEHIST=8192
setopt autocd nomatch notify beep
unsetopt extendedglob
bindkey -e # -e = emacs mode, -v = vim mode
# End of lines configured by zsh-newuser-install

Log

N/A

Aloxaf commented 2 years ago

Please try #258

FalcoGer commented 2 years ago

Works. Thank you.