问题
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 bto change buffers. You have to enter the first few letters of the buffer name, and of course you can use completion. If you pressTAB(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-menuto a key. Pick a key that's not used for another command — let's sayf12— 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 bandC-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