.emacs.d/config.org
2024-10-04 19:50:51 -04:00

4.6 KiB

Emacs Configuration

Basic Setup

Server

  (require 'bind-key)
  (load "server")
  (unless (server-running-p) (server-start))

Disable Auto-Save and Backup

(I don't like having #file# and file~ everywhere in my directories)

  (setq auto-save-default nil)
  (setq make-backup-files nil)

Enable Real Auto Save

  (use-package real-auto-save
    :ensure t
    :config
    (setq real-auto-save-interval 1)
    (add-hook 'prog-mode-hook 'real-auto-save-mode))

No Scratch On Open

  (setq initial-scratch-message nil)
  (setq initial-buffer-choice nil)

  (add-hook 'emacs-startup-hook
      (lambda ()
        (when (and (get-buffer "*scratch*")
       (not (eq (current-buffer) (get-buffer "*scratch*"))))
    (kill-buffer "*scratch*"))))

Dirvish

  (use-package dirvish
    :ensure t
    :config
    (dirvish-override-dired-mode)
    (dirvish-side-follow-mode)
    (setq dired-mouse-drag-files t)
    (setq mouse-drag-and-drop-region-cross-program t))

  ;; Addtional syntax highlighting for dired
  (use-package diredfl
    :ensure t
    :hook
    ((dired-mode . diredfl-mode)
     (dirvish-directory-view-mode . diredfl-mode))
    :config
    (set-face-attribute 'diredfl-dir-name nil :bold t))

  (use-package all-the-icons
    :ensure t)

  (use-package ns-auto-titlebar
    :ensure t
    :config
    (when (eq system-type 'darwin) (ns-auto-titlebar-mode)))

Fix Indents + Enable Autopairs

  (electric-indent-mode 1)
  (electric-pair-mode 1)
  (setq c-basic-offset 2)
  (setq-default indent-tabs-mode nil)

  (use-package evil
    :ensure t
    :init
    (setq evil-split-window-below t)
    (setq evil-undo-system 'undo-tree)
    (setq evil-vsplit-window-right t)
    (setq evil-want-C-i-jump nil)
    (setq evil-want-C-u-scroll t)
    (setq evil-want-integration t)
    (setq evil-want-integration t)
    (setq evil-want-keybinding nil)
    :config
    (evil-mode 1))

  (use-package evil-collection
    :ensure t
    :config
    (evil-collection-init))

  (use-package evil-leader
    :ensure t
    :config
    (global-evil-leader-mode)
    (setq evil-leader/leader "<SPC>")
    (evil-leader/set-key "a" #'eglot-code-actions)
    (evil-leader/set-key "bd" #'kill-this-buffer)
    (evil-leader/set-key "e" #'dirvish-side))

  (use-package eglot
    :hook (emacs-lisp-mode . eglot-ensure))

  (use-package catppuccin-theme
    :ensure t
    :demand t
    :config
    (load-theme 'catppuccin t))

  (setq auto-save-default nil)
  (setq make-backup-files nil)

Rainbow Delimiters

  (use-package rainbow-delimiters
    :ensure t
    :config
    (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))

Disable Bars

  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tool-bar-mode -1)

Line Numbers

  (global-display-line-numbers-mode t)

  (setq display-line-numbers-type 'relative)

  (dolist (mode '(term-mode-hook
      vterm-mode-hook
      shell-mode-hook
      dirvish-setup-hook
      eshell-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 0))))

Vim-Style Scrolling

  (setq scroll-step 3
        scroll-conservatively 9999)

System-Specific Settings

  (cond
   ((eq system-type 'darwin)
    (setq default-frame-alist '((font . "Iosevka Comfy-14"))))
   ((eq system-type 'gnu/linux)
    (setq default-frame-alist '((font . "Maple Mono NF-12")
        (undecorated . t)))))

Use Short Answers

  (setq use-short-answers t)

Undo Tree

  (use-package undo-tree
    :ensure t
    :demand t
    :config
    (global-undo-tree-mode)
    (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))))

Dashboard

  (use-package dashboard
    :ensure t
    :config
    (dashboard-setup-startup-hook)
    (setq dashboard-startup-banner 'logo)
    (setq dashboard-center-content t)
    (setq dashboard-vertically-center-content t)
    (setq dashboard-startup-banner 'logo)
    (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
    (setq recentf-exclude '("~/.emacs.d/.cache/treemacs-persist")))

Ido Mode

  (setq ido-ignore-buffers
      '("\\` " "^\*")) ;; Ignore buffers that start with a space or *

  (ido-mode 1)
  (ido-everywhere 1)