- 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.
推薦閱讀
- Java語言程序設計
- Learning Cython Programming(Second Edition)
- Objective-C Memory Management Essentials
- HTML5 移動Web開發(fā)從入門到精通(微課精編版)
- VSTO開發(fā)入門教程
- Web全棧工程師的自我修養(yǎng)
- WordPress Plugin Development Cookbook(Second Edition)
- Julia Cookbook
- 你不知道的JavaScript(中卷)
- Rust游戲開發(fā)實戰(zhàn)
- Flask Web開發(fā):基于Python的Web應用開發(fā)實戰(zhàn)(第2版)
- HTML5游戲開發(fā)實戰(zhàn)
- Responsive Web Design with jQuery
- 從零開始學算法:基于Python
- 軟技能2:軟件開發(fā)者職業(yè)生涯指南