Skip to content

FZF_CTRL_R_OPTS to support ctrl-o to execute and prepare next commad #2399

Open
@ri-aje

Description

@ri-aje
  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

bash ctrl-o operate-and-get-next stops working once I source source ~/.fzf.bash which is auto generated by fzf and replaces the default ctrl-r by the __fzf_history__ function.

fzf ctrl-r behavior

  1. bash --noprofile --norc
  2. source ~/.fzf.bash
  3. export FZF_CTRL_R_OPTS="--bind=ctrl-o:accept", I don't see an accept-and-execute event, and execute(...) isn't what I want either.
  4. cd ~
  5. ls
  6. press ctrl-r
  7. find cd ~ command
  8. press ctrl-o, notice fzf exits and command line is populated with cd ~, but no execution happens.
  9. press ctrl-o again, notice it executes cd ~, then populates cd ~ again.

for comparison, here is vanilla bash ctrl-r behavior

  1. bash --noprofile --norc
  2. cd ~
  3. ls
  4. press ctrl-r
  5. find cd ~ command
  6. press ctrl-o, notice the history search exits and the command is executed, and ls is auto populated, ready for execution.
  7. press ctrl-o will execute ls and further chain up remaining next commands, eventualy giving a walking through previous sequence effect. this works even when I modify the commands (except the first one found in history which has to be executed as is by ctrl-o).

is there anyway to keep bash original ctrl-o behavior? I do like fzf to search history, but the ctrl-o auto sequencing behavior is very useful, e.g., in edit-compile-run cycles. thanks.

for reference, here is some explanation about bash behavior, I found it on http://web.mit.edu/gnu/doc/html/features_7.html

operate-and-get-next (C-o)
Accept the current line for execution and fetch the next line relative to the current line from the history for editing. Any argument is ignored.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions