Emacs has this very handy kill-ring that can be cycled through after yanking, by pressing
M-y repeatedly. Is there a way to switch the cycling direction? So I don not need to cycle through all when I actually want to get to the very first one?
This is from 12.2.2 Yanking Earlier Kills:
‘M-y’ can take a numeric argument, which tells it how many entries to advance the “last yank” pointer by. A negative argument moves the pointer toward the front of the ring; from the front of the ring, it moves “around” to the last entry and continues forward from there.
You have a few options for this :-
You can use
counselwhich provides with the command
counsel-yank-popwhich will show the list of all the yanked text and you can select anyone of them using
ivy(this is what I use). In your case, you can press
M->to go the first entry in the
if you use
helm, there is the command
helm-show-kill-ringwhich does the same as mentioned above, except uses
helmnarrowing framework instead of
If you don't want either of the above options, then have a look at the package
Also, a useful variable
kill-do-not-save-duplicates will do as the name suggests :)
It seems you could use -1 as a prefix argument to
M-y as hinted by the manual:
M-y can take a numeric argument, which tells it how many entries to advance the last-yank pointer by. A negative argument moves the pointer toward the front of the ring; from the front of the ring, it moves around to the last entry and continues forward from there.
Check out Emacs Wiki page Browse Kill Ring. The basic feature is to show you a buffer of all kill-ring entries and let you act on them (edit, yank, etc.).
Alternatives to, and enhancements of, the basic feature are also presented on that page, including these:
You can browse (or pop) other rings, in addition to the
kill-ring— in particular, the
You can copy or move selections from one ring to another (using
delete-selection-modereplace the active region whenever you insert a kill.
Icicles lets you clean up the kill ring selectively during completion, deleting entries on the fly. You can sort completions in various ways.
C-- C-yyanks from the kill ring using completion.
M-yat top level (i.e., not after a yank from either the kill ring or the
second-sel.el) yanks from one of those rings using completion. It yanks a kill by default, but a secondary selection if you use a prefix argument.
When you use either of these, you can cycle among completion candidates (the entries in the ring), in various orders, or you can choose any of them directly, without cycling.