tmux 基本配置

将以下内容拷贝到 ~/.tmux.conf 文件中,没有此文件的请自行创建。

############################################################
# Author: whoru.S.Q <whoru@sqiang.net>
# Link: https://github.com/whorusq/linux-learning/blob/master/tmux/.tmux.conf
# Version: 0.1
############################################################

# ---------- 基本设置 ----------
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g escape-time 0
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1

# ---------- 按键绑定 ----------

# 更改前缀键未 ctrl a
unbind ^b
set -g prefix ^a
bind a send-prefix

# 重新加载配置文件 - prefix r
bind r source ~/.tmux.conf \; display "==> 配置文件重新加载成功!"

# 拆分窗格
unbind '"'
bind - splitw -v # 垂直拆分 - prefix - 
unbind %
bind \ splitw -h # 水平拆分 - prefix \

# 新窗格默认 shell 位置设置为当前目录
bind '"' split-window -c '#{pane_current_path}'
bind '%' split-window -h -c '#{pane_current_path}'

# 窗格切换 - prefix h/j/k/l
bind h select-pane -L # 左边窗格
bind j select-pane -D # 上边窗格
bind k select-pane -U # 下边窗格
bind l select-pane -R # 右边窗格

# 调整窗格大小 - prefix H/J/K/L
bind L resize-pane -L 10  # 向左扩展
bind R resize-pane -R 10  # 向右扩展
bind K resize-pane -U 5   # 向上扩展
bind J resize-pane -D 5   # 向下扩展


# ---------- 显示 ----------

setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on  # renumber windows when a window is closed

set -g set-titles on                        # set terminal title
#set -g set-titles-string '#h ❐ #S ● #I #W'
set -g set-titles-string '❐ #S ● #I'

set -g status-interval 10     # redraw status line every 10 seconds


# 状态栏
# 颜色
set -g status-bg black
set -g status-fg white
# 对齐方式
set-option -g status-justify centre
# 左下角
set-option -g status-left '#[bg=black,fg=green][#[fg=cyan]#S#[fg=green]]'
set-option -g status-left-length 20
# 窗口列表
setw -g automatic-rename on
set-window-option -g window-status-format '#[dim]#I:#[default]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '#[fg=cyan,bold]#I#[fg=blue]:#[fg=cyan]#W#[fg=dim]'
# 右下角
set -g status-right '#[fg=green][#[fg=cyan]%Y-%m-%d#[fg=green]]'

转载于:https://my.oschina.net/antsky/blog/1558791

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值