Skip to content

Instantly share code, notes, and snippets.

Last active March 19, 2023 21:22
What would you like to do?
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
Copy link

Fucking awesome!

Copy link

zetetic commented Aug 23, 2021

I didn't realize how much I needed this. Thanks.

Copy link

thriveth commented Sep 7, 2021

Great, thanks. This should be the default behavior.

Copy link

No over-exaggeration when I say this.... but this is LIFE CHANGING! ;)

Copy link


Copy link


Copy link

dlvhdr commented Jan 25, 2022

Thank you!

Copy link

Work :)

Copy link

Thank you!

Copy link


Copy link

Thanks !!!

Copy link


Copy link

You are a lifesaver!!! Thank u!

Copy link


Copy link


Copy link

Awesome!! Thx!!

Copy link

abuGit commented Apr 27, 2022

Thanks! Works well !!!

Copy link

jbankes commented May 1, 2022

This is great! Thank you!

Copy link

save lots of time! thx!

Copy link

You are amazing, thank you senpai 🙂

Copy link

SpLauT commented May 21, 2022

Thank you! :)

Copy link

umtdemr commented May 26, 2022

This is really what I need! Thank you so much!

Copy link

shmup commented Aug 8, 2022

Here is all I added to mine, if you wanna see the "bare minimum requirements":

# window splits
bind-key v split-window -h -c "#{pane_current_path}"
bind-key b split-window -c "#{pane_current_path}"

Copy link

naltun commented Aug 11, 2022

Exactly what I was looking for, and easy to grok! Thank you @william8th!

Copy link

Tony-Sol commented Sep 28, 2022

Is there a way to open new pane not only in same directory but alse in same shell?
For example:

  1. i open term, default SHELL is '/bin/zsh'
  2. split pane and run powershell - now i have 2 panes, with zsh and pwsh
  3. being in pwsh pane, split-pane creates another zsh pane, but pwsh needed

i've tried with setting

$env:SHELL = '%full pwsh path%'

in pwsh profile and

set-option -g default-command "${SHELL}"
set-option -g default-shell "${SHELL}"
bind '"' split-window -c "#{pane_current_path}" "${SHELL}"
bind % split-window -h -c "#{pane_current_path}" "${SHELL}"

in tmux.conf but it not works :c

Copy link

Thank you! Saves me so much daily frustration.

Copy link

MrRoiz commented Nov 2, 2022

Awesome, thanks! 🚀

Copy link


Copy link

this did not work in cygwin 3.3.6. hmmm

Copy link

you're a G thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment