encyclopegia.org

Bracketed-paste

Bracketed paste (sometimes referred to as paste bracketing ) is a mode of some terminal emulators which allows programs running in the terminal to treat pasted text differently from text typed normally.

Bracketed paste (sometimes referred to as paste bracketing ) is a mode of some terminal emulators which allows programs running in the terminal to treat pasted text differently from text typed normally. Bracketed paste is used to resolve the following issue, commonly encountered when editing code in a terminal text editor (such as Vim or Emacs). These text editors often include autoindent functionality, which causes indentation to be added automatically when the user presses the enter key at the end of a line. For example, suppose we are editing the following code block in a text editor, with the cursor position marked by the | character. def f(): print('foo')| If the user presses enter, text editors will often advance the cursor to the location marked in the next code block. def f(): print('foo') | This can have unintended consequences when pasting code which is already formatted. For example, suppose the user intends to copy the following block of code into a file. def g(): print('hello') print('world') In a typical workflow, the user starts by selecting the block of code and copying it to their system clipboard. Then, they select the target location in their file, and issue a paste command. The terminal emulator then sends the characters from the clipboard to the text editor, and the text editor may not be able to differentiate between, for example, a d character that came from the clipboard and one which came from the user pressing the D key on her keyboard. The newlines in the code block are treated the same way as would be presses of the enter key by the user. So, when the newline at the end of the first line is sent to the text editor, if autoindent is enabled, the text editor will insert an indent (several spaces or a tab character). Next, the terminal emulator will transmit the space characters corresponding to the spaces at the beginning of the second line of the block of code on the clipboard, resulting in double-indentation. Furthermore, in this context, typical autoindent behavior would be to match the indentation level of the second line when starting the third, which would result in the third line being triple-indented. The final result might look something like the following. def g(): print('hello') print('world')

References

No reference rows published for this article.

Cite this article

MLA

"Bracketed-paste." encyclopegia.org, 2026, https://encyclopegia.org/wiki/bracketed-paste. Accessed 24 November 2026.

Chicago

"Bracketed-paste." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/bracketed-paste.

APA

encyclopegia.org. (2026). Bracketed-paste. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/bracketed-paste

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

List of charter schools in Georgia

enwiki · references available

Star Gazers (2022 season)

enwiki · references available

Santa Chiara all'Albergaria

enwiki · references available

Thomas Paul Chipp

enwiki · references available

August Tamm

enwiki · references available

List of charter schools in Idaho

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1331086187 · 0.5 · snapshot enwiki-001331086187

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.