tmux修改配置

28 篇文章 1 订阅

tmux学习资料很多,但是配置方法很少,我这里补个bug

第一种网上配置

https://github.com/gpakosz/.tmux

sudo apt-get install tmux

git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
sudo apt-get install fonts-powerline

修改配置文件.tmux.conf.local

set -g base-index         1     # 窗口编号从 1 开始计数
set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms
set -g mouse              on    # 开启鼠标
set -g pane-base-index    1     # 窗格编号从 1 开始计数
set -g renumber-windows   on    # 关掉某个窗口后,编号重排

setw -g monitor-activity on
set -g visual-activity on
 
bind h split-window -h #扩展窗口
bind v split-window -v
unbind '"'
unbind %
 
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

第二种私人定制

基础学习链接

进阶学习链接

  1. 修改默认配置是~/.tmux.conf修改,但是可能在用户目录下找不到,那就重新创建vim ~/.tmux.conf即可
  2. 配置文件写完后,如果不想关闭矿口,需要进行更新,不是使用source ~/.tmux.conf更新,而是使用tmux source-file ~/.tmux.conf。或者直接关闭所有tmux,重新打开即可
# 文件内容填写

set -g prefix C-b

unbind C-x

bind C-b send-prefix

set -g base-index 1 # 窗口编号从 1 开始计数

set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms

set -g mouse on # 开启鼠标

set -g pane-base-index 1 # 窗格编号从 1 开始计数

set -g renumber-windows on # 关掉某个窗口后,编号重排

set -g default-shell /bin/zsh

退出之后运行:

tmux source-file ~/.tmux.conf

上面是基础
下面更新一点,功能还在不断更新

#设置终端颜色为256色
set -g default-terminal "screen-256color"
#设置pan前景色
#set -g pane-border-fg green
#设置pane背景色
set -g pane-border-bg black
#设置活跃pane前景色
set -g pane-active-border-fg white
#设置活跃pane背景色
set -g pane-active-border-bg yellow
#设置消息前景色
set -g message-fg white
#设置消息背景色
set -g message-bg black
#设置消息高亮显示
set -g message-attr bright
#设置status-bar颜色
set -g status-fg white
set -g status-bg black
#设置窗口列表颜色
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
#设置当前窗口在status bar中的颜色
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
#设置status bar格式
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%b %d %R"
set -g status-interval 60
set -g status-justify centre

set -g base-index         1     # 窗口编号从 1 开始计数
set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms
set -g mouse              on    # 开启鼠标
set -g pane-base-index    1     # 窗格编号从 1 开始计数
set -g renumber-windows   on    # 关掉某个窗口后,编号重排

# 启用活动警告
setw -g monitor-activity on
set -g visual-activity on

# split panes using | and -
bind h split-window -h #扩展窗口
bind v split-window -v
unbind '"'
unbind %

# 允许Alt + 方向键选择窗口
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

ctrl+b+h 水平方向扩展
ctrl+b+v 竖直方向扩展

最新个人使用

set -g default-terminal "screen-256color"
set -g pane-border-style bg=black
set -g pane-active-border-style fg=white
set -g pane-active-border-style bg=yellow
set -g message-style fg=white
set -g message-style bg=black
set -g message-style bright
set -g status-fg white
set -g status-bg black
setw -g window-status-style fg=cyan
setw -g window-status-style bg=default
setw -g window-status-style dim
setw -g window-status-current-style fg=white
setw -g window-status-current-style bg=red
setw -g window-status-current-style bright
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%b %d %R"
set -g status-interval 60
set -g status-justify centre

set -g base-index         1     # 窗口编号从 1 开始计数
set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms
set -g mouse              on    # 开启鼠标
set -g pane-base-index    1     # 窗格编号从 1 开始计数
set -g renumber-windows   on    # 关掉某个窗口后,编号重排

setw -g monitor-activity on
set -g visual-activity on
set -g history-limit 5000

bind h split-window -h #扩展窗口
bind v split-window -v
unbind '"'
unbind %

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

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要下载tmux配置文件,你可以按照以下步骤进行操作: 1. 首先,确保你的系统上已经安装了tmux。你可以使用包管理器(如apt、yum或brew)来安装tmux。例如,在Ubuntu上,你可以运行以下命令来安装tmux: ``` sudo apt-get install tmux ``` 2. 接下来,下载配置文件。你可以在Github等代码托管平台上找到很多现成的tmux配置文件。你可以根据自己的需求选择一个合适的配置文件。例如,你可以在Github上搜索“tmux config”并浏览搜索结果。 3. 找到一个适合你的配置文件后,你可以直接下载它。在Github上,你可以点击绿色的“Code”按钮,然后选择“Download ZIP”,将配置文件的zip包下载到你的本地。 4. 解压缩下载的zip包。你可以使用archive工具(如WinRAR、7-Zip)来解压缩文件。解压缩后,你会得到一个包含配置文件的文件夹。 5. 找到tmux配置文件。在解压缩后的文件夹中,你可能会找到一个或多个文件,带有`.tmux.conf`、`.tmux`或`tmux.conf`的名称。选择其中一个文件,并将其命名为`.tmux.conf`。 6. 将配置文件放置在正确的位置。将`.tmux.conf`文件复制到你的用户目录下(在Linux和macOS中为`~`,在Windows中为`C:\Users\你的用户名`)。 7. 然后,打开终端,并重新启动tmux。你将看到新应用的配置已经生效。 通过遵循以上步骤,你可以方便地下载并使用tmux配置文件。记得在使用之前备份你的现有配置文件,以防止出现问题。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Fighting_1997

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

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

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

打赏作者

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

抵扣说明:

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

余额充值