Skip to content
A program to sync the working directory of panes in a tmux window
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
tmux_goto_dir.plugin.zsh
tmux_goto_dir.py

README.md

tmux_goto_dir

A zsh plugin to sync dirs in all open panes in a tmux window.

  1. clone it
  2. source it in your zshrc
  3. use c instead of cd
  4. keys 1-9 can be used to access directory stack.
  5. use . to sync cwd in all panes

Set the value of these variables to the key bindings you want to use for splitting tmux panes, new panes will open at the same directory:

export TMUX_SYNC_DIR_SPLIT_VERT="\e;sv" 
export TMUX_SYNC_DIR_SPLIT_HORIZ="\e;sh" 

Will sync working dir in sh, bash, zsh, [n]vim and python panes. Provided you import os module in your python startup files. If you don't, here's the step by step procedure:

  1. goto your computer
  2. take out a shotgun
  3. point it at your computer
  4. pull the trigger
  5. reverse the direction of shotgun and repeat step 4

Just a hack. Use it at your own risk(works fine for me). It just sends a ^C/esc and change dir command to panes in current window whose command name matches the ones it knows.

Tmux can't provide enough info about programs running in panes for it to decide if a change dir command should be sent.(can it?) Tmux just emulates terminals. The real problem is that a terminal is just a grid of boxes which display chars. Terminals don't know anything about the programs running in them. (work on interface)

TODO

  1. Try pymux, configurability isn't the root of all evil.

  2. Do something about the lag, 0.35 sec for tmux_goto_dir and 0.2 sec for tmux_split. These scripts start a python interpreter and import some modules every time they're called. A server might help. Dispatching python scripts to the background works, but cds shouldn't register on the cpu monitor (Try pymux)

  3. Not very elegent too. Split commands are the only ones which do not tmux prefix. (Try pymux)

You can’t perform that action at this time.