From 7e4d8399a80b949d53e82fcc3e3688a0454dd019 Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Thu, 18 Feb 2021 18:02:01 -0700 Subject: [feat] Fully customize tmux configuration --- base.yaml | 1 + base/tmux.conf | 94 +++++++++++++++++++++++++++++++++++++-------------- base/tmux/status-left | 7 ++++ 3 files changed, 76 insertions(+), 26 deletions(-) create mode 100755 base/tmux/status-left diff --git a/base.yaml b/base.yaml index 339c581..55cd156 100644 --- a/base.yaml +++ b/base.yaml @@ -32,6 +32,7 @@ ~/.task/task.triggers: base/task/task.triggers ~/.task/taskwarrior-holidays.sh: base/task/taskwarrior-holidays.sh ~/.task/taskwarrior-holidays.rc: base/task/taskwarrior-holidays.rc + ~/.tmux: base/tmux ~/.tmux.conf: base/tmux.conf ~/.vim/autoload: base/vim/autoload ~/.vim/colors: base/vim/colors diff --git a/base/tmux.conf b/base/tmux.conf index 0f3aa0e..6e86f46 100644 --- a/base/tmux.conf +++ b/base/tmux.conf @@ -1,47 +1,89 @@ -bind r source-file ~/.tmux.conf - -#set -g utf8 -#set-window-option -g utf8 on - set -g base-index 1 set -g pane-base-index 1 +set -g escape-time 10 +set -g repeat-time 300 +set -g history-limit 4096 +set -g focus-events on set -g renumber-windows on +setw -g aggressive-resize on + set -g default-terminal "screen-256color" -set -g history-limit 4096 +set -ga terminal-overrides ",screen-256color:Tc" +#set -g mouse on set -g set-titles on -set -g set-titles-string '#h :: #S' +set -g set-titles-string '#h - #S' set -g monitor-activity on set -g visual-activity off -set -g status-bg default -set -g status-fg brightblack set -g status-interval 5 -set -g status-left-length 90 -set -g status-right-length 60 set -g status-justify left -set -g status-right "%a %d %b %R" +set -g status-position top +set -g status-left-length 50 +set -g status-right-length 30 +set -g status-style "fg=colour8,bg=colour18" +set -g status-left "#(~/.tmux/status-left)" +set -g status-right "#[fg=colour19]#[bg=colour19,fg=colour7] %a %m.%d %R 💜" +set -g window-status-format "#W #[default,fg=colour19]" +set -g window-status-current-style "fg=colour4,bold" +set -g window-status-activity-style "fg=colour20" +set -g window-status-bell-style "fg=colour20" +#█ ^Vue0b0 + +set -g message-style "fg=white,bg=colour19" +set -g pane-border-style "fg=colour18,bg=colour18" +set -g pane-active-border-style "fg=colour19,bg=colour19" unbind C-b set -g prefix C-a bind C-a send-prefix - -unbind-key h -unbind-key j -unbind-key k -unbind-key l -bind-key h select-pane -L -bind-key j select-pane -D -bind-key k select-pane -U -bind-key l select-pane -R - -unbind-key V -unbind-key H -bind-key V split-window -hc "#{pane_current_path}" -bind-key H split-window -c "#{pane_current_path}" +bind C-d detach set -g status-keys vi set -g mode-keys vi +bind -T copy-mode-vi 'v' send -X begin-selection +bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel +bind C-c run "tmux save-buffer - | xclip -i -sel clipboard" +bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" + +#unbind -T copy-mode-vi MouseDragEnd1Pane +#bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard >/dev/null" +# +## Mac OSX clipboard +#if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"' +## X11 clipboard +#if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"' +#if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"' +## Windows clipboard +#if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"' +#if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"' + +unbind E +bind e setw synchronize-panes on +bind E setw synchronize-panes off + +unbind l +bind h selectp -L +bind j selectp -D +bind k selectp -U +bind l selectp -R +bind -r C-h resizep -L +bind -r C-j resizep -D +bind -r C-k resizep -U +bind -r C-l resizep -R + +unbind % +unbind "'" +unbind '"' +bind % command-prompt -p index "select-window -t ':%%'" +bind '"' splitw -hc "#{pane_current_path}" +bind "'" splitw -c "#{pane_current_path}" +bind Tab last # most recent window +bind -r "<" swapw -d -t -1 +bind -r ">" swapw -d -t +1 + +bind r source ~/.tmux.conf + if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' diff --git a/base/tmux/status-left b/base/tmux/status-left new file mode 100755 index 0000000..77e04dd --- /dev/null +++ b/base/tmux/status-left @@ -0,0 +1,7 @@ +#!/bin/bash + +STATUS="#[bg=colour$HOST_COLOR]#[fg=black] $SHORT_HOSTNAME" +if [[ `tmux ls | wc -l` -gt 1 ]]; then STATUS="$STATUS  #S"; fi +STATUS="$STATUS #[fg=colour$HOST_COLOR]#[bg=colour18] #($0)" +tmux set -g status-left "$STATUS" +#█ ^Vue0b0 -- cgit v1.2.3-54-g00ecf