2 minutes
The Kill Ring
It may sound intimidating, but don’t worry - it’s not about killing this time. The term “kill ring” in Emacs refers to a list of text blocks that have been cut (or “killed”). That’s right! It involves multiple blocks of text that you can cut and paste. Emacs, as an exceptional text editor, allows you to maintain a history of what you have killed. Just be sure to close it before you start doing nasty things :)
Now, how do you use handy kill ring? It’s quite simple; just imagine transforming into an octopus and placing your eight hands on the keyboard:
- Use
C-y
(yank) to reinsert the text from your most recent cut or copy action. - Press
M-y
to cycle through your cut and copy history.
For example, if you want to copy two blocks of text and paste them somewhere in your buffer, first select the initial block and copy it using M-w
. Repeat this for the second block. Then, navigate to where you’d like to paste the text, and press C-y
to paste the most recent block, or use C-y M-y
to access previously copied blocks.
Sometimes, navigating through your history can become tedious, especially when it grows rapidly. In those cases, you’d prefer to see the contents of the kill ring and make a more informed decision about what to paste.
This is where browse-kill-ring.el comes to the rescue. Include it in your load path and require it like this:
(require 'browse-kill-ring)
You can then use it anytime by invoking M-x browse-kill-ring
.
To quickly move between items in your history, utilize the keyboard shortcuts ’n’ for next and ‘p’ for previous.
But the true excitement begins when you discover Anything. Install it alongside anything-config and enjoy the fantastic anything-show-kill-ring
.