Doom Emacs Practical Tips

| Categories emacs  | Tags doom  emacs 

Doom Emacs Practical Tips and Configuration Guide for Go / Python / Flutter

Doom Emacs is a modern Emacs configuration framework that combines Vim keybindings, a modular architecture, and ultra-fast startup—ideal for developers in any language.

This post not only summarizes practical tips for using Doom Emacs but also provides configuration examples and plugin support for Go, Python, and Flutter development—helping you quickly build your own efficient development environment.


1. Quick Overview of Doom Emacs Configuration

The core configuration files are located in ~/.doom.d/:

File Description
init.el Enable modules (languages, tools, etc.)
config.el Daily settings (keybindings, hooks)
packages.el Install custom plugins

After making changes, run:

doom sync && doom restart

2. Common Practical Shortcuts

Shortcut Description
SPC f f Find file
SPC p p Switch project
SPC b b Switch buffer
SPC / Global search (ripgrep)
SPC g g Open Magit Git panel
SPC c c Compile current buffer
SPC w / Vertical split
SPC TAB TAB Switch recent buffer
SPC h d h Help for symbol at point

3. Go Development Setup

1. Enable Module

Enable in ~/.doom.d/init.el:

:lang
(go +lsp)

2. Install Dependencies

go install golang.org/x/tools/gopls@latest

Optional:

go install github.com/go-delve/delve/cmd/dlv@latest

3. Formatting Support (config.el)

(after! go-mode
  (setq gofmt-command "goimports")
  (add-hook 'before-save-hook #'gofmt-before-save))

4. Python Development Setup

1. Enable Module

:lang
(python +lsp +pyright +poetry)

2. Install Dependencies

It’s recommended to use pyenv and Poetry to manage environments:

pip install 'python-lsp-server[all]'
# or
npm i -g pyright

3. Optional Formatter Config

(setq-hook! python-mode +format-with 'black)

5. Flutter Development Setup

Flutter support is implemented through Dart + LSP + flutter command.

1. Enable Module

:lang
(dart +lsp)

:tools
lsp

2. Install Flutter SDK and DevTools

flutter doctor
flutter pub global activate devtools

Make sure dart and flutter are available in your $PATH.

3. LSP Configuration (enabled by default)

To verify if lsp-mode and lsp-dart are enabled:

(use-package! lsp-dart
  :after lsp-mode
  :config
  (setq lsp-dart-sdk-dir "~/flutter/bin/cache/dart-sdk"))

4. Development Tips

  • Use flutter emulators to start emulator
  • Launch DevTools from Emacs or browser
  • Bind hot reload to a shortcut:
(map! :leader
      :desc "Flutter Reload" "c r" #'lsp-dart-hot-restart)

6. Debugging Support (DAP)

Doom Emacs supports DAP-based debugging:

:tools
(debugger +lsp)

After installing dap-mode, you can debug Go, Python (via dap-python), and Dart.


7. Custom Keybindings (config.el)

(map! :leader
      :desc "Open TODO" "o t" (lambda () (interactive) (find-file "~/todo.org"))

      :desc "Format Buffer" "b f" #'format-all-buffer

      (:prefix ("c" . "code")
        :desc "Compile" "c" #'compile
        :desc "LSP Rename" "r" #'lsp-rename)

      (:prefix ("g" . "git")
        :desc "Status" "g" #'magit
        :desc "Blame" "b" #'magit-blame))

8. Plugin Recommendations (packages.el)

;; Flutter/Dart
(package! lsp-dart)
(package! hover) ;; Optional GUI debugger

;; Go tools
(package! go-eldoc)

;; Python tools
(package! pip-requirements)

;; UI Enhancements
(package! doom-themes)
(package! doom-modeline)
(package! rainbow-delimiters)

9. Performance Tips

  • Remove unused modules like :email, :app, :tools debugger
  • Compile Emacs with native-comp (Emacs 28+)
  • Use doom build to byte-compile plugins
  • Disable extra lsp-ui features:
(setq lsp-ui-sideline-enable nil
      lsp-ui-doc-enable nil)


Doom Emacs is not just Emacs + Vim, but your ultimate hacker workstation.