Skip to content

Instantly share code, notes, and snippets.

@Yasu31
Last active November 21, 2021 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yasu31/1970082305bcca8c11025d328d16553d to your computer and use it in GitHub Desktop.
Save Yasu31/1970082305bcca8c11025d328d16553d to your computer and use it in GitHub Desktop.
tmux configuration
# set shell used by tmux to zsh
set-option -g default-shell /bin/zsh
# tmuxを256色表示できるようにする
set-option -g default-terminal screen-256color
set -g terminal-overrides 'xterm:colors=256'
# set tmux prefix keybind to ctrl-t
set -g prefix C-t
unbind C-b
# ステータスバーをトップに配置する
set-option -g status-position top
# 左右のステータスバーの長さを決定する
set-option -g status-left-length 90
set-option -g status-right-length 90
# #P => ペイン番号
# 最左に表示
set-option -g status-left '#H:[#P]'
# Wi-Fi、バッテリー残量、現在時刻
# 最右に表示
set-option -g status-right '#(wifi) #(battery --tmux) [%Y-%m-%d(%a) %H:%M]'
# ステータスバーを1秒毎に描画し直す
set-option -g status-interval 1
# センタライズ(主にウィンドウ番号など)
set-option -g status-justify centre
# ステータスバーの色を設定する
set-option -g status-bg "colour238"
# status line の文字色を指定する。
set-option -g status-fg "colour255"
# vimのキーバインドでペインを移動する
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# vimのキーバインドでペインをリサイズする
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
# | でペインを縦分割する
bind | split-window -h
# - でペインを縦分割する
bind - split-window -v
# 番号基準値を変更
set-option -g base-index 1
# マウス操作を有効にする
set-option -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# コピーモードを設定する
# コピーモードでvimキーバインドを使う
setw -g mode-keys vi
# 'v' で選択を始める
bind -T copy-mode-vi v send -X begin-selection
# 'V' で行選択
bind -T copy-mode-vi V send -X select-line
# 'C-v' で矩形選択
bind -T copy-mode-vi C-v send -X rectangle-toggle
# 'y' でヤンク
bind -T copy-mode-vi y send -X copy-selection
# 'Y' で行ヤンク
bind -T copy-mode-vi Y send -X copy-line
# 'C-p'でペースト
bind-key C-p paste-buffer
# from https://qiita.com/shin-ch13/items/9d207a70ccc8467f7bab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment