I'm on Arch Linux (4.13.11) and in my .bashrc, there's a custom function that finds a file using fzf and then opens that file with the default editor:
# Search a file with fzf inside a Tmux pane and then open the file in an editor
fzf_then_open_in_editor() {
local file=$(fzf-tmux)
# Open the file if it exists
if [ -n "$file" ]; then
# Use the default editor if it's defined, otherwise Vim
${EDITOR:-vim} "$file"
fi
}
I've configured my .inputrc, to use Vim-like keybindings for the shell:
set editing-mode vi
Preferably, I could press Ctrl + o when in command mode to call my function fzf_then_open_in_editor.
I tried
set keymap vi-command
"\C-o": fzf_then_open_in_editor
but that didn't work.
In .inputrc, how can I create keybindings for functions defined in .bashrc?