navi/shell/navi.plugin.zsh
2020-09-14 11:30:25 -07:00

19 lines
408 B
Bash

#!/usr/bin/env zsh
_call_navi() {
local selected
if [ -n "$LBUFFER" ]; then
if selected="$(printf "%s" "$(navi --print --fzf-overrides '--no-select-1' --query "${LBUFFER}" </dev/tty)")"; then
LBUFFER="$selected"
fi
else
if selected="$(printf "%s" "$(navi --print </dev/tty)")"; then
LBUFFER="$selected"
fi
fi
zle redisplay
}
zle -N _call_navi
bindkey '^g' _call_navi