Skip to content

Instantly share code, notes, and snippets.

@songfei1983
Last active February 27, 2017 02:40
Show Gist options
  • Save songfei1983/f1c5d49bc393fee4abb1ee5b82202a67 to your computer and use it in GitHub Desktop.
Save songfei1983/f1c5d49bc393fee4abb1ee5b82202a67 to your computer and use it in GitHub Desktop.
my.tmux.conf
# rで設定読み込み
bind r source-file ~/.tmux.conf \; display "Config reloaded."
set-option -g default-shell /bin/zsh
set-option -g default-command "reattach-to-user-namespace -l zsh"
# ステータスバーをトップに配置する
# set-option -g status-position top
# ウィンドウ履歴の最大行数
set-option -g history-limit 5000
# 左右のステータスバーの長さを決定する
set-option -g status-left-length 90
set-option -g status-right-length 90
# #H => マシン名
# #P => ペイン番号
# 最左に表示
# set-option -g status-left '#H:[#P]'
set-option -g status-right '#H:[#P]'
# Wi-Fi、バッテリー残量、現在時刻
# 最右に表示
# set-option -g status-right '#(get_ssid) #(battery -c tmux) [%Y-%m-%d(%a) %H:%M]'
# ステータスバーを Utf-8 に対応
# set-option -g status-utf8 on
# ステータスバーを1秒毎に描画し直す
# set-option -g status-interval 10
# センタライズ(主にウィンドウ番号など)
# set-option -g status-justify centre
####### status line
# window-status を中央揃えで配置する
set-option -g status-justify "left"
# status line の背景色を指定する。
set-option -g status-bg "colour238"
# status line の文字色を指定する。
set-option -g status-fg "colour255"
# status-left の最大の長さを指定する。
set-option -g status-left-length 20
# status-left のフォーマットを指定する。
set-option -g status-left "#[fg=colour255,bg=colour241]Session: #S #[default]"
# status-right の最大の長さを指定する。
set-option -g status-right-length 60
# status-right のフォーマットを指定する。
set-option -g status-right "#[fg=colour255,bg=colour241] #h : [#P]"
# window-status のフォーマットを指定する。
set-window-option -g window-status-format " #I: #W "
# カレントウィンドウの window-status のフォーマットを指定する
set-window-option -g window-status-current-format "#[fg=colour255,bg=colour27,bold] #I: #W #[default]"
####### status line
# Vi キーバインド
set-window-option -g mode-keys vi
# Prefix+v でコピーモード開始
bind-key v copy-mode \; display "Copy mode!"
#bind-key -t vi-copy v begin-selection
# Prefix+Enter/y でコピー
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Prefix+p でペースト
# クリップボードにも保存されているので Cmd-v でもペースト可能
bind-key p paste-buffer
# ウィンドウとペインの番号を1から開始する(デフォルト0)
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Prefix+- で横に、Prefix+| で縦に分割(ペイン)する
bind-key | split-window -h
bind-key - split-window -v
# Prefix + Ctrl-h/l でウィンドウ切り替え
# Prefix + Ctrl-h,h,h,h,...と連打できる
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Prefix+hjkl でペイン移動
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# ペインサイズを上下左右(Prefix+JKHL)に変更
# Prefix+J,J,J,J,...と連打してリサイズ可能
bind-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5
# Ctrl-o でペインをローテーションしながら移動
# Prefix を用いないのでタイプが楽だが、Ctrl-o を使用してしまう
# 他のソフトウェアの設定に支障をきたさないように注意
#bind-key -n C-o select-pane -t :.+
# new window
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment