|
| 1 | +# Mac and TMUX Config |
| 2 | + |
| 3 | +Some configurations I always struggle with when things are misconfigured and suddenly not working as expected (e.g. when installing a new Mac or after a Mac upgrade). |
| 4 | + |
| 5 | +## Mac |
| 6 | + |
| 7 | +### Jump word in iTerm2 with Option + Key |
| 8 | + |
| 9 | +I want to jump words with `Option + ←` and `Option + →`, respectively. Configure iTerm like this: |
| 10 | + |
| 11 | +1. open iTerm2 Settings with `CMD + ,` |
| 12 | +1. navigate to `Profiles -> Keys -> General` |
| 13 | +1. Make sure Left Option key is set to `Esc+` |
| 14 | +1. add the following Keyboard Shortcuts: |
| 15 | + |
| 16 | + | Keyboard Shortcut | Action | Escape Sequence (Esc+) | |
| 17 | + | ----------------------- | -------------------- | ---------------------- | |
| 18 | + | `option + Left` (`⌥←`) | Send Escape Sequence | `b` | |
| 19 | + | `option + Right` (`⌥→`) | Send Escape Sequence | `f` | |
| 20 | + |
| 21 | +## TMUX |
| 22 | + |
| 23 | +### Resize Pane Shortcut |
| 24 | + |
| 25 | +I want to resize tmux panes with the Shortcut `[TMUX Shortcut - Ctrl-b] + Ctrl + ←`, `[TMUX Shortcut - Ctrl-b] + Ctrl + →`, `[TMUX Shortcut - Ctrl-b] + Ctrl + ↑` and `[TMUX Shortcut - Ctrl-b] + Ctrl + ↓`. |
| 26 | + |
| 27 | +By default, this should be configured in the tmux config already. You can verify it with |
| 28 | + |
| 29 | +```sh |
| 30 | +tmux list-keys | grep resize |
| 31 | +``` |
| 32 | + |
| 33 | +Which should give you |
| 34 | + |
| 35 | +```sh |
| 36 | +bind-key -r -T prefix C-Up resize-pane -U |
| 37 | +bind-key -r -T prefix C-Down resize-pane -D |
| 38 | +bind-key -r -T prefix C-Left resize-pane -L |
| 39 | +bind-key -r -T prefix C-Right resize-pane -R |
| 40 | +``` |
| 41 | + |
| 42 | +If they don't exist, add it to your `~/.tmux.conf` and source it with `tmux source-file ~/.tmux.conf`. |
| 43 | + |
| 44 | +To make it work in iTerm2, do the following: |
| 45 | + |
| 46 | +1. open iTerm2 Settings with `CMD + ,` |
| 47 | +1. navigate to `Profiles -> Keys -> General` |
| 48 | +1. Make sure Left Option key is set to `Esc+` |
| 49 | +1. Add the following keyboard shortcuts: |
| 50 | + |
| 51 | + | Keyboard Shortcut | Action | Escape Sequence (Esc+) | |
| 52 | + | ------------------ | -------------------- | ---------------------- | |
| 53 | + | `⌃ + Left` (`^←`) | Send Escape Sequence | `[1;5D` | |
| 54 | + | `⌃ + Right` (`^→`) | Send Escape Sequence | `[1;5C` | |
| 55 | + | `⌃ + Up` (`^↑`) | Send Escape Sequence | `[1;5A` | |
| 56 | + | `⌃ + Down` (`^↓`) | Send Escape Sequence | `[1;5B` | |
0 commit comments