vim copy to clipboard code example

Example 1: vim copy line

yy - Yank (copy) the current line, including the newline character.
3yy - Yank (copy) three lines, starting from the line where the cursor is positioned.
y$ - Yank (copy) everything from the cursor to the end of the line.
y^ - Yank (copy) everything from the cursor to the start of the line.
yw - Yank (copy) to the start of the next word.
yiw – Yank (copy) the current word.
y% - Yank (copy) to the matching character. By default supported pairs are (), {}, and []. Useful to copy text between matching brackets.

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

Example 3: asciidoc copy to clipboard

= My document
Author
:nocopyblocks: