快速配置tmux

编辑 sudo vi /usr/bin/tt

#!/bin/bash

if [ $# = 0 ]; then
    tmux ls
    exit
fi

if tmux ls -F '#S' | grep -q $1; then
    tmux a -t $1
else
    tmux new -s $1
fi

修改权限sudo chmod 755 /usr/bin/tt

在需要使用的用户下都分别添加tmux配置文件 vi ~/.tmux.conf

set  -g escape-time 20 # ms
set  -g default-terminal "screen-256color"
setw -g window-size smallest
setw -g window-status-format '│#[fg=colour9]#I #[fg=colour190]#W'
setw -g window-status-current-format '#[bg=colour190,fg=black]│#I #W'
set  -g status-interval 1
set  -g status-left "#h "
set  -g status-left-length 30
set  -g status-left-style bg=black,fg=colour214
set  -g status-right " %Y%m%d %H:%M:%S"
set  -g status-right-style bg=black,fg=colour227
set  -g status-bg colour236
set  -g status-fg colour45
set  -g status-position    bottom
set  -g pane-border-status top
set  -g pane-border-format '┤ #S[#I] │ #{s|/home/hf|~|:pane_current_path} ├'
set  -g base-index 1
setw -g pane-base-index 1

unbind C-b
set -g prefix C-o
unbind %
unbind '"'
bind    x     send-prefix
bind    C-c   detach
bind    |     split-window -h
bind    -     split-window -v
bind    S     split-window -v
bind    A     command-prompt -I "#W" "rename-window -- '%%'"
bind    r     source-file ~/.tmux.conf
bind    Space next-window
bind    C-s   swap-pane -U
bind -n C-s   next-window
bind    Tab   select-pane -t :.+
bind -n C-j   select-pane -t :.+
bind    b     last-window
bind    C-x   last-window
bind -n C-n   new-window
bind    F1    send-keys F1
bind    F2    send-keys F2
bind    F3    send-keys F3
bind    F4    send-keys F4
bind    F5    send-keys F5
bind    F6    send-keys F6
bind    F7    send-keys F7
bind    F8    send-keys F8
bind    F9    send-keys F9
bind    F10   send-keys F10
bind    F11   send-keys F11
bind    F12   send-keys F12
bind -n F1    select-window -t 1
bind -n F2    select-window -t 2
bind -n F3    select-window -t 3
bind -n F4    select-window -t 4
bind -n F5    select-window -t 5
bind -n F6    select-window -t 6
bind -n F7    select-window -t 7
bind -n F8    select-window -t 8
bind -n F9    select-window -t 9
bind -n F10   select-window -t 10
bind -n F11   select-window -t 11
bind -n F12   select-window -t 12

bind Pageup   resize-pane -U
bind Pagedown resize-pane -D

unbind [
bind Escape copy-mode
setw -g mode-keys vi
bind -T copy-mode-vi Escape send-keys -X cancel

set -s command-alias[10] quit='kill-session'

set -g history-limit 5000

if-shell -b "test -f ~/.tmux.$HOSTNAME.conf" "source ~/.tmux.$HOSTNAME.conf"

### .tmux.conf ends here

用户下运行tt run, 创建执行窗口,

  • F1~F12 切换窗口
  • ctrl+N 创建新窗口
  • ctrl+o, A 更名
  • ctrl+o, :后输入kill-window 杀掉窗口
  • ctrl+o, esc 可以用page up/down翻看历史记录
  • ctrl+o, d 离线

发送离线指令, 比如向run会话的2号窗口发送一条

tcmd run:2 ^C "DBG=1 tube -e 15:10 ~/ipc/tick ~/tick/{today}.cntick.lz4"
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

门豪杰

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

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

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

打赏作者

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

抵扣说明:

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

余额充值