Fzf: Directly execute item from history

Created on 6 Oct 2016  路  2Comments  路  Source: junegunn/fzf

  • Category

    • [x] fzf binary

    • [ ] fzf-tmux script

    • [ ] Key bindings

    • [ ] Completion

    • [ ] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [x] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Etc.

  • Shell

    • [x] bash

    • [ ] zsh

    • [ ] fish

Having switched to fzf, and coming from the normal Bash backwards history search, it鈥檇 be great, if selecting the item from the fzf list, would execute it right away, so I only have to hit return once.

duplicate question

Most helpful comment

Duplicate of #477. The issue is left open as we haven't found a way to allow the user to dynamically choose which action to perform, edit or execute, on bash. If you unconditionllay want to execute the command, you can simply append \C-m to the key binding.

# Append \C-m
bind "$(bind -s | grep '^"\\C-r"' | grep -v '\\C-m' | sed 's/"$/\\C-m"/')"

Alternatively, you can define an extra key binding for that leaving the default one unchanged.

# CTRL-X CTRL-R
bind "$(bind -s | grep '^"\\C-r"' | sed 's/"/"\\C-x/' | sed 's/"$/\\C-m"/')"

All 2 comments

Duplicate of #477. The issue is left open as we haven't found a way to allow the user to dynamically choose which action to perform, edit or execute, on bash. If you unconditionllay want to execute the command, you can simply append \C-m to the key binding.

# Append \C-m
bind "$(bind -s | grep '^"\\C-r"' | grep -v '\\C-m' | sed 's/"$/\\C-m"/')"

Alternatively, you can define an extra key binding for that leaving the default one unchanged.

# CTRL-X CTRL-R
bind "$(bind -s | grep '^"\\C-r"' | sed 's/"/"\\C-x/' | sed 's/"$/\\C-m"/')"

I added the "Append \C-m" line to the end of

shell/key-bindings.bash

It works but is this the correct location?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nordlow picture nordlow  路  3Comments

olethanh picture olethanh  路  3Comments

leonklingele picture leonklingele  路  3Comments

erusev picture erusev  路  3Comments

jberglinds picture jberglinds  路  3Comments