LoginSignup
1
1

More than 5 years have passed since last update.

Yank registered

Last updated at Posted at 2013-12-13

:reg " and :reg 0

When you use x, you are cutting to the default register.

# To see what in the default register
:reg "

# To see what in the register 0
:reg 0 # yank register

Using reg 0 to paste

# diw(delete inner word) will register in the default register.
# In order to put the yanked word, use `"0P`.
"0P

True delete in vim

# Just to delete, use "_. 
# e.g. to delete a word
"_diw

Meet the yank register

Replace a word with yanked text

Within a file

# copy to register a
# <C-V> to change to visual mode and select line(s) or word(s) 
"ay # use a-z
# to paste it
"ap
# check it in register
:reg "a:
# Delete it in the register a
qaq
# check it again
:reg "a # should be nothing in register a
# help 
:h quote_alpha
# You can append to a register
"Ayy # to append to a line
# or use
:yank A 
# or append all lines which has def
:global/def/yank A

Using Vim's named registers

To copy from one file to another

# <C-v> to change to visual mode and select lines
# to copy
"+y
# to paste
"+p
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1