How to invoke the buffer list in Emacs

送分小仙女□ 提交于 2019-12-13 14:34:32

问题


I usually type M-x buffer-menu to switch buffers in Emacs. How can I do this with a shorter command? Its quite a long string to type.

Thanks!


回答1:


  • You can use C-x b to change buffers. You have to enter the first few letters of the buffer name, and of course you can use completion. If you press TAB (the most useful key in Emacs), a list of (matching) buffers appears. You can click in this list to switch to a buffer.

  • You can bind buffer-menu to a key. Pick a key that's not used for another command — let's say f12 — and add the following line to the file ~/.emacs:

    (global-set-key (kbd "<f12>") 'buffer-menu)
    
  • There are many other interfaces to changing buffers in Emacs, and they can be significantly more efficient than C-x b and C-x C-b. Since this tends to be a very personal choice, I recommend you experiment with a few and keep the one(s) you feel most comfortable with.




回答2:


C-x C-b

As stated here




回答3:


I'd highly recommend switching to a mode designed for efficient buffer switching.

If your version of Emacs is recent enough (22+):

M-x ido-mode

and then:

C-x b

to switch buffers, with incremental substring matching, C-s and C-r rotate forward and backwards through the matches.

If you have an older version of Emacs, it should have:

M-x iswitchb-mode

and then, as with ido-mode:

C-x b

opens up the minibuffer to let you choose the buffer to switch to.




回答4:


Bind C-x C-b to buffer-menu. There is no sense leaving it bound to list-buffers. list-buffers is just a eunuch version of buffer-menu. ;-)

And you might want to try this: http://www.emacswiki.org/emacs/BufferMenuPlus




回答5:


Try bs-show (in my opinion a way better than C-x C-b). You can bind it to F9 by adding this to .emacs:

(global-set-key (kbd "<f9>") 'bs-show)


来源:https://stackoverflow.com/questions/3505997/how-to-invoke-the-buffer-list-in-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!