Emacs Basics - Frames Buffers Windows
Understanding the basic terminology will help you make the most out of Spacemacs and allow very efficient use.
Terminology | Description |
---|---|
File | A file on the file system |
Buffer | A container to display a file or other information |
Window | Contains a buffer, allowing you to organise multiple buffers in a frame |
Frame | Holds one or more windows. Opening another frame gives you another instance of Emacs |
Status bar | Information about current window and buffer, e.g. window number, buffer mode & name, location of cursor. Also referred to as the mode line. |
Mini-buffer | A command line for Emacs - shows commands and some results, acts as an interactive prompt for some commands |
Working with Frames
When you open Emacs for the first time you are presented with a frame that contains a single window.
If you run Emacs again, or if you make a new frame SPC F n
, then a second frame will appear containing a single window.
If you kill a frame, only that frame closes unless its the last Emacs frame running, then Emacs itself closes.
If you quit Emacs, then all frames are closed.
Working with windows
There can be one or more windows in Emacs. Windows are used to split up the Emacs frame into sections. This allows you to display multiple buffers (files, REPL, error messages, etc) at the same time.
Each window has a number enabling you to jump between windows, e.g. SPC 1
takes you to window number 1.
Some of the common windows functions include:
keybinding | action |
---|---|
SPC w |
Opens Window menu |
SPC w . |
Open Window transient state menu for multiple command |
SPC w 2 |
2 window layout - shows current buffer in new window |
SPC w 3 |
3 window layout - shows current buffer in new windows |
SPC w m |
maximise the current buffer |
SPC w d |
delete current window |
SPC t g |
toggles golden ratio view of windows |
Golden Ratio
Golden-ratio automatically lays out windows in a Fibonacci style pattern. The active window becomes the largest window and all other windows are automatically shrunk so they are out of the way, but still visible.