What Is Doom Emacs And How To Install It Tutorial

What Is Doom Emacs?

Doom Emacs is a custom Emacs distribution designed to streamline the text editor's default feature set, making it an approachable and powerful tool for both new and experienced users. It combines the flexibility of Emacs with the efficiency of Vim keybindings, offering a unique and highly customizable editing experience.

Key Features of Doom Emacs

Doom Emacs stands out for several reasons:

  • Sane Defaults: It provides sensible default configurations for most tasks, reducing the need for extensive customization.
  • Vim Keybindings: Doom Emacs integrates the extensible vi layer (EVIL) mode, allowing users to leverage Vim-like keybindings within the Emacs ecosystem.
  • Performance: It is known for its fast startup time and responsive performance, even on less powerful hardware.
  • Customization: With over 150 modules available, users can tailor their Doom Emacs setup to suit their specific needs, from language support to UI modifications.

Installing Doom Emacs

Preparing Your System

Before installing Doom Emacs, ensure you have the necessary dependencies installed:

Ubuntu/Debian

sudo apt install emacs-gtk ripgrep git

RHEL and Fedora

sudo dnf install emacs ripgrep git

Arch-based Distributions

sudo pacman -S emacs ripgrep git

These dependencies include Emacs itself, ripgrep for fast file searching, and git for version control.

Installing Doom Emacs

  1. Clone the Doom Emacs Repository
    git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
    
  2. Run the Installation Script
    ~/.emacs.d/bin/doom install
    

    This script will configure and set up Doom Emacs for the first time. Follow the prompts to complete the installation.

Configuring Doom Emacs

Enabling Modules

Doom Emacs allows you to customize your setup by enabling or disabling various modules. Here’s how to do it:

  1. Open the Configuration File
    • Start Doom Emacs and press Space + F, then P to open the init.el file.
    • Navigate to the line starting with (doom and find the module you want to enable.
  2. Enable a Module
    • Remove the two semi-colons (;;) in front of the module name to enable it.
    • For example, to enable the org module with journal support, you would modify the line to look like this:
      (doom :org +journal)
      
  3. Save and Sync
    • Save the init.el file by pressing Ctrl + X, then Ctrl + C.
    • Open a new terminal session and run doom sync to apply the changes.

Basic Navigation

  • File Navigation
    • Space + .: Find a file to open in a new buffer using dired.
    • Space + Space: Find a file in the current project using projectile.
  • Buffer Management
    • Space + b + i: Open a buffer listing all buffers via ibuffer.
    • Space + b + p: Go to the previous buffer.
    • Space + b + n: Go to the next buffer.
    • Space + b + k: Kill the current buffer.

Git Integration

  • Open Magit Buffer
    • Space + g + g: Open the Magit buffer for Git operations.
  • Commit Operations
    • Space + g + g + c + c: Create a commit.
    • Space + g + g + c + w: Reword a commit.
    • Space + g + g + c + a: Amend a commit.

Terminal Integration

  • Create a New Terminal Buffer
    • Space + vterm: Create a new terminal emulator buffer using vterm.
  • Open Terminal in Current Buffer
    • Space + o + T: Open a terminal in the current buffer using the current dired location.

Advanced Features

Org Mode

Doom Emacs integrates well with Org mode, offering features like:

  • Literate Programming: Execute code blocks within notes using #+begin_src and #+end_src.
  • Bullet Point Management: Maximize or minimize bullet points using the Tab key.
  • Checkboxes and TODOs: Use checkboxes and TODO items with syntax highlighting.
  • Tables: Auto-align tables by pressing Tab.

Evil Mode

For users familiar with Vim, Doom Emacs's integration with Evil mode provides a seamless transition:

  • Vim Keybindings: Use Vim-like movements and commands within Emacs.
  • Temporary Disable: Use the d + n + e shortcut to temporarily disable Evil mode if needed.

By following these steps and understanding these features, you can fully leverage the power and flexibility of Doom Emacs to enhance your text editing and development workflow.

Leave a Reply

Your email address will not be published. Required fields are marked *