C.W.K.
Stream
Lesson 01 of 03 · published

필수 .tmux.conf 설정

~14 min · tmux, config, keybindings

Level 0갇힌 자
0 XP0/35 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Config 가 사는 곳

tmux 가 시작 시 ~/.tmux.conf 읽어. 편집 후 재시작 안 하고 reload 하려면 셸에서 tmux source-file ~/.tmux.conf 또는 키에 바인드 (아래에 박을 거야).

첫 동작: prefix rebind

Ctrl-b 는 홈 row 에서 두 손가락 점프. Ctrl-a 는 왼 새끼손가락 바로 옆. 숙련된 tmux 사용자 대부분이 rebind. 함정: Ctrl-a 가 bash/readline 의 라인 시작 단축이기도 해서 — 라인 시작 진짜 원할 때 Ctrl-a a (또는 매핑한 거) 필요. 트레이드오프 가치 있어.

Escape-time fix — Vim 에 결정적

기본으로 tmux 가 Esc 후 escape 시퀀스 시작인지 보려고 (레거시 터미널의 화살표 키 같은) 약간 기다려. Vim 사용자면 그 지연이 끔찍해 — 매 Esc 가 끈적해. set -sg escape-time 0 이 그걸 제거. Vim 사용자에게 가장 중요한 단일 tmux 설정.

삶의 질 묶음

set -g base-index 1 + setw -g pane-base-index 1 이 window 와 pane 번호를 1 부터 시작 (키보드 row 와 매치). set -g renumber-windows on 이 하나 죽으면 다시 번호 매겨 1, 3, 7 안 끝나게. set -g history-limit 50000 이 스크롤백을 기본 2000 에서 올려. set -g mouse on 으로 클릭-포커스와 휠-스크롤. setw -g mode-keys vi 로 vi 스타일 copy mode. set -g focus-events on 으로 pane 전환 시 Vim 의 autoread 작동.

True-color 와 tmux 3.6 niceties

set -g default-terminal "tmux-256color" + set -ag terminal-overrides ",xterm-256color:RGB" 가 24-bit 컬러 활성화해서 Vim 컬러 스킴이 tmux 안에서 실제 옳게 보임. tmux 3.6 (2026 현재) 가 pane 스크롤바 추가: set -g pane-scrollbars on.

더 나은 split 바인딩 — 그리고 working dir 유지

|- 를 split 명령에 바인드. -c "#{pane_current_path}" 추가해서 새 pane 이 현재 pane 의 working dir 에서 열게 — 즉시 느낄 거대한 삶의 질 승리.

Vim 스타일 pane navigation

prefix + h/j/k/lselect-pane -L/-D/-U/-R 에 바인드해서 Vim split navigate 하는 식으로 pane navigate. 트랙 7 이 prefix + 요구 자체를 제거하는 vim-tmux-navigator 도입.

한 config, 모든 변경 의도적. 트랙 4 와 같은 레슨: 인터넷에서 500 줄 config 잡지 마. 아래 25 줄 블록으로 시작; 매 줄 이해; 통증 포인트 느끼면 추가. tmux 가 작아; config 도 작을 수 있어.

Code

.tmux.conf reload·bash
# 편집 후 셸에서
tmux source-file ~/.tmux.conf

# 또는 tmux 안에서
prefix + :
source-file ~/.tmux.conf
Starter ~/.tmux.conf — 이 블록 통째로 붙여·tmux
# ───────────── Prefix ─────────────
unbind C-b
set -g prefix C-a
bind C-a send-prefix     # Ctrl-a 두 번 = 리터럴 Ctrl-a

# ───────────── Reload 바인딩 ─────────────
bind r source-file ~/.tmux.conf \; display "Config reloaded"

# ───────────── 인덱싱 ─────────────
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on

# ───────────── 동작 ─────────────
set -sg escape-time 0          # Vim 사용자에 결정적
set -g history-limit 50000
set -g mouse on
setw -g mode-keys vi           # copy mode 의 vi 키
set -g focus-events on         # Vim autoread 발동

# ───────────── 컬러 ─────────────
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

# ───────────── Split — | 과 - 가 cwd 유지 ─────────────
unbind '"'
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

# ───────────── Vim 스타일 pane navigation ─────────────
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# 반복 가능 리사이즈
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
Copy-mode 키바인딩 — Vim 같은 시작/끝 선택·tmux
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

External links

Exercise

~/.tmux.conf 생성 또는 열기. 위 starter config 붙여넣기. 셸에서 tmux kill-server 로 모든 돌고 있는 세션 kill, 그 다음 tmux new -s test. 검증: (1) Ctrl-a 가 새 prefix, (2) prefix + | 가 세로 split 하고 새 pane 이 같은 dir 에, (3) prefix + h/j/k/l 가 pane 사이 이동, (4) prefix + r 가 config reload 하고 "Config reloaded" 출력.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.