Description
Emacs is a text editor that is hailed for its ability to be customized and many people use it for their agenda, RSS feeds, code editing, and more. By extending the base packages, vim keybindings could be enabled, LSPs can be configured, etc.
Quickstart
I started with Spacemacs which has 200+ packages already configured. This instantly adds lots of keybinds and functionality to emacs, and you’ll have to decide if it’s worth using.
Building a configuration from scratch (instead of using a distro like Spacemacs) is often recommended for beginners to better understand what’s happening under the hood.
Terms
- Projects - Just a folder.
- Layers - A set of configurations that can be enabled/disabled to bring packages together.
- Modes - There are major and minor modes. Simply changes how text input affects the buffer.
- Packages - Extending the base functionality of emacs.
Spacemacs Keybind Reference
Note
As you press keys, watch the menu that appears at the bottom of the screen to find more useful keybinds.
Keybind | Description |
---|---|
SPC ? | Opens all keybindings |
SPC SPC | Opens emacs command menu |
, | Opens the major chord menu |
SPC f s | Save file |
SPC f t | Open file tree |
SPC f e d | Open emacs dotfile |
SPC f e R | Reload emacs config |
SPC p f | Find file in project (fuzzy) |
SPC j = | Auto-format code |
SPC j j | Jump anywhere |
SPC w 2 | Split into a 2 window layout |
SPC w TAB | Navigate to next window |
SPC b b | List all buffers |
SPC b x | Close current buffer and window |
SPC T s | Switch themes |
SPC s s | Search file |
SPC q q | Kill emacs |
CTRL+c CTRL+p a | Add project to workspace |
CTRL+c CTRL+p d | Drop project from workspace |
SPC / | Search project (live grep) |
SPC g s | Open Magit (git) panel |
CTRL+n | Select next occurance |
CTRL+h i | Opens the emacs instruction manual |
As you combine these with vim/emacs keybinds, everything just becomes more efficient.
Performance
Spacemacs and the OCaml layer added ~3s to my emacs startup time. Coming from neovim, this was unacceptable and that’s when I learned to run emacs as a daemon.
systemctl --user enable --now emacs
This command added emacs to my startup services. The idea is that we’ll leave emacs running all the time and connect with a client which is installed as “Emacs (Client)” on my machine.
Instead of cold starting emacs, it will now have a daemon to instantly attach to.
Org Mode
There’s a rabbit hole called org-mode which I encourage you to at least consider.
It’s useful for keeping an agenda and creating todos. GDQuest has a solid intro video here. A good follow-up is this video about tagging with org-mode.