summaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.bashrc23
1 files changed, 23 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
new file mode 100644
index 0000000..790d6d4
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,23 @@
+sessionizer() {
+ DIR=$(fdfind --type d --strip-cwd-prefix -L -H | fzf)
+ SESSION_NAME="$DIR_$(date +%M%S)"
+
+ if [ -n "$DIR" ]
+ then
+ if [ "$1" == "-cd" ]
+ then
+ cd $DIR
+ return
+ fi
+ tmux new-session -d -c "$DIR" -s "$SESSION_NAME"
+ if [ -n "$TMUX" ]
+ then
+ tmux switch -t "$SESSION_NAME"
+ else
+ tmux attach -t "$SESSION_NAME"
+ fi
+ fi
+}
+
+bind '"\C-f": "sessionizer\n"'
+bind '"\C-F": "sessionizer -cd\n"'