diff options
author | Case Duckworth | 2020-06-02 21:53:52 -0500 |
---|---|---|
committer | Case Duckworth | 2020-06-02 21:53:52 -0500 |
commit | 7151ad96302cfad921e9ff79c8867c2596dc2988 (patch) | |
tree | 4f628ea10b02c54bb43ea9619922292fc1bbbdbe | |
parent | Add history file (diff) | |
download | bollux-7151ad96302cfad921e9ff79c8867c2596dc2988.tar.gz bollux-7151ad96302cfad921e9ff79c8867c2596dc2988.zip |
Add wip
This is where all my works in progress are going to go. Expect it to be really messy.
-rw-r--r-- | wip/tab-compl.sh | 37 |
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 | |||
3 | option_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 | |||
26 | tab(){ # requires bash 4+ | ||
27 | READLINE_LINE=foobar | ||
28 | READLINE_POINT="${#READLINE_LINE}" | ||
29 | } | ||
30 | |||
31 | option_two() { | ||
32 | set -o emacs | ||
33 | bind -x '"\t":"tab"' | ||
34 | read -rep "> " | ||
35 | } | ||
36 | |||
37 | option_two "$@" | ||