summaryrefslogtreecommitdiff
path: root/home/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'home/tmux')
-rw-r--r--home/tmux/default.nix16
-rw-r--r--home/tmux/tmux.conf105
-rwxr-xr-xhome/tmux/tmux_window7
3 files changed, 128 insertions, 0 deletions
diff --git a/home/tmux/default.nix b/home/tmux/default.nix
new file mode 100644
index 0000000..c7ce7db
--- /dev/null
+++ b/home/tmux/default.nix
@@ -0,0 +1,16 @@
+{
+ config,
+ pkgs,
+ ...
+}: {
+ home-manager.users.${config.user} = {
+ home.packages = [
+ pkgs.tmux
+ ];
+
+ home.file = {
+ ".tmux.conf".source = ./tmux.conf;
+ ".local/bin/tmux_window".source = ./tmux_window;
+ };
+ };
+}
diff --git a/home/tmux/tmux.conf b/home/tmux/tmux.conf
new file mode 100644
index 0000000..31ac742
--- /dev/null
+++ b/home/tmux/tmux.conf
@@ -0,0 +1,105 @@
+
+# change prefix
+set -g prefix C-a
+unbind C-b
+bind C-a send-prefix
+
+# split windows like vim
+# vim's definition of a horizontal/vertical split is reversed from tmux's
+bind s split-window -v
+bind v split-window -h
+
+# split panes using | and -
+bind - split-window -v
+bind | split-window -h
+unbind '"'
+unbind %
+
+# reload config file
+bind r source-file ~/.tmux.conf
+
+# large history
+set -g history-limit 10000
+
+# start windows and panes at 1, not 0
+set -g base-index 1
+setw -g pane-base-index 1
+
+# switch term
+bind 1 run-shell "tmux_window 1"
+bind 2 run-shell "tmux_window 2"
+bind 3 run-shell "tmux_window 3"
+bind 4 run-shell "tmux_window 4"
+bind 5 run-shell "tmux_window 5"
+bind 6 run-shell "tmux_window 6"
+bind 7 run-shell "tmux_window 7"
+bind 8 run-shell "tmux_window 8"
+bind 9 run-shell "tmux_window 9"
+bind 0 run-shell "tmux_window 10"
+bind S choose-tree
+
+# terminal style
+set -g default-terminal "tmux-256color"
+set -g terminal-overrides "*:colors=256"
+set -a terminal-features "xterm-kitty:RGB"
+
+# focus events
+set -g focus-events on
+
+# move around panes with hjkl, as one would in vim after pressing ctrl-w
+bind -n M-Left select-pane -L
+bind -n M-Right select-pane -R
+bind -n M-Up select-pane -U
+bind -n M-Down select-pane -D
+
+# enable mouse control
+set -g mouse on
+
+# don't rename windows automatically
+set-option -g allow-rename off
+
+# don't do anything when a 'bell' rings
+set -g visual-activity off
+set -g visual-bell off
+set -g visual-silence off
+setw -g monitor-activity off
+set -g bell-action none
+
+# clock mode
+setw -g clock-mode-colour yellow
+
+# copy mode
+setw -g mode-style 'fg=black bg=red bold'
+setw -g mode-keys vi
+
+# panes
+set -g pane-border-style 'fg=red'
+set -g pane-active-border-style 'fg=yellow'
+
+# statusbar
+set -g status-position bottom
+set -g status-justify left
+set -g status-style 'fg=blue'
+set -g status-interval 1
+
+set -g status-left ''
+set -g status-left-length 10
+
+set -g status-right-style 'fg=black bg=blue'
+set -g status-right '%Y-%m-%d %H:%M:%S '
+set -g status-right-length 50
+
+setw -g window-status-current-style 'fg=black bg=blue'
+setw -g window-status-current-format ' #I #W #F '
+
+setw -g window-status-style 'fg=blue bg=black'
+setw -g window-status-format ' #I #[fg=white]#W #[fg=blue]#F '
+
+setw -g window-status-bell-style 'fg=blue bg=red bold'
+
+# messages
+set -g message-style 'fg=yellow bg=red bold'
+
+# bind : to command-prompt like vim
+# this is the default in tmux already
+bind : command-prompt
diff --git a/home/tmux/tmux_window b/home/tmux/tmux_window
new file mode 100755
index 0000000..1cdacf0
--- /dev/null
+++ b/home/tmux/tmux_window
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if tmux list-windows | grep -q "^$1:"; then
+ tmux select-window -t "$1"
+else
+ tmux new-window -t "$1"
+fi