LoginSignup
28
22

More than 5 years have passed since last update.

.tmux.confでifを使う

Posted at

tmux-powerlineを使い始めたのですが、設定ファイルを複数端末で共有している関係で、tmux-powerlineがインストールされていない場合は読み込まないようにしたいと思いました。
.tmux.confはシェルスクリプトではないので、あまり自由度は高くないのですが、ifは使うことができます。
syntaxはif shell-command command [command] となっていて、shell-commandのexit codeが0の時のみcommandが実行されます。

今回はこんな感じで~/work/tmux-powerlineが存在するときのみ設定をロードするようにしてみました。

tmux.conf
if "test -d ~/work/tmux-powerline" "set-option -g status-left '#(~/work/tmux-powerline/status-left.sh)'"
28
22
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
28
22