Skip to content

Instantly share code, notes, and snippets.

@nikita-nuykin
Last active May 15, 2026 22:54
Show Gist options
  • Select an option

  • Save nikita-nuykin/536b71dc017c44ace62aafdc397ddca9 to your computer and use it in GitHub Desktop.

Select an option

Save nikita-nuykin/536b71dc017c44ace62aafdc397ddca9 to your computer and use it in GitHub Desktop.
Doom Emacs cheatsheet

Doom Emacs Cheatsheet

Shortcuts

Use SPC h w to find shortcut or command

Cursor

Combination Description
g g Move cusor to first line
G Move cusor to last line
M-< Move cursor to start of the file
M-> Move cursor to end of the file

Window manipulation

Combination Description
SPC w v Split verically
SPC w d Close active
SPC w w Swith focus to next
SPC w W Swith focus to previous

Vterm

Combination Description
SPC o t Open vterm popup
SPC o T Open vterm window
CTRL c CTRL c Send cancel command to terminal
CTRL l Clear terminal

Misc

Combination Description
SPC f s Save current file
CMD s Save current file
SPC s b Search current file
SPC s p Search current project
SPC c d / g d Open reference
SPC c D / g D Open reference usage list popup
SPC SPC File file inside of project
SPC f r Find recent file
CTRL SPC Open autocomplete popup
C-u C-c C-c Render plantuml in new window

Tips

Project Search Params (Vertico)

Search string Result
#gifts Any words that contain 'gifts'
#gifts -- -s Case sensitive substring
#gifts -- -w Whole word (gifts, Gifts, …)
#gifts -- -sw Exact word gifts

Search file

  • One way is to use buffer search via SPC s b
  • Another one is i-search:
    • Open via C-s
    • Type search entry
    • Toggle between results with C-s (forward) and C-r (backwards)
    • Use C-s C-w to search the whole word without typing in
  • Simple search with C-s ENTER. It finds the first entrance of search query

Replace string in file

  • replace-string command. Case sensetinve replacement
    • M-x replace-string ENTER foo ENTER buz
  • Query replacement. Goes from one to another awaiting you coomand to replace or to skip
    • M-% foo ENTER buz
    • SPACE/y to replace
    • n to skip

Installation

MacOS

  1. Update brew via brew update
  2. Upgrade brew via brew upgrade
  3. Add emacs plus brew repository via bew tap d12frosted/emacs-plus
  4. Install emacs plus via brew install emacs-plus
  5. Create a link in applications directory via ln -s /opt/homebrew/opt/emacs-plus@28/Emacs.app /Applications
  6. Launch emacs and check if it works
  7. Install git if it's not installed
  8. Install deps via brew install ripgrep coreutils fd
  9. Clone doom emacs repo via git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d
  10. Install doom emacs via ~/.emacs.d/bin/doom install
  11. Add global doom command by adding the directory to your PATH
    1. Add export Path="$HOME/.emacs.d/bin:$PATH" to .zshrc
    2. Execute .zshrc in current terminal session via source .zshrc

Doom usage:

  • Run doom doctor to check for errors and warnings
  • Run doom sync to syncronyze your private config with doom and install missing packages

Links:

Configuration

Enabling typescript or another language support

  1. Inside init.el find :lang section and uncomment languages you need
  2. Reload via SPC h r r

Adding build-in terminal

  1. Inside init.el find :term section and uncomment vterm
  2. Reload via SPC h r r
  3. Open vterm window via SPC o T. It may require additional installation during the first launch

To open vterm popup use SPC o t

Adding project explorer side window

  1. Inside init.el find :ui section and uncomment treemacs
  2. Reload via SPC h r r
  3. Open project
  4. Use SPC o p to open project explorer

Adding Atom One Dark/Light theme

  1. Open config.el
  2. Add following code:
    (require 'package)
    (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
    ;; Comment/uncomment this line to enable MELPA Stable if desired.
    ;; See `package-archive-priorities` and `package-pinned-packages`.
    ;; Most users will not need or want to do this.
    ;; (add-to-list 'package-archives
    ;;              '("melpa-stable" . "https://stable.melpa.org/packages/") t)
    (package-initialize)
    
  3. Reload doom via SPC h r r
  4. Run package-refresh-contents command (SPC : and search)
  5. Run package-install one-themes
  6. Add following code to config.el
    • For light theme:
      (use-package one-themes
        :init
        (load-theme 'one-light t))
      
    • For dark theme:
      (use-package one-themes
        :init
        (load-theme 'one-dark t))
      
  7. Reload doom via SPC h r r

Links:

CMD + x to cut text

  1. Open config.el
  2. Add following code
    (defun cut-region (beg end)
      "Copies the text to the kill buffer and deletes the selected region."
      (interactive "r")
      (copy-region-as-kill beg end)
      (delete-region beg end))
    
    (map! "s-x" #'cut-region)
    
  3. Reload doom via SPC h r r

Change global font or font properties

  1. Options -> Set default font...
  2. Configure

Tide relative path import by default

  1. Add following code to config.el: (setq-default tide-user-preferences '(:importModuleSpecifierPreference "relative" :includeCompletionsForModuleExports t :includeCompletionsWithInsertText t :allowTextChangesInNewFiles t))
  2. Restart doom emacs

Links:

TODO

  • eslint fix current file
  • multiple cursor usage
  • find and replace within file
  • find and replace within project
  • spellcheck
  • Markdown live preview
  • Autocomplete case insensitive
  • Vterm option + backspace
  • Vterm CMD + backspace
  • Vterm cursor move
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment