summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/shells/zsh/.zshrc1
-rw-r--r--.config/tmux/tmux.conf25
-rwxr-xr-x.local/bin/tmux-sessionizer29
3 files changed, 55 insertions, 0 deletions
diff --git a/.config/shells/zsh/.zshrc b/.config/shells/zsh/.zshrc
index 9f934a9..75f7f16 100644
--- a/.config/shells/zsh/.zshrc
+++ b/.config/shells/zsh/.zshrc
@@ -9,6 +9,7 @@ source $SHELLDIR/dirrc
source $SHELLDIR/colorsrc # contians color substituions
source $SHELLDIR/cpwdrc # contains _collapsed_pwd
bindkey -v
+bindkey -s ^f "tmux-sessionizer\n"
HISTFILE="$XDG_CACHE_HOME/zshHIST"
SAVEHIST=100
HISTSIZE=5000
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
new file mode 100644
index 0000000..139c895
--- /dev/null
+++ b/.config/tmux/tmux.conf
@@ -0,0 +1,25 @@
+set -ga terminal-overrides ",xterm-256color*:Tc"
+set -s escape-time 0
+
+bind-key C-b send-prefix
+#set -g status-style 'bg=#333333 fg=#5eacd3'
+
+bind r source-file ~/.tmux.conf
+set -g base-index 1
+
+set-window-option -g mode-keys vi
+bind -T copy-mode-vi v send-keys -X begin-selection
+bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
+
+# vim-like pane switching
+bind -r ^ last-window
+bind -r k select-pane -U
+bind -r j select-pane -D
+bind -r h select-pane -L
+bind -r l select-pane -R
+
+# forget the find window. That is for chumps
+bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
+
+bind-key -r T run-shell "~/.local/bin/tmux-sessionizer ~/Documents/Projects/git/The-Morning-Paper"
+
diff --git a/.local/bin/tmux-sessionizer b/.local/bin/tmux-sessionizer
new file mode 100755
index 0000000..3780e18
--- /dev/null
+++ b/.local/bin/tmux-sessionizer
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+# This script is stolen from The Primeagen
+# https://github.com/ThePrimeagen/.dotfiles/
+
+if [[ $# -eq 1 ]]; then
+ selected=$1
+else
+ selected=$(find ~/Documents/Projects ~ ~/.config ~/Documents/Projects/git ~/Documents/Projects/Experiments -mindepth 1 -maxdepth 1 -type d | fzf)
+fi
+
+if [[ -z $selected ]]; then
+ exit 0
+fi
+
+selected_name=$(basename "$selected" | tr . _)
+tmux_running=$(pgrep tmux)
+
+if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
+ tmux new-session -s $selected_name -c $selected
+ exit 0
+fi
+
+if ! tmux has-session -t=$selected_name 2> /dev/null; then
+ tmux new-session -ds $selected_name -c $selected
+fi
+
+tmux switch-client -t $selected_name
+