- 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.
推薦閱讀
- JavaScript 從入門到項目實踐(超值版)
- 深入淺出PostgreSQL
- Mastering JavaScript High Performance
- 大數據分析與應用實戰:統計機器學習之數據導向編程
- ASP.NET程序開發范例寶典
- Android驅動開發權威指南
- Scratch3.0趣味編程動手玩:比賽訓練營
- SQL Server 2008 R2數據庫技術及應用(第3版)
- 平面設計經典案例教程:CorelDRAW X6
- Java Web應用開發項目教程
- STM8實戰
- PhoneGap 4 Mobile Application Development Cookbook
- 黑莓(BlackBerry)開發從入門到精通
- Python人工智能項目實戰
- Eclipse開發(學習筆記)