Buffer management

From WikEmacs
Jump to: navigation, search

Let's list the possible ways to manage buffers. How to manage a lot of buffers, to get fuzzy completion, to work in distinct projects, workspaces, etc ?

What is a buffer exactly ? Check the Emacs term.

List current buffers


Ibuffer is built-in. Nice extension: hydra-ibuffer will offer a nice prompt with ibuffer commands.


Switch buffers with completion

Choose your favorite option: ido, ivy or helm.

Work in projects


In Projectile, a project root is defined either by a source control repository either by a .projectile file. Among other features, it allows to show the list of buffers that belong to the current project and switch to it. It is by default bound to C-c p b (M-x projectile-switch-buffer). See also the menu. You can choose the completion engine for Projectile (helm, …).

Work in distinct workspaces / perspectives


persp-mode (in MELPA) implements named perspectives, i.e. a set of buffers/window configs, or also tagged workspaces. It is based on perspective-el and adds the ability to share perspectives among frames and to save/restore its state from/to a file.

Once we activate the mode (M-x persp-mode) we can carry on our work. Then we can create another group/perspective/workspace (persp-switch and entering a new name, C-x x s by default). Once we are in a new persp, the usual commands that list buffers will only list buffers from that one, not from the other perspectives.


persp-projectile (in MELPA) is a minor mode that provides the ability to manage different workspaces. If you need to open many projects at the same time, perspective can help you keep each project related buffers and windows setting separate from other projects, similar to multiple spaces on MacOS, which allows you to focus on the files of the current active project.

It is based on perspective-el listed above.


Tabs may be a concept that do not translate very well in Emacs. We often advise to loose this habit and embrace the Emacs way (i.e., everything else listed in that page !). But you can emulate some tabs features of course.


elscreen (in MELPA) is a tabbed window session manager modeled after GNU screen. We can create tabs manually. With extensions, we can choose to isolate a tab's buffers from the others.

Evil-mode, or switching buffers à la Vim

That's possible with evil. Just do :ls and voilà :)

See also

Keep a certain kind of buffers in a window: Purpose

emacs-purpose ("window-purpose" on MELPA) provides a new window management system for Emacs, which gives you a better control over where Emacs displays buffers.

With Purpose, each buffer has a configurable "purpose" and each window can interactively be dedicated to a certain "purpose". When you dedicate a window (C-c , d), Purpose makes sure that this window will be used only for buffers which have the same purpose as the buffer that is currently displayed in that window.

Frames only mode, better fit with tiling window managers

frames-only-mode makes emacs play nicely with tiling window managers by setting it up to use frames rather than windows.

Buffer navigation (Category)

Buffer Navigation

Session Management