Atuin, Fish shell, and fzf plugin
I recently installed and started using Atuin, an excellent tool for syncing shell history across machines.
It also provides a great interface for searching your shell history, which you can access with either
of the expected keybindings, ↑ key or ctrl-r
.
The only problem was that ctrl-r
wouldn’t work, as the fzf plugin was already using it.
In my case, I did the following to fix this.
I added a file under $fish_config/functions/atuin_key_bindings.fish
that captures the keybindings that Atuin tries to set up when initialized.
status is-interactive; or exit 0
function atuin_key_bindings
bind \cr _atuin_search
bind -k up _atuin_bind_up
bind \eOA _atuin_bind_up
bind \e\[A _atuin_bind_up
if bind -M insert >/dev/null 2>&1
bind -M insert \cr _atuin_search
bind -M insert -k up _atuin_bind_up
bind -M insert \eOA _atuin_bind_up
bind -M insert \e\[A _atuin_bind_up
end
end
Updating the file under $fish_config/functions/fish_user_key_bindings.fish
to call the new function above after the fzf_key_bindings
function.
function fish_user_key_bindings
end
fzf_key_bindings
atuin_key_bindings