Emma Maina
Emma Maina

Reputation: 33

Going back to a previous buffer in emacs

I used C-x u and the screen I was typing on disappeared, so I tried creating again on the second question but it says that file already exists; how do go back to the one I created in the first question?

Upvotes: 2

Views: 2280

Answers (2)

ramsay
ramsay

Reputation: 3845

If you want to go back to the previous buffer, probably you could use Ctrl-X <left> keybinding. If you want to go back to a previous window, you could try Ctrl-C <left> with winner-undo.

Edit: To use Ctrl-C <left>, you should enable winner-mode first:

;;;Winner mode is an Emacs built-in package that lets you undo and redo window
;;;configurations. Incredibly useful since I keep splitting and merging windows
;;;https://www.emacswiki.org/emacs/WinnerMode
(when (fboundp 'winner-mode)
  (winner-mode t))

Upvotes: 2

Matt Kneiser
Matt Kneiser

Reputation: 2146

There's a suite of options based on what you're trying to accomplish:

  1. Ctrl-x <left> jumps to your previous buffer, can be repeated to keep popping stack frames

  2. Ctrl-x b opens a prompt in the minibuffer. The default option is the prior buffer, but you can use <up>/<down> keys to browse the prior stack of buffers

  3. Ctrl-x Ctrl-b opens *Buffer List* where you can see all buffers and select the one you want

Upvotes: 5

Related Questions