feat: skills - add tmux autopilot skill

This commit is contained in:
tukuaiai 2026-01-18 01:37:53 +08:00
parent 79863d850d
commit 28f2dcfb4e
19 changed files with 3459 additions and 0 deletions

View File

@ -197,6 +197,7 @@ git push
- `AGENTS.md` - AI Agent 操作手册(本文件)
- `libs/external/prompts-library/main.py` - 提示词转换工具入口
- `backups/一键备份.sh` - 备份脚本入口
- `i18n/zh/skills/04-开发工具/tmux-autopilot/` - tmux 自动化操控技能(基于 oh-my-tmux含 capture-pane/send-keys/蜂群巡检脚本)
---

View File

@ -0,0 +1,170 @@
---
name: tmux-autopilot
description: "tmux 自动化操控:读取/广播/救援 session|window|pane基于 oh-my-tmux 配置安全地让 AI 自控/互控终端。触发:需要 capture-pane/send-keys、批量巡检、蜂群 AI 协作、卡死救援或快速查看快捷键。"
---
# tmux-autopilot Skill
让 AI 像熟练运维一样操作 tmux读取终端输出、发送按键、批量巡检、协作/救援其他终端,默认兼容 `libs/external/.tmux`gpakosz/oh-my-tmux
## When to Use This Skill
触发条件(满足其一即可):
- 需要远程读取/复制某个 tmux pane 的最新输出(日志、提示、错误)。
- 需要向指定 pane 发送按键/命令(确认 `y`、`Enter`、`Ctrl+C`、广播同一窗口)。
- 需要批量巡检/接管多 AI 终端(蜂群协作、自动救援卡死任务)。
- 需要快速回忆 oh-my-tmux 快捷键、前缀或同步面板操作。
- 需要在当前仓库复用 `libs/external/.tmux` 配置并避免修改主配置。
## Not For / Boundaries
- 不用于执行非 tmux 环境(目标不存在时先创建 session/window/pane
- 不直接编辑 `~/.tmux.conf` / `.tmux.conf`(遵循 oh-my-tmux修改请放到 `.tmux.conf.local`)。
- 不盲发破坏性按键:`kill-server`、`rm -rf` 等必须先 capture-pane 确认目标上下文。
- 如果 tmux 版本 < 2.6需先升级再使用本技能的命令组合
## Quick Reference
### 常用模式≤20 条,直接复制即用)
**查看快捷键帮助**oh-my-tmux 双前缀:主 `C-a`,备用 `C-b`,前缀后按 `?`
```text
[按] <prefix> ?
```
**枚举拓扑session/window/pane**
```bash
tmux list-sessions
tmux list-windows -a -F '#S:#I:#W#F'
tmux list-panes -a -F '#S:#I.#P #{pane_current_command} #{pane_title}'
```
**读取指定 pane 最近 120 行**
```bash
tmux capture-pane -t <session>:<window>.<pane> -p -S -120
```
**向指定 pane 发送确认键**
```bash
tmux send-keys -t <session>:<window>.<pane> "y" Enter
```
**安全中断挂住任务**
```bash
tmux send-keys -t <session>:<window>.<pane> C-c
```
**开启/关闭窗口内广播(同步全部 pane**
```bash
tmux set-window-option synchronize-panes on
tmux set-window-option synchronize-panes off
```
**一次扫描全部窗口并截取最近输出(蜂群巡检骨架)**
```bash
for w in $(tmux list-windows -a -F '#S:#I'); do
tmux capture-pane -t "$w" -p -S -80 | sed "s/^/[$w] /";
done
```
**远程救援:发现等待输入即发送 y**
```bash
target="0:3.0" # 示例
tmux capture-pane -t "$target" -p -S -50 | grep -qi "(y/n)" && \
tmux send-keys -t "$target" "y" Enter
```
**新建 AI 蜂群工作台1 指挥 + 3 工人)**
```bash
tmux new-session -d -s ai-hub -n commander 'bash'
tmux new-window -t ai-hub -n worker1 'kiro-cli chat'
tmux new-window -t ai-hub -n worker2 'kiro-cli chat'
tmux new-window -t ai-hub -n worker3 'kiro-cli chat'
tmux attach -t ai-hub
```
**启用 oh-my-tmux 配置(仓库内版本)**
```bash
ln -sfn /home/lenovo/zip/vibe-coding-cn/libs/external/.tmux/.tmux.conf ~/.tmux.conf
cp -n /home/lenovo/zip/vibe-coding-cn/libs/external/.tmux/.tmux.conf.local ~/.tmux.conf.local
```
**记录 pane 输出到文件**
```bash
tmux pipe-pane -t <session>:<window>.<pane> -o 'cat >> /tmp/tmux-<session>-<window>-<pane>.log'
```
## Rules & Constraints
- MUST在发送按键前用 `capture-pane` 复核目标上下文;按键操作必须带 `<session>:<window>.<pane>` 绝对定位。
- MUST遵循 oh-my-tmux 约定,不修改主配置文件;自定义写入 `~/.tmux.conf.local`
- MUST批量操作前先 `list-windows`/`list-panes` 建立白名单,避免误控用户窗口。
- SHOULD救援/确认前先 grep 关键词(如 `(y/n)`、`password`),只对匹配目标发送。
- SHOULD长任务开启 `pipe-pane` 记录审计;广播完成后立即 `synchronize-panes off`
- NEVER在未知 pane 发送破坏性命令NEVER 在 root 会话不经确认发送 `Ctrl+C`/`Ctrl+D`。
## Examples
### Example 1自动给卡住的安装脚本回车确认
- 输入:安装脚本停在 `Proceed? (y/n)`,位置在 `0:3.0`
- 步骤:
1) `tmux capture-pane -t 0:3.0 -p -S -50 | grep -qi "(y/n)"` 确认等待输入。
2) `tmux send-keys -t 0:3.0 "y" Enter` 发送确认。
- 验收:脚本继续运行,无额外多余输入。
### Example 2蜂群巡检 + 自动救援
- 输入4 个 AI 终端分布在 session `ai-hub` 的多个窗口。
- 步骤:
1) 运行 Quick Reference 巡检循环收集最近 80 行并观察状态。
2) 对匹配 `"(y/n)"` 的 pane 触发「远程救援」片段自动发 `y`
3) 对输出包含 `Traceback``ERROR` 的 pane`capture-pane` 记录再人工介入。
- 验收:等待确认的终端恢复,未误伤正常任务;巡检日志保存在本地。
### Example 3快速搭建 oh-my-tmux AI 工作台
- 输入:需要 1 个指挥 + 3 个 worker并使用仓库内 oh-my-tmux 配置。
- 步骤:
1) 运行「启用 oh-my-tmux 配置」片段完成软链和本地副本(若已存在跳过)。
2) 运行「新建 AI 蜂群工作台」片段创建 session 并 attach。
3) 在 commander pane 使用「枚举拓扑」确认 worker 窗口存在。
- 验收:前缀键为 `C-a`状态栏正常4 个窗口可互相捕获/发送按键。
## FAQ
- Q: 为什么按 `C-b` 无反应?
- A: oh-my-tmux 默认主前缀是 `C-a``C-b` 仅作备用;确保无其他程序占用 `C-a`
- Q: 如何只广播当前窗口而不影响其他窗口?
- A: 只对当前窗口执行 `set-window-option synchronize-panes on`,使用完立即关闭。
- Q: 远程发送命令前如何确认当前工作目录?
- A: `tmux display-message -pt <target> '#{pane_current_path}'`,必要时先 `send-keys 'cd /path' Enter`
## Troubleshooting
- `no such session/window/pane` → 检查目标名称,先 `list-sessions`/`list-windows` 校验再重试。
- 前缀键冲突 → 查看 `~/.tmux.conf.local` 是否改写前缀;可在其中设置 `set -g prefix C-b #!important`
- 状态栏样式错乱/重复 → 按 README 建议用 `tmux -f /dev/null -L test` 排查;多半是终端宽字符/字体导致。
- 发送命令没效果 → 目标 pane 可能在 copy-mode`tmux send-keys -t <target> Escape` 退出再重发。
## References
- `references/index.md`: 导航与文件速览
- `references/getting_started.md`: 术语、oh-my-tmux 最小接入步骤
- `references/api.md`: tmux/oh-my-tmux 常用命令、选项与 gpakosz 特色键位
- `references/examples.md`: 蜂群协议脚本与长示例
- `references/troubleshooting.md`: 典型故障到修复路径
## Maintenance
- Sources: `libs/external/.tmux/README.md`、蜂群实战提示词、Skill Seeker 生成的抓取材料(如需扩展自动化)。
- Last updated: 2026-01-17
- Known limits: 未涵盖 tmux 插件管理tpm及多用户共享权限配置需时再补充。
## Quality Gate
发布前自检(配合 `claude-skills` 校验脚本):
1. `description` 已含“capture-pane/send-keys/蜂群”等触发关键词。
2. 「When to Use」「Not For」已覆盖边界前缀/版本要求清晰。
3. Quick Reference ≤ 20 条且均可直接执行;无长篇解释。
4. ≥3 个端到端示例,含输入/步骤/验收。
5. 长文档放在 `references/` 并可导航;无文档堆砌。
6. 不确定项给出验证路径;禁止虚构 tmux 行为。
7. 运行 `i18n/zh/skills/00-元技能/claude-skills/scripts/validate-skill.sh i18n/zh/skills/04-开发工具/tmux-autopilot` 通过。

View File

@ -0,0 +1,41 @@
# API / CLI / Config Reference
## 结构化速查(按场景)
### 拓扑与定位
- 列 session`tmux list-sessions`
- 列窗口(含 flag`tmux list-windows -a -F '#S:#I:#W#F'`
- 列 pane`tmux list-panes -a -F '#S:#I.#P #{pane_current_command} #{pane_title}'`
### 读取输出
- 抓取最近 N 行:`tmux capture-pane -t <s:w.p> -p -S -120`
- 全量抓取到文件:`tmux capture-pane -t <s:w.p> -p -S -100000 > pane.log`
- 实时镜像:`tmux pipe-pane -t <s:w.p> -o 'cat >> /tmp/pane.log'`
### 发送按键/命令
- 发送字符串+回车:`tmux send-keys -t <s:w.p> "command here" Enter`
- 发送单键:`tmux send-keys -t <s:w.p> C-c`、`Escape`、`Space`
- 发送确认:`tmux send-keys -t <s:w.p> "y" Enter`
- 退出 copy-mode 后再发:`tmux send-keys -t <s:w.p> Escape`
### 广播 / 同步
- 开启窗口广播:`tmux set-window-option synchronize-panes on`
- 关闭广播:`tmux set-window-option synchronize-panes off`
- 广播一次性命令(推荐先列出名单):配合上面 `list-panes` 逐一 send-keys
### session/window 管理
- 新建:`tmux new-session -d -s <name> -n <win> 'cmd'`
- 新窗口:`tmux new-window -t <s> -n <name> 'cmd'`
- 重命名:`tmux rename-window -t <s:w> <new>`
- 分屏:`tmux split-window -t <s:w> -h|-v 'cmd'`
### oh-my-tmux 关键配置
- 前缀:默认 `set -g prefix C-a`;若想回到 `C-b``~/.tmux.conf.local` 中加 `#!important`
- 主题/状态栏调整:在 `~/.tmux.conf.local` 修改对应变量(按 README 指引)。
- 升级/重载:`tmux source-file ~/.tmux.conf.local`
## 常见误用与修复
- 错 pane始终用 `<s:w.p>`,避免仅用 `-t 0`(易撞到当前 pane
- 广播遗留未关:操作完立即 `synchronize-panes off`,避免误输入。
- Unicode 宽度导致状态栏错位:优先使用仓库内 `.tmux.conf.local` 默认设置;若仍异常用 `tmux -f /dev/null -L test` 排查终端字体。

View File

@ -0,0 +1,69 @@
# Long Examples
## 用例 1巡检 + 自动救援脚本bash
```bash
#!/usr/bin/env bash
# 巡检所有窗口,标注输出并对 (y/n) 提示自动回车
set -euo pipefail
for w in $(tmux list-windows -a -F '#S:#I'); do
panes=$(tmux list-panes -t "$w" -F '#S:#I.#P')
for p in $panes; do
log=$(tmux capture-pane -t "$p" -p -S -80)
printf '--- [%s] ---\n%s\n' "$p" "$log"
if echo "$log" | grep -qi "(y/n)"; then
tmux send-keys -t "$p" "y" Enter
echo "[action] sent y to $p"
fi
done
done
```
- 运行:保存为 `scan_and_rescue.sh``chmod +x` 后执行;建议放在 commander 窗口运行。
- 验收:匹配的 pane 自动继续,其他 pane 不受影响。
## 用例 2批量录制 + 审计
```bash
#!/usr/bin/env bash
# 对 ai-hub 会话所有 pane 开启 pipe-pane 记录
set -euo pipefail
for p in $(tmux list-panes -a -F '#S:#I.#P #{session_name}' | awk '$2=="ai-hub"{print $1}'); do
tmux pipe-pane -t "$p" -o "cat >> /tmp/${p//[:.]/-}.log"
done
echo "audit pipes enabled under /tmp/*-ai-hub-*.log"
```
- 用于长跑任务或多 AI 协作时保留证据;任务结束后记得 `tmux pipe-pane -t <p> -o cat` 关闭。
## 用例 3Skill Seeker 抓取 oh-my-tmux 文档并生成补充参考
> 目的:在需要更全面文档时,用仓库自带的 `Skill_Seekers-development` 自动抓取 gpakosz/.tmux 与 README生成扩展参考文件再手动筛选进 `references/`
```bash
cd /home/lenovo/zip/vibe-coding-cn/libs/external/Skill_Seekers-development
# 准备 Python 环境(如未安装)
uv tool install skill-seekers # 或 pip install skill-seekers
# 直接抓取 GitHub 仓库并生成 skill 雏形
skill-seekers github --repo gpakosz/.tmux --name tmux-oh-my --output /tmp/skill-out
# 可选:抓取 README 站点或 PDF
# skill-seekers scrape --url https://github.com/gpakosz/.tmux --name tmux-oh-my-web --async
# 产物:/tmp/skill-out/tmux-oh-my.zip
# 解压后挑选与 tmux-autopilot 相关的 API/快捷键,整理到 references/api.md 或 examples.md
```
- 这样满足“严选来源 + 自动化抓取”要求,后续人工抽取精华补入本技能。
## 用例 4多 AI 工作台一键启动(命令行版)
```bash
tmux new-session -d -s ai-hub -n commander 'bash'
for w in worker1 worker2 worker3; do
tmux new-window -t ai-hub -n "$w" 'kiro-cli chat'
done
tmux select-window -t ai-hub:commander
tmux attach -t ai-hub
```
- 进入后执行用例 1 的巡检脚本即可形成「指挥+工人」模式。

View File

@ -0,0 +1,41 @@
# Getting Started & Vocabulary
## 核心术语10 个)
1. sessiontmux 的最外层会话。
2. windowsession 下的窗口,编号 `<session>:<window>`
3. pane窗口内分屏编号 `<session>:<window>.<pane>`
4. prefix组合键前缀oh-my-tmux 主前缀为 `Ctrl+a`,备用 `Ctrl+b`
5. capture-pane抓取 pane 输出到 stdout。
6. send-keys向 pane 注入按键/命令。
7. synchronize-panes窗口级广播开关。
8. pipe-pane将 pane 输出流向命令/文件。
9. copy-modetmux 内置滚动/复制模式,需先退出再发按键。
10. .tmux.conf.localoh-my-tmux 推荐的用户自定义文件。
## 最短路径:接管本仓库内 oh-my-tmux 并跑通命令
```bash
# 1) 确认 tmux 版本 >= 2.6
tmux -V
# 2) 软链配置(不会覆盖已有 .tmux.conf.local如需自定义请编辑该文件
ln -sfn /home/lenovo/zip/vibe-coding-cn/libs/external/.tmux/.tmux.conf ~/.tmux.conf
cp -n /home/lenovo/zip/vibe-coding-cn/libs/external/.tmux/.tmux.conf.local ~/.tmux.conf.local
# 3) 启动会话并验证前缀
tmux new -s demo -n shell
# 在 tmux 内按 <Ctrl+a> ? 打开快捷键帮助,确认状态栏与主题正常
# 4) 基础自检:列窗、抓取、发送
tmux list-windows
tmux capture-pane -t demo:0.0 -p -S -10
tmux send-keys -t demo:0.0 "echo ok" Enter
```
## 工作姿势
- 始终用绝对定位 `<session>:<window>.<pane>`;跨 session 操作更安全。
- 批量广播前先名单化:`tmux list-panes -a -F '#S:#I.#P #{pane_current_command}'`。
- 高风险按键(`Ctrl+C`、确认 `y`)先 `capture-pane` 再发送。
- 长任务用 `pipe-pane` 记录;救援/打断后再关。

View File

@ -0,0 +1,14 @@
# tmux-autopilot Reference Index
## Quick Links
- `getting_started.md`:术语、最小安装、前缀说明
- `api.md`tmux/oh-my-tmux 常用命令、同步广播、安全写法
- `examples.md`蜂群巡检脚本、自动救援脚本、Skill Seeker 抓取示例
- `troubleshooting.md`:常见报错与修复路径
## Notes
- 长文档、脚本细节放这里,`SKILL.md` 只保留可立即执行的片段。
- 配置来源:仓库内 `libs/external/.tmux`gpakosz/oh-my-tmux
- 大规模文档抓取/刷新可用 `libs/external/Skill_Seekers-development`,示例见 `examples.md`

View File

@ -0,0 +1,35 @@
# Troubleshooting & Edge Cases
格式:症状 → 可能原因 → 诊断 → 修复
- `no such session` / `no current client`
→ 会话名写错或未 attach
`tmux list-sessions` 校验;需要时 `tmux new -s <name>`
→ 重试带绝对目标:`-t <s:w.p>`
- 发送无效、卡在 copy-mode
→ pane 处于 copy-mode
`tmux display-message -pt <t> '#{pane_in_mode}'`
→ 先 `tmux send-keys -t <t> Escape` 再发命令
- 状态栏符号混乱、重复一行
→ 终端宽字符/字体问题或重复加载配置
`tmux -f /dev/null -L test` 检查;确认 `LC_CTYPE` 使用 UTF-8清理多重 source
→ 使用仓库版 `.tmux.conf.local` 默认字体设置
- 广播误伤其他 pane
`synchronize-panes` 未关闭
`tmux show-window-options | grep synchronize`
`tmux set-window-option synchronize-panes off`
- Powerline 符号缺失
→ 字体未带 Powerline codepoints
→ 切换到带符号字体或安装 `PowerlineSymbols.otf`,再重载 `tmux source-file ~/.tmux.conf.local`
- `prefix` 无反应
→ 其他程序占用或配置被覆盖
`grep prefix ~/.tmux.conf.local` 确认;可改为 `C-b` 并加 `#!important`
- 长任务输出缺失
→ 未开启 pipe-pane / buffer 溢出
→ 提前 `pipe-pane` 到文件;或 `capture-pane -S -100000` 抓历史

7
libs/external/.tmux/.gitattributes vendored Normal file
View File

@ -0,0 +1,7 @@
* text=auto
# git
.gitignore text
.tmux.conf eol=lf
.tmux.conf.local eol=lf

View File

@ -0,0 +1 @@
github: gpakosz

1
libs/external/.tmux/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
plugins/**

16
libs/external/.tmux/.logo/LICENSE vendored Normal file
View File

@ -0,0 +1,16 @@
Oh my tmux! logo copyright (c) 2024, Gregory Pakosz <gregory.pakosz@gmail.com>
Original tmux logo copyright (c) 2015, Jason Long <jason@jasonlong.me>
See https://github.com/tmux/tmux/tree/master/logo
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 187"><path fill="#00afff" d="M240 147.4c29.6 0 50.4-25.6 50.4-68.6 0-42.4-20.8-67.4-50.4-67.4s-50.4 25-50.4 67.4c0 43 20.8 68.6 50.4 68.6zm0-14.6c-20 0-33.2-20.4-33.2-54 0-33 13.2-52.8 33.2-52.8s33.2 19.8 33.2 52.8c0 33.6-13.2 54-33.2 54zm68.52 12.2h16.4V77.2c11.4-11.8 19.2-17.6 30.8-17.6 16 0 22.4 8.8 22.4 27.2V145h16.4V84.6c0-25.6-10.6-39.2-33.6-39.2-15.2 0-26.4 8.2-36.4 19h-.6l1-23V2.6h-16.4zm162.85 0h16.4V74.6c4.8-10 9.2-15 16-15 7.2 0 10 5.8 10 17V145h15.2V74.6c5.2-10 8.8-15 15.6-15 7.2 0 10.4 5.8 10.4 17V145h16.4V75.4c0-19.4-8-30-21.6-30-11.2 0-17.2 6.4-22.8 16.8-2.8-11.2-8.8-16.8-18.4-16.8-11.2 0-17.2 6.2-22.2 15.2h-.4l-1.4-12.8h-13.2zm124.52 41.8c22 0 34-14.6 41.2-33.8l42.8-105.2h-15.6l-21.2 53.8c-3.2 8.8-7 19-10.4 28.2h-.8c-4-9.4-8.2-19.6-12-28.2l-23.8-53.8h-16.6l45.4 97.4-3 7.2c-4.8 12-13 20.8-26.6 20.8-3 0-6.2-.6-8.8-1.4l-3.4 13c3.4 1.2 8.2 2 12.8 2zm222.44-39.4c12.2 0 21.6-2.6 30.4-5.8l-3.6-12c-7 2.6-14.2 4.4-23.4 4.4-18.8 0-24.6-9.2-24.6-26.6V61.2h47.8V47.8h-47.8V16.6h-13.6l-2.2 31.2-28 1v12.4h27.4v46c0 24 9.2 40.2 37.6 40.2zm42.72-2.4h16.4V74.6c4.8-10 9.2-15 16-15 7.2 0 10 5.8 10 17V145h15.2V74.6c5.2-10 8.8-15 15.6-15 7.2 0 10.4 5.8 10.4 17V145h16.4V75.4c0-19.4-8-30-21.6-30-11.2 0-17.2 6.4-22.8 16.8-2.8-11.2-8.8-16.8-18.4-16.8-11.2 0-17.2 6.2-22.2 15.2h-.4l-1.4-12.8h-13.2zm147.55 2.4c15 0 26.4-8 36.2-19.4h.8l1.4 17h13.4V47.8H1044v67.4c-10.8 12.6-19 18-30.2 18-16.2 0-22.4-8.8-22.4-27.2V47.8h-16.6v60.4c0 25.6 10.6 39.2 33.8 39.2zm73.5-2.4h17.6l16-22.4c4-6.2 8-11.8 12-17.6h.8c4.2 5.6 8.8 12 12.8 17.6l17 22.4h18l-37.2-49 34.6-48.2h-17.4l-14.6 21c-3.4 5.4-7.4 11.4-11 16.8h-.8c-4-5.4-8-11.2-11.4-16.4l-15.4-21.4h-18.2l34.2 46.8zm151.5-46.4h11.2l2-68.8.4-18.8h-16l.4 18.8zm5.6 48.8c8 0 14.6-6 14.6-15.6 0-9.4-6.6-15.2-14.6-15.2s-14.6 5.8-14.6 15.2c0 9.6 6.6 15.6 14.6 15.6z" aria-label="Oh my tmux!"/><path fill="#fff" d="M76.892 144.526h7.91V76.812h76.014l.03-7.85-76.044-.06V-.131h-7.91z"/><path fill="#3c3c3c" fill-rule="evenodd" d="M83.788 69.866v-70h-6v146h6v-70h77v-6zm-83-54.994C.788 6.584 7.51-.134 15.786-.134h130c8.283 0 14.998 6.725 14.998 15.006v130.99h-160z"/><path fill="#ff0" d="m2 146 23-1v13.719s-14.06 1.335-18.379-2.658C1.471 151.301 2 146.001 2 146.001z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#ff00af" d="M25 145h30v13.719H25z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#3c3c3c" d="M55 145h5v13.719h-5z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#00afff" d="M60 145h17v13.719H60z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#3c3c3c" d="M77 145h54.248v13.719H77z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#fff" d="m157.95 146-13.053-1-9.947 13.719s14.06 1.335 18.379-2.658c5.15-4.76 4.62-10.06 4.62-10.06z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#d70000" d="M131.25 145h13.752v13.719H131.25z" style="mix-blend-mode:normal" transform="translate(.788 -.134)"/><path fill="#3c3c3c" fill-rule="evenodd" d="M2.788 144.866c0 7.189 5.816 13.004 12.998 13.004h130c7.174 0 12.998-5.824 12.998-13.004m2 0c0 8.287-6.722 15.004-14.998 15.004h-130c-8.283 0-14.998-6.706-14.998-15.004m2 1.004-2-2h160l-2 2m2 0h-160"/></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 160"><path fill="#fff" d="M76.104 144.66h7.91V76.946h76.014l.03-7.85-76.044-.06V.003h-7.91z"/><path fill="#3c3c3c" fill-rule="evenodd" d="M83 70V0h-6v146h6V76h77v-6zM0 15.006C0 6.718 6.722 0 14.998 0h130c8.283 0 14.998 6.725 14.998 15.006v130.99h-160z"/><path fill="#ff0" d="m2 146 23-1v13.719s-14.06 1.335-18.379-2.658C1.471 151.301 2 146.001 2 146.001z" style="mix-blend-mode:normal"/><path fill="#ff00af" d="M25 145h30v13.719H25z" style="mix-blend-mode:normal"/><path fill="#3c3c3c" d="M55 145h5v13.719h-5z" style="mix-blend-mode:normal"/><path fill="#00afff" d="M60 145h17v13.719H60z" style="mix-blend-mode:normal"/><path fill="#3c3c3c" d="M77 145h54.248v13.719H77z" style="mix-blend-mode:normal"/><path fill="#fff" d="m157.95 146-13.053-1-9.947 13.719s14.06 1.335 18.379-2.658c5.15-4.76 4.62-10.06 4.62-10.06z" style="mix-blend-mode:normal"/><path fill="#d70000" d="M131.25 145h13.752v13.719H131.25z" style="mix-blend-mode:normal"/><path fill="#3c3c3c" fill-rule="evenodd" d="M2 145c0 7.189 5.816 13.004 12.998 13.004h130c7.174 0 12.998-5.824 12.998-13.004m2 0c0 8.287-6.722 15.004-14.998 15.004h-130C6.715 160.004 0 153.298 0 145m2 1.004-2-2h160l-2 2m2 0H0"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

1890
libs/external/.tmux/.tmux.conf vendored Normal file

File diff suppressed because it is too large Load Diff

509
libs/external/.tmux/.tmux.conf.local vendored Normal file
View File

@ -0,0 +1,509 @@
# : << 'EOF'
# Oh my tmux!
# 💛🩷💙🖤❤️🤍
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- bindings ------------------------------------------------------------------
# preserve tmux stock bindings,
# while adding bindings that don't conflict with these stock bindings
# /!\ this disables some of Oh my tmux! bindings described in README.md
# - true
# - false (default)
tmux_conf_preserve_stock_bindings=false
# -- session creation ----------------------------------------------------------
# prompt for session name when creating a new session, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_prompt=false
# new session retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_retain_current_path=false
# -- windows & pane creation ---------------------------------------------------
# new window retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_retain_current_path=false
# new window tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_reconnect_ssh=false
# new pane retains current path, possible values are:
# - true (default)
# - false
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_retain_current_path=true
# new pane tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_reconnect_ssh=false
# -- display -------------------------------------------------------------------
# RGB 24-bit colour support, possible values are:
# - true
# - false
# - auto (default)
#
# automatic detection relies on the COLORTERM environment variable being defined
# to 'truecolor' or '24bit' or '$ tput colors' answering '16777216'
# see https://github.com/termstandard/colors
tmux_conf_24b_colour=auto
# -- theming -------------------------------------------------------------------
# enable or disable theming:
# - enabled (default)
# - disabled
# when disabled, all tmux_conf_theme_xxx variables are ignored except:
# - tmux_conf_theme_pairing
# - tmux_conf_theme_prefix
# - tmux_conf_theme_mouse
# - tmux_conf_theme_root
# - tmux_conf_theme_synchronized
tmux_conf_theme=enabled
# default theme
tmux_conf_theme_colour_1="#080808" # dark gray
tmux_conf_theme_colour_2="#303030" # gray
tmux_conf_theme_colour_3="#8a8a8a" # light gray
tmux_conf_theme_colour_4="#00afff" # light blue
tmux_conf_theme_colour_5="#ffff00" # yellow
tmux_conf_theme_colour_6="#080808" # dark gray
tmux_conf_theme_colour_7="#e4e4e4" # white
tmux_conf_theme_colour_8="#080808" # dark gray
tmux_conf_theme_colour_9="#ffff00" # yellow
tmux_conf_theme_colour_10="#ff00af" # pink
tmux_conf_theme_colour_11="#5fff00" # green
tmux_conf_theme_colour_12="#8a8a8a" # light gray
tmux_conf_theme_colour_13="#e4e4e4" # white
tmux_conf_theme_colour_14="#080808" # dark gray
tmux_conf_theme_colour_15="#080808" # dark gray
tmux_conf_theme_colour_16="#d70000" # red
tmux_conf_theme_colour_17="#e4e4e4" # white
# default theme (ansi)
#tmux_conf_theme_colour_1="colour0"
#tmux_conf_theme_colour_2="colour8"
#tmux_conf_theme_colour_3="colour8"
#tmux_conf_theme_colour_4="colour14"
#tmux_conf_theme_colour_5="colour11"
#tmux_conf_theme_colour_6="colour0"
#tmux_conf_theme_colour_7="colour15"
#tmux_conf_theme_colour_8="colour0"
#tmux_conf_theme_colour_9="colour11"
#tmux_conf_theme_colour_10="colour13"
#tmux_conf_theme_colour_11="colour10"
#tmux_conf_theme_colour_12="colour8"
#tmux_conf_theme_colour_13="colour15"
#tmux_conf_theme_colour_14="colour0"
#tmux_conf_theme_colour_15="colour0"
#tmux_conf_theme_colour_16="colour1"
#tmux_conf_theme_colour_17="colour15"
# window style
tmux_conf_theme_window_fg="default"
tmux_conf_theme_window_bg="default"
# highlight focused pane, possible values are:
# - true
# - false (default)
tmux_conf_theme_highlight_focused_pane=false
# focused pane colours:
tmux_conf_theme_focused_pane_bg="$tmux_conf_theme_colour_2"
# pane border style, possible values are:
# - thin (default)
# - fat
tmux_conf_theme_pane_border_style=thin
# pane borders colours:
tmux_conf_theme_pane_border="$tmux_conf_theme_colour_2"
tmux_conf_theme_pane_active_border="$tmux_conf_theme_colour_4"
%if #{>=:#{version},3.2}
tmux_conf_theme_pane_active_border="#{?pane_in_mode,$tmux_conf_theme_colour_9,#{?synchronize-panes,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_4}}"
%endif
# pane indicator colours (when you hit <prefix> + q)
tmux_conf_theme_pane_indicator="$tmux_conf_theme_colour_4"
tmux_conf_theme_pane_active_indicator="$tmux_conf_theme_colour_4"
# status line style
tmux_conf_theme_message_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_attr="bold"
# status line command style (<prefix> : Escape)
tmux_conf_theme_message_command_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_command_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_command_attr="bold"
# window modes style
tmux_conf_theme_mode_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_mode_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_mode_attr="bold"
# status line style
tmux_conf_theme_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_status_attr="none"
# terminal title
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W"
# window status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_window_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_attr="none"
tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window current status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_current_bg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_current_attr="bold"
tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window activity status style
tmux_conf_theme_window_status_activity_fg="default"
tmux_conf_theme_window_status_activity_bg="default"
tmux_conf_theme_window_status_activity_attr="underscore"
# window bell status style
tmux_conf_theme_window_status_bell_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_window_status_bell_bg="default"
tmux_conf_theme_window_status_bell_attr="blink,bold"
# window last status style
tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2"
tmux_conf_theme_window_status_last_attr="none"
# status left/right sections separators
tmux_conf_theme_left_separator_main=""
tmux_conf_theme_left_separator_sub="|"
tmux_conf_theme_right_separator_main=""
tmux_conf_theme_right_separator_sub="|"
#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with "|"
# - separate subsections with ","
# - built-in variables are:
# - #{battery_bar}
# - #{battery_hbar}
# - #{battery_percentage}
# - #{battery_status}
# - #{battery_vbar}
# - #{circled_session_name}
# - #{hostname_ssh}
# - #{hostname}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{loadavg}
# - #{mouse}
# - #{pairing}
# - #{prefix}
# - #{root}
# - #{synchronized}
# - #{uptime_y}
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
# - #{uptime_h}
# - #{uptime_m}
# - #{uptime_s}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} "
#tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} | #{pretty_pane_current_path} "
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} "
# status left style
tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8"
tmux_conf_theme_status_left_bg="$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11"
tmux_conf_theme_status_left_attr="bold,none,none"
# status right style
tmux_conf_theme_status_right_fg="$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14"
tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17"
tmux_conf_theme_status_right_attr="none,none,bold"
# pairing indicator
tmux_conf_theme_pairing="⚇" # U+2687
tmux_conf_theme_pairing_fg="none"
tmux_conf_theme_pairing_bg="none"
tmux_conf_theme_pairing_attr="none"
# prefix indicator
tmux_conf_theme_prefix="⌨" # U+2328
tmux_conf_theme_prefix_fg="none"
tmux_conf_theme_prefix_bg="none"
tmux_conf_theme_prefix_attr="none"
# mouse indicator
tmux_conf_theme_mouse="↗" # U+2197
tmux_conf_theme_mouse_fg="none"
tmux_conf_theme_mouse_bg="none"
tmux_conf_theme_mouse_attr="none"
# root indicator
tmux_conf_theme_root="!"
tmux_conf_theme_root_fg="none"
tmux_conf_theme_root_bg="none"
tmux_conf_theme_root_attr="bold,blink"
# synchronized indicator
tmux_conf_theme_synchronized="⚏" # U+268F
tmux_conf_theme_synchronized_fg="none"
tmux_conf_theme_synchronized_bg="none"
tmux_conf_theme_synchronized_attr="none"
# battery bar symbols
tmux_conf_battery_bar_symbol_full="◼"
tmux_conf_battery_bar_symbol_empty="◻"
#tmux_conf_battery_bar_symbol_full="♥"
#tmux_conf_battery_bar_symbol_empty="·"
# battery bar length (in number of symbols), possible values are:
# - auto
# - a number, e.g. 5
tmux_conf_battery_bar_length="auto"
# battery bar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_full_fg,colour_empty_fg,colour_bg"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_bar_palette="gradient"
#tmux_conf_battery_bar_palette="#d70000,#e4e4e4,#000000" # red, white, black
#tmux_conf_battery_bar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# battery hbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_hbar_palette="gradient"
#tmux_conf_battery_hbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
#tmux_conf_battery_hbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# battery vbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
# - gradient(colour_fg_1,colour_fg_2,...,colour_fg_n)
tmux_conf_battery_vbar_palette="gradient"
#tmux_conf_battery_vbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
#tmux_conf_battery_vbar_palette="gradient(#00afff,#47a2ff,#7c91ff,#ac7afb,#d65be2,#e163df,#eb6cdd,#f475db,#ec9ff1,#eac3fe,#efe2ff,#ffffff)"
# symbols used to indicate whether battery is charging or discharging
tmux_conf_battery_status_charging="↑" # U+2191
tmux_conf_battery_status_discharging="↓" # U+2193
#tmux_conf_battery_status_charging="🔌" # U+1F50C
#tmux_conf_battery_status_discharging="🔋" # U+1F50B
# clock style (when you hit <prefix> + t)
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
tmux_conf_theme_clock_colour="$tmux_conf_theme_colour_4"
tmux_conf_theme_clock_style="24"
# -- clipboard -----------------------------------------------------------------
# in copy mode, copying selection also copies to the OS clipboard
# - true
# - false (default)
# - disabled
# on Linux, this requires xsel, xclip or wl-copy
tmux_conf_copy_to_os_clipboard=false
# -- urlscan -------------------------------------------------------------------
# options passed to urlscan
tmux_conf_urlscan_options="--compact --dedupe"
# -- user customizations -------------------------------------------------------
# this is the place to override or undo settings
# increase history size
#set -g history-limit 10000
# start with mouse mode enabled
#set -g mouse on
# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
#set -g status-keys vi
#set -g mode-keys vi
# replace C-b by C-a instead of using both prefixes
# set -gu prefix2
# unbind C-a
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix
# if you don't want Oh my tmux! to alter a binding or a setting, use #!important
# bind c new-window -c '#{pane_current_path}' #!important
# display a message after toggling mouse support
bind m run "cut -c3- '#{TMUX_CONF}' | sh -s _toggle_mouse" \; display 'mouse #{?#{mouse},on,off}'
# move status line to top
#set -g status-position top
# -- tpm -----------------------------------------------------------------------
# while I don't use tpm myself, many people requested official support so here
# is a seamless integration that automatically installs plugins in parallel
# whenever a plugin introduces a variable to be used in 'status-left' or
# 'status-right', you can use it in 'tmux_conf_theme_status_left' and
# 'tmux_conf_theme_status_right' variables.
# by default, launching tmux will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_launch=true
# by default, reloading the configuration will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_reload=true
# by default, reloading the configuration will uninstall tpm and plugins when no
# plugins are enabled
# - true (default)
# - false
tmux_conf_uninstall_plugins_on_reload=true
# /!\ the tpm bindings differ slightly from upstream:
# - installing plugins: <prefix> + I
# - uninstalling plugins: <prefix> + Alt + u
# - updating plugins: <prefix> + u
# /!\ do not add set -g @plugin 'tmux-plugins/tpm'
# /!\ do not add run '~/.tmux/plugins/tpm/tpm'
# /!\ the 'set -g @tpm_plugins' syntax is not supported
# to enable a plugin, use the 'set -g @plugin' syntax:
# visit https://github.com/tmux-plugins for available plugins
#set -g @plugin 'tmux-plugins/tmux-copycat'
#set -g @plugin 'tmux-plugins/tmux-cpu'
#set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'
#set -g @continuum-restore 'on'
# -- custom variables ----------------------------------------------------------
# to define a custom #{foo} variable, define a POSIX shell function between the
# '# EOF' and the '# "$@"' lines. Please note that the opening brace { character
# must be on the same line as the function name otherwise the parse won't detect
# it.
#
# then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the
# 'tmux_conf_theme_status_right' variables.
# ------------------------------------------------------------------------------
# # /!\ do not remove the following line
# EOF
#
# # /!\ do not "uncomment" the functions: the leading "# " characters are needed
#
# # usage: #{weather}
# weather() { # see https://github.com/chubin/wttr.in#one-line-output
# curl -f -s -m 2 'wttr.in?format=3' || printf '\n' # /!\ make sure curl is installed
# sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{online}
# online() {
# ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘'
# }
#
# # usage: #{wan_ip_v4}
# wan_ip_v4() {
# curl -f -s -m 2 -4 ifconfig.me
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{wan_ip_v6}
# wan_ip_v6() {
# curl -f -s -m 2 -6 ifconfig.me
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# # usage: #{github_stars}, #{github_stars tmux/tmux}, ...
# github_stars() {
# repository=${1##*https://github.com/}
# repository=${repository%% *}
# repository=${repository%%.git}
# url="https://api.github.com/repos/${repository:-gpakosz/.tmux}"
# curl -s "$url" | perl -MJSON::PP=decode_json -CO -0777 -E '$response = decode_json(readline *STDIN); say ($response->{stargazers_count})'
# sleep 300 # sleep for 5 minutes, throttle network requests whatever the value of status-interval
# }
#
# "$@"
# # /!\ do not remove the previous line
# # do not write below this line

18
libs/external/.tmux/LICENSE.MIT vendored Normal file
View File

@ -0,0 +1,18 @@
Copyright 2012— Gregory Pakosz
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13
libs/external/.tmux/LICENSE.WTFPLv2 vendored Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

442
libs/external/.tmux/README.md vendored Normal file
View File

@ -0,0 +1,442 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset=".logo/logomark+wordmark.svg">
<source media="(prefers-color-scheme: dark)" srcset=".logo/logomark+wordmark.svg">
<img alt="Oh my tmux! logo and wordmark" src=".logo/logomark+wordmark.svg">
</picture>
</p>
˗ˏˋ ★ ˎˊ˗ My self-contained, pretty and versatile tmux configuration, made with ❤️ ˗ˏˋ ★ ˎˊ˗
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://cloud.githubusercontent.com/assets/553208/19740585/85596a5a-9bbf-11e6-8aa1-7c8d9829c008.gif">
<source media="(prefers-color-scheme: dark)" srcset="https://cloud.githubusercontent.com/assets/553208/19740585/85596a5a-9bbf-11e6-8aa1-7c8d9829c008.gif">
<img alt="Oh my tmux! in action" src="https://cloud.githubusercontent.com/assets/553208/19740585/85596a5a-9bbf-11e6-8aa1-7c8d9829c008.gif">
</picture>
</p>
Installation
------------
**Requirements:**
- tmux **`>= 2.6`** running on Linux, macOS, OpenBSD, Windows (WSL or Cygwin)
- awk, perl (with Time::HiRes support), grep, and sed
- Outside of tmux, the `TERM` environment variable must be set to
`xterm-256color`
⚠️ Before installing, you may want to backup your existing configuration.
You can install Oh my tmux! at any of the following locations:
- `~`
- `$XDG_CONFIG_HOME/tmux`
- `~/.config/tmux`
**Automatic installation**
Copy the following command and paste it in your terminal.
```
curl -fsSL "https://github.com/gpakosz/.tmux/raw/refs/heads/master/install.sh#$(date +%s)" | bash
```
**Manual installation in `~`**
```
$ cd
$ git clone --single-branch https://github.com/gpakosz/.tmux.git
$ ln -s -f .tmux/.tmux.conf
$ cp .tmux/.tmux.conf.local .
```
**Manual installation in `$XDG_CONFIG_HOME/tmux`**
```
$ git clone --single-branch https://github.com/gpakosz/.tmux.git "/path/to/oh-my-tmux"
$ mkdir -p "$XDG_CONFIG_HOME/tmux"
$ ln -s /path/to/oh-my-tmux/.tmux.conf "$XDG_CONFIG_HOME/tmux/tmux.conf"
$ cp /path/to/oh-my-tmux/.tmux.conf.local "$XDG_CONFIG_HOME/tmux/tmux.conf.local"
```
**Manual installation `~/.config/tmux`**
```
$ git clone --single-branch https://github.com/gpakosz/.tmux.git "/path/to/oh-my-tmux"
$ mkdir -p ~/.config/tmux
$ ln -s /path/to/oh-my-tmux/.tmux.conf ~/.config/tmux/tmux.conf
$ cp /path/to/oh-my-tmux/.tmux.conf.local ~/.config/tmux/tmux.conf.local
```
⚠️ When installing `$XDG_CONFIG_HOME/tmux` or `~/.config/tmux`, the configuration
file names don't have a leading `.` character.
🚨 **You should never alter the main `.tmux.conf` or `tmux.conf` file. If you do,
you're on your own. Instead, every customization should happen in your
`.tmux.conf.local` or `tmux.conf.local` customization file copy.**
If you're a Vim user, setting the `VIUAL` or `EDITOR` environment variable to
`vim` will enable and further customize the `vi-style` key bindings (see tmux
manual).
If you're new to tmux, I recommend you to read the [tmux getting started
guide][getting-started], as well as the [tmux 3: Productive Mouse-Free
Development][bhtmux3] book by [@bphogan].
Now proceed to [adjust] your `.local` customization file copy.
[getting-started]: https://github.com/tmux/tmux/wiki/Getting-Started
[bhtmux3]: https://pragprog.com/titles/bhtmux3/tmux-3/
[@bphogan]: https://bphogan.com/
[adjust]: #configuration
Troubleshooting
---------------
- **I believe something's not quite right**
Please, try make sure no tmux client or server process is currently running.
Then launch tmux with:
```
$ tmux -f /dev/null -L test
```
Which launches a new tmux client/server pair without loading any
configuration.
If the issue is still reproducing, please reach out to the tmux project for
support.
Otherwise, please open an issue describing what doesn't work and I'll do my
best to address it.
- **I tried to used `set`, `bind` and `unbind` in my `.local` customization
file, but Oh my tmux! overwrites my preferences**
When that happens append `#!important` to the line:
```
bind c new-window -c '#{pane_current_path}' #!important
```
```
set -g default-terminal "screen-256color" #!important
```
- **Status line is broken and/or gets duplicated at the bottom of the screen**
This could happen on Linux when the distribution provides a version of glib
that received Unicode 9.0 upgrades (glib `>= 2.50.1`) while providing a
version of glibc that didn't (glibc `< 2.26`). You may also configure
`LC_CTYPE` to use an `UTF-8` locale. Typically VTE based terminal emulators
rely on glib's `g_unichar_iswide()` function while tmux relies on glibc's
`wcwidth()` function. When these two functions disagree, display gets messed
up.
This can also happen on macOS when using iTerm2 and "Use Unicode version 9
character widths" is enabled in `Preferences... > Profiles > Text`
For that reason, the sample `.local` customization file stopped using
Unicode characters for which width changed in between Unicode 8.0 and 9.0
standards, as well as Emojis.
- **I installed Powerline and/or (patched) fonts but I can't see the Powerline
symbols**
**🤯 Please realize that you don't need to install [Powerline].**
You only need fonts patched with Powerline symbols or the standalone
`PowerlineSymbols.otf` font.
Then make sure your `.local` customization file copy uses the [Powerline
code points] for the
`tmux_conf_theme_left_separator_main`,
`tmux_conf_theme_left_separator_sub`,
`tmux_conf_theme_right_separator_main`
and `tmux_conf_theme_right_separator_sub` variables.
[Powerline]: https://github.com/Lokaltog/powerline
[Powerline code points]: #enabling-the-powerline-look
Features
--------
- `C-a` acts as secondary prefix, while keeping default `C-b` prefix
- Visual theme inspired by [Powerline][]
- [Maximize any pane to a new window with `<prefix> +`][maximize-pane]
- Mouse mode toggle with `<prefix> m`
- Laptop battery status line information
- Uptime status line information
- Optional highlight of focused pane
- Configurable new sessions, windows and panes behavior (to optionally retain
the current path)
- SSH/Mosh aware username and hostname status line information
- SSH/Mosh aware pane splitting (with automatic reconnection to the remote
server)
- Copy to OS clipboard (needs `xsel`, `xclip`, or `wl-copy` on Linux)
- Support for 4-digit hexadecimal Unicode characters
- [PathPicker][] integration, if available
- [Urlscan][] (preferred) or [Urlview][] integration, if available
[maximize-pane]: http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/
[PathPicker]: https://facebook.github.io/PathPicker/
[Urlview]: https://packages.debian.org/stable/misc/urlview
[Urlscan]: https://github.com/firecat53/urlscan
The "Maximize any pane to a new window with `<prefix> +`" feature is different
from the builtin `resize-pane -Z` command, as it allows you to further split a maximized
pane. It's also more flexible by allowing you to maximize a pane to a new
window, then change window, then go back and the pane is still in maximized
state in its own window. You can then minimize a pane by using `<prefix> +`
either from the source window or the maximized window.
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://cloud.githubusercontent.com/assets/553208/9890858/ee3c0ca6-5c02-11e5-890e-05d825a46c92.gif">
<source media="(prefers-color-scheme: dark)" srcset="https://cloud.githubusercontent.com/assets/553208/9890858/ee3c0ca6-5c02-11e5-890e-05d825a46c92.gif">
<img alt="Maximizing a pane" src="https://cloud.githubusercontent.com/assets/553208/9890858/ee3c0ca6-5c02-11e5-890e-05d825a46c92.gif">
</picture>
</p>
Mouse mode allows you to set the active window, set the active pane, resize
panes and automatically switches to copy-mode to select text.
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://cloud.githubusercontent.com/assets/553208/9890797/8dffe542-5c02-11e5-9c06-a25b452e6fcc.gif">
<source media="(prefers-color-scheme: dark)" srcset="https://cloud.githubusercontent.com/assets/553208/9890797/8dffe542-5c02-11e5-9c06-a25b452e6fcc.gif">
<img alt="Mouse mode" src="https://cloud.githubusercontent.com/assets/553208/9890797/8dffe542-5c02-11e5-9c06-a25b452e6fcc.gif">
</picture>
</p>
Bindings
--------
tmux may be controlled from an attached client by using a key combination of a
prefix key, followed by a command key. This configuration uses `C-a` as a
secondary prefix while keeping `C-b` as the default prefix. In the following
list of key bindings:
- `<prefix>` means you have to either hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd>
- `<prefix> c` means you have to hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd> followed by <kbd>c</kbd>
- `<prefix> C-c` means you have to hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd> followed by <kbd>Ctrl</kbd> + <kbd>c</kbd>
This configuration uses the following bindings:
- `<prefix> e` opens the `.local` customization file copy with the editor
defined by the `VISUAL` or `EDITOR` environment variable (defaults to `vim`
when empty)
- `<prefix> r` reloads the configuration
- `C-l` clears both the screen **and** the tmux history
- `<prefix> C-c` creates a new session
- `<prefix> C-f` lets you switch to another session by name
- `<prefix> C-h` and `<prefix> C-l` let you navigate windows (default
`<prefix> n` is unbound and `<prefix> p` is repurposed)
- `<prefix> Tab` brings you to the last active window
- `<prefix> -` splits the current pane vertically
- `<prefix> _` splits the current pane horizontally
- `<prefix> h`, `<prefix> j`, `<prefix> k` and `<prefix> l` let you navigate
panes ala Vim
- `<prefix> H`, `<prefix> J`, `<prefix> K`, `<prefix> L` let you resize panes
- `<prefix> <` and `<prefix> >` let you swap panes
- `<prefix> +` maximizes the current pane to a new window
- `<prefix> m` toggles mouse mode on or off
- `<prefix> U` launches Urlscan (preferred) or Urlview, if available
- `<prefix> F` launches Facebook PathPicker, if available
- `<prefix> Enter` enters copy-mode
- `<prefix> b` lists the paste-buffers
- `<prefix> p` pastes from the top paste-buffer
- `<prefix> P` lets you choose the paste-buffer to paste from
Additionally, `copy-mode-vi` matches [my own Vim configuration]
[my own Vim configuration]: https://github.com/gpakosz/.vim.git
Bindings for `copy-mode-vi`:
- `v` begins selection / visual mode
- `C-v` toggles between blockwise visual mode and visual mode
- `H` jumps to the start of line
- `L` jumps to the end of line
- `y` copies the selection to the top paste-buffer
- `Escape` cancels the current operation
It's also possible to preserve the tmux stock bindings by setting the
`tmux_conf_preserve_stock_bindings` variable to `true` in your `.local`
customization file copy.
Configuration
-------------
While this configuration tries to bring sane default settings, you may want to
customize it further to your needs.
🚨 Again, you should never alter the main `.tmux.conf` or `tmux.conf` file.
If you do, you're on your own.
Please refer to the sample `.local` customization file to know more about the
variables that allow you to alter different behaviors. Upon successful
installation, pressing `<prefix> e` will open your `.local` customization file
copy with the editor defined by the `VISUAL` or `EDITOR` environment variable
(defaults to `vim` when empty).
### Enabling the Powerline look
Powerline originated as a status-line plugin for Vim. Its popular eye-catching
look is based on the use of special symbols:
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/55afd317-150b-42f0-9ef3-fa619be7b160">
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/55afd317-150b-42f0-9ef3-fa619be7b160">
<img alt="Powerline symbols" src="https://github.com/user-attachments/assets/55afd317-150b-42f0-9ef3-fa619be7b160">
</picture>
</p>
To make use of these symbols, there are several options:
- Use a font that already bundles those: this is the case of the [Source Code
Pro][source code pro] font
- Use a [pre-patched font][powerline patched fonts]
- Use your preferred font along with the standalone [Powerline font][powerline
font] (that only contains the Powerline symbols): [this highly depends on
your operating system and your terminal emulator][terminal support], for
instance here's a screenshot of iTerm2 configured to use
`PowerlineSymbols.otf` for non ASCII symbols:
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/553208/62243890-8232f500-b3de-11e9-9b8c-51a5d38bdaa8.png">
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/553208/62243890-8232f500-b3de-11e9-9b8c-51a5d38bdaa8.png">
<img alt="iTerm2 + Powerline font" src="https://user-images.githubusercontent.com/553208/62243890-8232f500-b3de-11e9-9b8c-51a5d38bdaa8.png">
</picture>
</p>
[source code pro]: https://github.com/adobe-fonts/source-code-pro/releases/latest
[powerline patched fonts]: https://github.com/powerline/fonts
[powerline font]: https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
[terminal support]: http://powerline.readthedocs.io/en/master/usage.html#usage-terminal-emulators
Then edit your `.local` customization file copy (with `<prefix> e`) and adjust
the following variables:
```
tmux_conf_theme_left_separator_main='\uE0B0'
tmux_conf_theme_left_separator_sub='\uE0B1'
tmux_conf_theme_right_separator_main='\uE0B2'
tmux_conf_theme_right_separator_sub='\uE0B3'
```
The [Powerline manual] contains further details on how to install fonts
containing the Powerline symbols.
[Powerline manual]: http://powerline.readthedocs.org/en/latest/installation.html#fonts-installation
### Configuring the status line
Edit your `.local` customization file copy (`<prefix> e`) and adjust the
`tmux_conf_theme_status_left` and `tmux_conf_theme_status_right` variables to
your liking.
This configuration supports the following builtin variables:
- `#{battery_bar}`: horizontal battery charge bar
- `#{battery_hbar}`: 1 character wide, horizontal battery charge bar
- `#{battery_vbar}`: 1 character wide, vertical battery charge bar
- `#{battery_percentage}`: battery percentage
- `#{battery_status}`: is battery charging or discharging?
- `#{circled_session_name}`: circled session number (from ⓪) to ⑳)
- `#{hostname}`: SSH/Mosh aware hostname information
- `#{hostname_ssh}`: SSH/Mosh aware hostname information, blank when not
connected to a remote server through SSH/Mosh
- `#{loadavg}`: load average
- `#{pairing}`: is the current session attached to more than one client?
- `#{pretty_pane_current_path}`: prettified `#{pane_current_path}` when its
length is too long
- `#{prefix}`: is prefix being depressed?
- `#{root}`: is the current user root?
- `#{synchronized}`: are the panes synchronized?
- `#{uptime_y}`: uptime years
- `#{uptime_d}`: uptime days, modulo 365 when `#{uptime_y}` is used
- `#{uptime_h}`: uptime hours
- `#{uptime_m}`: uptime minutes
- `#{uptime_s}`: uptime seconds
- `#{username}`: SSH/Mosh aware username information
- `#{username_ssh}`: SSH aware username information, blank when not connected
to a remote server through SSH/Mosh
Beside the variables mentioned above, the `tmux_conf_theme_status_left` and
`tmux_conf_theme_status_right` variables support the usual tmux syntax, e.g.
using `#()` to call an external command that inserts weather information
provided by [wttr.in]:
```
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #(curl -m 1 wttr.in?format=3 2>/dev/null; sleep 900) , %R , %d %b | #{username}#{root} | #{hostname} '
```
The `sleep 900` call makes sure the network request is issued at most every 15
minutes whatever the value of `status-interval`.
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/553208/52175490-07797c00-27a5-11e9-9fb6-42eec4fe4188.png">
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/553208/52175490-07797c00-27a5-11e9-9fb6-42eec4fe4188.png">
<img alt="Weather information from wttr.in" src="https://user-images.githubusercontent.com/553208/52175490-07797c00-27a5-11e9-9fb6-42eec4fe4188.png">
</picture>
</p>
[wttr.in]: https://github.com/chubin/wttr.in#one-line-output
💡 You can also define your own custom variables by defining your own POSIX
shell functions, see the sample `.local` customization file for instructions.
Finally, remember that `tmux_conf_theme_status_left` and
`tmux_conf_theme_status_right` end up being given to tmux as `status-left` and
`status-right` which means they're passed through `strftime()`. As such, the `%`
character has a special meaning and needs to be escaped by doubling it, e.g.
```
tmux_conf_theme_status_right='#(echo foo %% bar)'
```
See also `man 3 strftime`.
### Using TPM plugins
This configuration comes with built-in [TPM] support:
- Use the `set -g @plugin ...` syntax to enable a plugin
- Whenever a plugin introduces a variable to be used in `status-left` or
`status-right`, you can use it in the `tmux_conf_theme_status_left` and
`tmux_conf_theme_status_right` variables, see instructions above 👆
- ⚠️ Do not add `set -g @plugin 'tmux-plugins/tpm'` to any configuration file
- ⛔️ Do not add `run '~/.tmux/plugins/tpm/tpm'` to any configuration file
⚠️ The TPM bindings differ slightly from upstream:
- Installing plugins: `<prefix> + I`
- Uninstalling plugins: `<prefix> + Alt + u`
- Updating plugins: `<prefix> + u`
See the sample `.local` customization file for further instructions.
[TPM]: https://github.com/tmux-plugins/tpm
### Using Oh my tmux! on Windows
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/7f84a687-fb4d-4817-a445-419e63ccfac5">
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/7f84a687-fb4d-4817-a445-419e63ccfac5">
<img alt="Windows Terminal + WSL" src="https://github.com/user-attachments/assets/7f84a687-fb4d-4817-a445-419e63ccfac5">
</picture>
</p>
⚠️ I don't recommend running this configuration with [Cygwin] anymore. Forking
under Cygwin is extremely slow and this configuration issues a fair amount
`run-shell` commands under the hood. As such, you will experience high CPU
usage.
Instead I recommend [Windows Subsystem for Linux][WSL] along with [Windows
Terminal]. As an alternative, you may also consider using [Mintty as a terminal
for WSL][wsltty].
[Cygwin]: https://www.cygwin.com
[WSL]: https://learn.microsoft.com/en-us/windows/wsl
[wsltty]: https://github.com/mintty/wsltty
[Windows Terminal]: https://aka.ms/terminal

189
libs/external/.tmux/install.sh vendored Normal file
View File

@ -0,0 +1,189 @@
#!/bin/bash
# Oh my tmux!
# 💛🩷💙🖤❤️🤍
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
#
# ------------------------------------------------------------------------------
# 🚨 PLEASE REVIEW THE CONTENT OF THIS FILE BEFORE BLINDING PIPING TO CURL
# ------------------------------------------------------------------------------
{
if [ ${EUID:-$(id -u)} -eq 0 ]; then
printf '❌ Do not execute this script as root!\n' >&2 && exit 1
fi
if [ -z "$BASH_VERSION" ]; then
printf '❌ This installation script requires bash\n' >&2 && exit 1
fi
if ! tmux -V >/dev/null 2>&1; then
printf '❌ tmux is not installed\n' >&2 && exit 1
fi
is_true() {
case "$1" in
true|yes|1)
return 0
;;
*)
return 1
;;
esac
}
if ! is_true "$PERMISSIVE" && [ -n "$TMUX" ]; then
printf '❌ tmux is currently running, please terminate the server\n' >&2 && exit 1
fi
install() {
printf '🎢 Installing Oh my tmux! Buckle up!\n' >&2
printf '\n' >&2
now=$(date +'%Y%d%m%S')
for dir in "${XDG_CONFIG_HOME:-$HOME/.config}/tmux" "$HOME/.tmux"; do
if [ -d "$dir" ]; then
printf '⚠️ %s directory exists, making a backup → %s\n' "${dir/#"$HOME"/'~'}" "${dir/#"$HOME"/'~'}.$now" >&2
if ! is_true "$DRY_RUN"; then
mv "$dir" "$dir.$now"
fi
fi
done
for conf in "$HOME/.tmux.conf" \
"$HOME/.tmux.conf.local" \
"${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf" \
"${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf.local"; do
if [ -f "$conf" ]; then
if [ -L "$conf" ]; then
printf '⚠️ %s symlink exists, removing → 🗑️\n' "${conf/#"$HOME"/'~'}" >&2
if ! is_true "$DRY_RUN"; then
rm -f "$conf"
fi
else
printf '⚠️ %s file exists, making a backup -> %s\n' "${conf/#"$HOME"/'~'}" "${conf/#"$HOME"/'~'}.$now" >&2
if ! is_true "$DRY_RUN"; then
mv "$conf" "$conf.$now"
fi
fi
fi
done
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}" ]; then
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/tmux"
TMUX_CONF="${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
else
TMUX_CONF="$HOME/.tmux.conf"
fi
TMUX_CONF_LOCAL="$TMUX_CONF.local"
OH_MY_TMUX_CLONE_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/tmux/oh-my-tmux"
if [ -d "$OH_MY_TMUX_CLONE_PATH" ]; then
printf '⚠️ %s exists, making a backup\n' "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}" >&2
printf '%s → %s\n' "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}" "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}.$now" >&2
if ! is_true "$DRY_RUN"; then
mv "$OH_MY_TMUX_CLONE_PATH" "$OH_MY_TMUX_CLONE_PATH.$now"
fi
fi
printf '\n'
printf '✅ Using %s\n' "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}" >&2
printf '✅ Using %s\n' "${TMUX_CONF/#"$HOME"/'~'}" >&2
printf '✅ Using %s\n' "${TMUX_CONF_LOCAL/#"$HOME"/'~'}" >&2
printf '\n'
OH_MY_TMUX_REPOSITORY=${OH_MY_TMUX_REPOSITORY:-https://github.com/gpakosz/.tmux.git}
printf '⬇️ Cloning Oh my tmux! repository...\n' >&2
if ! is_true "$DRY_RUN"; then
mkdir -p "$(dirname "$OH_MY_TMUX_CLONE_PATH")"
if ! git clone -q --single-branch "$OH_MY_TMUX_REPOSITORY" "$OH_MY_TMUX_CLONE_PATH"; then
printf '❌ Failed\n' >&2 && exit 1
fi
fi
printf '\n'
if is_true "$DRY_RUN" || ln -s -f "$OH_MY_TMUX_CLONE_PATH/.tmux.conf" "$TMUX_CONF"; then
printf '✅ Symlinked %s → %s\n' "${TMUX_CONF/#"$HOME"/'~'}" "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}/.tmux.conf" >&2
fi
if is_true "$DRY_RUN" || cp "$OH_MY_TMUX_CLONE_PATH/.tmux.conf.local" "$TMUX_CONF_LOCAL"; then
printf '✅ Copied %s → %s\n' "${OH_MY_TMUX_CLONE_PATH/#"$HOME"/'~'}/.tmux.conf.local" "${TMUX_CONF_LOCAL/#"$HOME"/'~'}" >&2
fi
tmux() {
${TMUX_PROGRAM:-tmux} ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@"
}
if ! is_true "$DRY_RUN" && [ -n "$TMUX" ]; then
tmux set-environment -g TMUX_CONF "$TMUX_CONF"
tmux set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF_LOCAL"
tmux source "$TMUX_CONF"
fi
if [ -n "$TMUX" ]; then
printf '\n' >&2
printf '⚠️ Installed Oh my tmux! while tmux was running...\n' >&2
printf '→ Existing sessions have outdated environment variables\n' >&2
printf ' • TMUX_CONF\n' >&2
printf ' • TMUX_CONF_LOCAL\n' >&2
printf ' • TMUX_PROGRAM\n' >&2
printf ' • TMUX_SOCKET\n' >&2
printf '→ Some other things may not work 🤷\n' >&2
fi
printf '\n' >&2
printf '🎉 Oh my tmux! successfully installed 🎉\n' >&2
}
if [ -p /dev/stdin ]; then
printf '✋ STOP\n' >&2
printf ' 🤨 It looks like you are piping commands from the internet to your shell!\n' >&2
printf " 🙏 Please take the time to review what's going to be executed...\n" >&2
(
printf '\n'
self() {
printf '# Oh my tmux!\n'
printf '# 💛🩷💙🖤❤️🤍\n'
printf '# https://github.com/gpakosz/.tmux\n'
printf '\n'
declare -f install
}
while :; do
printf ' Do you want to review the content? [Yes/No/Cancel] > ' >&2
read -r answer >&2
case $(printf '%s\n' "$answer" | tr '[:upper:]' '[:lower:]') in
y|yes)
case "$(command -v bat)${VISUAL:-${EDITOR}}" in
*bat*)
self | LESS='' bat --paging always --file-name install.sh
;;
*vim*) # vim, nvim, neovim ... compatible
self | ${VISUAL:-${EDITOR}} -c ':set syntax=tmux' -R -
;;
*)
tput smcup
clear
self | LESS='-R' ${PAGER:-less}
tput rmcup
;;
esac
break
;;
n|no)
break
;;
c|cancel)
printf '\n'
printf '⛔️ Installation aborted...\n' >&2 && exit 1
;;
esac
done
) < /dev/tty || exit 1
printf '\n'
fi
install
}