65 lines
1.4 KiB
Markdown
65 lines
1.4 KiB
Markdown
# tmux
|
||
|
||
## install
|
||
|
||
```bash
|
||
sudo apt install tmux
|
||
|
||
```
|
||
|
||
## tlayout
|
||
|
||
```bash
|
||
|
||
#! /bin/sh
|
||
#
|
||
# tenv.sh
|
||
# Copyright (C) 2023 veypi <i@veypi.com>
|
||
#
|
||
# Distributed under terms of the MIT license.
|
||
#
|
||
|
||
|
||
s=$1
|
||
tmux new-session -s $s -n f -d
|
||
# tmux send-keys -t $s 'p' C-m
|
||
|
||
tmux split-window -v -p 70 -t $s:1.1
|
||
tmux split-window -h -p 70 -t $s:1.2
|
||
tmux split-window -h -p 70 -t $s:1.1
|
||
tmux attach -t $1
|
||
|
||
|
||
```
|
||
|
||
## .tmux.conf
|
||
```bash
|
||
# ln -s $(pwd)/tmux.conf ~/.tmux.conf
|
||
|
||
# 重新绑定prefix
|
||
unbind C-b
|
||
set -g prefix 'C-s'
|
||
|
||
# 重新加载配置文件
|
||
bind r source-file ~/.tmux.conf \; display-message "Config reloaded.."
|
||
|
||
# 打开鼠标 调整面板 切换面板
|
||
set-option -g mouse on
|
||
|
||
set -g base-index 1 # 设置窗口的起始下标为1
|
||
set -g pane-base-index 1 # 设置面板的起始下标为1
|
||
|
||
unbind '"'
|
||
bind - splitw -v -c '#{pane_current_path}' # 垂直方向新增面板,默认进入当前目录
|
||
unbind %
|
||
bind = splitw -h -c '#{pane_current_path}' # 水平方向新增面板,默认进入当前目录
|
||
|
||
set -g status-interval 1 # 状态栏刷新时间
|
||
set -g status-justify left # 状态栏列表左对齐
|
||
setw -g monitor-activity on # 非当前窗口有内容更新时在状态栏通知
|
||
|
||
set -wg window-status-format " #I #W " # 状态栏窗口名称格式
|
||
set -wg window-status-current-format " #I:#W#F " # 状态栏当前窗口名称格式(#I:序号,#w:窗口名称,#F:间隔符)
|
||
set -wg window-status-separator "" # 状态栏窗口名称之间的间隔
|
||
```
|