aboutsummaryrefslogtreecommitdiffstats
path: root/.config/tmux
diff options
context:
space:
mode:
authorSimen A. W. Olsen <so@bjerk.io>2024-08-10 12:28:07 +0200
committerSimen A. W. Olsen <so@bjerk.io>2024-08-10 12:28:07 +0200
commit17f4bf3cb258a6e898377078deb23b8588cf9ba7 (patch)
tree483a02132711ca31f2c496eb34c33a5546fb56b1 /.config/tmux
parent519875b83090af2591a2663afccf2f58c83e9c91 (diff)
downloaddotfiles-17f4bf3cb258a6e898377078deb23b8588cf9ba7.tar.gz
dotfiles-17f4bf3cb258a6e898377078deb23b8588cf9ba7.zip
add missing tmux config
Diffstat (limited to '.config/tmux')
-rw-r--r--.config/tmux/tmux.conf63
1 files changed, 63 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
new file mode 100644
index 0000000..88042e9
--- /dev/null
+++ b/.config/tmux/tmux.conf
@@ -0,0 +1,63 @@
+
+unbind C-b
+set-option -g prefix C-a
+bind-key C-a send-prefix
+set -g status-style 'bg=#333333 fg=#5eacd3'
+set -g mouse on
+set -g base-index 1
+set -g pane-base-index 1
+set-window-option -g pane-base-index 1
+set-option -g renumber-windows on
+set-option -g mouse on
+
+set -ga terminal-overrides ",screen-256color*:Tc"
+set-option -g default-terminal "screen-256color"
+set -s escape-time 0
+
+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'
+
+bind '"' split-window -c "#{pane_current_path}"
+bind % split-window -h -c "#{pane_current_path}"
+
+bind-key -r g run-shell "tmux neww lazygit"
+bind-key -r i run-shell "tmux neww ~/scripts/tmux-cht.sh"
+
+bind-key -r f run-shell "tmux neww twm"
+bind-key -r F run-shell "tmux neww twm -l"
+bind-key -r e run-shell "tmux switch -t $TWM_DEFAULT"
+
+# Smart pane switching with awareness of Vim splits.
+# See: https://github.com/christoomey/vim-tmux-navigator
+
+# decide whether we're in a Vim process
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
+ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
+
+bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
+bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
+bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
+bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
+
+tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
+
+if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
+if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
+
+bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
+
+bind-key -T copy-mode-vi 'C-h' select-pane -L
+bind-key -T copy-mode-vi 'C-j' select-pane -D
+bind-key -T copy-mode-vi 'C-k' select-pane -U
+bind-key -T copy-mode-vi 'C-l' select-pane -R
+bind-key -T copy-mode-vi 'C-\' select-pane -l
+bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
+
+set -g @plugin 'tmux-plugins/tpm'
+set -g @plugin 'tmux-plugins/tmux-sensible'
+
+
+run '~/.tmux/plugins/tpm/tpm'