Home Doom Emacs Cheatsheet
Post
Cancel

Doom Emacs Cheatsheet

Doom Emacs enhances Emacs by configuring it with sane defaults and adding a modern UI, among other improvements. Here’s a quick cheat sheet to get you started with Doom Emacs.

General

SPC is your space key

CommandDescription
SPC .Open file finder
SPC xExecute command
SPC b bSwitch buffer
SPC b dKill buffer
SPC b RRevert buffer without confirmation
ctrl w vSplit window vertically
ctrl w sSplit window horizontally
SPC w d or SPC w cClose current window
SPC TABSwitch to last buffer
SPC w wSwitch window

Code and Text Editing

CommandDescription
SPC c cCompile
SPC c lComment or uncomment lines
SPC /Search in project
SPC s sSearch in current buffer
SPC s rReplace in current buffer
SPC g gMagit status
SPC g c cCommit changes
SPC g p pPush changes
SPC g oOpen GitHub/GitLab repository
CommandDescription
SPC h d bDescribe bindings
SPC h d fDescribe function
SPC h d vDescribe variable
SPC h d kDescribe key
SPC j j or C-jJump down
SPC j k or C-kJump up

Org Mode

CommandDescription
SPC m aOrg agenda
SPC m cCapture item
SPC m lInsert link
SPC m tTodo state cycle
SPC m TSet specific todo state
SPC m hInsert heading
SPC m HInsert subheading
SPC m -Insert list item

Emacs and Doom

CommandDescription
SPC h r rReload Doom configuration
SPC q rRestart Emacs
SPC q qQuit Emacs

This cheat sheet covers some basic Doom Emacs functionality. Explore the Doom Emacs documentation and the vast ecosystem of Emacs packages to further enhance your productivity.

Python Development Environment

Inside the init.el, uncomment

1
2
(python +lsp)
lsp

Install the language servers, i use pipenv, but pip will work

1
2
3
4
5
pipenv install python-lsp-server

sudo pacman -S npm

npm install pyright pyright-langserver

Inside the config.el

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;; REMEMBER TO CHANGE THE PATH TO YOUR NODE-MODULES .bin DIRECTORY
(after! tramp
  (setq tramp-remote-path (append tramp-remote-path '("/home/jonny/node_modules/.bin/"))))

(with-eval-after-load 'tramp
  (add-to-list 'tramp-remote-path 'tramp-own-remote-path))

;;(after! eglot
  ;; Ensure `pyright` is used for Python files
;;  (add-to-list 'eglot-server-programs '(python-mode . ("pyright-langserver" "--stdio"))))
(use-package! company
  :after eglot
  :config
  ;; This configures company to use company-capf, which is the completion-at-point-function backend
  (setq company-idle-delay 0.5) ; Adjust the delay according to preference
 ;; company-capf is a generic completion mechanism that works with eglot.
  (setq company-backends '(company-capf)))

;; Ensure `eglot` is installed and configured for Python
(use-package! eglot
  :hook (python-mode . eglot-ensure)
  :config
  (add-to-list 'eglot-server-programs '(python-mode . ("pyright-langserver" "--stdio")))
  (add-hook 'eglot-managed-mode-hook (lambda () (company-mode 1))))

(setq org-agenda-files (directory-files-recursively "~/org-agenda" "\\.org$"))
(require 'pyvenv)
(add-hook 'python-mode-hook #'pyvenv-mode)

(defun open-eshell-in-bottom-window ()
  "Split the window and open eshell in the bottom window with a specific size."
  (interactive)
  ;; Calculate the desired window height for the eshell window: e.g., 1/3 of the frame height.
  (let ((window-size (- (floor (* 0.33 (frame-height))) window-min-height)))
    ;; Split the window with the specified height and open eshell in the new window.
    (split-window-below (- window-size))
    (other-window 1)
    (eshell)))

(global-set-key (kbd "C-c e") 'open-eshell-in-bottom-window)

Inside the packages.el

1
2
(package! pyvenv)
(package! eglot)

Inside alt-x

1
2
3
4
5
- open-eshell-in-bottom-window C-c e
- doom/reload
- eshell
- eglot
- pyvenv-activate (although, my config should automatically load this if in a package directory with a virtual environment)
This post is licensed under CC BY 4.0 by the author.