简体   繁体   中英

How to invoke the buffer list in Emacs

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

Thanks!

Cx Cb

As stated here

  • You can use Cx 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 Cx b and Cx Cb . 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.

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, Cs and Cr 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.

Bind Cx Cb 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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM