mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +00:00
25 lines
598 B
Bash
25 lines
598 B
Bash
function tv_smart_autocomplete() {
|
|
local current_prompt="${READLINE_LINE:0:$READLINE_POINT}"
|
|
|
|
local output=$(tv --autocomplete-prompt "$current_prompt")
|
|
|
|
if [[ -n $output ]]; then
|
|
READLINE_LINE=$current_prompt$output
|
|
READLINE_POINT=${#READLINE_LINE}
|
|
fi
|
|
}
|
|
|
|
function tv_shell_history() {
|
|
local current_prompt="${READLINE_LINE:0:$READLINE_POINT}"
|
|
|
|
local output=$(tv bash-history --input "$current_prompt")
|
|
|
|
if [[ -n $output ]]; then
|
|
READLINE_LINE=$output
|
|
READLINE_POINT=${#READLINE_LINE}
|
|
fi
|
|
}
|
|
|
|
bind -x '"\C-t": tv_smart_autocomplete'
|
|
bind -x '"\C-r": tv_shell_history'
|