Emacs! A Cheat-Sheet!

Abhishek Amralkar
2 min readJun 9, 2022

--

Note:- This article is heavily borrowed from

https://www.braveclojure.com/basic-emacs/

The editor is always the ally and if it’s Emacs it will be the closet ally. I will try to write down all the Emac’s possible commands I know.

This is more of a revision place for me.

Installation

Emacs installation is pretty straightforward. Follow the below link to install Emacs.

Once the installation is done you should be able to see something like the below.

All credit goes to Richard Stallman! Thank You!

Editing in Emacs takes place in a buffer, any file that you open is held by the buffer.

Scratch is the default Emacs buffer.

  1. In Emacs, editing takes place in buffers.
  2. To switch to a buffer, use C-x b and enter the buffer name in the minibuffer.
  3. To create a new buffer, use C-x b and enter a new buffer name.
  4. To open a file, use C-x C-f and navigate to the file.
  5. To save a buffer to a file, use C-x C-s.
  6. To create a new file, use C-x C-f and enter the new file’s path. When you save the buffer, Emacs will create the file on the file system.

How to create Buffer?

  1. Press Control and X buttons together
  2. Release Control
  3. Press B

Some of the very important Key Bindings in Emacs

Note:- C is Control Key and M is Meta Key on your keyboard

C-a Move to begin of line.

M-m Move to the first non-whitespace character on the line.

C-e Move to the end of the line.

C-f Move forward one character.

C-b Move backward one character.

M-f Move forward one word.

M-b Move backward one word.

C-s Regex searches for text in the current buffer and moves to it.

Press C-s again to move to the next match.

C-r Same as C-s, but search in reverse.

M-< Move to the beginning of the buffer.

M-> Move to the end of the buffer.

M-g g Go to line.

Keybindings for Kill Ring

C-w Kill region.

M-w Copy region to kill ring.

C-y Yank.

M-y Cycle through kill-ring after yanking.

M-d Kill word.

C-k kill line.

This article is still a Work In Progress and I keep updating it.

--

--