emacs: debloat

This commit is contained in:
Jeremy Baxter 2024-03-04 13:18:57 +13:00
parent ae5643c66d
commit b61d6545b2

View file

@ -1,9 +1,9 @@
(setq gc-cons-threshold 100000000) (setq gc-cons-threshold 100000000)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize) (package-initialize)
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; disable menu bar, tool bar, scroll bar and savehist ;; disable menu bar, tool bar, scroll bar and savehist
(menu-bar-mode -1) (menu-bar-mode -1)
@ -11,10 +11,12 @@
(scroll-bar-mode -1) (scroll-bar-mode -1)
(savehist-mode -1) (savehist-mode -1)
;; evil + undo-tree ;; evil-mode
(package-install 'evil) (package-install 'evil)
(add-hook 'prog-mode 'evil-local-mode)
(add-hook 'text-mode 'evil-local-mode)
;; undo-tree
(package-install 'undo-tree) (package-install 'undo-tree)
(evil-mode)
(global-undo-tree-mode) (global-undo-tree-mode)
(evil-set-undo-system 'undo-tree) (evil-set-undo-system 'undo-tree)
@ -35,21 +37,18 @@
(package-install 'lua-mode) (package-install 'lua-mode)
(package-install 'markdown-mode) (package-install 'markdown-mode)
(package-install 'nix-mode) (package-install 'nix-mode)
(package-install 'rainbow-mode)
(package-install 'yaml-mode) (package-install 'yaml-mode)
(package-install 'org-modern)
(package-install 'toc-org)
;; hooks ;; hooks
(defun indent-common-hook () (defun indent-common-hook ()
;; turn off smart indent
(electric-indent-mode -1)
;; set indent width to 4 spaces ;; set indent width to 4 spaces
(setq tab-width 4 (setq tab-width 4
c-basic-offset 4 c-basic-offset 4
c-syntactic-indentation nil c-syntactic-indentation nil
c-ts-mode-indent-offset 4 c-ts-mode-indent-offset 4
lua-indent-level 4) lua-indent-level 4))
;; turn off smart indent
(electric-indent-mode -1))
(defun indent-tab-hook () (defun indent-tab-hook ()
(indent-common-hook) (indent-common-hook)
(setq indent-tabs-mode t)) (setq indent-tabs-mode t))
@ -73,14 +72,21 @@
'(("\\<\\(bool\\|byte\\|ubyte\\|char\\|delegate\\|double\\|float\\|function\\|int\\|long\\|short\\|uint\\|ulong\\|ushort\\|cent\\|ucent\\|real\\|ireal\\|idouble\\|ifloat\\|creal\\|cfloat\\|cdouble\\|wchar\\|dchar\\|void\\|string\\|wstring\\|dstring\\|__vector\\|Thread\\)\\>" . 'font-lock-type-face))) '(("\\<\\(bool\\|byte\\|ubyte\\|char\\|delegate\\|double\\|float\\|function\\|int\\|long\\|short\\|uint\\|ulong\\|ushort\\|cent\\|ucent\\|real\\|ireal\\|idouble\\|ifloat\\|creal\\|cfloat\\|cdouble\\|wchar\\|dchar\\|void\\|string\\|wstring\\|dstring\\|__vector\\|Thread\\)\\>" . 'font-lock-type-face)))
;; highlight colours ;; highlight colours
(package-install 'rainbow-mode)
(add-hook 'prog-mode-hook 'rainbow-mode) (add-hook 'prog-mode-hook 'rainbow-mode)
;; rainbow parens in lisp-mode
(package-install 'rainbow-delimiters)
(add-hook 'lisp-mode 'rainbow-delimiters)
;; modernize org-mode ;; modernize org-mode
(package-install 'org-modern)
(add-hook 'org-mode-hook 'org-modern-mode) (add-hook 'org-mode-hook 'org-modern-mode)
;; create a TOC on saving an org document ;; create a TOC on saving an org document
(package-install 'toc-org)
(add-hook 'org-mode-hook 'toc-org-mode) (add-hook 'org-mode-hook 'toc-org-mode)
;; enable spell checking in org mode ;; enable spell checking in org mode
(add-hook 'org-mode-hook '(lambda () (flyspell-mode))) (add-hook 'org-mode-hook #'(lambda () (flyspell-mode)))
;; minibuffer completion ;; minibuffer completion
(package-install 'marginalia) (package-install 'marginalia)
@ -88,7 +94,7 @@
(marginalia-mode) (marginalia-mode)
(vertico-mode) (vertico-mode)
;; company completion with eglot ;; company completion + eglot
(package-install 'company) (package-install 'company)
(require 'company) (require 'company)
(require 'eglot) (require 'eglot)
@ -150,7 +156,7 @@
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(package-selected-packages '(package-selected-packages
'(forge elcord nix-mode vterm breadcrumb nyan-mode simple-modeline catppuccin-theme which-key treesit-auto editorconfig diff-hl company vertico marginalia toc-org org-modern yaml-mode rainbow-mode markdown-mode lua-mode json-mode git-modes d-mode sudo-edit nerd-icons magit undo-tree evil))) '(rainbow-delimiters forge elcord nix-mode vterm breadcrumb nyan-mode simple-modeline catppuccin-theme which-key treesit-auto editorconfig diff-hl company vertico marginalia toc-org org-modern yaml-mode rainbow-mode markdown-mode lua-mode json-mode git-modes d-mode sudo-edit nerd-icons magit undo-tree evil)))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
@ -168,13 +174,15 @@
(setq catppuccin-flavor 'mocha) (setq catppuccin-flavor 'mocha)
(load-theme 'catppuccin :no-confirm) (load-theme 'catppuccin :no-confirm)
;; simple-modeline
(package-install 'simple-modeline) (package-install 'simple-modeline)
(package-install 'nyan-mode)
(simple-modeline-mode) (simple-modeline-mode)
(column-number-mode) (column-number-mode)
;; nyan-mode ;; nyan-mode
(nyan-mode) (package-install 'nyan-mode)
(setq nyan-animate-nyancat t) (setq nyan-animate-nyancat t)
(nyan-mode)
;; modeline segments ;; modeline segments
(setq simple-modeline-segments (setq simple-modeline-segments
@ -199,17 +207,11 @@
(package-install 'breadcrumb) (package-install 'breadcrumb)
(setq breadcrumb-project-crumb-separator "" (setq breadcrumb-project-crumb-separator ""
breadcrumb-imenu-crumb-separator "") breadcrumb-imenu-crumb-separator "")
(add-hook 'prog-mode-hook '(lambda () (add-hook 'prog-mode-hook #'(lambda ()
(setq header-line-format '( (setq header-line-format '(
" " (:eval (breadcrumb-project-crumbs)) " " (:eval (breadcrumb-project-crumbs))
" : " (:eval (breadcrumb-imenu-crumbs)))))) " : " (:eval (breadcrumb-imenu-crumbs))))))
;; vterm, a terminal emulator
(package-install 'vterm)
(add-hook 'vterm-mode-hook (lambda ()
(evil-local-mode -1)
(hl-line-mode -1)))
;; misc ;; misc
;; guess the major mode from file name ;; guess the major mode from file name