如何用yank缓冲区内容替换emacs中的区域? [英] How to replace a region in emacs with yank buffer contents?
问题描述
当我使用VIM或大多数无模式编辑器(Eclipse,NetBeans等)时,我经常执行以下操作。如果我有类似的文本块,我需要更改它们,我将更改一个,复制它(或使用非删除的yank),选择下一个块我需要并粘贴更改的版本。如果我在emacs中做同样的事情(选择区域并用C-y粘贴),它不会替换该区域,它只是粘贴在光标位置。在emacs中做什么?
将此添加到您的 .emacs
(delete-selection-mode 1)
pre>
在该区域处于活动状态时,写入缓冲区的任何东西都将覆盖它,包括粘贴,也可以简单地输入某些内容或者点击退格键
When I use VIM or most modeless editors (Eclipse, NetBeans etc.) I frequently do the following. If I have similar text blocks and I need to change them all, I will change one, copy it (or use non-deleting yank), select next block I need and paste the changed version over it. If I do the same thing in emacs (select region and paste with C-y), it doesn't replace the region, it just pastes at the cursor position. What is the way to do this in emacs?
解决方案Add this to your
.emacs
:(delete-selection-mode 1)
Anything that writes to the buffer while the region is active will overwrite it, including paste, but also simply typing something or hitting backspace
这篇关于如何用yank缓冲区内容替换emacs中的区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!