Emacs: List Buffers
This page is a tutorial on managing buffers in emacs.
In emacs, every file is shown in a “buffer”. (You can think of “buffer” as opened file or tabbed window without the tab.)
2 most useful commands for buffer are:
Try them now.
Close a Buffer
To close a buffer, use:
kill-buffer 【Ctrl+x k】 → close the current buffer.
List Buffers: ibuffer
ibuffer is a improved version of
list-buffers. It colors the files by type.
ibuffer as default, put the following in your init file:
(defalias 'list-buffers 'ibuffer) ; make ibuffer default
Select the code and Alt+x
eval-region. Now, Alt+x
Batch Operation on Buffers
You can do operation in batch to the marked ones. Example:
- Save all unsaved files
- Close all files of a given dir
- Close all Java files
describe-mode to see a full list of ibuffer commands.
Here's most useful
|【* u】||Mark unsaved|
|【S】||Save marked buffer|
|【D】||Close marked buffers|
ibuffer, the key sequence 【* u S D】 will save all unsaved files and close them. This is particularly useful after you've done a find replace on hundreds of files with
dired-do-query-replace-regexp. [see Emacs: Find Replace Text in Directory]
Buffer Switching: ido-mode
Open File topics
- Emacs: File Manager, dired
- Emacs: Bookmark Tutorial
- Emacs: Open Recently Opened File
- Emacs: Open File Fast
- Emacs: Open Last Closed File
- Emacs: Open File Path Under Cursor
If you have a question, put $5 at patreon and message me.