this repo has no description
1;; -*- lexical-binding: t; -*-
2
3(require 'keymap)
4(require 'package)
5(require 'use-package)
6
7;; -- helpers
8
9(defmacro xx (&rest body) nil)
10
11(defun jonathan/home (&optional path)
12 (expand-file-name (or path "") "/home/jonathan"))
13
14(defun jonathan/homed (&optional path)
15 (directory-file-name (jonathan/home path)))
16
17(defun jonathan/emacs (&optional path)
18 (expand-file-name (or path "") user-emacs-directory))
19
20(defun jonathan/emacsd (&optional path)
21 (directory-file-name (jonathan/emacs path)))
22
23;; -- setup
24
25(setq use-package-always-ensure t)
26
27(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
28(add-to-list 'package-archives '("elpa-dev" . "https://elpa.gnu.org/devel/"))
29
30(add-to-list 'load-path (jonathan/emacsd "site-lisp"))
31(setq temporary-file-directory (jonathan/homed "tmp"))
32
33(defun browse-url-firefox-flatpak (url &optional new-window)
34 (interactive (browse-url-interactive-arg "URL: "))
35 (let* ((command "flatpak")
36 (window-arg (if new-window "--new-window" "--new-tab"))
37 (args (list "run" "org.mozilla.firefox" window-arg url)))
38 (apply #'start-process "firefox-flatpak" nil command args)))
39(setq browse-url-browser-function #'browse-url-firefox-flatpak)
40
41;; ---
42
43(use-package emacs
44 :config
45 (global-goto-address-mode))
46
47(use-package no-littering
48 :init
49 (setq no-littering-etc-directory (jonathan/emacsd "etc"))
50 (setq no-littering-var-directory (jonathan/emacsd "var"))
51 (setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
52 (setq backup-directory-alist `(("." . ,(no-littering-expand-var-file-name "backups/")))))
53
54(use-package editorconfig
55 :config (editorconfig-mode))
56
57(use-package envrc
58 :init (setq envrc-debug nil)
59 :config (envrc-global-mode))
60
61(use-package exec-path-from-shell
62 :config (exec-path-from-shell-initialize))
63
64(use-package whitespace
65 :hook (before-save-hook . whitespace-cleanup))
66
67(use-package evil
68 :hook ((prog-mode . evil-local-mode)
69 (text-mode . evil-local-mode)
70 (diff-mode . evil-local-mode)
71 (wdired-mode . evil-local-mode)))
72
73(use-package evil-commentary
74 :hook ((evil-mode . evil-commentary-mode)
75 (evil-local-mode . evil-commentary-mode)))
76
77(use-package evil-surround
78 :hook ((evil-mode . evil-surround-mode)
79 (evil-local-mode . evil-surround-mode)))
80
81(use-package tree-sitter)
82(use-package treesit-langs
83 :vc (:url "https://github.com/emacs-tree-sitter/treesit-langs")
84 :config (treesit-langs-major-mode-setup))
85
86(use-package lsp-mode
87 :hook (prog-mode . lsp-mode)
88 :init
89 ;; this should fix the weird import renaming in typescript
90 (setq lsp-apply-edits-after-file-operations nil)
91 (setq lsp-warn-no-matched-clients nil)
92 (setq lsp-keymap-prefix "C-x l"))
93
94(use-package lsp-ui
95 :hook ((lsp-mode . lsp-diagnostics-mode)
96 (lsp-mode . lsp-completion-mode)
97 (lsp-mode . lsp-enable-which-key-integration)))
98
99(use-package yasnippet
100 :hook (prog-mode . yas-minor-mode))
101
102;; ---
103
104(use-package which-key
105 :config (which-key-mode))
106
107(use-package paren-face
108 :hook (prog-mode . paren-face-mode))
109
110(use-package highlight-parentheses
111 :hook ((prog-mode . highlight-parentheses-mode)
112 (minibuffer-setup-mode . highlight-parentheses-minibuffer-setup)))
113
114(use-package vertico
115 :config (vertico-mode))
116
117(use-package marginalia
118 :config (marginalia-mode))
119
120(use-package corfu
121 :config (global-corfu-mode))
122
123(use-package consult
124 :init
125 (keymap-substitute global-map #'switch-to-buffer #'consult-buffer)
126 (keymap-substitute project-prefix-map #'project-switch-to-buffer #'consult-project-buffer)
127 (keymap-substitute project-prefix-map #'project-find-regexp #'consult-ripgrep))
128
129(use-package magit)
130
131;; --- language stuff
132
133(add-to-list 'auto-mode-alist '("\\.mjs\\'" . js-mode))
134
135;; ---
136
137(use-package ef-themes)
138
139(custom-set-variables
140 ;; custom-set-variables was added by Custom.
141 ;; If you edit it by hand, you could mess it up, so be careful.
142 ;; Your init file should contain only one such instance.
143 ;; If there is more than one, they won't work right.
144 '(fill-column 110)
145 '(indent-tabs-mode nil)
146 '(line-spacing 0.25)
147 '(menu-bar-mode nil)
148 '(package-selected-packages
149 '(company consult corfu dap-mode docker-compose-mode ef-themes envrc evil-commentary evil-surround
150 exec-path-from-shell highlight-parentheses jj-mode lsp-java lsp-ui magit marginalia nix-ts-mode
151 no-littering olivetti paren-face treesit-langs typescript-mode vertico yasnippet))
152 '(package-vc-selected-packages
153 '((jj-mode :url "https://github.com/bolivier/jj-mode.el")
154 (treesit-langs :url "https://github.com/emacs-tree-sitter/treesit-langs")))
155 '(scroll-bar-mode nil)
156 '(tool-bar-mode nil)
157 '(typescript-indent-level 2))
158(custom-set-faces
159 ;; custom-set-faces was added by Custom.
160 ;; If you edit it by hand, you could mess it up, so be careful.
161 ;; Your init file should contain only one such instance.
162 ;; If there is more than one, they won't work right.
163 )
164(put 'dired-find-alternate-file 'disabled nil)