LoginSignup
17
19

More than 5 years have passed since last update.

tmuxのステータスラインとかのカスタマイズ

Last updated at Posted at 2014-07-27

はじめに

今回はずっとやりたかったtmuxのステータスラインを改造したのでそれについてのメモ.

手順

  1. tmuxをインストールする(とかはいりませんよね)
    • mac -> brew install tmux
    • ubuntu -> apt-get install tmux
    • etc...
  2. tmuxの設定ファイルといえば,~/.tmux.conf
  3. これに以下のように記述します.
~/.tmux.conf
set-option -g status on
set-option -g status-interval 1
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left "[S->#S] #H"
set-option -g status-left-length 50
set-option -g status-right "%y/%m/%d(%a) %T"
set-option -g status-right-length 50

set-window-option -g window-status-format "[#I:#{pane_current_path}]"
set-window-option -g window-status-current-format "[#I:#{pane_current_path}]"

set-option -g status-bg colour166
setw -g window-status-current-fg black
setw -g window-status-current-bg white

解説

何をどう設定しているのかを解説します.

ここではステータスラインの更新間隔時間を設定しています.status-intervalってそのままですね.今回私は1秒間隔で更新するようにしました.後述しますが,ステータスラインに時間(秒も)を表示したかったからです.

set-option -g status-interval 1

これは初期状態からあるステータスラインに表示されているもの(1:zsh 2:vim)とかのやつを中央に寄せちゃう設定です.

set-option -g status-justify "centre"

これは右と左のステータスラインに表示する項目とステータスラインの限界値(幅)です.tmuxにはzshのプロンプトのように右と左にわけて情報を表示させられるんですね.

set-option -g status-left "[S->#S] #H"
set-option -g status-left-length 50
set-option -g status-right "%y/%m/%d(%a) %T"
set-option -g status-right-length 50

これは選択中のウィンドウと選択中以外のウィンドウをステータスラインにどのように表示するかというものです.

set-window-option -g window-status-format "[#I:#{pane_current_path}]"
set-window-option -g window-status-current-format "[#I:#{pane_current_path}]"

この#{pane_current_path}というものがカレントディレクトリのパスをもっているみたいです.
あとたびたび登場していた#Iとか#Wとかステータスラインの色とかが意味するものは以下のサイトで詳しく紹介されていました.
tmuxのすすめ
tmuxチュートリアル

感想

 やってみて分かったのですが,フルパスだとウィンドウ2個くらい作ると長くて切れてしまうので,どうにか出来かな〜と思った.あと,パス表示されていると結講邪魔!だから結局ウィンドウタイトルを表示することにした(笑)
 prefix + w(デフォルトだと)でウィンドウリストを表示出来ると思うが,そこではフル画面でリストが出るので,パスを表示出来るようにしたいなと思った.設定方法分かる方教えて下さい.

ではまた:)

追記

list-windowの設定が出来た!

bind-key w list-window -F "表示項目の設定"

このように記述すれば出来た!どうやら,-Fオプションはそのキーバインドの機能のフォーマットを指定することが出来るものらしい!

なるほど ʅ(´◔౪◔)ʃ

17
19
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
17
19