0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

tmuxの環境設定

0
Last updated at Posted at 2026-01-04
~/.tmux.conf
# ==================================
# General settings
# ==================================
# Prefixを変更(Ctrl+b -> Ctrl+s)
unbind-key C-b
set-option -g prefix C-s
bind-key C-s send-prefix

# マウスでウィンドウ・ペインの切り替えやリサイズを可能にする
set-option -g mouse on

# コピーモードの操作をvi風にする
set-window-option -g mode-keys vi

# 'v' で選択を始める (スペースキーの代わり)
bind-key -T copy-mode-vi v send-keys -X begin-selection

# yでコピーし、copy-modeは終了しない
bind-key -T copy-mode-vi y send-keys -X copy-pipe "clip.exe"

# Ctrl + cでコピー + 終了する
#bind-key -T copy-mode C-c send-keys -X copy-pipe-and-cancel
bind-key -T copy-mode-vi C-c send-keys -X copy-pipe-and-cancel "clip.exe"

# マウスホイールでヒストリではなくスクロールできるようにする
set -g mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# デフォルトのコピー方法を解除
unbind-key -T copy-mode M-w

# 全てのペインへのコマンド送信ON/OFF
bind a setw synchronize-panes

# ヒストリーサイズの調整
set -g history-limit 10000

# ==================================
# Window settings
# ==================================
# ペインの開始番号を 0 から 1 に変更する
set-option -g base-index 1

# ステータスバーの背景色を変更する
#set -g status-bg cyan
#set -g status-bg silver
set -g status-bg aquamarine

# 非アクティブなウィンドウの色を変更する
set -g window-status-style bg=aquamarine

# アクティブなウィンドウの色を変更する
set -g window-status-current-style bg=lime,fg=black
#set -g window-status-current-style bg=blue,fg=white

# 右側の表示フォーマットを変更する
# tun0があれば表示、なければ非表示。その後に日時を表示
#set-option -g status-right "%H:%M:%S %Y/%m/%d"
#set-option -g status-right "#(ip addr show tun0 2>/dev/null | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) %H:%M:%S %Y/%m/%d"
#set-option -g status-right "%H:%M:%S %Y/%m/%d VPN:#(ip addr show tun0 2>/dev/null | grep -q 'inet ' && ip addr show tun0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 || echo '-') "
set-option -g status-right "%H:%M:%S %Y/%m/%d tun0:#(ip addr show tun0 2>/dev/null | grep -q 'inet ' && ip addr show tun0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 || echo '-') "

# ステータスバーの更新間隔を1秒に設定 (デフォルトは15秒)
set-option -g status-interval 1

# ==================================
# Shortcut settings
# ==================================
# pane killキーの変更(x -> k)
unbind-key x
bind-key k confirm-before -p "kill-pane #P? (y/n)" kill-pane

# ウィンドウ分割のキーを変更する
bind | split-window -h
bind - split-window -v

# Prefix + r で設定ファイルをリロードする
bind r source-file ~/.tmux.conf \; display "Config Reloaded!"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?