6.8 KiB
6.8 KiB
Emacs Configuration
- Basic Setup
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
make-backup-files nil)
Enable Real Auto Save
(use-package real-auto-save
:ensure t
:hook
(prog-mode . real-auto-save-mode)
:config
(setq real-auto-save-interval 1))
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
(setq dired-omit-files
(rx (or (seq bol (? ".") "#")
(seq bol "." eol))))
(add-hook 'dired-mode-hook 'dired-omit-mode)
(defun my/dirvish-create-file ()
"Create a new file in the current directory."
(interactive)
(let ((new-file (read-file-name "New file name: " (dired-current-directory))))
(if (file-exists-p new-file)
(message "File already exists!")
(write-region "" nil new-file)
(revert-buffer) ;; Refresh the directory listing
(message "File created: %s" new-file))))
(use-package dirvish
:ensure t
:init
(dirvish-override-dired-mode)
:config
(dirvish-peek-mode)
(dirvish-side-follow-mode)
(setq dired-listing-switches "-al --ignore='^\\.$' --human-readable --group-directories-first"
dired-mouse-drag-files t
dirvish-attributes '(vc-state subtree-state nerd-icons collapse git-msg file-time file-size)
dirvish-mode-line-format '(:left (sort symlink) :right (omit yank index))
dirvish-subtree-state-style 'nerd
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 nerd-icons
:ensure t
:custom
(nerd-icons-font-family "Maple Mono NF"))
(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
evil-undo-system 'undo-tree
evil-vsplit-window-right t
evil-want-C-i-jump nil
evil-want-C-u-scroll t
evil-want-integration t
evil-want-integration t
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 "bb" #'switch-to-buffer)
(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
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
org-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)
(set-face-attribute 'default nil :font "Iosevka Comfy-14")
(set-face-attribute 'fixed-pitch nil :font "Iosevka Comfy-14")
(set-face-attribute 'variable-pitch nil :font "Iosevka Comfy Motion Duo-16")
(setq default-frame-alist '((font . "Iosevka Comfy-14"))))
((eq system-type 'gnu/linux)
(set-face-attribute 'default nil :font "Iosevka Comfy-12")
(set-face-attribute 'fixed-pitch nil :font "Iosevka Comfy-12")
(set-face-attribute 'variable-pitch nil :font "Iosevka Comfy Motion Duo-14")
(setq default-frame-alist
'((font . "Iosevka Comfy-12")
(undecorated . t)))))
Use Short Answers
(setq use-short-answers t)
Enable ctrl+c/ctrl+v
(cua-mode 1)
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
dashboard-center-content t
dashboard-vertically-center-content t
dashboard-startup-banner 'logo
initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))))
Better M-x
Ivy Mode (Completions)
(setq ivy-ignore-buffers '("\\` " "\\`\\*"))
(use-package ivy
:ensure t
:config
(ivy-mode)
(setq ivy-use-virtual-buffers t
enable-recursive-minibuffers t))
Amx Mode (Better Interface)
(use-package amx
:ensure t
:config
(amx-mode))
Org Mode Improvements
(add-hook 'org-mode-hook 'visual-line-mode)
(use-package mixed-pitch
:hook
(org-mode . mixed-pitch-mode))
(use-package org-modern
:ensure t
:hook (org-mode . org-modern-mode)
:config
(setq org-ellipsis "…")
(setq org-modern-star 'replace))
(use-package org-modern-indent
:ensure (org-modern-indent :type git :host github :repo "jdtsmith/org-modern-indent")
:config
(add-hook 'org-mode-hook #'org-modern-indent-mode 90))