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

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

问题描述

我最近开始使用 emacs,并且大部分时间我都很享受使用它.我唯一不喜欢的是在缓冲区之间切换.我经常打开一些缓冲区,而且我已经厌倦了使用 C-x bC-x C-b,是否有任何软件包可以使缓冲区之间的切换更容易?我已经查看了 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.

推荐答案

UPDATE: 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 用非常直观的缓冲区切换完成系统替换了默认的 C-x 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 之后,你会看到一个所有缓冲区的列表.开始键入您想要的缓冲区的名称(或其名称的一部分),然后列表会缩小,直到只有一个缓冲区匹配.但是,您不需要完成名称,只要突出显示您想要的缓冲区,按 Enter 键就会将您移至该缓冲区.您也可以使用 C-sC-r 按顺序在列表中移动.

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天全站免登陆