From d9113da04cdf2f1c4e71b06aed7a358f70757e9a Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Thu, 22 Jan 2015 20:18:09 +0800 Subject: Rewrite .tmux.conf --- .tmux.conf | 172 ++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 107 insertions(+), 65 deletions(-) (limited to '.tmux.conf') diff --git a/.tmux.conf b/.tmux.conf index a7335dc..a77b8a4 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,91 +1,133 @@ -## -## tmux config file -## -## LY4ever -## 3/15/2011 -## - ######################################################################### -## BINDINGS ## +## tmux configuration ## +## ~/.tmux.conf ## +## ## +## Weitian LI ## +## 2015/01/22 ## +## ## +## ChangeLogs: ## ######################################################################### -## change escape to c-a + +## 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 -## switch between windows -bind-key -n C-p previous-window -bind-key -n C-n next-window +## Settings the delay between prefix and command +set-option -gs escape-time 1 -## C-c also create new window, like in screen -bind-key C-c new-window +## 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 -## More straight forward key bindings for splitting +## 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 windows -bind k selectp -U -bind j selectp -D -bind h selectp -L -bind l selectp -R - -## resize the windows -bind C-k resizep -U 10 -bind C-j resizep -D 10 -bind C-h resizep -L 10 -bind C-l resizep -R 10 - -## extra bindings -bind m command-prompt "splitw -h 'exec man %%'" -bind @ command-prompt "splitw -h 'exec perldoc -f %%'" -######################################################################### +## 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 -######################################################################### -## SETTINGS ## -######################################################################### -## Use Vi mode -set-window-option -g mode-keys vi -set-option -g status-keys vi +## C-h/C-l to cycle through windows +bind -r C-h select-window -t :- +bind -r C-l select-window -t :+ -## use xterm function key sequence -set-window-option -g xterm-keys on +## Quich cycle through windows +bind-key -n C-p previous-window +bind-key -n C-n next-window -## Notifying if other windows has activities -set-option -g visual-activity on -set-window-option -g monitor-activity off +## 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 -## Terminal emulator window title -## set it to off so that we can use zsh to operate it -#setw -g automatic-rename off +## 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 -## utf8 -set-window-option -g utf8 on +## Set the default terminal mode +set-option -g default-terminal "screen-256color" -## altscreen -set-window-option -g alternate-screen on +## Enable activity alerts +set-window-option -g monitor-activity on +set-option -g visual-activity on -## terminal overrides -# set-option -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:colors=256" -# set -g default-terminal "rxvt-256color" +## utf8 +set-option -g status-utf8 on +set-window-option -g utf8 on -## start index from 1 -set-option -g base-index 1 +## Vi mode +set-window-option -g mode-keys vi +set-option -g status-keys vi -## Set status bar +## 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 -set-option -g status-utf8 on + +## 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-bg default -set-option -g status-left "#[fg=white,bold]:: #[fg=red][ #[fg=colour227]#H #[fg=red]]#[default]" -set-option -g status-left-length 25 -set-option -g status-right-length 25 -set-option -g status-right "#[fg=red][ #[fg=colour154]%H:%M #[fg=colour183]%a %m/%d #[fg=red]] #[fg=white,bold]::#[default]" -set-window-option -g window-status-format '#[fg=blue,bold]#I #T#[default] ' -set-window-option -g window-status-current-format '#[fg=blue,bold,reverse]#I #T#[default] ' -######################################################################### +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=conf: # +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=tmux: # -- cgit v1.2.2