To copy all the content of a file in Vim to the clipboard, you can use the following command:
:%y+
Press ESC
key to quit from insert mode to normal mode, then press :
to type in the command above(%y+
).
Basically, this command yanks (copies) all the lines in the file to the system clipboard. The %
symbol indicates that you want to operate on all lines, and y
letter is the yank command. The +
 sign tells Vim to use the system clipboard.
See also: