summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahim Muftee <ibrahim@muftee.net>2025-08-22 14:06:08 -0500
committerIbrahim Muftee <ibrahim@muftee.net>2026-07-01 00:23:31 -0400
commit510346e10839934217cc0885cf724642f831212f (patch)
treeabd7bc499e2d34a170dd3977a883c16d05bb582a
parente9cb678475e8fcf2d9a825f1b0fa0cd47358d4d9 (diff)
feat(tmux): add tmux
-rw-r--r--dot_config/tmux/tmux.conf20
-rw-r--r--dot_zshrc.tmpl2
-rw-r--r--private_dot_local/bin/executable_tmux-session-dispensary.sh30
3 files changed, 51 insertions, 1 deletions
diff --git a/dot_config/tmux/tmux.conf b/dot_config/tmux/tmux.conf
new file mode 100644
index 0000000..e0d060d
--- /dev/null
+++ b/dot_config/tmux/tmux.conf
@@ -0,0 +1,20 @@
+set -a terminal-features "xterm-256color:RGB"
+set -g prefix C-SPACE
+set -g base-index 1
+set -g renumber-windows on
+set -g mode-keys vi
+set -g status-position top
+set -g status-justify absolute-centre
+set -g status-style "bg=default"
+set -g window-status-current-style "fg=blue bg=default bold"
+set -g status-right ""
+set -g status-left "#S"
+
+bind r source-file "~/.config/tmux/tmux.conf"
+bind f run-shell "tmux neww ~/.local/bin/tmux-session-dispensary.sh"
+
+# Vim key pane naviagtion
+bind -r h select-pane -L
+bind -r j select-pane -D
+bind -r k select-pane -U
+bind -r l select-pane -R
diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl
index 4e7cb75..5c51dab 100644
--- a/dot_zshrc.tmpl
+++ b/dot_zshrc.tmpl
@@ -93,7 +93,7 @@ bindkey -s '^o' 'lfcd\n'
bindkey -s '^a' 'bc -lq\n'
-bindkey -s '^f' '$(eval find $HOME/.config $HOME/code $HOME/.local/share -mindepth 1 -maxdepth 1 | fzf)\n'
+bindkey -s '^f' 'tmux-session-dispensary.sh\n'
bindkey '^[[P' delete-char
diff --git a/private_dot_local/bin/executable_tmux-session-dispensary.sh b/private_dot_local/bin/executable_tmux-session-dispensary.sh
new file mode 100644
index 0000000..ccbdbaf
--- /dev/null
+++ b/private_dot_local/bin/executable_tmux-session-dispensary.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+DIRS=(
+ "$HOME"
+ "$HOME/.config"
+ "$HOME/.local"
+ "$HOME/.local/share"
+ "$HOME/Documents"
+ "$HOME/Documents/Code"
+)
+
+if [[ $# -eq 1 ]]; then
+ selected=$1
+else
+ selected=$(fd "${DIRS[@]}" --type=dir --max-depth=1 --full-path \
+ | sed "s|^$HOME/||" \
+ | sk -m)
+ [[ $selected ]] && selected="$HOME/$selected"
+fi
+
+[[ ! $selected ]] && exit 0
+
+selected_name=$(basename "$selected" | tr . _)
+if ! tmux has-session -t "$selected_name"; then
+ tmux new-session -ds "$selected_name" -c "$selected"
+ tmux select-window -t "$selected_name:1"
+fi
+
+connect_cmd=$([[ -z $TMUX ]] && echo "attach" || echo "switch-client")
+tmux "$connect_cmd" -t "$selected_name"