Learning Vim: Day 5



Copying (Yanking), Pasting, and Searching

Copying (Yanking)

Keys to type What they do
(n)yy (or Y) copies or yanks current line. Here n is an integer. For instance, when n is 1, you type yy (or 1yy), then only the current line will be copied. If you type 4yy, then four lines including the current line will be copied
y$ copies to the end of the current line from cursor
yw copies from cursor to the end of the current word

Pasting

Keys to type What they do
p pastes after the cursor
P pastes before the cursor

Searching

Keys to type What they do
/pattern searches forward for pattern
?pattern searches backward for pattern
* searches for word under the cursor
n searches for the next instance of the pattern. In other words, repeats forward search
N searches for the previous instance of the pattern. In other words, repeats backward search