Last active
January 17, 2017 02:22
-
-
Save waruqi/9f892acb6e2747b7d18315cdff463fb3 to your computer and use it in GitHub Desktop.
tmux configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set prefix: Ctrl + x | |
set -g prefix C-x | |
unbind C-b | |
# split window | |
unbind '"' | |
bind - splitw -v | |
unbind % | |
bind | splitw -h | |
# resize window | |
bind k resizep -U 10 | |
bind j resizep -D 10 | |
bind h resizep -L 10 | |
bind l resizep -R 10 | |
# these four options is not only available brefore tmux 2.1 | |
if-shell '[[ `tmux -V | cut -d" " -f2` < 2.1 ]]' \ | |
"set-window-option -g mode-mouse on" | |
if-shell '[[ `tmux -V | cut -d" " -f2` < 2.1 ]]' \ | |
"set-window-option -g mouse-resize-pane on" | |
if-shell '[[ `tmux -V | cut -d" " -f2` < 2.1 ]]' \ | |
"set-window-option -g mouse-select-pane on" | |
if-shell '[[ `tmux -V | cut -d" " -f2` < 2.1 ]]' \ | |
"set-window-option -g mouse-select-window on" | |
# this option is only available in tmux 2.1+ | |
if-shell '[[ `tmux -V | cut -d" " -f2` == 2.1 ]] || [[ `tmux -V | cut -d" " -f2` > 2.1 ]]' \ | |
"set-window-option -g mouse on" | |
# set vi as copy-mode | |
set-window-option -g mode-keys vi | |
# VI-style copy/paste (http://jasonwryan.com/blog/2011/06/07/copy-and-paste-in-tmux/) | |
# unbind-key [ | |
bind-key Escape copy-mode | |
unbind-key p | |
bind-key p paste-buffer | |
bind-key -t vi-copy v begin-selection | |
bind-key -t vi-copy y copy-selection | |
bind-key -t vi-copy C-v rectangle-toggle | |
## status bar | |
# status-utf8 option is only availabe before tmux 2.2 | |
if-shell '[[ `tmux -V | cut -d" " -f2` < 2.2 ]]' \ | |
"set-option -g status-utf8 on" | |
set-option -g status-interval 60 | |
set-option -g status-left "#[fg=green]S:#S #[fg=yellow]W:#I #[fg=cyan]P:#P" | |
set-option -g status-left-length 30 | |
# status line variables document http://linux.die.net/man/3/strftime | |
set-option -g status-right "#{prefix_highlight} #[fg=cyan]#(date +'%Y-%m-%d %H:%M') " # right part: time lisk 23:59 | |
set-option -g status-right-length 30 # more space left for center part (window names) | |
set-option -g status-justify centre | |
set-option -g window-status-format '#I:#W' | |
set-option -g window-status-current-format '[#I:#W*]' | |
set-window-option -g window-status-current-fg red | |
set-window-option -g window-status-current-bg default | |
set-window-option -g window-status-current-attr bright | |
# Start windows and panes at 1, not 0 | |
set-option -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
# let the window be renamed automatically when launching a process | |
# but prevent renaming once you have manually changed it. | |
set-option -g allow-rename off | |
# window status style | |
# set-window-option -g window-status-current-bg blue | |
# set-window-option -g window-status-current-fg green | |
# pane border style | |
set-option -g pane-border-bg default | |
set-option -g pane-border-fg blue | |
set-option -g pane-active-border-bg default | |
set-option -g pane-active-border-fg red | |
# set status background and foreground color | |
set-option -g status-bg default | |
set-option -g status-fg white |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment