daniebker

doom emacs cheat sheet

· [Daniel baker]

A work in progress Doom Emacs Cheat sheet. Check the original org file on github.

Doom

Commands

doom sync

doom doctor

Checks for errors in your configuration. Can spot mispelled and duplicate modules in the ~/.doom.d/init.el file as well incorrect flags being passed to modules.

Modules

Doom has a module concept. Modules are a bundle of packages combined into one. Modules are enabled in the ~/.doom.d/init.el file. On initial install many are commented out. If a module you want to use is commented out simply uncomment it, exit doom emacs and run ~/.emacs.d/bin/doom sync before restarting.

Modules also support enabling extra features by passing flags. For example, the org module in :lang can be updated to enable ox-hugo by updating the line to (org +hugo) the +hugo piece tells doom to enable ox-hugo for org mode. A comprehensive list of module flags can be found in the modules index.

Org File navigation

Cmd Description
SHIFT TAB in normal mode will cycle through closing and opening headings and their sub headings.
w In normal mode will move the cursor to the next word
C SPC Sets a marker. Use the movement keys to move the marker around. Anything under the highlighted mark can be yanked.

Copy and pasting

Emacs using the term ‘yank’ to copy something to the clip board. Yanking is equivalent to copying.

Cmd Mode Description
y Normal ‘Yanks’ anything under a marker to the clipboard.
p Normal Pastes the selection to the marked location.

Headings

Cmd Description
ALT RETURN adds a new heading below the current one.
ALT SHIFT left/right Alters the level of the heading.

Setting Properties

Cmd Description
C-c C-x p Opens the add property dialog for the headter

Window Mangement

Cmd Description
SPC w v Splits the screen verticaly into two buffers
SPC w s Splits the screen horizontally into two buffers

Projects

Treemacs

Cmd Description
SPC o p Opens treemacs
Cmd Description
SPC m l Opens the links dialog
SPC m l s Stores the current org-heading as a link
SPC m l l Creates a link. If you have a link stored it will be the first option. Running this on an existing link opens the link function in an edit mode. Useful for updating and altering links.

org-mode

Cmd Description
SPC i s Insers a snippet into the document.

Tasks

Tasks in org-mode are special headings with a status.

Cmd Description
SHIFT right To cycle through to do states.
SPC m t To change the status of a to do to a different state.

Priorities

Cmd Description
SHIFT up Cycle through priorities in ascending order
SHIFT down Cycle through priorities in descending order
1
2
3
 **** [#C] A piroity C task

 **** [#B] A priority B task

Refiling

Cmd Description
SPC m s r Moves a heading to a new parent heading

Checklists

It’s possible to add checkboxes under a heading using the syntax - [ ] check name

For example:

1
2
3
4
5
6
 * Daily Tasks

 - [ ] Check email
 - [ ] Empty dishwasher
 - [ ] Make bed
 - [ ] Meditate

For recurring tasks it’s nice to have checkboxes automatically untick when the parent heading is moved to a done state. To enable this in doom emacs add the following line to your /.doom.d/config.el file.

1
2
;; ~/.doom.d/config.el
(add-to-list 'org-modules 'org-checklist)

Next, on a recurring task with checkboxes add the following property. See Properties for how to set properties.

1
:RESET_CHECK_BOXES: t

Now, when the heading is moved to a done state the checkboxes should all automatically untick.

Tables

Tables can be formatted using the syntax:

| Heading 1| Heading 2|
|----------|----------|
| Col 1    | Col 2    |
Cmd Description
TAB Cycles through the cells in a table
M up Moves a row up.
M down Moves a row down.
M left Moves a column left.
M down Moves a column right.

Headings

Cmd Mode Description
SPC m i Normal Turns a heading into a list item or a list item into a heading
M h Normal Moves a heading one level to the left
M H Normal Moves a heading and all subheadings one level to the left.
M l Normal Moves a heading one level to the right.
M L Normal Moves a heading and all subheadings one level to the right.
M RETURN Insert Adds a new Heading at the same level as the current heading.
M SHIFT right Insert Indents a heading one level deeper.
M SHIFT left Insert Moves a heading one level shallower, along with it’s children.

Properties

Cmd Mode Description
SPC m o Normal Opens the add property dialog to add a property to the current heading.

=====

Cmd Mode Description
SPC m o Normal Opens the add property dialog to add a property to the current heading.

Modules

org-pomodoro

In doom emacs, enabling org-pomodoro is as simple as enabling the pomodoro module.

;; ~/.doom.d/init.el
(:lang
 ...
 (org +pomodoro)

As with everything emacs lisp it’s easy to customise the pomodoro timers to your liking. The default clocks in twenty five minutes plus a five minute break in blocks of four before starting a longer ten minute break. To customise the times simply add this to your config:

;; ~/.doom.d/config.el
(!package org-pomodoro
  :ensure t
  :commands (org-pomodoro)
  :config
  (setq
   org-pomodoro-length 50
   org-pomodoro-short-break-length 10
   ))

This will set the pomodoro length to fifty minutes with a break of ten minutes.

Once a pomodoro is started you will immediately be clocked in to the current heading. If you transition the heading to a DONE state the heading will be clocked out, but the pomodoro timer will continue to run. This is useful to clock into another task. When the pommodoro is done the last clocked in task will then be clocked out.

Formatting

Cmd Mode Description
SHIFT ~ Normal Cycles through capitalising the currently selected character.

Timestamps

Cmd Mode Description
SPC m d T Normal Inserts an inactive timestamp e.g. [2021-09-13 Mon]
SPC m d t Normal Inserts an active timestamp. e.g. <2021-09-13 Mon>

Exporting

Cmd Description
C-c C-e Opens up the org export menu

Org mode ships with a couple of export options, but some need to be enabled for them to work.

Enabling ox-hugo

ox-hugo is an emacs package that adds export functionality for Hugo compatible markdown.

In ~/doom.d/init.el update the org declaration to include the module hugo. After the line should look lke the the following:

1
2
3
4
(doom!
 
 :lang
 (org +hugo))

After making the modification remember to run a doom/sync