Unbuntu终端插件tmux的安装与配置方案

在unbuntu环境中使用终端时,一个终端满足不了你的需求。开两个终端或者多个又觉得切换太麻烦,怎么办,那还能怎么办,只能安装tmux了。

unbuntu安装:sudo apt-get install tmux  

先把未改配置文件的快捷键介绍下,如改过配置文件的详细快捷键请参照配置文件:

  • C-b ? 显示快捷键帮助
  • C-b C-o 调换窗口位置,类似与vim 里的C-w
  • C-b 空格键 采用下一个内置布局
  • C-b ! 把当前窗口变为新窗口
  • C-b “ 横向分隔窗口
  • C-b % 纵向分隔窗口
  • C-b q 显示分隔窗口的编号
  • C-b o 跳到下一个分隔窗口
  • C-b 上下键 上一个及下一个分隔窗口
  • C-b C-方向键 调整分隔窗口大小
  • C-b c 创建新窗口
  • C-b 0~9 选择几号窗口
  • C-b c 创建新窗口
  • C-b n 选择下一个窗口
  • C-b l 切换到最后使用的窗口
  • C-b p 选择前一个窗口
  • C-b w 以菜单方式显示及选择窗口
  • C-b t 显示时钟
  • C-b ; 切换到最后一个使用的面板
  • C-b x 关闭面板
  • C-b & 关闭窗口
  • C-b s 以菜单方式显示和选择会话
  • C-b d 退出tumx,并保存当前会话,这时,tmux仍在后台运行,可以通过tmux attach进入 到指定的会话


配置文件放在  ~/.tmux.conf   ,如果没有请自行创建.

unbuntu的一个终端插件tmux,能在终端界面打开多个窗口。话不多说,把配置放上:

#解绑ctrl+b快捷键
#unbind C-b
#更换前缀快捷键为ctrl+a
#set -g prefix C-a
#Tmux会话选项
set -g status-keys vi
#开启鼠标模式
# set -g mode-mouse on
# set -g monitor-activity on
# set -g xterm-keys on
#设置默认终端配色
# set -g default-terminal "screen-256color"
#自动重命名窗口名字
set -g automatic-rename on
#关闭窗口自动重新分配ID
set -g renumber-windows on
# 开启鼠标点击选择窗格
set -g mouse-select-pane on
# 开启鼠标点击选择窗口
set -g mouse-select-window on
# 开启鼠标调节窗格大小
set -g mouse-resize-pane on
# 美化窗格栏
# set -g pane-active-border-bg    none
# set -g pane-active-border-fg    red
# set -g display-panes-active-colour red
# 美化信息栏
set -g message-bg blue
set -g message-fg white
# 美化命令行
set -g message-command-bg cyan
set -g message-command-fg white
# black blue red green yellow white cyan magenta
# 美化标题栏
# set -g status on
set -g status-position top
set -g status-fg black
set -g status-bg white
set -g status-justify centre
# set -g status-justify left
set -g status-left '#[fg=black,bold][#S]'
# set -g status-left-length 20
set -g status-right '#[fg=black,bold][%Y-%m-%d %H:%M]'
set -g window-status-format ' #[fg=black,bold]#I:#W '
set -g window-status-current-format ' #[fg=white,bold]* #I:#W *#[fg=black] '
set -g window-status-fg black
set -g window-status-bg white
set -g window-status-current-fg white
set -g window-status-current-bg black
#每当修改tmux.conf后 按ctrl+b r重新加载配置立即生效
bind-key r source-file ~/.tmux.conf \; display-message "Config Reloaded."
#拷贝模式按键重定义
set -g mode-keys vi
#定义ctrl+y进入拷贝模式
bind-key y copy-mode
#定义使用v选取
bind-key -t vi-copy v begin-selection
#定义使用y复制 加入到剪切板
bind-key -t vi-copy y copy-pipe "xclip -i -sel clip > /dev/null"
#定义ctrl+b p粘贴
bind-key p run "xclip -o -sel clip | tmux load-buffer - ; tmux paste-buffer"
# 重定义分隔窗格快捷键
unbind '"'
unbind %
bind-key | split-window -h
bind-key - split-window -v
#重定义选择分隔窗格
bind k selectp  -U
bind j selectp  -D
bind h selectp  -L
bind l selectp  -R
# 重定义新建窗口快捷键
# bind-key -n C-T new-window
#重定义窗口选择快捷键为alt + 0-9
bind-key -n M-1 select-window -t :0
bind-key -n M-2 select-window -t :1
bind-key -n M-3 select-window -t :2
bind-key -n M-4 select-window -t :3
bind-key -n M-5 select-window -t :4
bind-key -n M-6 select-window -t :5
bind-key -n M-7 select-window -t :6
bind-key -n M-8 select-window -t :7
bind-key -n M-9 select-window -t :8
bind-key -n M-0 select-window -t :9


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

头号菜鸡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值