display-menu
Short form: menu
Display an interactive menu at the given position. Each item has a display name, a shortcut key, and a tmux command to run when chosen.
How display-menu works
display-menu shows a small menu that you can choose from with the keyboard or the mouse. tmux uses it for two default keys: Prefix + < opens a window menu (swap, kill, respawn, rename, new) and Prefix + > opens a pane menu (split, swap, kill, zoom, copy, paste). With the mouse on, right-clicking opens similar menus.
You describe a menu as a list of items, each made of three parts: the name shown, a shortcut key, and the tmux command to run. An empty name adds a separator line, and a name starting with - shows a dimmed item that can't be chosen. Names and commands can use formats, so items can change with the situation.
-T sets a title and -x and -y set the position: a number, or a special value such as C for the center, P for the pane, M for the mouse, or W for the window's place in the status line.
Synopsis
tmux display-menu [-MO] [-b border-lines] [-c target-client] [-C starting-choice] [-H selected-style] [-s style] [-S border-style] [-t target-pane] [-T title] [-x position] [-y position] name [key] [command] ...Options
| Flag | Description |
|---|---|
| -T title | Menu title |
| -x position | Horizontal position (number, or R/P/M) |
| -y position | Vertical position |
| -M | Always enable the mouse while the menu is open |
| -O | Don't close automatically when the mouse is released |
Examples
Show a small window menu at the pane
tmux display-menu -T "Window" -x P -y P "New" c new-window "Kill" x kill-windowBind a quick split menu
bind m display-menu "Split -h" h "split-window -h" "Split -v" v "split-window -v"In .tmux.conf: Prefix + y opens a centered menu for choosing a pane layout.
bind y display-menu -T 'Layouts' -x C -y C \
'Tiled' t 'select-layout tiled' \
'Side by side' h 'select-layout even-horizontal' \
'' \
'Main + stack' v 'select-layout main-vertical'Default Keybinding
Prefix + < (window menu), Prefix + > (pane menu)
Default prefix is Ctrl+b
Common Mistakes
- If the menu is too big for the terminal, tmux silently doesn't show it. Keep menus short or make the terminal bigger.
- Every item needs its name, key, and command as separate arguments, so quoting gets tricky. Put menus in .tmux.conf and use one item per line with a trailing backslash.
- Menus opened from a mouse binding close when you release the button. -O keeps them open until you click.
Pro Tips
- •An empty item name inserts a separator line
- •Position with -x/-y using a number or R/P/M (right, pane, mouse)