- 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.
推薦閱讀
- Docker and Kubernetes for Java Developers
- Learning Real-time Processing with Spark Streaming
- 華為HMS生態(tài)與應(yīng)用開發(fā)實戰(zhàn)
- 程序員面試算法寶典
- Java 9 Programming Blueprints
- Android Application Development Cookbook(Second Edition)
- Learning Hunk
- 零基礎(chǔ)學(xué)Scratch 3.0編程
- C++ System Programming Cookbook
- Python Web自動化測試設(shè)計與實現(xiàn)
- 大數(shù)據(jù)時代的企業(yè)升級之道(全3冊)
- Microsoft HoloLens By Example
- Android高級開發(fā)實戰(zhàn):UI、NDK與安全
- Drupal Search Engine Optimization
- 和孩子一起學(xué)編程:用Scratch玩Minecraft我的世界