Skip to content

Instantly share code, notes, and snippets.

@aloispichler
Last active September 25, 2025 17:19
Show Gist options
  • Select an option

  • Save aloispichler/5e079adaacb90c1d66efa3af41cf1b96 to your computer and use it in GitHub Desktop.

Select an option

Save aloispichler/5e079adaacb90c1d66efa3af41cf1b96 to your computer and use it in GitHub Desktop.
Emacs shortcuts

Introduction

Emacs Reference Card: 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
M-x load-file RET           recompile this file
C-f/ C-b                    move forward/ backward one character – genau verkehrt positioniert :-(
M-f/ M-b                    move forward/ backward one word      – genau verkehrt positioniert :-(
C-n/ C-p                    move down (next)/ up (previous) 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

Basic Emacs editing

C-g                         cancel
<DEL>, C-d                  delete character before/ after the cursor
M-<DEL>/ M-d                kill the word before/ after the cursor
C-k/ M-k                    kill to end of line/ end of sentence

C-SPC + C-w                 set mark at text block and kill
C-w (kill), M-w (copy)      copy/ kill
C-y (+ M-y)                 then yank (paste) to retrieve the killed text (with history)

C-_, C-/, C-x-u             undo
C-?, C-g + …                redo
C-s, C-r                    ISearch (find) forward, backward
C-M-n, C-M-p                Move forward over a parenthetical group

Emacs Files

C-x C-f                     find a file
C-x C-s                     save/ write the file

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
describe-char               describe the character
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