vim how to copy and paste code example

Example 1: how to copy in vim

Place the cursor on the line you want to begin cutting.
Press V to select the entire line, or v to select from where your cursor is.
Move the cursor to the end of what you want to cut, using h,j,k, or l
Press y to copy it, or d to cut it.
Place the cursor where you would like to paste your copied stuff.
Press P to paste it before your cursor, or p to paste it after the cursor.
You can copy and paste between buffers.

Example 2: paste vim

p 
(use v to highlight, y to copy, p to paste)

Tags:

Misc Example