Skip to content

Commit dc0a48e

Browse files
committed
docs: add root connect instructions
1 parent aaa6d22 commit dc0a48e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt
161161
set -g detach-on-destroy off # don't exit from tmux when closing a session
162162
```
163163

164-
## Bonus: sesh last
164+
## Bonus
165+
166+
### Last
165167

166168
The default `<prefix>+L` command will "Switch the attached client back to the last session." However, if you close a session while `detach-on-destroy off` is set, the last session will not be found. To fix this, I have a `sesh last` command that will always switch the client to the second to last session that has been attached.
167169

@@ -171,6 +173,18 @@ Add the following to your `tmux.conf` to overwrite the default `last-session` co
171173
bind -N "last-session (via sesh) " L run-shell "sesh last"
172174
```
173175

176+
### Connect to root
177+
178+
While working in a nested session, you may way to connect to the root session of a git worktree or git repository. To do this, you can use the `--root` flag with the `sesh connect` command.
179+
180+
I recommend adding this to your `tmux.conf`:
181+
182+
```sh
183+
bind -N "switch to root session (via sesh) " 9 run-shell "sesh connect --root \'$(pwd)\'"
184+
```
185+
186+
**Note:** This will only work if you are in a git worktree or git repository. For now, git worktrees expect a `.bare` folder.
187+
174188
## Configuration
175189

176190
You can configure sesh by creating a `sesh.toml` file in your `$XDG_CONFIG_HOME/sesh` or `$HOME/.config/sesh` directory.

0 commit comments

Comments
 (0)