diff --git a/README.md b/README.md index 9b3baee..43ddcd6 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,4 @@ make install - `pro [path]` — jump to a project directory under `$PROJECTS_HOME` (`~/Projects` on macOS, `~` on Linux), with tab completion for nested paths - `dfh [topic]` — dotfiles help; run `dfh` for version info and available topics, `dfh tmux` / `dfh fzf` / `dfh vim` for keybinding references extracted from config files +- `tmux-ssh ` — SSH into a machine and attach to (or create) a tmux session named `main` diff --git a/files/help/tmux b/files/help/tmux index 69b4f4d..cb61041 100644 --- a/files/help/tmux +++ b/files/help/tmux @@ -19,9 +19,10 @@ Within the session list (`prefix + s`): `x` to delete, `t` to tag. -Attach to a remote tmux over SSH: +Attach to (or create) a tmux session on a remote machine: ```sh -ssh darth.local -t "/opt/homebrew/bin/tmux attach" +tmux-ssh kylo +tmux-ssh 192.168.86.201 ``` ## Windows @@ -38,7 +39,7 @@ ssh darth.local -t "/opt/homebrew/bin/tmux attach" ## Panes | Key | Action | -|--------------------|-----------------------------------------| +|--------------------|------------------------------------------| | `prefix + \|` | Split horizontally (keeps current path) | | `prefix + -` | Split vertically (keeps current path) | | `prefix + h/j/k/l` | Move between panes (vi-style) | diff --git a/files/shell/functions/tmux-ssh b/files/shell/functions/tmux-ssh new file mode 100644 index 0000000..715949f --- /dev/null +++ b/files/shell/functions/tmux-ssh @@ -0,0 +1,4 @@ +tmux-ssh() { + local host="${1:?Usage: tmux-ssh }" + ssh -t "$host" 'tmux new-session -A -s main' +}