|
diff --git a/emacs.el b/emacs.el
|
| 1 |
(require 'package) |
|
|
| 2 |
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/") t) |
|
|
| 3 |
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")) |
|
|
| 4 |
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/")) |
|
|
| 5 |
(package-initialize) |
|
|
| 6 |
|
|
|
| 7 |
(setq custom-file "~/.config/emacs/custom.el") |
|
|
| 8 |
(when (file-exists-p custom-file) |
|
|
| 9 |
(load custom-file)) |
|
|
| 10 |
|
|
|
| 11 |
;; Function to install packages if they're not already installed |
|
|
| 12 |
(defvar my-packages |
|
|
| 13 |
'(go-mode yaml-mode web-mode markdown-mode tree-sitter tree-sitter-langs |
|
|
| 14 |
editorconfig company drag-stuff eglot helm elfeed crux)) |
|
|
| 15 |
|
|
|
| 16 |
(defun install-my-packages () |
|
|
| 17 |
(unless package-archive-contents |
|
|
| 18 |
(package-refresh-contents)) |
|
|
| 19 |
(dolist (package my-packages) |
|
|
| 20 |
(unless (package-installed-p package) |
|
|
| 21 |
(package-install package)))) |
|
|
| 22 |
|
|
|
| 23 |
(install-my-packages) |
|
|
| 24 |
|
|
|
| 25 |
;; General stuff |
|
|
| 26 |
(menu-bar-mode -1) |
|
|
| 27 |
(setq inhibit-startup-message t) |
|
|
| 28 |
(setq visible-bell t) |
|
|
| 29 |
(setq echo-keystrokes 0.1) |
|
|
| 30 |
(setq gc-cons-threshold 20000000) |
|
|
| 31 |
(setq make-backup-files nil) |
|
|
| 32 |
(setq create-lockfiles nil) |
|
|
| 33 |
(setq auto-save-default nil) |
|
|
| 34 |
(setq global-auto-revert-non-file-buffers t) |
|
|
| 35 |
(setq auto-revert-verbose nil) |
|
|
| 36 |
(setq-default tab-width 4) |
|
|
| 37 |
(setq-default truncate-lines t) |
|
|
| 38 |
(set-default 'indicate-empty-lines t) |
|
|
| 39 |
(setq electric-pair-preserve-balance nil) |
|
|
| 40 |
(setq byte-compile-warnings '(cl-functions)) |
|
|
| 41 |
(global-display-line-numbers-mode 1) |
|
|
| 42 |
(global-auto-revert-mode 1) |
|
|
| 43 |
(electric-pair-mode t) |
|
|
| 44 |
(show-paren-mode 1) |
|
|
| 45 |
(setq-default fill-column 80) |
|
|
| 46 |
(global-hl-line-mode 1) |
|
|
| 47 |
(set-face-background hl-line-face "gray13") |
|
|
| 48 |
(add-to-list 'default-frame-alist '(foreground-color . "#ffffff")) |
|
|
| 49 |
(add-to-list 'default-frame-alist '(background-color . "#151515")) |
|
|
| 50 |
|
|
|
| 51 |
;; Key rebinds |
|
|
| 52 |
(global-set-key (kbd "C-z") 'undo-only) |
|
|
| 53 |
(global-set-key (kbd "C-S-z") 'undo-redo) |
|
|
| 54 |
(global-set-key (kbd "M-s") 'save-buffer) |
|
|
| 55 |
(global-set-key (kbd "C-f") 'isearch-forward) |
|
|
| 56 |
(global-set-key (kbd "M-f") 'fill-paragraph) |
|
|
| 57 |
(global-set-key (kbd "C-x C-c") 'kill-emacs) |
|
|
| 58 |
(global-set-key (kbd "M-q") 'kill-emacs) |
|
|
| 59 |
(global-set-key (kbd "M-<right>") 'end-of-line) |
|
|
| 60 |
(global-set-key (kbd "M-<left>") 'beginning-of-line) |
|
|
| 61 |
(global-set-key (kbd "M-d") 'crux-duplicate-current-line-or-region) |
|
|
| 62 |
(global-set-key (kbd "M-k") 'crux-kill-whole-line) |
|
|
| 63 |
(global-set-key (kbd "C-h") 'crux-kill-line-backwards) |
|
|
| 64 |
(global-set-key (kbd "C-k") 'crux-kill-other-buffers) |
|
|
| 65 |
(global-set-key (kbd "M-v") 'visual-line-mode) |
|
|
| 66 |
(global-set-key (kbd "C-_") (lambda() (interactive) (comment-line 1) (previous-line 1))) |
|
|
| 67 |
|
|
|
| 68 |
;; Move line up and down |
|
|
| 69 |
(drag-stuff-mode t) |
|
|
| 70 |
(global-set-key (kbd "M-<up>") 'drag-stuff-up) |
|
|
| 71 |
(global-set-key (kbd "M-<down>") 'drag-stuff-down) |
|
|
| 72 |
|
|
|
| 73 |
;; Save a list of recent files visited. (open recent file with C-x f) |
|
|
| 74 |
(recentf-mode 1) |
|
|
| 75 |
(setq recentf-max-saved-items 100) |
|
|
| 76 |
|
|
|
| 77 |
;; Helm stuff |
|
|
| 78 |
(require 'helm) |
|
|
| 79 |
(helm-autoresize-mode 1) |
|
|
| 80 |
(setq helm-autoresize-max-height 25 helm-autoresize-min-height 25) |
|
|
| 81 |
(global-set-key (kbd "M-x") 'helm-M-x) |
|
|
| 82 |
(global-set-key (kbd "C-p") 'helm-find-files) |
|
|
| 83 |
(global-set-key (kbd "C-b") 'helm-buffers-list) |
|
|
| 84 |
(global-set-key (kbd "C-x C-_") 'helm-find) |
|
|
| 85 |
|
|
|
| 86 |
;; Enables editorconfig |
|
|
| 87 |
(editorconfig-mode 1) |
|
|
| 88 |
|
|
|
| 89 |
;; Enable company mode completion |
|
|
| 90 |
(add-hook 'after-init-hook 'global-company-mode) |
|
|
| 91 |
|
|
|
| 92 |
;; Eglot LSP |
|
|
| 93 |
(setq eglot-ignored-server-capabilities '(:inlayHintProvider)) |
|
|
| 94 |
(add-hook 'c-mode-hook 'eglot-ensure) |
|
|
| 95 |
(add-hook 'go-mode-hook 'eglot-ensure) |
|
|
| 96 |
(add-hook 'tcl-mode-hook 'eglot-ensure) |
|
|
| 97 |
(add-hook 'sh-mode-hook 'eglot-ensure) |
|
|
| 98 |
(add-hook 'python-mode-hook 'eglot-ensure) |
|
|
| 99 |
(add-hook 'lua-mode-hook 'eglot-ensure) |
|
|
| 100 |
(add-hook 'js-mode-hook 'eglot-ensure) |
|
|
| 101 |
|
|
|
| 102 |
;; Go format before save |
|
|
| 103 |
(add-hook 'go-mode-hook |
|
|
| 104 |
(lambda () |
|
|
| 105 |
(add-hook 'before-save-hook 'gofmt-before-save) |
|
|
| 106 |
(setq tab-width 4) |
|
|
| 107 |
(setq indent-tabs-mode 1))) |
|
|
| 108 |
|
|
|
| 109 |
;; Enables tree sitter |
|
|
| 110 |
(global-tree-sitter-mode) |
|
|
| 111 |
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode) |
|
|
| 112 |
|
|
|
| 113 |
;; Templating engines |
|
|
| 114 |
(require 'web-mode) |
|
|
| 115 |
(add-to-list 'auto-mode-alist '("\\.twig\\'" . web-mode)) |
|
|
| 116 |
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) |
|
|
| 117 |
(add-to-list 'auto-mode-alist '("\\.django\\'" . web-mode)) |
|
|
| 118 |
(setq web-mode-enable-current-element-highlight t) |
|
|
| 119 |
(setq web-mode-enable-current-column-highlight t) |
|
|
| 120 |
;; (setq web-mode-enable-auto-pairing t) |
|
|
| 121 |
;; (setq web-mode-enable-auto-closing t) |
|
|
| 122 |
|
|
|
| 123 |
;; RSS Feeds |
|
|
| 124 |
(setq elfeed-search-filter "@48-months-ago") |
|
|
| 125 |
(setq elfeed-feeds '( |
|
|
| 126 |
("https://landley.net/rss.xml") |
|
|
| 127 |
("https://blog.regehr.org/feed") |
|
|
| 128 |
("https://szymonkaliski.com/feed.xml") |
|
|
| 129 |
("https://world.hey.com/dhh/feed.atom") |
|
|
| 130 |
("https://workchronicles.com/feed/") |
|
|
| 131 |
("https://mitchellh.com/feed.xml") |
|
|
| 132 |
("https://matt-rickard.com/rss") |
|
|
| 133 |
("https://solar.lowtechmagazine.com/posts/index.xml") |
|
|
| 134 |
("https://utcc.utoronto.ca/~cks/space/blog/?atom") |
|
|
| 135 |
("https://gosamples.dev/index.xml") |
|
|
| 136 |
("https://neil.computer/rss/") |
|
|
| 137 |
("https://matduggan.com/rss/") |
|
|
| 138 |
("https://michael.stapelberg.ch/feed.xml") |
|
|
| 139 |
("https://offbeatpursuit.com/blog/index.rss") |
|
|
| 140 |
("https://offbeatpursuit.com/paste/index.rss") |
|
|
| 141 |
("https://offbeatpursuit.com/notes/index.rss") |
|
|
| 142 |
("https://emacsredux.com/atom.xml") |
|
|
| 143 |
("https://journal.valeriansaliou.name/rss/") |
|
|
| 144 |
("https://www.taniarascia.com/rss.xml") |
|
|
| 145 |
("https://crawl.develz.org/wordpress/feed") |
|
|
| 146 |
("https://snarky.ca/rss/") |
|
|
| 147 |
("https://www.jeffgeerling.com/blog.xml") |
|
|
| 148 |
("https://serokell.io/blog.rss.xml") |
|
|
| 149 |
("https://www.duskborn.com/index.xml") |
|
|
| 150 |
("https://mirzapandzo.com/rss.xml") |
|
|
| 151 |
("https://blog.boot.dev/index.xml") |
|
|
| 152 |
("https://macwright.com/rss.xml") |
|
|
| 153 |
)) |
|
|
| 154 |
|
|
|