The Emacs Logo, licensed under GPLV2 or later

Emacs cheat sheet - part 2

Notes published the
1 - 2 minutes to read, 331 words
Categories: editing
Keywords: cheat sheet editing emacs
Table of Contents

This is a follow-up of my emacs cheat sheet.

Some notes about working with multiple files: frames, buffers, windows, and tabs.

I am also using the Emacs convention for denoting commands, thus unless configured otherwise:

  • C- is Ctrl followed by another key

  • M- is Alt followed by another key

  • S- is Shift followed by another key

Buffer

A buffer is where the content you are editing or viewing is shown

Emacs can display multiple buffers, just like many editors and IDe can open multiple files at the same time.

  • show next buffer: C-x <right>

  • show previous buffer: C-x <left>

  • Kill current buffer: C-x k

  • list all buffers: C-x C-b (dialog can be closed with q)

  • open/create a new file C-x C-f

Frames

Frames are for executing the same Emacs session in multiple windows.

An Emacs frame is what is normally called a window in most desktop environments.

Mostly out of scope for these notes.

Window

Emacs can split a frame into two or more windows.

Multiple windows can display parts of different buffers, or different parts of one buffer.

Multiple frames imply multiple windows because each frame has its own set of windows.

Each window belongs to one frame.

  • split frame horizontally: C-x 2

  • split frame vertically: C-x 3

  • select another window: C-x o or mouse click

  • kill current window: C-x 0

  • kill another window: C-x 1

  • kill current window and buffer: C-x 4 0

Note: when a buffer is closed/killed (C-x k), the current window shows another existing buffer.

Tabs

Emacs can optionally display a Tab Bar.

Those work similarly to other graphical editors.

Separate tabs can be used for editing separate files. A tab contains a frame, which can be split into multiple windows.

  • open a new tab with the current buffer C-x t 2

  • close the current tab: C-x t 0, or mouse click on the x

  • close all other tabs: C-x t 1

  • select the next tab: C-TAB

  • select the previous tab: C-S-TAB


Do you want to share your opinion? Or is there an error, some parts that are not clear enough?

You can contact me anytime.