######################################################################### ## tmux configuration ## ## ~/.tmux.conf ## ## ## ## Weitian LI ## ## 2015/01/22 ## ## ## ## ChangeLogs: ## ######################################################################### ## References: ## [1] tmux: Productive Mouse-Free Development (by Brian P. Hogan) ## https://pragprog.com/book/bhtmux/tmux ## [2] Copy and Paste in tmux ## http://dudenbostel.leanside.com/2014/01/copy-paste-in-tmux/ ## Settings the prefix from 'C-b' to 'C-a' #set-option -g prefix C-a #unbind-key C-b #bind-key C-a send-prefix ## Settings the delay between prefix and command set-option -gs escape-time 1 ## Set the base index for windows to 1 instead of 0 set-option -g base-index 1 ## Set the base index for panes to 1 instead of 0 set-window-option -g pane-base-index 1 ## Reload the configuration file with 'Prefix-r' bind r source-file ~/.tmux.conf \; display "Reloaded!" ## More straightforward key bindings for splitting panes unbind % bind | split-window -h unbind '"' bind - split-window -v ## Move between the split panes bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R ## C-h/C-l to cycle through windows bind -r C-h select-window -t :- bind -r C-l select-window -t :+ ## Quich cycle through windows #bind-key -n C-p previous-window #bind-key -n C-n next-window ## Pane resizing bind -r H resize-pane -L 5 bind -r J resize-pane -D 5 bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 ## Mouse support #set-window-option -g mode-mouse on #set-option -g mouse-select-window on #set-option -g mouse-select-pane on #set-option -g mouse-resize-pane on ## Set the default terminal mode set-option -g default-terminal "screen-256color" ## Enable activity alerts set-window-option -g monitor-activity on set-option -g visual-activity on ## utf8 set-option -g status-utf8 on set-window-option -g utf8 on ## Vi mode set-window-option -g mode-keys vi set-option -g status-keys vi ## Set copy mode # start copy mode with 'Prefix-Escape' bind-key Escape copy-mode # paste the latest buffer with 'Prefix-p' bind-key p paste-buffer # delete the most recently copied buffer bind-key + delete-buffer # vi-copy settings bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy 'y' copy-selection # change between line- and column-wise selection bind-key -t vi-copy 'V' rectangle-toggle bind-key -t vi-copy 'Y' copy-end-of-line ## Scrollback history set-option -g history-limit 5000 ## How long to display messages and other indicators (unit: ms) set-option -g display-time 3000 ## Send multiple commands without pressing Prefix again set-option -g repeat-time 1000 ## Maximize and restore a pane unbind Up bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp unbind Down bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp ## Log output to a text file on demand bind P pipe-pane -o "cat >> ~/#W.log" \; display "Toggled logging to ~/#W.log" ### Styles ### ## Set the status line set-option -g status-style "bg=default" set-option -g status-justify centre set-option -g status-left-length 30 set-option -g status-right-length 30 set-option -g status-left " #[fg=yellow,bold]#h:#[fg=blue,bold]#S #[fg=magenta,bold]|#[default]" set-option -g status-right "#[fg=magenta,bold]| #[fg=yellow,bold]%a %m/%d #[fg=blue,bold]%H:%M " set-window-option -g window-status-style "fg=blue,bold" set-window-option -g window-status-current-style "fg=blue,bold,reverse" set-window-option -g window-status-format "#I:#{=10:window_name}#F" set-window-option -g window-status-current-format "#I:#W#F" ## command/message line style set-option -g message-style "fg=white,bold,bg=blue" # vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=tmux: #