Buffer management

From WikEmacs
Revision as of 11:13, 10 May 2017 by Elvince (talk | contribs) (buffer management)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Let's list the possible ways to manage buffers. How to manage a lot of buffers, to get fuzzy completion, to work in project, in custom groups, etc ?


List current buffers

Ibuffer

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

Projectile

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 custom groups / perspectives

perps-mode

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

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

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

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

Buffer navigation (Category)

Buffer Navigation

Session Management

Session_management