Bruce
Bruce

Reputation: 35223

How to switch back to a window after C-x C-f in emacs?

I often use C-x C-f or C-x d to open a new file in the emacs window. How to I go back to the previous file I was editing without doing C-x C-f again. Is there a shortcut?

Upvotes: 0

Views: 237

Answers (4)

Sazid
Sazid

Reputation: 2827

Press C-xb RET to get back to the previous buffer quickly.

Alternatively, you can view the details and names of the current buffers by pressing C-xC-b and then type that name in the C-xb (mini-buffer) and then RET.

Upvotes: 0

Ross Patterson
Ross Patterson

Reputation: 5742

Every file you open is opened in a "buffer". The "window" you are looking at is just displaying one buffer. The buffers for previously opened files will still be open unless you have done something to kill/close that buffer. So the concept you are looking for is how to change the buffer that the current window is displaying. If you're not yet familiar with this concept which is very fundamental to the power of emacs, then you will find all sorts of great goodies in C-h t. It will really be worth your while.

Use C-x C-b to pull up the buffer menu and switch back. Better yet, use ido-mode.

Upvotes: 2

Marcelo Cantos
Marcelo Cantos

Reputation: 185852

C-x b lets you switch to a different buffer, defaulting to the most recent one. In GUI mode, some combination of meta keys and mouse buttons — depending on your environment — might give a list of open files (my Aquamacs has a tabbed interface, so I can't tell you the exact incantation).

Upvotes: 1

Wooble
Wooble

Reputation: 89847

C-x b<ret>

will take you to the previous buffer.

Upvotes: 2

Related Questions