Skip to content

Instantly share code, notes, and snippets.

@aloispichler
Last active October 23, 2024 11:24
Show Gist options
  • Save aloispichler/5e079adaacb90c1d66efa3af41cf1b96 to your computer and use it in GitHub Desktop.
Save aloispichler/5e079adaacb90c1d66efa3af41cf1b96 to your computer and use it in GitHub Desktop.
Doom Emacs shortcuts

Introduction

Cf. https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf

For vim see also: https://gist.github.com/aloispichler/9c0650fce17af172c36f7e8885c621c7

* C ≙ Ctrl
* M ≙ Alt
* leader ≙ SPC

Packages

M-x list-packages           list available of packages
M-x package-refresh-contents  

Basic Emacs motion

C-z                         evil-emacs-state
C-f/ C-b                    move forward/ backward one character
M-f/ M-b                    move forward/ backward one word
C-p/ C-n                    move up/ down one line
C-a/ C-e                    go to line beginning/ end
M-a/ M-e                    sentence

C-v/ M-v                    next/ previous screen
C-l                         scroll current line to center/ top/ bottom
M-:                         run a command/ execute code
M-x  …~ or ~…               command history and all commands (~ for fzf; as describe-mode, auto-fill-mode, etc.)
M-: major-mode RET          display major mode

Emacs Evil Navigation

h, j, k, l                  evil cursor navigaton
SPC w h/ j/ k/ l            move to window left/ down/ up/ right
SPC w H/ J/ K/ L            move the window left/ down/ up/ right
C-x 3, c !                  split window right
SPC w v (SPC w V)           window-vsplit (window-vsplit-and-follow)
g ;/ g ,                    goto-last-change/-reverse

Move Julia-minibuffer to right

window-vsplit-and-follow (SPC w V)  split vertically and follow
consult-buffer (SPC b B)    find the REPL among the buffers

Doom Emacs

C-g                         doom/escape
SPC j j                     jump to position on screen (avy-goto-word)
SPC SPC, SPC p p            switch project
SPC p a                     add-known-project
C-h k, M-x describe-key     describe the following key
C-h m, M-x describe-mode    describe the mode
C-h v                       describe the variable
SPC f f/ -r                 find file
SPC b b, C-TAB              buffer list
SPC b B                     all buffers
SPC h t, consult-theme      toggle themes
SPC c x                     +default/diagnostics: display lsp diagnostics (errors, warnings, hints)
describe-face, ga           colors and properties of the face/ theme on frame
C-u C-x =                   what-cursor-position (after leaving evil-emacs-state with C-z) 

Emacs commands and workflows

Projects

To create a new project, add an empty .projectile file, then M-x projectile-add-known-project.

projectile-display-buffer   display projects in a buffer
projectile-add-known-project
projectile-remove-known-project
treemacs-edit-workspaces    edit treemacs workspaces and projects

C-x d                       dired file navigation
SPC .                       find file

Bring up Julia REPL

SPC w V                     vertical split window and follow
SPC b B                     find Julia REPL

LaTeX

LaTeX-find-matching-begin/ -end goto matching bne

Shell command

M-! …                       run the shell-command …
C-x =                       reftex-toc
TeX-command-master, , m     Run tex command on current file.
reftex-label, C-c (         derive and insert a new label (equation number)
reftex-citation, C-c [      insert a new citation label
reftex-renumber-simple-labels renumber equation labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment