tmuxtmuxCLI manual

Choose documentation 1

3.2a

tmux manual version

Latest (3.7c) 3.7c 3.2a
English

tmux commands

tmux command-prompt

command tmux 3.2a

Open the command prompt in a client.

Syntax

tmux command-prompt [-1kiNTW] [-I inputs] [-p prompts] [-t target-client] [template]

Behavior

Open the command prompt in a client. This may be used from inside tmux to execute commands interactively.

If template is specified, it is used as the command. If present, -I is a comma-separated list of the initial text for each prompt. If -p is given, prompts is a comma-separated list of prompts which are displayed in order; otherwise a single prompt is displayed, constructed from template if it is present, or ‘:’ if not.

Before the command is executed, the first occurrence of the string ‘%%’ and all occurrences of ‘%1’ are replaced by the response to the first prompt, all ‘%2’ are replaced with the response to the second prompt, and so on for further prompts. Up to nine prompt responses may be replaced (‘%1’ to ‘%9’). ‘%%%’ is like ‘%%’ but any quotation marks are escaped.

-1 makes the prompt only accept one key press, in this case the resulting input is a single character. -k is like -1 but the key press is translated to a key name. -N makes the prompt only accept numeric key presses. -i executes the command every time the prompt input changes instead of when the user exits the command prompt. -T tells tmux that the prompt is for a target which affects what completions are offered when Tab is pressed; -W is similar but indicates the prompt is for a window.

The following keys have a special meaning in the command prompt, depending on the value of the status-keys option:

q Escape
C-w
d C-u
D C-k
Enter Enter
Down
Up
p C-y
Tab Tab
h Left
l Right
$ C-e
w M-f
b M-b
0 C-a
C-t

C implementation

Internal declarations in tmux 3.2a:

Use from a library

These methods send command-prompt. Each describes its own defaults, errors and execution model.

Library methods that send tmux command-prompt, by scope
Language Methods
Python Server.command_prompt
Rust Server.command_prompt
Go Server.CommandPrompt
C# Server.ShowCommandPromptAsync
Raku ClientRef.prompt-async ClientTarget.prompt-async

No method in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Haskell, Common Lisp, TypeScript, Java, Clojure, Kotlin, Scala, F#, C++, Swift, OCaml, or Perl sends this command itself.

tmux sources and license

Syntax comes from tmux 3.2a list-commands. See the global options for sockets and configuration, and command syntax and targets.

Behavior is taken from the tmux 3.2a manual.

Command declaration

Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Esc

Type to search.

Reference previewOpen reference