官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 广东省| 安龙县| 达尔| 原阳县| 长治县| 和政县| 离岛区| 福清市| 盘锦市| 灌云县| 孝义市| 拜城县| 洛扎县| 喜德县| 郸城县| 扬州市| 蓝田县| 荔浦县| 汉寿县| 河北省| 龙川县| 兴海县| 太仓市| 田林县| 定襄县| 沂南县| 永年县| 荥阳市| 曲周县| 屯门区| 育儿| 张家界市| 临夏县| 清新县| 炉霍县| 和政县| 丰原市| 南宫市| 泰来县| 日照市| 永川市|