LoginSignup
6
5

More than 5 years have passed since last update.

tmuxのwindow名をカレントディレクトリにする

Last updated at Posted at 2014-11-20

zsh限定.

add-zsh-hookを使って tmux rename-window する.

.zshrc
autoload -Uz add-zsh-hook

function rename_tmux_window() {
   if [ $TERM = "screen" ]; then
       local current_path=`pwd | sed -e s/\ /_/g`
       local current_dir=`basename $current_path`
       tmux rename-window $current_dir
   fi
}

add-zsh-hook precmd rename_tmux_window
6
5
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
6
5