aboutsummaryrefslogtreecommitdiffstats
path: root/.config/tmux
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2022-10-18 17:49:37 +0200
committerDavid Runge <dave@sleepmap.de>2022-10-18 17:49:37 +0200
commitf5777782a31900a21e4bf9be4a2dd48c6751c95f (patch)
tree933545d0e19eecf02c688f233e5d2c690bf7637d /.config/tmux
parentbacb6432acec5c7a52c31ffc4ad5ecb6342f52fa (diff)
downloaddotfiles-f5777782a31900a21e4bf9be4a2dd48c6751c95f.tar.gz
dotfiles-f5777782a31900a21e4bf9be4a2dd48c6751c95f.tar.bz2
dotfiles-f5777782a31900a21e4bf9be4a2dd48c6751c95f.tar.xz
dotfiles-f5777782a31900a21e4bf9be4a2dd48c6751c95f.zip
Move tmux.conf to XDG_CONFIG_HOME
.config/tmux/tmux.conf: As tmux supports XDG_CONFIG_HOME, use that instead of providing the file in home directly.
Diffstat (limited to '.config/tmux')
-rw-r--r--.config/tmux/tmux.conf119
1 files changed, 119 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
new file mode 100644
index 0000000..2b25399
--- /dev/null
+++ b/.config/tmux/tmux.conf
@@ -0,0 +1,119 @@
+# Ring the bell if any background window rang a bell
+set -g bell-action any
+
+set -g default-terminal "screen-256color"
+
+# 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
+
+# move around panes with hjkl, as one would in vim after pressing ctrl-w
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+# Create splits and vertical splits
+bind-key v split-window -h
+bind-key s split-window
+
+# Pane resize in all four directions using HJKL
+bind-key -r H resize-pane -L
+bind-key -r J resize-pane -D
+bind-key -r K resize-pane -U
+bind-key -r L resize-pane -R
+# Fix ctrl + L/R
+bind-key -n C-Right send-keys w
+bind-key -n C-Left send-keys b
+
+# setting titles on
+set -g set-titles on
+set -g set-titles-string "#T"
+set-option -g allow-rename on
+
+set -g history-limit 10000
+# set mouse mode on
+set -g mouse on
+
+# set the lock command to be vlock
+set -g lock-command vlock
+
+# Wheel scroll in pane
+unbind -T root WheelUpPane
+unbind -T root WheelDownPane
+bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= "#{pane_in_mode}" "send-keys -M" "copy-mode -u"'
+
+# Wheel scroll in pane WHILE in copy-mode
+bind -T copy-mode-vi WheelUpPane send -X halfpage-up
+bind -T copy-mode-vi WheelDownPane send -X halfpage-down
+
+# Logout with Ctrl+D
+bind-key ^D detach-client
+
+# Use vi keybindings for tmux commandline input.
+# Note that to get command mode you need to hit ESC twice...
+set -g status-keys vi
+
+# Use vi keybindings in copy and choice modes
+setw -g mode-keys vi
+
+# v and y like vi in copy-mode
+bind-key -T copy-mode-vi v send -X begin-selection
+bind-key -T copy-mode-vi y send -X copy-selection
+# clipboard settings
+set-option -s set-clipboard off
+# mouse selection gets copied to system clipboard
+bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "~/bin/clipboard-wrapper -i"
+# visual selection gets copied to system clipboard
+bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "~/bin/clipboard-wrapper -i"
+# paste (doesn't do anything yet)
+bind-key -T copy-mode-vi p run "~/bin/clipboard-wrapper -o | tmux load-buffer - ; tmux paste-buffer"
+
+# set first window to index 1 (not 0) to map more to the keyboard layout...
+set -g base-index 1
+
+# color scheme (styled as vim-powerline)
+set -g status-left-length 52
+set -g status-right-length 451
+set -g status-fg white
+set -g status-bg colour234
+
+# set status-interval to 2 for tmux-mem-cpu-load
+set -g status-interval 1
+set -g status-left '#[fg=colour235,bg=colour252,bold] #(hostname) #[fg=colour245,bg=colour238,bold] #(whoami) (#S) '
+set -g status-right '#[fg=colour23,bg=colour234]|>#[fg=white,bg=colour234]#(~/bin/get_cpu_status)\
+#[fg=colour23,bg=colour234]|#[fg=white,bg=colour234]#(~/bin/get_mem)\
+#[fg=colour23,bg=colour234]|#[fg=white,bg=colour234]#(~/bin/get_load)\
+#[fg=colour23,bg=colour234]|#[fg=white,bg=colour234]#(~/bin/get_battery_status)\
+#[fg=colour23,bg=colour234]|#[fg=white,bg=colour234]%Y%m%d/%a\
+#[fg=colour23,bg=colour234]|#[fg=white,bg=colour234]%H:%M:%S\
+#[fg=colour23,bg=colour234]<|'
+set -g window-status-format '#[fg=colour235,bg=colour252,bold] #I: #W '
+set -g window-status-current-format '#[fg=black,bg=colour23,noreverse,bold] #I: #W '
+
+# No escape time for vi mode
+set -sg escape-time 0
+
+# next/prev window
+bind-key -n M-k next-window
+bind-key -n M-j previous-window
+
+# select windows
+bind-key -n M-1 select-window -t 1
+bind-key -n M-2 select-window -t 2
+bind-key -n M-3 select-window -t 3
+bind-key -n M-4 select-window -t 4
+bind-key -n M-5 select-window -t 5
+bind-key -n M-6 select-window -t 6
+bind-key -n M-7 select-window -t 7
+bind-key -n M-8 select-window -t 8
+bind-key -n M-9 select-window -t 9
+bind-key -n M-0 select-window -t 0
+
+# Reload config
+bind r source-file ~/.tmux.conf
+
+# Swap windows
+bind-key m command-prompt -p "move window to:" "swap-window -t '%%'"
+