1

fzf has some keybindings of which some are listed below as examples:

  • Alt-C : cd into the selected directory
  • Ctrl-T : select a file

I want to add a keybiding so that I can launch the selected file with fzf, maybe using xdg-open or mimeopen.

1 Answer 1

0

Add this to your .bashrc:

bind -x '"\C-o": file="$(fzf --height 40% --reverse)" && [ -f "$file" ] && xdg-open "$file"'

Restart your terminal, or run source .bashrc. Now you can use Ctrl+o to open files directly with preferred application.

1
  • Thanks. Why does this not need & to be run asynchronously?
    – kadekai
    May 14, 2019 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.