From 1195c3a15e2957fba882a4bce018a6a2c4d7d8a1 Mon Sep 17 00:00:00 2001 From: Runrioter Wung Date: Wed, 25 Nov 2026 03:39:45 +0800 Subject: [PATCH] fix(tmux): handle `$EDITOR` with options in `tmuxconf` alias (#14159) * fix(tmux): handle `$EDITOR` with options in `tmuxconf` alias * docs(tmux): update docs for `tmuxconf` --- plugins/tmux/README.md | 24 ++++++++++++------------ plugins/tmux/tmux.plugin.zsh | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index aaa81aa17..a60de2b7b 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -15,18 +15,18 @@ The plugin also supports the following: ## Aliases -| Alias | Command | Description | -| ---------- | -------------------------- | -------------------------------------------------------- | -| `ta` | tmux attach -t | Attach new tmux session to already running named session | -| `tad` | tmux attach -d -t | Detach named tmux session | -| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path | -| `tkss` | tmux kill-session -t | Terminate named running tmux session | -| `tksv` | tmux kill-server | Terminate all running tmux sessions | -| `tl` | tmux list-sessions | Displays a list of running tmux sessions | -| `to` | tmux new-session -A -s | Create or attach to a named tmux session | -| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session | -| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor | -| `ts` | tmux new-session -s | Create a new named tmux session | +| Alias | Command | Description | +| ---------- | -------------------------------------- | -------------------------------------------------------- | +| `ta` | tmux attach -t | Attach new tmux session to already running named session | +| `tad` | tmux attach -d -t | Detach named tmux session | +| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path | +| `tkss` | tmux kill-session -t | Terminate named running tmux session | +| `tksv` | tmux kill-server | Terminate all running tmux sessions | +| `tl` | tmux list-sessions | Displays a list of running tmux sessions | +| `to` | tmux new-session -A -s | Create or attach to a named tmux session | +| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session | +| `tmuxconf` | `${(z)EDITOR:-vim} "$ZSH_TMUX_CONFIG"` | Open .tmux.conf file with an editor. | +| `ts` | tmux new-session -s | Create a new named tmux session | ## Configuration Variables diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8b2007575..fa0717054 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -77,7 +77,7 @@ function _build_tmux_alias { alias tksv='tmux kill-server' alias tl='tmux list-sessions' -alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG' +alias tmuxconf='${(z)EDITOR:-vim} "$ZSH_TMUX_CONFIG"' _build_tmux_alias "ta" "attach" "-t" _build_tmux_alias "tad" "attach -d" "-t"