Vim Recall繁體中文

Collect text in one register

"ayyj"Ayy

Example

Normal mode on alpha. Next line: beta. Lowercase a replaces; uppercase A appends.

Before
Buffer lines: alpha, beta Register a after "ayy: alpha

  1. "ayy Register a · alpha; previous contents replaced
  2. j"Ayy Move to beta and append · register a holds alpha, beta
  3. "ap Paste both lines below beta · originals remain

After
Register a: alpha followed by beta as two lines. Buffer after "ap: alpha, beta, alpha, beta on four lines.

Details & Vim help

Use an uppercase register name to append to its lowercase register.

Collect nonadjacent lines without editing a temporary file.

Lowercase names replace; uppercase names append to the same register. Linewise and characterwise register types affect how appended text joins.

Lowercase a replaces register a. Uppercase A appends to that same register. "ap later pastes the collected lines.

Try it in Vim

  1. On the first desired line, type "ayy to replace register a.
  2. On another desired line, type "Ayy to append it.
  3. At the destination, use "ap to put the collected lines.