- Mastering Vim
- Ruslan Osipov
- 148字
- 2021-06-10 18:51:32
Copying and pasting with registers
You can copy text by using the y (yank) command, followed by a movement or a text object. You can also hit y from a visual mode when you have selected some text.
In addition to all of the standard movement, you can use yy to yank the contents of the current line.
Let's yank the following piece of code by typing ye (yank until the end of the word):
This will copy animal_kind into our default register. Now, place the cursor where you want the text to appear (the text is inserted after the cursor):
To paste the code, hit p:
The delete and change operators also yanks content so that you can paste it later. Oh, and you can prefix the paste command with a number, in case you ever want to duplicate something multiple times.
推薦閱讀
- Bootstrap Site Blueprints Volume II
- 程序員面試白皮書
- Apache Oozie Essentials
- Progressive Web Apps with React
- 造個小程序:與微信一起干件正經(jīng)事兒
- SQL for Data Analytics
- Apache Spark 2.x for Java Developers
- C專家編程
- Kotlin開發(fā)教程(全2冊)
- UI設(shè)計全書(全彩)
- 編寫高質(zhì)量代碼:改善Objective-C程序的61個建議
- C語言程序設(shè)計實訓(xùn)教程與水平考試指導(dǎo)
- Mastering OAuth 2.0
- Kotlin語言實例精解
- Android開發(fā)權(quán)威指南(第二版)