centos7 应用笔记: tmux3.0 安装 和 配置
编译 tmux3.0 所依赖的库
# 安装 libtermcap、ncurses、libevent、readline库 (编译 vim & tmux 所依赖的库)
yum -y install libtermcap-devel ncurses-devel libevent-devel readline-devel
# unzip tmux3.0
cd /tmp
unzip tmux-3.0.zip
# config
cd /tmp/tmux-3.0/
./autogen.sh
./configure
# compile and install
make && make install
tmux3.0 支持 256 色
在 /etc/profile
中添加 以下命令。令到 tmux 指令默认 支持 256 色。
# tmux for 256-color
alias tmux="tmux -2"
tmux3.0 的配置文件
快捷键功能:
快捷键 | 功能 |
---|---|
ctrl+x | bind-key |
ctrl+x c | 新建窗口 |
ctrl+x = | 垂直分屏 |
ctrl+x - | 水平分屏 |
配置文件路径:
~/.tmux.conf
配置文件内容:
# remap prefix from 'C-b' to 'C-x'
unbind C-b
set-option -g prefix C-x
bind-key C-x send-prefix
# paste
bind p paste-buffer
# split panes using | and -
bind = split-window -h
bind - split-window -v
unbind '"'
unbind %
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
######################
### DESIGN CHANGES ###
######################
## Status bar design
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
# Info on left (I don't have a session display for now)
set -g status-left ''
# The modes {
setw -g clock-mode-colour colour135
# }
# The statusbar {
#set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
# set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# }
# manpage highlight {
set -g default-terminal "xterm"
# }
来源:CSDN
作者:Andrew Yang
链接:https://blog.csdn.net/yk_wing4/article/details/104354518