我可以在Emacs中保留相同的项目吗? [英] Can I keep the same item for yanks in Emacs?

查看:115
本文介绍了我可以在Emacs中保留相同的项目吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在Emacs中做的是剪切一些文本,然后用切割文本替换另一个文本。所以,说我有我想要的文本,作为我的 kill-ring 中的最后一个项目。我把它扔到新的地方,然后杀死已经在那里的文字。但是现在,已杀死的文本是 kill-ring 中的最新项目。所以下一次我想要第一个项目,我必须做 C-y M-y 。然后下一次在 kill-ring 中有两个更新的项目,所以我必须做 Cy My My 等等。 / p>

我猜想有更好的方法来做到这一点。有人可以启发我吗?

解决方案

你应该使用 delete-region 而不是 kill-region



delete-region 删除该地区,而不把它放在杀戒中。它绑定到< menu-bar> <编辑> < clear>



如果您只想使用默认绑定而不使用菜单,则可以使用删除矩形 Cx r d ,但它适用于矩形。在 delete-region 之类的单行上使用它可能会很好。


Something I do often in Emacs is to cut a bit of text, and then replace another bit with the cut text. So, say I've got the text I want to yank as the last item in my kill-ring. I yank it into the new place, then kill the text that was already there. But now the killed text is the latest item in the kill-ring. So next time I want to yank the first item, I have to do C-y M-y. Then the next time there are two more recent items in the kill-ring, so I have to do C-y M-y M-y, and so on.

I'm guessing there's a better way to do this. Can someone enlighten me please?

解决方案

You should use delete-region instead of kill-region.

delete-region deletes the region without putting it in the kill ring. It is bind to <menu-bar> <edit> <clear> by default.

If you only want to use default bindings without using the menu, you could use delete-rectangle with C-x r d but it works on rectangle. It could be fine to use it on a single line like delete-region.

这篇关于我可以在Emacs中保留相同的项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆