From 7bdff15f8068c7db8d99abc6ae926015693fd6f1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 23 Dec 2015 02:20:12 -0500 Subject: [PATCH] tmux: better ssh support + add tmuxifier to tmux.conf --- tmux.conf | 12 +++++++----- tmux/conf-status.sh | 14 +++++++------- tmux/conf.sh | 7 +++++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tmux.conf b/tmux.conf index 8791d7ad..eb141d41 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,5 +1,5 @@ ## Behavior ############### -#### + run-shell "~/.dotfiles/tmux/conf.sh" # utf-8 @@ -48,7 +48,7 @@ bind - join-pane # reload config without killing server bind r source-file ~/.tmux.conf \; display-message " Config reloaded..". -bind R refresh-client +bind ^r refresh-client # Smart pane switching with awareness of vim splits # See: https://github.com/christoomey/vim-tmux-navigator @@ -121,13 +121,15 @@ setw -g window-status-activity-attr bold,blink setw -g window-status-activity-bg colour236 setw -g window-status-activity-fg white -set -g status-interval 60 +set -g status-interval 30 set -g status-justify left set -g status-right-length 100 set -g status-left-length 80 -set -g status-left "#{prefix_highlight}#(~/.dotfiles/tmux/conf-status.sh left) " +set -g status-left "#(~/.dotfiles/tmux/conf-status.sh left) " set -g status-right "#(~/.dotfiles/tmux/conf-status.sh right) " set -g window-status-format " #I #W:#T " -set -g window-status-current-format " ⮀ #W:#T " +set -g window-status-current-format " ▶ #W:#T " +#### +run-shell "~/.dotfiles/tmux/prefix_highlight.tmux" diff --git a/tmux/conf-status.sh b/tmux/conf-status.sh index 97540129..650d9eee 100755 --- a/tmux/conf-status.sh +++ b/tmux/conf-status.sh @@ -25,14 +25,14 @@ else fi STATUS="$DELIM<<$RESET" - STATUS+=$SYSINFO - command -v 'tmux-mem-cpu-load' >/dev/null && STATUS+=' '$(tmux-mem-cpu-load -i 5) - STATUS+=$RESET + if command -v 'tmux-mem-cpu-load' >/dev/null; then + STATUS+=$SYSINFO + STATUS+=' '$(tmux-mem-cpu-load -i 15) + STATUS+=$RESET + fi STATUS+="$DELIM < $RESET" - STATUS+=$IP - STATUS+=$(dig +short myip.opendns.com @208.67.222.222) - STATUS+=' '$RESET$HOST' ' - STATUS+=$HOSTNAME + STATUS+=$IP$(dig +short myip.opendns.com @208.67.222.222)" $RESET" + STATUS+=$HOST' '$HOSTNAME' ' fi echo $STATUS diff --git a/tmux/conf.sh b/tmux/conf.sh index 30f33264..1f01c7c1 100755 --- a/tmux/conf.sh +++ b/tmux/conf.sh @@ -40,11 +40,10 @@ else fi # If in ssh, use default C-b prefix -if [[ -z "$SSH_CONNECTON" ]] +if [[ -z "$SSH_CONNECTION" ]] then # Remap the key prefix tmux set -g prefix ^c - tmux unbind C-b # Restore sigterm C-c tmux bind C-c send-prefix @@ -54,9 +53,13 @@ then tmux set -g pane-active-border-fg yellow tmux set -g pane-border-fg colour238 else + # Remap the key prefix + tmux set -g prefix ^a + tmux set -g status-bg yellow tmux set -g status-fg black tmux set -g pane-active-border-fg blue tmux set -g pane-border-fg colour237 fi +tmux unbind C-b