- 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.
推薦閱讀
- 精通Nginx(第2版)
- C++案例趣學
- 零基礎搭建量化投資系統(tǒng):以Python為工具
- Learning Spring 5.0
- Learning RabbitMQ
- Object-Oriented JavaScript(Second Edition)
- Python 3破冰人工智能:從入門到實戰(zhàn)
- PhpStorm Cookbook
- Asynchronous Android Programming(Second Edition)
- 單片機C語言程序設計實訓100例
- 西門子S7-200 SMART PLC編程從入門到實踐
- Mobile Device Exploitation Cookbook
- Mastering Git
- Instant Zurb Foundation 4
- IBM RUP參考與認證指南