summary refs log tree commit diff stats
path: root/session.bash
diff options
context:
space:
mode:
Diffstat (limited to 'session.bash')
-rw-r--r--session.bash12
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() {