Tzu ng
Tzu ng

Reputation: 9234

switch back and forth between two buffers in emacs like b# in vim

I'm new to Emacs and I'm looking for the command that switch between the current and the last switched buffer. The equivalent in vim is b#

Thanks!

Upvotes: 1

Views: 370

Answers (2)

6422languedoc
6422languedoc

Reputation: 21

A very simple command. Does the job perfectly well.

command mode-line-other-buffer (found in global-map), which is an interactive compiled Lisp function in ‘bindings.el’.

Does what b# for vim does, switching back and forth between the last 2 buffers (any kind of buffers)

(global-set-key (kbd "M-o") 'mode-line-other-buffer)

Upvotes: 2

echristopherson
echristopherson

Reputation: 7074

It's C-x b RET. It's possible to type a buffer name before the RET, but if you don't, it will use the previous buffer.

You can learn this and other basic Emacs commands in the built-in tutorial. To run it, hit C-h t.

Upvotes: 3

Related Questions