Skip to main content
Reformatting, adding a little explanation about why the command works.
Source Link
SnoringFrog
  • 967
  • 6
  • 13

YouSince vim uses the percent sign to reference the current buffer, you can use it to get everything quickly.

:%y towill yank the entire buffer without moving the cursor and   :%y+ will putyank it into the + register (and presumably the clipboard, provided vim was compiled with the proper options).

Similarly, :%d and :%d+ will deletedo the entire buffersame for deletion.

In each of these cases, the cursor remains in place.

You can use :%y to yank the entire buffer without moving the cursor and :%y+ will put it in the + register (and presumably the clipboard, provided vim was compiled with the proper options).

Similarly, :%d will delete the entire buffer.

Since vim uses the percent sign to reference the current buffer, you can use it to get everything quickly.

:%y will yank the entire buffer  :%y+ will yank it to the + register (and presumably the clipboard, provided vim was compiled with the proper options).

:%d and :%d+ will do the same for deletion.

In each of these cases, the cursor remains in place.

added 125 characters in body
Source Link
SnoringFrog
  • 967
  • 6
  • 13

You can use :%y to yank the entire buffer without moving the cursor and :%y+ will put it in the + register (and presumably the clipboard, provided vim was compiled with the proper options).

Similarly, :%d will delete the entire buffer.

You can use :%y to yank the entire buffer without moving the cursor.

Similarly, :%d will delete the entire buffer.

You can use :%y to yank the entire buffer without moving the cursor and :%y+ will put it in the + register (and presumably the clipboard, provided vim was compiled with the proper options).

Similarly, :%d will delete the entire buffer.

Source Link
SnoringFrog
  • 967
  • 6
  • 13

You can use :%y to yank the entire buffer without moving the cursor.

Similarly, :%d will delete the entire buffer.