如何用 yank 缓冲区内容替换 emacs 中的区域? [英] How to replace a region in emacs with yank buffer contents?

查看:19
本文介绍了如何用 yank 缓冲区内容替换 emacs 中的区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 VIM 或大多数无模式编辑器(Eclipse、NetBeans 等)时,我经常执行以下操作.如果我有类似的文本块并且我需要全部更改它们,我将更改一个,复制它(或使用非删除猛拉),选择我需要的下一个块并将更改后的版本粘贴到它上面.如果我在 emacs 中做同样的事情(选择区域并用 C-y 粘贴),它不会替换该区域,它只是粘贴在光标位置.在 emacs 中这样做的方法是什么?

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?

推荐答案

将此添加到您的 .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屋!

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