In emacs how can I keep many files open at once?

When you load a file in Emacs with find-file (bound to Ctrl-x Ctrl-f by default), it gets put into a "buffer". As long as you don't kill the buffer, it stays in memory, you don't have to reload it.

You access already loaded files (buffers) with switch-to-buffer (bound to Ctrl-x b). Press the keys, then type the buffer name you want to switch to (by default that's the basename for any loaded file).

You can also press Ctrl-x Ctrl-b to get a list of currently existing buffers. And click any buffer there with the mouse to switch to it (IIRC, rarely use the mouse with Emacs ;-))

You can also split the screen in two (or more) parts to see different files (buffers) with Ctrl-x 2. Initially, this shows the same buffer twice. Switch to another buffer in one of the windows to see another file.


C-x b and C-x C-b are what you want. Also consider trying iswitchb or ido. Since I started using those I wish every program I used could switch tabs / windows / documents as quickly and conveniently as emacs. Often I have 50 files or more open in emacs, you can find the one you want very quickly with iswitchb or ido.

Tags:

Emacs