how to copy to clipboard vim 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: copy from vim to clipboard
Use "+ to copy to the system clipboard
i.e. "+y instead of y
Likewise you can paste from "+ to get text from the system clipboard
i.e. "+p instead of p