dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 79344c1c103be77f3ceb186832fbe43284ed567a
parent 41036aa9c401d98b8188da4183cffd316bc426bb
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Sun,  5 Nov 2017 09:47:01 -0500

small improvements to tmux config readability

Diffstat:
Mlinks/.tmux.conf | 93+++++++++++++++++++++++++++++++++----------------------------------------------
1 file changed, 39 insertions(+), 54 deletions(-)

diff --git a/links/.tmux.conf b/links/.tmux.conf @@ -1,11 +1,9 @@ ### GENERAL set-option -g prefix C-a # Set prefix to <C-a> -bind-key C-s last-window # Go to last window with <C-a><C-s> -bind-key C-a last-pane # Go to last pane with <C-a><C-a> bind-key a send-prefix # Send <C-a> with <C-a>a -bind R source-file ~/.tmux.conf \; display "tmux config reloaded" +bind R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded" set -g history-limit 10000 # lines to keep in hisoty set-option -g display-panes-time 3000 # Timeout for pane-numbering in ms @@ -13,57 +11,48 @@ set-option -sg escape-time 0 # speed up commands set -g mouse on # enable mouse (tmux 2.1+) set -g base-index 1 # start window numbering at 1 set -g pane-base-index 1 # start pane numbering at 1 -set -g renumber-windows on # renumber remaining windows when a window is closed +set -g renumber-windows on # renumber windows when a window is closed setw -g automatic-rename on # rename window after process #### APPEARANCE -set -g default-terminal "screen-256color" - -# resize window to smallest client actually viewing it -setw -g aggressive-resize on - -# zoom pane -bind -r z resize-pane -Z - -# Highlighting the active window in status bar -setw -g window-status-current-bg default -setw -g window-status-current-fg default -setw -g window-status-bg default -setw -g window-status-fg white -setw -g window-status-activity-attr blink -setw -g window-status-activity-bg default -setw -g window-status-activity-fg default +set -g default-terminal "screen-256color" # use 256 colors +setw -g aggressive-resize on # resize window to smallest client + +# Status bar colors and format setw -g window-status-bell-attr blink -setw -g window-status-bell-bg default -setw -g window-status-bell-fg default setw -g window-status-format '#[fg=#999999]#I #[bg=default]#[fg=$666666]#W |' -setw -g window-status-current-format '(#[fg=white]#[bg=default]#I #W#[fg=white]) #[fg=#999999]|' - -# Inactive panes -set -g pane-border-fg colour238 +setw -g window-status-current-format \ + '(#[fg=white]#[bg=default]#I #W#[fg=white]) #[fg=#999999]|' -# Active panes -set -g pane-active-border-fg colour247 +set -g pane-border-fg colour238 # border color for inactive panes +set -g pane-active-border-fg colour247 # border color for active panes # Status bar -set -g status-position top # put status bar on top or bottom -set -g status-interval 5 # interval in s to update status bar text -set -g status-justify left # horizontal status alignment -set -g message-style fg=white,bg=black -set -g message-command-style fg=white,bg=default -set -g status-bg default -set -g status-fg cyan +set -g status-position top # put status bar on top or bottom +set -g status-interval 5 # interval in s to update status +set -g status-justify left # horizontal alignment +set -g message-style fg=white,bg=black # appearance of messages +set -g message-command-style fg=white # appearance of message cmds + +# Left section of status bar set -g status-left "#[fg=#333333]s:#S #[fg=#999999]| " -set -g status-right-length 40 + +# Right section of status bar if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//' | cut -c 1-22) #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#333333]%Y-%m-%d #[fg=#666666]%R\"" if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(acpi|sed 's/Battery//; s/0://; s/Discharging//; s/Full, //; s/remaining//; s/ , //; s/Charging, /+/; s/ until charged/ /; s/, / /; s/Unknown //; s/ $//;') #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#333333]%Y-%m-%d #[fg=#666666]%R\"" +# Scaling of status-bar sections +set -g status-right-length 40 +#set-hook client-resized "tmux set status-right-length `echo $(tmux display -p '#{client_width}')/3|bc|tr -d '\n'`; tmux set status-left-length `echo $(tmux display -p '#{client_width}'put cols)/3|bc|tr -d '\n'`" +#set-hook client-resized "display '#{client_width}'" +#set-hook client-resized 'display "#(tmux display -p \'#{client_width}/3\'|bc|tr -d \'\n\')"' +#set-hook client-resized "display '#(tmux display -p \'#{client_width}\'|tr -d \'\n\')'" + #### NAVIGATION -setw -g mode-keys vi # Use vi-like keys for navigation -bind -r h select-pane -L # navigate left with <C-a>h +bind -r h select-pane -L # navigate left with <C-a>h bind -r j select-pane -D # navigate down with <C-a>j bind -r k select-pane -U # navigate up with <C-a>k bind -r l select-pane -R # navigate right with <C-a>l @@ -78,8 +67,9 @@ bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-k) || tmux select-pane -U" bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-l) || tmux select-pane -R" -bind-key -r n next-window # next window with <C-a>n -bind-key -r p previous-window # previous window with <C-a>p +bind-key C-s last-window # go to last window with <C-a><C-s> +bind-key C-a last-pane # go to last pane with <C-a><C-a> +bind-key -r n next-window # next window with <C-a>n #### LAYOUT BINDINGS @@ -88,21 +78,16 @@ bind-key -r p previous-window # previous window with <C-a>p bind-key '"' split-window -c "#{pane_current_path}" bind-key '%' split-window -h -c "#{pane_current_path}" -# cycle between preset layouts. select specific presets with select-layout <n> -bind-key -r y next-layout -bind-key -r Y previous-layout -bind-key -r r rotate-window +bind -r z resize-pane -Z # toggle pane zoom with <C-a>z +bind-key -r y next-layout # cycle to next pane layout with <C-a>y +bind-key -r Y previous-layout # cycle to previous pane layout with <C-a>Y +bind-key -r r rotate-window # rotate panes with <C-a>r -#set-hook client-resized "tmux set status-right-length `echo $(tmux display -p '#{client_width}')/3|bc|tr -d '\n'`; tmux set status-left-length `echo $(tmux display -p '#{client_width}'put cols)/3|bc|tr -d '\n'`" -#set-hook client-resized "display '#{client_width}'" -#set-hook client-resized 'display "#(tmux display -p \'#{client_width}/3\'|bc|tr -d \'\n\')"' -#set-hook client-resized "display '#(tmux display -p \'#{client_width}\'|tr -d \'\n\')'" #### CLIPBOARD # enable reattach-to-user-namespace which fixes pasteboard access and launchctl if-shell 'uname | grep -qi Darwin' 'set-option -g default-command "reattach-to-user-namespace -l zsh"' -# vi-like text yanking in copy mode bind Space copy-mode # enter copy mode with <C-a><Space> bind-key -T copy-mode-vi v send-keys -X begin-selection # start "visual" with v @@ -117,17 +102,17 @@ if-shell 'uname | grep -qi Darwin && which reattach-to-user-namespace > /dev/nul #### LAUNCH PROCESSES -# use urlview to follow URLs +# use urlview to follow URLs in current pane bind-key u capture-pane -J \; \ save-buffer "/tmp/active_tmux_buffer" \; \ delete-buffer \; \ split-window -l 10 "urlview '/tmp/active_tmux_buffer' && rm /tmp/active_tmux_buffer" -# Offlineimap +# Launch offlineimap in inactive splits bind-key o split-window -p 25 '$SHELL -c "offlineimap -qf INBOX"' \; select-pane -l bind-key O split-window -p 25 '$SHELL -c "offlineimap"' \; select-pane -l -# Launch in new windows +# Use nested bindings (<C-a>l) for grouping process launch bindings bind l switchc -Tlaunch bind -Tlaunch m new-window -n mutt "mutt" bind -Tlaunch v new-window -n vim "vim" @@ -135,11 +120,11 @@ bind -Tlaunch w new-window -n weather \ "curl 'wttr.in/?m'; echo -e '\nPress <enter> to quit'; read -n 1 -s" # Open new window and resize status accordingly (should be a hook instead) +#bind-key Enter new-window bind-key Enter new-window \ "tmux set status-right-length `echo $(tput cols)/3|bc|tr -d '\n'`; $SHELL" -#bind-key Enter new-window -# Use nested bindings (C-a m) for grouping music-control bindings +# Use nested bindings (<C-a>m) for grouping music-control bindings bind m switchc -Tmpd bind -Tmpd v new-window -n vimpc "vimpc" bind -Tmpd p new-window -n mpc "mpc toggle"