Closed anon-legion closed 11 months ago
Hi,
bind
and paste the bottom lines that aren't default?Hi @PatrickF1,
The only non-default fzf.fish bind that I configured is Directory, set to ctrl+f
. The results of bind
:
GNOME Terminal > Preferences > Shortcuts has no binds for Ctrl+R
, the only commands that start with ctrl
are Zoom in (ctrl++
), Zoom out (ctrl+-
), Normal Size (ctrl+0
), Switch to previous tab (ctrl+page up
), and Switch to next tab (ctrl+page down
). The rest start with either shift
, alt
, or are disabled
Yes the other fzf.fish commands work as expect. Directory, Process, etc... I am only having issue with History
Okay. Can you try binding Ctrl+R to ls and see if it triggers ls successfully?
And also can you run history
and make sure itβs not empty?
I bind ctrl+r
to ls
in config.fish
like so:
Pressing ctrl+r
triggers ls
as expected:
Running history
shows history is not empty:
Wow, very strange indeed. Can you try using a different terminal emulator and seeing it it works there? I'm trying to isolate the bug.
And if that still doesn't work, can you go into _fzf_search_history
and overwrite the file to do something really simply like this
function _fzf_search_history
set -f commands_selected (ls | _fzf_wrapper)
if test $status -eq 0
commandline --replace -- $commands_selected
end
commandline --function repaint
end
You can the path to the file is by running functions _fzf_search_history
.
Sorry you have to get your hands dirty. This is a tricky bug.
Tried using a different terminal (Guake Terminal) and the same issue persist, pressing ctrl+r
creates a newline above my prompt:
Copy pasted suggested code to _fzf_search_history.fish
and overwrote existing code like so:
The results of pressing ctrl+r
now yields the contents of the path directory:
Ok we've isolated the issue to something within _fzf_search_history
.
One more test:
this time replace _fzf_search_history
with
function _fzf_search_history
set -f commands_selected (history | _fzf_wrapper)
if test $status -eq 0
commandline --replace -- $commands_selected
end
commandline --function repaint
end
does that work?
I copy pasted your code and replaced _fzf_search_history
as you requested:
Pressing ctrl+r
now shows command history like so:
Did we fix it? Or are we close?
I think we're close-ish. We've eliminated a lot of things as the problem and know the problem is something in _fzf_search_history
. Still don't know exactly what it is though.
You seem like a very competent user. Would you prefer to play around with _fzf_search_history
and debug it yourself now, or do you want me to continue debugging over this conversation? Obviously it'll be more thinking for you to do the former but it'll also be way faster.
I will give it a shot. I'll see what I can do and work on it this weekend when I have no work so I have plenty time to sit down and thoroughly debug the issue. If I have any questions or if I find the solution I will be posting it here.
Hi @PatrickF1, I Have isolated the issue to the --scheme=history
option of the _fzf_wrapper
function.
Currently my _fzf_search_history.fish
is exactly like the default fish function except with the --scheme=history
commented out like so:
function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
if test -z "$fish_private_mode"
builtin history merge
end
if not set --query fzf_history_time_format
set -f fzf_history_time_format "%m-%d %H:%M:%S"
end
set -f time_prefix_regex '^.*? β '
set -f commands_selected (
builtin history --null --show-time="$fzf_history_time_format β " |
_fzf_wrapper --read0 \
--print0 \
--multi \
# --scheme=history \
--prompt="History> " \
--query=(commandline) \
--preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \
--preview-window="bottom:3:wrap" \
$fzf_history_opts |
string split0 |
string replace --regex $time_prefix_regex ''
)
if test $status -eq 0
commandline --replace -- $commands_selected
end
commandline --function repaint
end
Now pressing ctrl+r
show the command history and it looks to me like its working normally now? What was that option supposed to do?
https://github.com/PatrickF1/fzf.fish/pull/302 is where it was added. It makes the scoring algorithm better for chronological list. Your issue might be that you're not on the latest version of fzf, but for some reason the error isn't showing up!
Oh, please pardon me. I installed fzf using apt repo and I did not realize until I looked at "Packaging status" that the version it downloads for Ubuntu 22.04 is very far behind (0.29.0), I should have not made any assumptions regarding the recency of the package's version. I have downloaded and built fzf from source and I am now on the latest version (0.43.0).
I have also uncommented the -scheme=history
option in _fzf_search_history.fish
and now everything works as expected.
Thank you for your patience.
No problem, it happens! I am also very confused why it doesn't error and just outputs a newline. Let me know if you have any ideas!
Before proceeding...
Describe the bug
ctrl+r (command history) only creates a new line above my prompt and does not show any command history.
Steps to reproduce
Press ctrl+r
Environment
Versions installed:
Which, if any, configuration variables such as
fzf_preview_file_cmd
are set?I am using defaults except for
fzf_configure_bindings --directory=\cf
set in myconfig.fish
Additional context
This is a fresh install for a brand new S76 laptop. If I unbind command history by doing
fzf_configure_bindings --history=
, triggers a different looking command history like so: