Hacker News new | past | comments | ask | show | jobs | submit login

My favourite little tmux trick is in ~/.tmux.conf:

`bind r attach-session -c "#{pane_current_path}"`

All the terminals I open start a new tmux session (left as an exercise to the reader). I change directory to whatever project I'm working on, hit `C-b r` and from then on all panes and and windows in that session will start in the correct directory. Saves me a lot of cd'ing.





Ohhh, thank you! One of my biggest annoyances so far was exactly this - every time I split off a new pane, I'd have to cd back to wherever I was working.


If you want the directory to come from your current pane instead of the current session, it's a little easier:

  bind '"' split-window -v -c "#{pane_current_path}"
  bind % split-window -h -c "#{pane_current_path}"
https://github.com/mfarrugi/.dots/blob/master/tmux/.tmux.con...


This can be done too in MacOS by configuring iTerm2 to open a new pane in the same directory and using tmux integration. Cool part is you don't have to learn the tmux commands, but you can use the iTerm2 commands to split panes, among other things.

Edit: Added MacOs




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: