about summary refs log tree commit diff stats
path: root/wip/tab-compl.sh
diff options
context:
space:
mode:
Diffstat (limited to 'wip/tab-compl.sh')
-rw-r--r--wip/tab-compl.sh37
1 files changed, 37 insertions, 0 deletions
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 @@
1#!/usr/bin/env bash
2
3option_one() {
4 set -o emacs
5 bind 'set show-all-if-ambiguous on'
6 bind 'set completion-ignore-case on'
7
8 COMP_WORDBREAKS=${COMP_WORDBREAKS//:/}
9
10 bind 'TAB:dynamic-complete-history'
11
12 urls=(http://example.com http://sample.net http://example.org)
13
14 for i in "${urls[@]}"; do
15 history -s "$i"
16 done
17
18 echo "${urls[@]}"
19
20 compgen -W "${urls[@]}" http://sa
21 read -rep "> "
22
23 echo "$REPLY"
24}
25
26tab(){ # requires bash 4+
27 READLINE_LINE=foobar
28 READLINE_POINT="${#READLINE_LINE}"
29}
30
31option_two() {
32 set -o emacs
33 bind -x '"\t":"tab"'
34 read -rep "> "
35}
36
37option_two "$@"