LoginSignup
0
0

More than 5 years have passed since last update.

tmux1.9以上でsplit-window, new-windowをカレントディレクトリで開く設定

Posted at

tmuxでウインドウを新しく作ったり分割したりするときにカレントディレクトリにいる状態で開く設定です。
バージョンが1.8以下だとデフォルトでカレントディレクトリで開いてくれますが、1.9以上だとpane_current_pathを使う必要があります。

bind-key S split-window -c "#{pane_current_path}"\
bind-key | split-window -h -c "#{pane_current_path}"\
bind-key C-c new-window -c "#{pane_current_path}"\

参考ページ

pane_current_pathについて
https://qiita.com/bomcat/items/73de1105f7ffa0f93863

蛇足

if-shellを使ってバージョン1.9以上のときだけ上記の設定を反映するのを試してみましたがうまく動きませんでした。

bind-key S split-window
bind-key | split-window -h
bind-key C-c new-window

if-shell "[[ `tmux -V | cut -d' ' -f2` -ge 1.9 ]]" '\
    bind-key S split-window -c "#{pane_current_path}"\
    bind-key | split-window -h -c "#{pane_current_path}"\
    bind-key C-c new-window -c "#{pane_current_path}"\
'

man-page
http://man.openbsd.org/OpenBSD-current/man1/tmux.1#if-shell

0
0
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
0
0