Coder Social home page Coder Social logo

History search not working about fzf HOT 7 CLOSED

0xBigBoss avatar 0xBigBoss commented on August 15, 2024
History search not working

from fzf.

Comments (7)

junegunn avatar junegunn commented on August 15, 2024

What's the version of your zsh?

zsh --version

Is the problem still reproducible on zsh without any configuration?

zsh -d -f

source <(fzf --zsh)

# Or if fzf is not in your $PATH
source <(~/.fzf/bin/fzf --zsh)

from fzf.

0xBigBoss avatar 0xBigBoss commented on August 15, 2024

same issue. tried with the homebrew zsh and apple zsh.

zsh --version
zsh 5.9 (x86_64-apple-darwin23.0)
opt/homebrew/bin/zsh --version
zsh 5.9 (arm-apple-darwin23.0.0)
fzf-bug.mp4

from fzf.

LangLangBart avatar LangLangBart commented on August 15, 2024

Could you share the output when running the following commands one after another?

# Improved trace prompt
PS4='%B%F{0}+ %D{%T:%3.} %2N:%i%f%b '
# Clears current shell history to minimize debug output
fc -p =(<<<"")

unsetopt KSH_OPTION_PRINT
setopt
fzf --version
source <(fzf --zsh)
# Enable tracing for the function
typeset -fT fzf-history-widget
# Press Ctrl-R, then Enter

from fzf.

junegunn avatar junegunn commented on August 15, 2024

CTRL-R uses Perl since 0.53.0. Could this be a problem with the Perl installation? perl --version?

from fzf.

0xBigBoss avatar 0xBigBoss commented on August 15, 2024

here is the trace outputs

~/.fzf tags/0.53.0 45s
❯ PS4='%B%F{0}+ %D{%T:%3.} %2N:%i%f%b '

~/.fzf tags/0.53.0
❯ fc -p =(<<<"")


~/.fzf tags/0.53.0
❯ unsetopt KSH_OPTION_PRINT


~/.fzf tags/0.53.0
❯ setopt
alwaystoend
autocd
autopushd
combiningchars
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
interactive
interactivecomments
login
longlistjobs
monitor
nopromptcr
nopromptsp
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle

~/.fzf tags/0.53.0
❯ fzf --version

0.53.0 (c4a9ccd)

~/.fzf tags/0.53.0
❯ source <(fzf --zsh)


~/.fzf tags/0.53.0
❯ typeset -fT fzf-history-widget


~/.fzf tags/0.53.0
❯ + 17:18:46:611 fzf-history-widget:1 local selected num
+ 17:18:46:611 fzf-history-widget:2 setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases
+ 17:18:46:612 fzf-history-widget:5 zmodload -F zsh/parameter p:history
+ 17:18:46:612 fzf-history-widget:5 ((  22  ))
+ 17:18:46:612 fzf-history-widget:6 selected=+ 17:18:46:616 fzf-history-widget:6 printf '%1$s\t%2$s\000' 6 $'typeset -fT fzf-history-widget\n' 5 $'source <(fzf --zsh)\n' 4 $'fzf --version\n' 3 setopt 2 $'unsetopt KSH_OPTION_PRINT\n' 1 ''
+ 17:18:46:612 fzf-history-widget:6 selected=+ 17:18:46:617 fzf-history-widget:7 perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\s+(.*)/, $1)}++) { s/\n/\n\t/gm; print; }'
+ 17:18:46:612 fzf-history-widget:6 selected=+ 17:18:46:617 fzf-history-widget:8 __fzfcmd
+ 17:18:46:612 fzf-history-widget:6 selected=+ 17:18:46:619 fzf-history-widget:8 FZF_DEFAULT_OPTS=+ 17:18:46:620 fzf-history-widget:8 __fzf_defaults '' '-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line  --query="" +m --read0'
+ 17:18:46:619 fzf-history-widget:8 FZF_DEFAULT_OPTS=$'--height 40% --bind=ctrl-z:ignore \n -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line  --query="" +m --read0' FZF_DEFAULT_OPTS_FILE='' fzf
+ 17:18:46:612 fzf-history-widget:6 selected=$'4\tfzf --version\n\t'
+ 17:18:49:857 fzf-history-widget:15 local ret=0
+ 17:18:49:857 fzf-history-widget:16 [ -n $'4\tfzf --version\n\t' ']'
+ 17:18:49:857 fzf-history-widget:17 num=+ 17:18:49:857 fzf-history-widget:17 num=+ 17:18:49:862 fzf-history-widget:17 awk '{print $1; exit}'
+ 17:18:49:862 fzf-history-widget:17 grep -o '^[1-9][0-9]*'
+ 17:18:49:857 fzf-history-widget:17 num=$'\C-[[01;31m\C-[[K4\C-[[m\C-[[K'
+ 17:18:49:868 fzf-history-widget:18 zle vi-fetch-history -n $'\C-[[01;31m\C-[[K4\C-[[m\C-[[K'
+ 17:18:49:868 fzf-history-widget:23 zle reset-prompt
~/.fzf tags/0.53.0
❯

I tried with apple perl (v5.34.1) and homebrew perl (v5.38.2).

from fzf.

junegunn avatar junegunn commented on August 15, 2024

It looks like your "grep" is injecting color codes to the output when it shouldn't. What is the output of type grep?

from fzf.

0xBigBoss avatar 0xBigBoss commented on August 15, 2024

@junegunn great find. I have GREP_OPTIONS set.

GREP_OPTIONS=--color=always -I --exclude=tags --exclude-dir={.svn,.git,target}

grep is an alias for grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Unsetting it and fzf works again.

from fzf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.