navi/shell/navi.plugin.zsh

20 lines
408 B
Bash
Raw Normal View History

2020-03-04 21:01:23 +00:00
#!/usr/bin/env zsh
_call_navi() {
2020-04-07 04:55:42 +00:00
local selected
if [ -n "$LBUFFER" ]; then
2020-09-14 18:30:25 +00:00
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
2020-04-07 04:55:42 +00:00
fi
zle redisplay
2020-03-04 21:01:23 +00:00
}
zle -N _call_navi
bindkey '^g' _call_navi