Skip to content

Commit

Permalink
docs: add root connect instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmedeski committed Sep 27, 2024
1 parent aaa6d22 commit dc0a48e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt
set -g detach-on-destroy off # don't exit from tmux when closing a session
```

## Bonus: sesh last
## Bonus

### Last

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.

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

### Connect to root

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.

I recommend adding this to your `tmux.conf`:

```sh
bind -N "switch to root session (via sesh) " 9 run-shell "sesh connect --root \'$(pwd)\'"
```

**Note:** This will only work if you are in a git worktree or git repository. For now, git worktrees expect a `.bare` folder.

## Configuration

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

0 comments on commit dc0a48e

Please sign in to comment.