From 7151ad96302cfad921e9ff79c8867c2596dc2988 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 2 Jun 2020 21:53:52 -0500 Subject: Add wip This is where all my works in progress are going to go. Expect it to be really messy. --- wip/tab-compl.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 wip/tab-compl.sh diff --git a/wip/tab-compl.sh b/wip/tab-compl.sh new file mode 100644 index 0000000..459797a --- /dev/null +++ b/wip/tab-compl.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +option_one() { + set -o emacs + bind 'set show-all-if-ambiguous on' + bind 'set completion-ignore-case on' + + COMP_WORDBREAKS=${COMP_WORDBREAKS//:/} + + bind 'TAB:dynamic-complete-history' + + urls=(http://example.com http://sample.net http://example.org) + + for i in "${urls[@]}"; do + history -s "$i" + done + + echo "${urls[@]}" + + compgen -W "${urls[@]}" http://sa + read -rep "> " + + echo "$REPLY" +} + +tab(){ # requires bash 4+ + READLINE_LINE=foobar + READLINE_POINT="${#READLINE_LINE}" +} + +option_two() { + set -o emacs + bind -x '"\t":"tab"' + read -rep "> " +} + +option_two "$@" -- cgit 1.4.1-21-gabe81