tmux 추가
This commit is contained in:
1 parent
a056dc268a
commit
0fe2ad11d5
4 files changed
+464
-2
No files matched your search
@@ -40,3 +40,7 @@ dist/
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
node_modules/
|
node_modules/
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
|
# pi
|
||||||
|
.pi/
|
||||||
|
thought/
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
## 지원 도구
|
## 지원 도구
|
||||||
|
|
||||||
|
- [tmux](https://github.com/tmux/tmux) - 터미널 멀티플렉서
|
||||||
- [bottom](https://github.com/ClementTsang/bottom) - 호스트 모니터링
|
- [bottom](https://github.com/ClementTsang/bottom) - 호스트 모니터링
|
||||||
- [lazygit](https://github.com/jesseduffield/lazygit) - Git 터미널 UI
|
- [lazygit](https://github.com/jesseduffield/lazygit) - Git 터미널 UI
|
||||||
- [ctop](https://github.com/bcicen/ctop) - 컨테이너 모니터링
|
- [ctop](https://github.com/bcicen/ctop) - 컨테이너 모니터링
|
||||||
@@ -14,60 +15,112 @@
|
|||||||
|
|
||||||
### MacOS / Linux
|
### MacOS / Linux
|
||||||
|
|
||||||
|
**tmux:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-tmux.sh?ref_type=heads" | bash
|
||||||
|
```
|
||||||
|
|
||||||
**bottom:**
|
**bottom:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.sh?ref_type=heads" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**lazygit:**
|
**lazygit:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-lazygit.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-lazygit.sh?ref_type=heads" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**ctop:**
|
**ctop:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.sh?ref_type=heads" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**uv:**
|
**uv:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
**pi (Pi Coding Agent + 추천 패키지):**
|
**pi (Pi Coding Agent + 추천 패키지):**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-pi.sh?ref_type=heads" | bash
|
curl -fsSL "https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-pi.sh?ref_type=heads" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows (PowerShell):
|
### Windows (PowerShell):
|
||||||
|
|
||||||
|
**tmux:**
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-tmux.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-tmux.ps1' -OutFile $t; & $t"
|
||||||
|
```
|
||||||
|
|
||||||
**bottom:**
|
**bottom:**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-bottom.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.ps1' -OutFile $t; & $t"
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-bottom.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-bottom.ps1' -OutFile $t; & $t"
|
||||||
```
|
```
|
||||||
|
|
||||||
**lazygit:**
|
**lazygit:**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-lazygit.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-lazygit.ps1' -OutFile $t; & $t"
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-lazygit.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-lazygit.ps1' -OutFile $t; & $t"
|
||||||
```
|
```
|
||||||
|
|
||||||
**ctop:**
|
**ctop:**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-ctop.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.ps1' -OutFile $t; & $t"
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-ctop.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-ctop.ps1' -OutFile $t; & $t"
|
||||||
```
|
```
|
||||||
|
|
||||||
**uv:**
|
**uv:**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
||||||
```
|
```
|
||||||
|
|
||||||
**pi (Pi Coding Agent + 추천 패키지):**
|
**pi (Pi Coding Agent + 추천 패키지):**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-pi.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-pi.ps1' -OutFile $t; & $t"
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-pi.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-pi.ps1' -OutFile $t; & $t"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 도구별 사용법
|
## 도구별 사용법
|
||||||
|
|
||||||
|
### tmux
|
||||||
|
|
||||||
|
터미널 멀티플렉서입니다. 하나의 터미널에서 여러 세션과 창을 관리할 수 있습니다.
|
||||||
|
|
||||||
|
- **세션 관리** — 백그라운드 세션 유지, detach/attach
|
||||||
|
- **창 분할** — 수평/수직 분할로 여러 패널 동시 작업
|
||||||
|
- **vim 스타일 이동** — h/j/k/l로 패널 간 이동
|
||||||
|
- **마우스 지원** — 마우스로 패널 선택 및 스크롤
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tmux # 새 세션 시작
|
||||||
|
tmux new -s <name> # 이름 지정 세션 시작
|
||||||
|
tmux attach -t <name> # 세션 접속
|
||||||
|
tmux ls # 세션 목록
|
||||||
|
```
|
||||||
|
|
||||||
|
| 단축키 | 동작 |
|
||||||
|
| ---------------- | ------------------------ |
|
||||||
|
| `Ctrl-a` | Prefix key (기본 Ctrl-b) |
|
||||||
|
| `Prefix \|` | 수평 분할 |
|
||||||
|
| `Prefix -` | 수직 분할 |
|
||||||
|
| `Prefix h/j/k/l` | 패널 이동 (vim 스타일) |
|
||||||
|
| `Prefix r` | .tmux.conf 다시 로드 |
|
||||||
|
| `Prefix Space` | 레이아웃 전환 |
|
||||||
|
| `Prefix o` | 패널 회전 |
|
||||||
|
| `Prefix ,` | 창 이름 변경 |
|
||||||
|
| `Prefix &` | 창 닫기 |
|
||||||
|
|
||||||
|
> `install-tmux` 스크립트는 `.tmux.conf`를 홈 디렉토리에 자동 배포합니다. 기존 파일이 있으면 백업 후 덮어씁니다.
|
||||||
|
|
||||||
### bottom
|
### bottom
|
||||||
|
|
||||||
호스트 모니터링 터미널 UI 도구입니다.
|
호스트 모니터링 터미널 UI 도구입니다.
|
||||||
@@ -158,10 +211,10 @@ CLI 기반 AI 코딩 어시스턴트입니다. `install-pi` 스크립트는 Pi
|
|||||||
| [pi-docparser](https://pi.dev/packages/pi-docparser) | 문서 파싱 도구 — PDF, 오피스 문서, 스프레드시트, 이미지, OCR |
|
| [pi-docparser](https://pi.dev/packages/pi-docparser) | 문서 파싱 도구 — PDF, 오피스 문서, 스프레드시트, 이미지, OCR |
|
||||||
| [pi-ollama-cloud](https://pi.dev/packages/pi-ollama-cloud?name=ollama) | Ollama Cloud 제공자 플러그인 — 동적 모델 발견, 웹 검색/패치 도구, 로컬 서버 불필요 |
|
| [pi-ollama-cloud](https://pi.dev/packages/pi-ollama-cloud?name=ollama) | Ollama Cloud 제공자 플러그인 — 동적 모델 발견, 웹 검색/패치 도구, 로컬 서버 불필요 |
|
||||||
|
|
||||||
|
|
||||||
> **Ollama Cloud 사용 시**: `~/.pi/agent/auth.json`에 API 키를 설정하세요. 자세한 내용은 [pi-ollama-cloud 문서](https://pi.dev/packages/pi-ollama-cloud?name=ollama)를 참조하세요.
|
> **Ollama Cloud 사용 시**: `~/.pi/agent/auth.json`에 API 키를 설정하세요. 자세한 내용은 [pi-ollama-cloud 문서](https://pi.dev/packages/pi-ollama-cloud?name=ollama)를 참조하세요.
|
||||||
|
|
||||||
> ~/.pi/agent/auth.json에 "api.key" : "YOUR_API_KEY" 형태로 추가한다.
|
> ~/.pi/agent/auth.json에 "api.key" : "YOUR_API_KEY" 형태로 추가한다.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"anthropic": {
|
"anthropic": {
|
||||||
@@ -185,4 +238,4 @@ pi list # 설치된 패키지 목록
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*GitLab: https://gitlab.com/publicproj/install-sh*
|
_GitLab: https://gitlab.com/publicproj/install-sh_
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs tmux (terminal multiplexer) and deploys .tmux.conf.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Installs tmux via winget (arndawg.tmux-windows) and deploys a
|
||||||
|
customized .tmux.conf to the current user's home directory.
|
||||||
|
|
||||||
|
Supported platforms:
|
||||||
|
- Windows x64 (AMD64 / Intel 64bit)
|
||||||
|
- Windows ARM64
|
||||||
|
|
||||||
|
Prerequisites:
|
||||||
|
- winget (Windows Package Manager) — built into Windows 10 1709+
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\install-tmux.ps1
|
||||||
|
|
||||||
|
# One-liner install from remote:
|
||||||
|
powershell -ExecutionPolicy Bypass -c "$t=\"$env:TEMP\install-tmux.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-tmux.ps1' -OutFile $t; & $t"
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
If execution policy error occurs:
|
||||||
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param()
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Utility functions
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
function Info { Write-Host "[INFO] $args" -ForegroundColor Cyan }
|
||||||
|
function Warn { Write-Host "[WARN] $args" -ForegroundColor Yellow }
|
||||||
|
function Success { Write-Host "[OK] $args" -ForegroundColor Green }
|
||||||
|
function ErrExit { Write-Host "[ERROR] $args" -ForegroundColor Red; exit 1 }
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Constants
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
$ConfFile = Join-Path $env:USERPROFILE '.tmux.conf'
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 1: Install tmux
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
Info "Installing tmux..."
|
||||||
|
|
||||||
|
$tmuxCmd = Get-Command tmux -ErrorAction SilentlyContinue
|
||||||
|
if ($tmuxCmd) {
|
||||||
|
$currentVer = & tmux -V 2>$null
|
||||||
|
if ($LASTEXITPR -ne 0) { $currentVer = "unknown" }
|
||||||
|
Info "tmux is already installed ($currentVer). Skipping installation."
|
||||||
|
} else {
|
||||||
|
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
|
||||||
|
ErrExit "winget is required. Install it from the Microsoft Store or https://learn.microsoft.com/en-us/windows/package-manager/winget/"
|
||||||
|
}
|
||||||
|
|
||||||
|
winget install --id arndawg.tmux-windows --accept-package-agreements --accept-source-agreements
|
||||||
|
if ($LASTEXITPR -ne 0) {
|
||||||
|
ErrExit "tmux installation via winget failed."
|
||||||
|
}
|
||||||
|
Success "tmux installed via winget"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify tmux is available (may need PATH refresh)
|
||||||
|
$tmuxCmd = Get-Command tmux -ErrorAction SilentlyContinue
|
||||||
|
if ($tmuxCmd) {
|
||||||
|
Success "tmux is available: $($tmuxCmd.Source)"
|
||||||
|
} else {
|
||||||
|
# Refresh PATH for current session
|
||||||
|
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'User') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
|
||||||
|
$tmuxCmd = Get-Command tmux -ErrorAction SilentlyContinue
|
||||||
|
if ($tmuxCmd) {
|
||||||
|
Success "tmux is available: $($tmuxCmd.Source)"
|
||||||
|
} else {
|
||||||
|
Warn "tmux was not found in PATH after installation. You may need to restart your terminal."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 2: Deploy .tmux.conf
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
if (Test-Path $ConfFile) {
|
||||||
|
$timestamp = Get-Date -Format 'yyyyMMddHHmmss'
|
||||||
|
$backup = "${ConfFile}.bak.${timestamp}"
|
||||||
|
Copy-Item $ConfFile $backup
|
||||||
|
Warn "Existing .tmux.conf found at $ConfFile"
|
||||||
|
Info "Backup saved to $backup"
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmuxConf = @'
|
||||||
|
# .tmux.conf 샘플
|
||||||
|
|
||||||
|
# Prefix key 변경 (기본은 Ctrl-b)
|
||||||
|
set -g prefix C-a
|
||||||
|
unbind C-b
|
||||||
|
bind C-a send-prefix
|
||||||
|
|
||||||
|
# 창 분할 단축키 변경
|
||||||
|
bind | split-window -h -c "#{pane_current_path}"
|
||||||
|
bind - split-window -v -c "#{pane_current_path}"
|
||||||
|
unbind '"'
|
||||||
|
unbind %
|
||||||
|
|
||||||
|
# 창 이동 단축키 (vim 스타일)
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
|
# 창 전환 단축키
|
||||||
|
bind -r C-h previous-window
|
||||||
|
bind -r C-l next-window
|
||||||
|
|
||||||
|
# 창 재정렬
|
||||||
|
bind Space next-layout
|
||||||
|
|
||||||
|
# 창 회전
|
||||||
|
bind o rotate-window
|
||||||
|
|
||||||
|
# 창 이름 변경
|
||||||
|
bind , command-prompt "rename-window %%"
|
||||||
|
|
||||||
|
# 창 닫기
|
||||||
|
bind & kill-window
|
||||||
|
|
||||||
|
# 세션 재시작
|
||||||
|
bind r source-file ~/.tmux.conf \; display "Reloaded!"
|
||||||
|
|
||||||
|
# 상태 표시줄 설정
|
||||||
|
set -g status-bg colour235
|
||||||
|
set -g status-fg colour136
|
||||||
|
set -g status-left-length 40
|
||||||
|
set -g status-right-length 40
|
||||||
|
set -g status-interval 5
|
||||||
|
set -g history-limit 10000
|
||||||
|
|
||||||
|
# 상태 표시줄 왼쪽 내용
|
||||||
|
set -g status-left '#[fg=green]#S #[fg=yellow]#H'
|
||||||
|
|
||||||
|
# 상태 표시줄 오른쪽 내용
|
||||||
|
set -g status-right '#[fg=cyan]%Y-%m-%d #[fg=green]%H:%M:%S'
|
||||||
|
|
||||||
|
# 활성 창 스타일
|
||||||
|
#set -g window-active-style 'fg=colour250,bg=colour232'
|
||||||
|
|
||||||
|
# 비활성 창 스타일
|
||||||
|
#set -g window-style 'fg=colour247,bg=colour236'
|
||||||
|
|
||||||
|
# 패널 테두리 색상
|
||||||
|
#set -g pane-border-fg colour238
|
||||||
|
#set -g pane-active-border-fg colour51
|
||||||
|
set-option -g pane-border-style 'fg=colour244'
|
||||||
|
set-option -g pane-active-border-style 'fg=colour77'
|
||||||
|
|
||||||
|
# 복사 모드에서 vi 키 바인딩 사용
|
||||||
|
setw -g mode-keys vi
|
||||||
|
|
||||||
|
# 마우스 지원 활성화
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
|
# 256색 지원
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
|
||||||
|
# for pi
|
||||||
|
set -g extended-keys on
|
||||||
|
set -g extended-keys-format csi-u
|
||||||
|
'@
|
||||||
|
|
||||||
|
Set-Content -Path $ConfFile -Value $tmuxConf -Encoding UTF8
|
||||||
|
Success ".tmux.conf deployed to $ConfFile"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 3: Post-install notes
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
Info ""
|
||||||
|
Info "=================================================="
|
||||||
|
Success "tmux installation complete!"
|
||||||
|
Info "=================================================="
|
||||||
|
Info ""
|
||||||
|
Info "Getting started:"
|
||||||
|
Info " tmux - Start a new session"
|
||||||
|
Info " tmux new -s <name> - Start a named session"
|
||||||
|
Info " tmux attach -t <name> - Attach to a session"
|
||||||
|
Info " tmux ls - List sessions"
|
||||||
|
Info ""
|
||||||
|
Info "Key bindings (customized via .tmux.conf):"
|
||||||
|
Info " Ctrl-a | - Split horizontally"
|
||||||
|
Info " Ctrl-a - - Split vertically"
|
||||||
|
Info " Ctrl-a h/j/k/l - Navigate panes (vim-style)"
|
||||||
|
Info " Ctrl-a r - Reload .tmux.conf"
|
||||||
|
Info ""
|
||||||
|
Info "Config file: $ConfFile"
|
||||||
Executable
+208
@@ -0,0 +1,208 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
|
||||||
|
# Installs tmux (terminal multiplexer) and deploys .tmux.conf.
|
||||||
|
# tmux: https://github.com/tmux/tmux
|
||||||
|
#
|
||||||
|
# Supported platforms:
|
||||||
|
# macOS : Intel (x86_64), Apple Silicon (arm64) — via Homebrew
|
||||||
|
# Linux : x86_64, aarch64 — via apt, yum, dnf, zypper, or pacman
|
||||||
|
#
|
||||||
|
# Prerequisites:
|
||||||
|
# - macOS: Homebrew (brew)
|
||||||
|
# - Linux: a supported package manager (apt, yum, dnf, zypper, or pacman)
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Constants
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
CONF_FILE="${HOME}/.tmux.conf"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Utility functions (all stderr output)
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
info() { echo "[INFO] $*" >&2; }
|
||||||
|
warn() { echo "[WARN] $*" >&2; }
|
||||||
|
error() {
|
||||||
|
echo "[ERROR] $*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
success() { echo "[OK] $*" >&2; }
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Detect OS
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
OS="$(uname -s)"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
|
||||||
|
case "$OS" in
|
||||||
|
Darwin | Linux) ;;
|
||||||
|
*)
|
||||||
|
error "Unsupported OS: $OS. This script only supports macOS and Linux."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
info "Platform: $OS ($ARCH)"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 1: Install tmux
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
info "Installing tmux..."
|
||||||
|
|
||||||
|
if command -v tmux &>/dev/null; then
|
||||||
|
CURRENT_VER="$(tmux -V 2>/dev/null || echo 'unknown')"
|
||||||
|
info "tmux is already installed ($CURRENT_VER). Skipping installation."
|
||||||
|
else
|
||||||
|
case "$OS" in
|
||||||
|
Darwin)
|
||||||
|
if command -v brew &>/dev/null; then
|
||||||
|
brew install -y tmux
|
||||||
|
success "tmux installed via Homebrew"
|
||||||
|
else
|
||||||
|
error "Homebrew (brew) is required on macOS. Install it from https://brew.sh/"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
if command -v apt-get &>/dev/null; then
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y tmux
|
||||||
|
success "tmux installed via apt-get"
|
||||||
|
elif command -v dnf &>/dev/null; then
|
||||||
|
sudo dnf install -y tmux
|
||||||
|
success "tmux installed via dnf"
|
||||||
|
elif command -v yum &>/dev/null; then
|
||||||
|
sudo yum install -y tmux
|
||||||
|
success "tmux installed via yum"
|
||||||
|
elif command -v zypper &>/dev/null; then
|
||||||
|
sudo zypper -n install tmux
|
||||||
|
success "tmux installed via zypper"
|
||||||
|
elif command -v pacman &>/dev/null; then
|
||||||
|
sudo pacman -S --noconfirm tmux
|
||||||
|
success "tmux installed via pacman"
|
||||||
|
else
|
||||||
|
error "No supported package manager found (apt, dnf, yum, zypper, pacman). Install tmux manually."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify tmux is available
|
||||||
|
if command -v tmux &>/dev/null; then
|
||||||
|
success "tmux is available: $(command -v tmux)"
|
||||||
|
else
|
||||||
|
warn "tmux was not found in PATH after installation. You may need to open a new terminal."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 2: Deploy .tmux.conf
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
if [ -f "$CONF_FILE" ]; then
|
||||||
|
warn "Existing .tmux.conf found at $CONF_FILE"
|
||||||
|
BACKUP="${CONF_FILE}.bak.$(date +%Y%m%d%H%M%S)"
|
||||||
|
cp "$CONF_FILE" "$BACKUP"
|
||||||
|
info "Backup saved to $BACKUP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >"$CONF_FILE" <<'TMUXCONF'
|
||||||
|
# .tmux.conf 샘플
|
||||||
|
|
||||||
|
# Prefix key 변경 (기본은 Ctrl-b)
|
||||||
|
set -g prefix C-a
|
||||||
|
unbind C-b
|
||||||
|
bind C-a send-prefix
|
||||||
|
|
||||||
|
# 창 분할 단축키 변경
|
||||||
|
bind | split-window -h -c "#{pane_current_path}"
|
||||||
|
bind - split-window -v -c "#{pane_current_path}"
|
||||||
|
unbind '"'
|
||||||
|
unbind %
|
||||||
|
|
||||||
|
# 창 이동 단축키 (vim 스타일)
|
||||||
|
bind h select-pane -L
|
||||||
|
bind j select-pane -D
|
||||||
|
bind k select-pane -U
|
||||||
|
bind l select-pane -R
|
||||||
|
|
||||||
|
# 창 전환 단축키
|
||||||
|
bind -r C-h previous-window
|
||||||
|
bind -r C-l next-window
|
||||||
|
|
||||||
|
# 창 재정렬
|
||||||
|
bind Space next-layout
|
||||||
|
|
||||||
|
# 창 회전
|
||||||
|
bind o rotate-window
|
||||||
|
|
||||||
|
# 창 이름 변경
|
||||||
|
bind , command-prompt "rename-window %%"
|
||||||
|
|
||||||
|
# 창 닫기
|
||||||
|
bind & kill-window
|
||||||
|
|
||||||
|
# 세션 재시작
|
||||||
|
bind r source-file ~/.tmux.conf \; display "Reloaded!"
|
||||||
|
|
||||||
|
# 상태 표시줄 설정
|
||||||
|
set -g status-bg colour235
|
||||||
|
set -g status-fg colour136
|
||||||
|
set -g status-left-length 40
|
||||||
|
set -g status-right-length 40
|
||||||
|
set -g status-interval 5
|
||||||
|
set -g history-limit 10000
|
||||||
|
|
||||||
|
# 상태 표시줄 왼쪽 내용
|
||||||
|
set -g status-left '#[fg=green]#S #[fg=yellow]#H'
|
||||||
|
|
||||||
|
# 상태 표시줄 오른쪽 내용
|
||||||
|
set -g status-right '#[fg=cyan]%Y-%m-%d #[fg=green]%H:%M:%S'
|
||||||
|
|
||||||
|
# 활성 창 스타일
|
||||||
|
#set -g window-active-style 'fg=colour250,bg=colour232'
|
||||||
|
|
||||||
|
# 비활성 창 스타일
|
||||||
|
#set -g window-style 'fg=colour247,bg=colour236'
|
||||||
|
|
||||||
|
# 패널 테두리 색상
|
||||||
|
#set -g pane-border-fg colour238
|
||||||
|
#set -g pane-active-border-fg colour51
|
||||||
|
set-option -g pane-border-style 'fg=colour244'
|
||||||
|
set-option -g pane-active-border-style 'fg=colour77'
|
||||||
|
|
||||||
|
# 복사 모드에서 vi 키 바인딩 사용
|
||||||
|
setw -g mode-keys vi
|
||||||
|
|
||||||
|
# 마우스 지원 활성화
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
|
# 256색 지원
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
|
||||||
|
# for pi
|
||||||
|
set -g extended-keys on
|
||||||
|
set -g extended-keys-format csi-u
|
||||||
|
TMUXCONF
|
||||||
|
|
||||||
|
success ".tmux.conf deployed to $CONF_FILE"
|
||||||
|
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
# Step 3: Post-install notes
|
||||||
|
# ────────────────────────────────────────────
|
||||||
|
info ""
|
||||||
|
info "=================================================="
|
||||||
|
success "tmux installation complete!"
|
||||||
|
info "=================================================="
|
||||||
|
info ""
|
||||||
|
info "Getting started:"
|
||||||
|
info " tmux - Start a new session"
|
||||||
|
info " tmux new -s <name> - Start a named session"
|
||||||
|
info " tmux attach -t <name> - Attach to a session"
|
||||||
|
info " tmux ls - List sessions"
|
||||||
|
info ""
|
||||||
|
info "Key bindings (customized via .tmux.conf):"
|
||||||
|
info " Ctrl-a | - Split horizontally"
|
||||||
|
info " Ctrl-a - - Split vertically"
|
||||||
|
info " Ctrl-a h/j/k/l - Navigate panes (vim-style)"
|
||||||
|
info " Ctrl-a r - Reload .tmux.conf"
|
||||||
|
info ""
|
||||||
|
info "Config file: $CONF_FILE"
|
||||||
Reference in new issue
Block a user