我如何更容易地在Emacs的缓冲区之间切换? [英] How can I more easily switch between buffers in Emacs?

查看:125
本文介绍了我如何更容易地在Emacs的缓冲区之间切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用emacs,我很喜欢在大部分时间使用它。我唯一不喜欢的是在缓冲区之间切换。我经常有几个缓冲区打开,我厌倦了使用 Cx b Cx Cb ,有没有使缓冲区之间切换的包更容易?我已经调查了切换缓冲区中的emacs wiki ,我很感激您的见解/反馈什么是使用/享受。谢谢。

I've recently started using emacs and I'm enjoying using it for the most part. The only thing I'm not enjoying, is switching between buffers. I often have a few buffers open and I've grown tired of using C-x b and C-x C-b, are there any packages that make switching between buffers easier? I've looked into emacs wiki on switching buffers and I'd appreciate insight/feedback on what are are using/enjoying. Thanks.

推荐答案

更新: iswitchb-mode 在Emacs = 24.4 ,替换为 ido



的所有功能iswitchdb 现在由 ido 提供。罗斯在答案中提供了文档的链接。您可以在 .emacs 中激活以下内容(或使用Ross建议的自定义界面):

UPDATE: iswitchb-mode is obsolete in Emacs >= 24.4, replaced by ido.

All of the features of iswitchdb are now provided by ido. Ross provided a link to the documentation in his answer. You can activate with the following in your .emacs (or use the customization interface as Ross suggests):

(require 'ido)
(ido-mode 'buffers) ;; only use this line to turn off ido for file names!
(setq ido-ignore-buffers '("^ " "*Completions*" "*Shell Command Output*"
               "*Messages*" "Async Shell Command"))

默认情况下, ido 为缓冲区名称和文件名提供完成。如果您只想替换 iswitchb 的功能,则第二行会关闭此功能的文件名。 ido 将忽略与 ido-ignore-buffers 中列出的正则表达式匹配的任何缓冲区。

By default, ido provides completions for buffer names and file names. If you only want to replace the features of iswitchb, the second line turns off this feature for file names. ido will ignore any buffers that match the regexps listed in ido-ignore-buffers.

下面针对 iswitchb-mode 描述的行为适用于切换缓冲区的 ido

The behaviour described below for iswitchb-mode applies equally to ido for switching buffers.

iswitchb-mode 用非常直观的缓冲区切换完成系统替换默认的 Cx b 行为。有更复杂的选择,但我从来没有需要这么多。

iswitchb-mode replaces the default C-x b behaviour with a very intuitive buffer-switching-with-completion system. There are more sophisticated options, but I've never needed more than this.

在您点击 C-x b 后,会显示所有缓冲区的列表。开始输入您想要的缓冲区的名称(或其名称的一部分),列表缩小,直到只有一个缓冲区匹配。您不需要完成名称,但是,一旦您想要的缓冲区突出显示输入将会将您移动到它。您也可以使用 Cs Cr 按顺序移动列表。

After you hit C-x b, you are presented with a list of all buffers. Start typing the name of the buffer you want (or part of its name), and the list is narrowed until only one buffer matches. You don't need to complete the name, though, as soon as the buffer you want is highlighted hitting enter will move you to it. You can also use C-s and C-r to move through the list in order.

您可以在.emacs中将其默认为打开:

You can turn it on by default with this in your .emacs:

(iswitchb-mode 1)

你也可以告诉它忽略你从来没有的某些缓冲区很少)需要切换到:

You can also tell it to ignore certain buffers that you never (or very rarely) need to switch to:

(setq iswitchb-buffer-ignore '("^ " "*Completions*" "*Shell Command Output*"
               "*Messages*" "Async Shell Command"))

这篇关于我如何更容易地在Emacs的缓冲区之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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