Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: How to move forward (after going backwards) in the kill ring?

Tags:

emacs

I understand that after yanking (C-y) I can move backwards through the kill ring (M-y). But sometimes I move past the desired yank - is there a way to move forward in the kill ring? Basically, I want the opposite of M-y.

If this is a duplicate, just let me know. I cannot seem to find my answer on SO or Google.

like image 566
modulitos Avatar asked Mar 12 '14 05:03

modulitos


People also ask

How do you yank in Emacs?

Ctrl-y - This command will yank back the text which was deleted most recently with the above command. The text will be placed at the current emacs cursor location. You can yank back the text as many times as you wish. Meta-y - When you kill or copy a region of text, it doesn't forget about previous kills.

What Emacs kill ring?

The kill ring is a list of blocks of text that were previously killed. There is only one kill ring, shared by all buffers, so you can kill text in one buffer and yank it in another buffer. This is the usual way to move text from one buffer to another.

How do I kill in Emacs?

The default command for killing the rest of the current line is 'kill-line' ( 'C-k' ). The default command for killing the rest of a sentence is 'kill-sentence' ( 'M-k' ).


1 Answers

You can simply `undo' when you move past it. Repeated undos will continually move forward. I agree with @Iqbai though that browse-kill-ring is more appropriate for long chains of yanks.

like image 187
seanmcl Avatar answered Sep 28 '22 20:09

seanmcl