|
| 1 | +- Yes — **`setw` is only meaningful inside a tmux context.** |
| 2 | +- But there are *two different ways* it can be valid, depending on how you run it. |
| 3 | +- ## 1. `setw` is a tmux command, not a shell command |
| 4 | + `setw` is short for: |
| 5 | + - ~~~ |
| 6 | + set-window-option |
| 7 | + ~~~ |
| 8 | + It is part of **tmux's command language**, not your shell's. |
| 9 | + So this: |
| 10 | + - ~~~ |
| 11 | + setw -g pane-border-style fg=colour238 |
| 12 | + ~~~ |
| 13 | + is **not valid in `bash`, `zsh`, etc.** |
| 14 | + If you type it in a normal terminal that is *not inside tmux*, you'll get: |
| 15 | + - ~~~ |
| 16 | + command not found |
| 17 | + ~~~ |
| 18 | + because your shell has no idea what `setw` is. |
| 19 | +- ## 2. When it *is* valid |
| 20 | + - ### ✅ Inside a tmux session, in command mode |
| 21 | + If you're inside tmux: |
| 22 | + - Press: |
| 23 | + - ~~~ |
| 24 | + prefix + : |
| 25 | + ~~~ |
| 26 | + - Type: |
| 27 | + - ~~~ |
| 28 | + setw -g pane-border-style fg=colour238 |
| 29 | + ~~~ |
| 30 | + - Hit Enter |
| 31 | + That runs the command in tmux's command interpreter. |
| 32 | + - ### ✅ Outside tmux, if you prefix with `tmux` |
| 33 | + You can also run it from a normal shell like this: |
| 34 | + - ~~~ |
| 35 | + tmux setw -g pane-border-style fg=colour238 |
| 36 | + ~~~ |
| 37 | + In this form: |
| 38 | + - `tmux` = client program |
| 39 | + - `setw` = subcommand passed to the tmux server |
| 40 | + tmux sends it to the running server and executes it. |
| 41 | +- ## 3. Where it is *not* valid |
| 42 | + - ### ❌ Plain shell (unqualified) |
| 43 | + This will never work: |
| 44 | + - ~~~ |
| 45 | + setw -g pane-border-style ... |
| 46 | + ~~~ |
| 47 | + unless: |
| 48 | + - you're inside `prefix + :` command mode in tmux. |
| 49 | +- ## 4. Rule of thumb |
| 50 | + - Inside tmux command mode: ✅ `setw ...` |
| 51 | + - Normal shell: ✅ `tmux setw ...` |
| 52 | + - Normal shell without `tmux`: ❌ `setw ...` |
| 53 | + - Inside tmux pane as shell command: ❌ unless prefixed |
| 54 | +- ## 5. Mental model |
| 55 | + Think of tmux like `git`: |
| 56 | + - ~~~ |
| 57 | + git commit # works |
| 58 | + commit # doesn't |
| 59 | + ~~~ |
| 60 | + Same pattern: |
| 61 | + - ~~~ |
| 62 | + tmux setw ... |
| 63 | + setw ... |
| 64 | + ~~~ |
| 65 | +- ## 6. Practical advice |
| 66 | + If you're experimenting: |
| 67 | + - Inside tmux live: → `prefix :` then type `setw ...` |
| 68 | + - Writing config or scripts: → use `tmux setw ...` |
0 commit comments