navi/shell/navi.plugin.zsh

19 lines
390 B
Bash

#!/usr/bin/env zsh
_call_navi() {
local selected
if [ -n "$LBUFFER" ]; then
if selected="$(printf "%s" "$(navi --print --no-autoselect 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