Files
install-sh/install-rmux.sh
T

139 lines
4.4 KiB
Bash
Raw Normal View History

2026-06-10 10:37:24 +09:00
#!/usr/bin/env bash
# shellcheck disable=SC2086
# tmux의 현대적이고 빠른 Rust 기반 대안인 rmux를 설치합니다.
# rmux: https://rmux.io
#
# 지원 플랫폼:
# macOS & Linux
set -euo pipefail
# ────────────────────────────────────────────
# 유틸리티 함수 (모두 stderr 출력)
# ────────────────────────────────────────────
info() { echo "[INFO] $*" >&2; }
warn() { echo "[WARN] $*" >&2; }
error() { echo "[ERROR] $*" >&2; exit 1; }
success() { echo "[OK] $*" >&2; }
# ────────────────────────────────────────────
# 필수 명령어 확인
# ────────────────────────────────────────────
for cmd in curl sh; do
command -v "$cmd" &>/dev/null || error "'$cmd' 명령어가 필요합니다. 먼저 설치해 주세요."
done
# ────────────────────────────────────────────
# 메인 설치 로직
# ────────────────────────────────────────────
main() {
info "rmux (tmux alternative in Rust) 설치를 시작합니다..."
if command -v rmux &>/dev/null; then
local current_ver
current_ver="$(rmux --version 2>/dev/null || echo 'unknown')"
info "rmux가 이미 설치되어 있습니다 ($current_ver). 설치를 건너뜁니다."
else
info "공식 스크립트를 통해 rmux를 설치하는 중..."
if curl -fsSL https://rmux.io/install.sh | sh; then
success "rmux 설치가 성공적으로 완료되었습니다!"
else
error "rmux 설치 스크립트 실행 중 오류가 발생했습니다."
fi
fi
2026-06-10 10:39:36 +09:00
# 2) Deploy .rmux.conf
local conf_file="${HOME}/.rmux.conf"
if [ -f "$conf_file" ]; then
warn "Existing .rmux.conf found at $conf_file"
local backup="${conf_file}.bak.$(date +%Y%m%d%H%M%S)"
cp "$conf_file" "$backup"
info "Backup saved to $backup"
fi
info "Deploying .rmux.conf..."
cat >"$conf_file" <<'RMUXCONF'
# .rmux.conf 샘플
# Prefix key 변경 (기본은 Ctrl-b)
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Ctrl + k를 누르면 화면을 깨끗이 지우고 tmux 이전 버퍼(히스토리)도 완전히 삭제
bind -n C-k clear-history
2026-06-10 10:39:36 +09:00
# 창 분할 단축키 변경
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 ~/.rmux.conf \; display "Reloaded!"
# 상태 표시줄 설정 (색상 설정 비활성화)
#set -g status-bg colour235
#set -g status-fg colour136
2026-06-10 10:39:36 +09:00
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'
2026-06-10 10:39:36 +09:00
# 상태 표시줄 오른쪽 내용 (색상 설정 비활성화)
#set -g status-right '#[fg=cyan]%Y-%m-%d #[fg=green]%H:%M:%S'
2026-06-10 10:39:36 +09:00
# 패널 테두리 색상 (색상 설정 비활성화)
#set-option -g pane-border-style 'fg=colour244'
#set-option -g pane-active-border-style 'fg=colour77'
2026-06-10 10:39:36 +09:00
# 복사 모드에서 vi 키 바인딩 사용
setw -g mode-keys vi
# 마우스 지원 활성화
set -g mouse on
# 256색 지원 (비활성화)
#set -g default-terminal "screen-256color"
2026-06-10 10:39:36 +09:00
# for pi
set -g extended-keys on
RMUXCONF
success ".rmux.conf deployed successfully."
2026-06-10 10:37:24 +09:00
# 설치 완료 검증
if command -v rmux &>/dev/null; then
success "rmux를 사용할 수 있습니다: $(command -v rmux)"
info "실행 명령어: rmux"
else
warn "rmux가 PATH에서 검색되지 않습니다. 터미널을 다시 열거나 환경 변수를 확인해 주세요."
fi
}
main "$@"