Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The copy and paste command of vim and the use of registers to store the contents to be copied

Shulou Source: shulou.com Published: 2022-06-03 03:46:44 10月01日 Update

One, y (yanks) copy, p (paste) paste

Yy copies the current line, 2yy, copies 2 lines

Y copy the whole line; Y=yy

P paste after the cursor

P paste in front of the cursor

Note that vim will know whether you are copying the content in a full line or a rectangular block, and pasting the content will be done accordingly.

Second, copy to register, amurz register

"A3Y copies 3 lines into a register, and the paste command is:" ap

"fyy copies the contents of the current line of the cursor to the f register, and pastes the command:" fp

Third, the contents of * can also be put in the register.

"wdaw copies the current word to register w, and the paste command is:" wp

Fourth, append content to the register

"aY copies the current line to register a

Move the cursor to the second line

"AY uses an uppercase A, which means what is appended to the a register

Tags: Register content cursor command uppercase that is meaning way rectangle or move Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS Redmi NVidia Shulou Technology