diff --git a/CHANGELOG.md b/CHANGELOG.md index 48e1dcf..bc54e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: se - `tmux.conf`: window tabs centred in the status bar (`absolute-centre`), with index, padding and a blank between tabs; the current tab bold on a light pill. - `bin/tmux-copy-exit-keys` + `tmux.conf`: after a mouse selection any bare key leaves copy-mode and returns to the prompt (key swallowed); ctrl/alt keys, and copy-mode opened from the keyboard or the wheel, keep their vi role. - `tmux.conf`: Alt+Left/Right switch windows without the prefix (macOS: map Cmd+arrow in iTerm2 to the `[1;3D` / `[1;3C` escape sequences). +- `tmux.conf`: Ctrl+Alt+arrow moves between panes without the prefix, in copy-mode too (macOS: map Ctrl+Cmd+arrow in iTerm2 to `[1;7A` `[1;7B` `[1;7D` `[1;7C`). ### Changed - `.githooks/post-commit` and `post-merge` fail closed on `gitflow.autopush`: an unreadable or non-boolean value means no push, with a named warning (was: silently treated as `true`). diff --git a/README.md b/README.md index 92078f0..f1aba57 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,21 @@ The same `./install.sh` detects macOS and replaces `apt-get` with Homebrew. Afte **zsh** chosen: installs oh-my-zsh with its official script (unattended, skipped if `~/.oh-my-zsh` exists), renders `zsh/zshrc-osx` into `~/.zshrc` (same identity as the bashrc) and deploys the `bchanot` theme to `~/.oh-my-zsh/custom/themes/`, then makes `/bin/zsh` the login shell. An existing `~/.zshrc` that differs from the repo's is saved as `~/.zshrc.backup-` (outside `~/Oldconfig`, which every run wipes). Move your machine-specific lines (nvm, bun, tokens) into `~/.zshrc.local`: the deployed zshrc loads it. 8. Ends with the list of what the Linux install has and this one does not: `gcc` (Apple clang answers to `gcc`), `valgrind`, `dkms`, `net-tools`, `openssh-server` and the RDP desktop (both built into macOS, switched on in System Settings > Sharing), `cifs-utils`, `php-imagick`, the NVIDIA driver, the disk-usage warning, `cloudpex`, the security baseline and the two end-of-install offers. +### Terminal key mappings for tmux (by hand) + +`tmux.conf` binds Alt+arrow (switch window) and Ctrl+Alt+arrow (switch pane) without the prefix. Cmd is not a modifier a terminal forwards, so on macOS iTerm2 must send the xterm Alt sequences itself: Settings → Profiles → *Default* → Keys → Key Mappings → `+`, action **Send Escape Sequence** (iTerm2 adds the leading `Esc`). This shadows iTerm2's own Cmd+arrow tab switching in that profile; `⌘⇧[` / `⌘⇧]` and `⌘1`…`⌘9` still switch its tabs. + +| Shortcut | Sequence | tmux key | Action | +|---|---|---|---| +| `⌘←` | `[1;3D` | `M-Left` | previous window | +| `⌘→` | `[1;3C` | `M-Right` | next window | +| `⌃⌘↑` | `[1;7A` | `C-M-Up` | pane above | +| `⌃⌘↓` | `[1;7B` | `C-M-Down` | pane below | +| `⌃⌘←` | `[1;7D` | `C-M-Left` | pane left | +| `⌃⌘→` | `[1;7C` | `C-M-Right` | pane right | + +Linux / PC keyboard: Alt+arrow and Ctrl+Alt+arrow send those sequences natively (GNOME Terminal, xterm, kitty, alacritty), nothing to map. Two things can still swallow them before tmux: the desktop (GNOME binds Ctrl+Alt+arrow to workspace switching: Settings → Keyboard → Shortcuts → Navigation, clear or change *Switch to workspace left/right*), and an SSH session from a Mac, where the keys are whatever the local iTerm2 mapping sends. Not verified on Linux yet. + ### CLI scripts (`bin/`) Deployed to `~/.local/bin` (the deployed bashrc adds this dir to `PATH`): diff --git a/tmux.conf b/tmux.conf index 9470c61..4e64a0a 100644 --- a/tmux.conf +++ b/tmux.conf @@ -151,6 +151,17 @@ bind -T copy-mode-vi C-u select-pane -U bind -T copy-mode-vi C-h select-pane -L bind -T copy-mode-vi C-j select-pane -D bind -T copy-mode-vi C-k select-pane -R +# Ctrl+Alt+arrow too (no prefix), straight to the pane, no vim pass-through. +# Native on Linux/PC; on macOS map Ctrl+Cmd+arrow in iTerm2 to the xterm +# Ctrl+Alt+arrow sequences (Send Escape Sequence `[1;7A` `[1;7B` `[1;7D` `[1;7C`). +bind -n C-M-Up select-pane -U +bind -n C-M-Down select-pane -D +bind -n C-M-Left select-pane -L +bind -n C-M-Right select-pane -R +bind -T copy-mode-vi C-M-Up select-pane -U +bind -T copy-mode-vi C-M-Down select-pane -D +bind -T copy-mode-vi C-M-Left select-pane -L +bind -T copy-mode-vi C-M-Right select-pane -R bind Escape copy-mode # bind vi-like 'normal' mode bind -Tcopy-mode-vi 'v' send -X begin-selection # bind vi-like visual mode