Skip to content

Instantly share code, notes, and snippets.

@wasabi0522
Last active July 13, 2020 22:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wasabi0522/4577542 to your computer and use it in GitHub Desktop.
Save wasabi0522/4577542 to your computer and use it in GitHub Desktop.
#################################################################################
## .tmux.conf
## reference
## 1. http://d.hatena.ne.jp/mizchi/20100829/1283076112
## 2. http://blog.goo.ne.jp/ebgp/e/4fe5c4ed53b2f7fb41835c4e1bcbb82c
## 3. http://dev.gentoo.org/~wired/conf/tmux.conf
#################################################################################
## status bar theme
## ステータス行の書式
# (コマンド行) コマンド出力の最初の行
# [属性] 色/属性の変更(例:#[fg=cyan,bright])
# H ホスト名
# I ウィンドウ番号
# P ペイン番号
# S セッション名
# T ウィンドウタイトル
# W ウィンドウ名
# # 「#」の文字
# コマンドは繰り返し実行される (更新頻度はstatus-intervalによる・既定値は15秒)
# 指定可能な色は
# black red green yellow blue magenta cyan white
# の他、256色パレット上のcolour0,colour1, ... colour255が利用可能
# 指定可能な属性は
# bright(bold)[明るい(太字)], dim[暗い], underscore[下線], blink[点滅],
# reverse[反転], hidden[非表示], italics[イタリック], default[書式のクリア]
# (端末によっては効果がないものもある)set -g base-index 1
## 既定の属性
# 「xxx-fg」「xxx-bg」は色、「xxx-attr」は属性
# 透明にしたい場合、端末によっては
# status-bgを「default」にすると256色パレット色の表示が部分的におかしくなる?
# 背景色は端末エミュレータの背景色に近いものを設定すると良いかも
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-attr default
## ウィンドウ一覧部における現在非アクティブなウィンドウの項目の表示
set-window-option -g window-status-bg black
set-window-option -g window-status-fg white
set-window-option -g window-status-attr default
#set-window-option -g window-status-alert-fg yellow
#set-window-option -g window-status-alert-attr default
## ウィンドウ一覧部における現在アクティブなウィンドウの項目の表示
## 端末によっては256色の色を用いると正常に表示されない?
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-fg green
set-window-option -g window-status-current-attr bold
## スクロールの右上やコピーモード選択範囲のスタイル
## スクロールの右上やコピーモード選択範囲のスタイル
# 256色パレットの色を付けると表示が変になる?(reverseすると回避可能?)
set-window-option -g mode-fg black
set-window-option -g mode-bg white
set-window-option -g mode-attr bold
## 左ステータス(現在時刻を表示)
## 日付/時刻部分はstrftime()と同様の書式
# rxvt-unicode上のblinkはbgを設定すると利かない?
set-option -g status-left-length 15 # 既定値は10
set-option -g status-left "[#[fg=green]#H#[default]]"
# set-option -g status-left "#[fg=colour211,bold]%m#[default,fg=colour212]/#[fg=colour218,bold]%d #[fg=colour81]%H#[default,blink,fg=colour45]:#[default,fg=colour75,bold]%M#[default]"
## 右ステータス(タイトルを表示)
#set-option -g status-right-length 99 # 右ステータスも長さ制限可
set-option -g status-right "#[fg=colour79,bold,hidden]#T#[default]"
# set-option -g status-right "#T"
set-option -g status-right "[#[fg=black]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default]][#[fg=colour211,bold]%m#[default,fg=colour212]/#[fg=colour218,bold]%d #[fg=colour81]%H#[default,blink,fg=colour45]:#[default,fg=colour75,bold]%M]"
set-option -g status-right-length 99 # 右ステータスも長さ制限可
# basic settings
set -g default-shell "/bin/zsh"
set -g default-terminal "screen-256color"
# title
set-option -g set-titles on # title 表示
set-option -g set-titles-string '#S:#I.#P #W' # title を設定
# set-option -g set-titles-string "[tmux]#T \"#W\"(#I/#P) @ #H"
# status
set-option -g status on # status 表示
set-option -g status-interval 5 # ステータス行更新間隔(1で毎秒更新・既定値15)
set-option -g status-utf8 on # status line 文字コード default utf-8
set-option -g status-attr bold # status 属性
set-option -g status-justify left
## message/prompt
set-option -g message-fg colour12   # message 文字色
set-option -g message-bg colour24 # message 背景色
set-option -g message-attr bright # message 属性
# set-option -g message-fg white
# set-option -g message-bg red
# set-option -g message-attr bold
set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black
# Option
set-window-option -g utf8 on # window 文字コード default utf-8
set-window-option -g mode-keys emacs # emacs keybind
set-window-option -g mode-mouse on #
set-window-option -g automatic-rename on # window title の自動rename
set-option -g mouse-select-pane off # マウスでのパネル選択
set-option -g base-index 1 # window番号の始まり(規定値:0)
set-option -g display-time 2000 # メッセージ表示時間(既定値:1000?)
set-option -g buffer-limit 32 # バッファ上限数(既定値:9/0番-8番)
set-option -g history-limit 2000 # 後方スクロール行数(既定値:2000)
# KeyBindings
## prefix key
unbind-key C-b # unbind default prefix key
set-option -g prefix C-z # prefix key
bind-key C-z send-prefix # prefix key
## show all window
unbind C-b # C-b をunbind
bind C-b choose-window # C-b でウインドウ一覧表示
unbind l
unbind ^C
bind r source-file ~/.tmux.conf
bind p previous-window
bind n next-window
bind c new-window
bind s split-window -v
bind S split-window -h
# bind 1 break-pane
# bind 2 split-window -v # emacs keybind
# bind 3 split-window -h # emacs keybind
## selector/resizer
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
bind -r C-h resize-pane -L 6
bind -r C-l resize-pane -R 6
bind -r C-j resize-pane -D 6
bind -r C-k resize-pane -U 6
bind -r s swap-pane -U
## other bind
#bind k kill-pane
bind K kill-window
bind i display-panes
#bind C-[ copy-mode
#bind C-] paste-buffer
# copy-mode ^[
unbind ^"["
bind -r ^"[" copy-mode
unbind ^]
bind -r ^] paste-buffer
## share clipboard with mac
unbind y
bind y run-shell '~/bin/tmux-pbcopy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment