diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2022-02-03 01:02:41 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2022-02-03 01:02:41 -0300 |
commit | 5032772c2a295d885cdbac419a32b2ed2e528f2b (patch) | |
tree | 5d0079c5e304fe10c97f07e5c6311256cce5e1e7 | |
parent | 5e15900d53124acd654f90a392b72b85ced6df3d (diff) |
Add completion support
-rw-r--r-- | session.bash | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/session.bash b/session.bash index caa35de..d6c02b3 100644 --- a/session.bash +++ b/session.bash @@ -30,6 +30,18 @@ session() { false fi } +# setup completion for session(), using only builtins +complete -C 'source <(printf "%s" '\'' + set -- ~/.bash_history."$2"* + flag=0 + [[ -e "$1" ]] && for f in "${@#~/.bash_history.}" ; do + if [[ "$f" =~ ^[a-z][a-z0-9]*$ ]] ; then + ((flag)) && printf "\n" + printf "%s" "$f" + flag=1 + fi + done +'\'')' session # sets the current cwd as the default cwd for the session setsessioncwd() { |