Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to selectively disable Ctrl+R shell keybinding (while NOT disabling Alt+C & others), e.g. for fish 3.6.0 #3115

Open
3 tasks done
ronjouch opened this issue Jan 7, 2023 · 3 comments

Comments

@ronjouch
Copy link

ronjouch commented Jan 7, 2023

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf (0.35.1 a38b63b)
  • I have searched through the existing issues

Info

  • OS: Linux
  • Shell: fish 3.6.0

Problem / Steps to reproduce

Version 3.6.0 of the Fish shell, released today, ships a default searchable interactive history bound to the typical Ctrl+R shell key binding: fish-shell/fish-shell#602 . It does a great job, and because it's specialized to fish, it does a few nice things fzf doesn't, like syntax highlighting.

So, I'd like to migrate from fzf Ctrl+R shell keybinding to it...

... but I also want to keep being able to use fzf's Alt+C ! I want to only disable fzf's Ctrl+R shell keybinding but I do not want to disable fzf's Alt+C.

→ How can I selectively disable fzf's Ctrl+R shell keybinding while keeping fzf's Alt+C keybinding working? So far my attempt was to no longer call fzf_key_bindings in my fish config, but of couse it disables all keybindings 😕. Is there more granular configuration?

Thanks for the help and thanks for fzf!

Alternative

Alternatively, maybe fzf should detect it's running in fish ≥ 3.6.0, and not register the Ctrl+R shell keybinding?

@ronjouch ronjouch changed the title How to selectively disable Ctrl+R keybinding (while NOT disabling Alt+C & others) How to selectively disable Ctrl+R shell keybinding (while NOT disabling Alt+C & others) Jan 7, 2023
@faho
Copy link

faho commented Jan 8, 2023

Speaking with my fish dev hat on: There's no need for fzf to do anything, you can just erase its ctrl-r binding right after fzf bound it:

fzf_key_bindings
bind --erase \cr

This will restore the preset binding, which is fish's "history-pager".

@ronjouch
Copy link
Author

ronjouch commented Jan 8, 2023

Speaking with my fish dev hat on: There's no need for fzf to do anything, you can just erase its ctrl-r binding right after fzf bound it:

@faho thaaaaaaaaaank youuuuuuuuuuuuuuuuuu! Confirmed working!

@ fzf triagers/maintainers: leaving this issue open, as:

  1. Maybe fzf could do something else (see "Alternative" paragraph of this issue)
  2. Maybe you want an option anyway
  3. Minimally, fzf may want to mention/document this

@ronjouch
Copy link
Author

ronjouch commented Jan 8, 2023

@faho now that I think of it, in addition to fzf needing to document it, since fzf is popular and its default Ctrl+R will override / "hide" the new fish Ctrl+R, maybe it'd be worthwhile to mention this in fish's changelog? What about something like this added to fish's CHANGELOG.rst? (And maybe even to the full keybindings docs?)

  • fzf users: fzf_key_bindings will override fish's new Ctrl+R. In order to both load fzf for other features, AND have the new fish Ctrl+R history, call bind --erase \cr after fzf_key_bindings .

It may help limit cases of "New fish Ctrl+R doesn't work for me" issues.

@ronjouch ronjouch changed the title How to selectively disable Ctrl+R shell keybinding (while NOT disabling Alt+C & others) How to selectively disable Ctrl+R shell keybinding (while NOT disabling Alt+C & others), e.g. for fish 3.6.0 Jan 9, 2023
rouge8 added a commit to rouge8/dotfiles that referenced this issue Feb 22, 2023
Fish 3.6.0's new history pager has syntax highlighting and is generally
very fancy. Let's use it!

junegunn/fzf#3115 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants