aboutsummaryrefslogtreecommitdiff
path: root/.config/tmux
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-02-23 12:12:44 +0100
committerPatrick Spek <p.spek@tyil.nl>2021-08-14 11:59:30 +0200
commit3dd93ef53990aca21af9ddac87e256c203b9bc8b (patch)
tree5278b98d896124c0a046034f7f63ff1d1da09384 /.config/tmux
parent2c60338d0df21d0a3c5662f57b6ee97484f8ea57 (diff)
Add tmux conf
Diffstat (limited to '.config/tmux')
-rw-r--r--.config/tmux/conf103
-rwxr-xr-x.config/tmux/status-right.pl51
2 files changed, 154 insertions, 0 deletions
diff --git a/.config/tmux/conf b/.config/tmux/conf
new file mode 100644
index 0000000..7477176
--- /dev/null
+++ b/.config/tmux/conf
@@ -0,0 +1,103 @@
+# global configuartion settings
+set -g default-terminal "screen-256color"
+set -g xterm-keys on
+set -g history-limit 15000
+
+# unbind some defaults
+unbind-key [
+unbind-key v
+unbind-key y
+unbind-key C-b
+
+set -sg escape-time 0
+set -g status-interval 1
+
+# setup vi-mode
+setw -g mode-keys vi
+
+bind p paste-buffer
+bind Escape copy-mode
+
+#bind -t vi-copy 'v' begin-selection
+#bind -t vi-copy 'y' copy-selection
+#bind -t vi-copy 'C-v' rectangle-toggle
+
+# ^a
+set -g prefix C-a
+bind-key C-a send-prefix
+
+# add other exotic keybinds
+bind [ previous-window
+bind ] next-window
+
+# remove all annoying lines
+set -g visual-bell off
+set -g visual-activity off
+
+# move statusbar to top
+set -g status-position top
+
+# recolor the messagebar/commandprompt
+set -g message-fg colour110
+set -g message-bg colour233
+
+# set the statusbar styles
+set -g window-status-format "#[fg=colour7]#I"
+set -g window-status-current-format "#[bg=colour12 fg=colour15] #I #[fg=colour16]"
+
+set -g status-left "#[#{?client_prefix,fg=colour16,fg=colour13}]"
+set -ag status-left "#[#{?client_prefix,bg=colour13,bg=colour16}]"
+set -ag status-left " #S #[bg=colour8] "
+
+set -g status-right "#[fg=colour7,bg=colour16]"
+set -ag status-right "#(~/.config/tmux/status-right.pl)"
+set -ag status-right "#[fg=colour7,bg=colour16] #(date '+%Y-%m-%d %H:%M') "
+
+set -g status-left-length 15
+set -g status-right-length 70
+
+set -g status-bg "colour8"
+
+set -wg window-status-bell-fg "default"
+set -wg window-status-bell-bg "default"
+set -wg window-status-bell-attr "bold"
+
+# start counting at 1 instead of 0
+set -g base-index 1
+set -g pane-base-index 1
+set -g renumber-windows on
+
+# set wm window titles
+set -g set-titles on
+set -g set-titles-string "#T » #{pane_current_command}"
+
+# pane border coloring
+set -g pane-border-fg colour234
+set -g pane-border-bg default
+set -g pane-active-border-fg colour110
+set -g pane-active-border-bg default
+
+# splitting up panes and windows
+bind | split-window -h
+bind \ split-window -v
+bind m command-prompt -p "merge with:" "join-pane -t '%%'"
+bind b break-pane -d
+bind - command-prompt -p "swap with:" "swap-window -t '%%'"
+
+# selecting panes
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+# resizing panes
+bind C-h resize-pane -L 10
+bind C-j resize-pane -D 10
+bind C-k resize-pane -U 10
+bind C-l resize-pane -R 10
+# workaround to make ^h work under certain conditions (^h is secretly the controlcode for a backspace)
+bind BSpace resize-pane -L 10
+
+# generic hotkeys
+bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
+
diff --git a/.config/tmux/status-right.pl b/.config/tmux/status-right.pl
new file mode 100755
index 0000000..23d6227
--- /dev/null
+++ b/.config/tmux/status-right.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+chomp(my $os = lc(`uname`));
+
+# define the subroutine for creating sections easely
+sub section
+{
+ my($color, $data) = @_;
+
+ return if $data eq '';
+
+ print "#[fg=colour$color] $data";
+ print "#[fg=colour8] ║";
+}
+
+# define the subroutines that generate the data
+sub battery
+{
+ chomp(my $output = `battery`);
+ $output =~ s/\n/ /g;
+ return $output;
+}
+
+sub inet
+{
+ my $device = "enp10s0";
+
+ chomp(my $output = `inet $device`);
+ return $output;
+}
+
+sub load
+{
+ chomp(my $output = `load`);
+ return $output;
+}
+
+sub mem
+{
+ chomp(my $output = `free -h | grep "Mem:" | awk '{print \$3}'`);
+ return $output;
+}
+
+# set the sections
+&section(12, &inet);
+&section(2, &load);
+&section(2, &mem);
+&section(11, &battery);