tmux的升级和设置

1. 升级tmux 2.0

ubuntu 14.04的tmux默认版本是1.8(tmux -V可查看版本),可以通过下面命令升级到2.0。

sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux=2.0-1~ppa1~t

2. tmux的设置

首先设置tmux的默认bash为zsh:

set-option -g default-shell /bin/zsh

其它一些设置

# First remove *all* keybindings
unbind-key -a
# Now reinsert all the regular tmux keys
bind-key C-b send-prefix
bind-key C-o rotate-window
bind-key C-z suspend-client
bind-key Space next-layout
bind-key ! break-pane
bind-key '"' split-window
bind-key '#' list-buffers
bind-key '$' command-prompt -I "#S" "rename-session '%%'"
bind-key % split-window -h
bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window
bind-key "'" command-prompt -p index "select-window -t ':%%'"
bind-key ( switch-client -p
bind-key ) switch-client -n
bind-key , command-prompt -I "#W" "rename-window '%%'"
bind-key - delete-buffer
bind-key . command-prompt "move-window -t '%%'"
bind-key 0 select-window -t :0
bind-key 1 select-window -t :1
bind-key 2 select-window -t :2
bind-key 3 select-window -t :3
bind-key 4 select-window -t :4
bind-key 5 select-window -t :5
bind-key 6 select-window -t :6
bind-key 7 select-window -t :7
bind-key 8 select-window -t :8
bind-key 9 select-window -t :9
bind-key : command-prompt
bind-key \; last-pane
bind-key = choose-buffer
bind-key ? list-keys
bind-key D choose-client
bind-key L switch-client -l
bind-key [ copy-mode
bind-key ] paste-buffer
bind-key c new-window
bind-key d detach-client
bind-key f command-prompt "find-window '%%'"
bind-key i display-message
bind-key l last-window
bind-key n next-window
bind-key o select-pane -t :.+
bind-key p previous-window
bind-key q display-panes
bind-key r refresh-client
bind-key s choose-tree
bind-key t clock-mode
bind-key w choose-window
bind-key x confirm-before -p "kill-pane #P? (y/n)" kill-pane
bind-key z resize-pane -Z
bind-key { swap-pane -U
bind-key } swap-pane -D
bind-key '~' show-messages
bind-key PPage copy-mode -u
bind-key -r Up select-pane -U
bind-key -r Down select-pane -D
bind-key -r Left select-pane -L
bind-key -r Right select-pane -R
bind-key M-1 select-layout even-horizontal
bind-key M-2 select-layout even-vertical
bind-key M-3 select-layout main-horizontal
bind-key M-4 select-layout main-vertical
bind-key M-5 select-layout tiled
bind-key M-n next-window -a
bind-key M-o rotate-window -D
bind-key M-p previous-window -a
bind-key -r M-Up resize-pane -U 5
bind-key -r M-Down resize-pane -D 5
bind-key -r M-Left resize-pane -L 5
bind-key -r M-Right resize-pane -R 5
bind-key -r C-Up resize-pane -U
bind-key -r C-Down resize-pane -D
bind-key -r C-Left resize-pane -L
bind-key -r C-Right resize-pane -R

############# start customize

bind-key -n          C-q copy-mode 
bind-key n M-o select-pane -t :.+

bind-key -n          M-0 select-window -t :0
bind-key -n          M-1 select-window -t :1
bind-key -n          M-2 select-window -t :2
bind-key -n          M-3 select-window -t :3
bind-key -n          M-4 select-window -t :4
bind-key -n          M-5 select-window -t :5
bind-key -n          M-6 select-window -t :6

# bind Escape copy-mode             # enter copy mode (prefix Escape)

# #
# # author   : Xu Xiaodong <[email protected]>
# # modified : 2015 May 10
# #

# #-- base settings --#
# set -g display-time 3000
# set -g escape-time 0
set -g history-limit 65535
# set -g base-index 0
# set -g pane-base-index 1

# #-- bindkeys --#
# # prefix key (Ctrl+a)
# # set -g prefix ^a
# # unbind ^b
# # bind a send-prefix

# # split window
# unbind '"'
# bind - splitw -v # vertical split (prefix -)
# unbind %
# bind | splitw -h # horizontal split (prefix |)

# # select pane
# bind k selectp -U # above (prefix k)
# bind j selectp -D # below (prefix j)
# bind h selectp -L # left (prefix h)
# bind l selectp -R # right (prefix l)

# # resize pane
# bind -r ^k resizep -U 10 # upward (prefix Ctrl+k)
# bind -r ^j resizep -D 10 # downward (prefix Ctrl+j)
# bind -r ^h resizep -L 10 # to the left (prefix Ctrl+h)
# bind -r ^l resizep -R 10 # to the right (prefix Ctrl+l)

# # swap pane
# bind ^u swapp -U # swap with the previous pane (prefix Ctrl+u)
# bind ^d swapp -D # swap with the next pane (prefix Ctrl+d)

# # misc
# bind e lastp  # select the last pane (prefix e)
# bind ^e last  # select the last window (prefix Ctrl+e)
# bind q killp  # kill pane (prefix q)
# bind ^q killw # kill window (prefix Ctrl+q)

# # copy mode
# bind Escape copy-mode             # enter copy mode (prefix Escape)
# bind ^p pasteb                    # paste buffer (prefix Ctrl+p)
# bind -t vi-copy v begin-selection # select (v)
# bind -t vi-copy y copy-selection  # copy (y)

# # app
# bind ! splitw htop                                     # htop (prefix !)
# bind m command-prompt "splitw 'exec man %%'"           # man (prefix m)
# bind @ command-prompt "splitw 'exec perldoc -t -f %%'" # perl func (prefix @)
# bind * command-prompt "splitw 'exec perldoc -t -v %%'" # perl var (prefix *)
# bind % command-prompt "splitw 'exec perldoc -t %%'"    # perl doc (prefix %)
# bind / command-prompt "splitw 'exec ri %%'"            # ruby doc (prefix /)

# # reload config (prefix r)
bind r source /home/zzhang/.tmux.conf \; display "Configuration reloaded! xxx - yyy"

# #-- statusbar --#
set -g status-utf8 on
set -g status-interval 1
set -g status-keys vi

setw -g mode-keys vi

# #-- colorscheme --#
# # statusbar

# # show session name, window & pane number, date and time on right side of
# # status bar
set -g status-right-length 60

set -g pane-border-bg default
set -g pane-border-fg colour238
set -g pane-active-border-bg default
set -g pane-active-border-fg colour51

set -g status-bg '#4e4e4e'
set -g status-fg '#bbbbbb'
set -g status-left-fg '#bbbbbb'
set -g status-left-bg '#4e4e4e'
set -g status-right-fg '#bbbbbb'
set -g status-right-bg '#4e4e4e'

set-option -g status-justify centre
setw -g automatic-rename off
set-option -g allow-rename off
set-window-option -g automatic-rename off
set-window-option -g window-status-current-fg magenta
set-window-option -g window-status-format '#[dim]#I:#[dim]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '[#[fg=white,bold]#I#[fg=white,bold]:#[fg=white,bold]#W#[fg=dim]]'
set -g status-right '#[fg=green][#[fg=white]%m-%d %H:%M#[fg=green]]'

set -g default-terminal "screen-256color"

# # window
setw -g window-status-format "#I:#W"
setw -g window-status-current-format "#I:#W#F"
Copyright © zhiqiang.org 2016 all right reserved,powered by Gitbook该文件修订时间: 2016-08-03 01:06:06

results matching ""

    No results matching ""