DECSET ?2004 — Bracketed paste mode
Wrap pasted text in distinct escape markers so apps can tell paste from typing.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[?2004h (enable) \x1b[?2004l (disable)\\033[
\033[?2004h / \033[?2004l\\e[
\e[?2004h / \e[?2004lESC [
ESC [ ? 2 0 0 4 h / lhex
1b 5b 3f 32 30 30 34 68 / 6cDescription
When enabled, every paste from the system clipboard is delivered to the application surrounded by `\x1b[200~` (paste start) and `\x1b[201~` (paste end). This lets shells / editors / TUIs disable autoindent, syntax-completion, and shortcut bindings while consuming pasted bytes. Modern bash (5.1+), zsh, fish, vim, neovim, emacs, and ipython all consume bracketed paste. Always disable (`?2004l`) on exit; pasted content showing literal `^[[200~` markers means a TUI crashed without restoring.
Spec citation: xterm-ctlseqs (Private mode 2004)
Examples
printf '\033[?2004h' # enable\nprintf '\033[?2004l' # disableimport sys; sys.stdout.write('\x1b[?2004h')fmt.Print("\x1b[?2004h")process.stdout.write('\x1b[?2004h')printf("\x1b[?2004h");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- yes
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | no | no |