Files
dotfiles/.emacs

221 lines
7.9 KiB
Plaintext
Raw Permalink Normal View History

2024-03-08 16:49:14 +01:00
(add-to-list
'package-archives
'("stable" . "https://stable.melpa.org/packages/") t)
(add-to-list
'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(customize-set-variable
'package-archive-priorities
'(("gnu" . 99) ; prefer GNU packages
("nongnu" . 80) ; use non-gnu packages if not found in GNU elpa
("stable" . 70) ; prefer "released" versions from melpa
("melpa" . 1))) ; if all else fails, get it from melpa
(use-package emacs
:ensure nil
:custom
(treesit-language-source-alist
'((heex "https://github.com/phoenixframework/tree-sitter-heex")
(elixir "https://github.com/elixir-lang/tree-sitter-elixir")))
(major-mode-remap-alist
2024-03-08 16:49:14 +01:00
'((elixir-mode . elixir-ts-mode)))
:config
(global-prettify-symbols-mode))
(use-package eglot
:ensure nil
:config
(add-to-list 'eglot-server-programs
`((elixir-ts-mode heex-ts-mode) .
,(if (and (fboundp 'w32-shell-dos-semantics)
(w32-shell-dos-semantics))
'("language_server.bat")
(eglot-alternatives
'("language_server.sh"
2024-03-09 16:57:58 +01:00
"/home/rdiedrich/dev/3rdparty/lexical/_build/dev/package/lexical/bin/start_lexical.sh"))))))
(use-package elixir-ts-mode
:ensure t
:hook
(elixir-ts-mode . eglot-ensure)
(before-save . eglot-format))
2024-03-09 16:57:58 +01:00
(use-package ligature :ensure t
:config
;; Enable all Iosevka ligatures in programming modes
(ligature-set-ligatures
'prog-mode
;; Iosevka
;;'("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--"
;; "<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---"
;; "<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!=="
;; ":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++")
'(
"</" "</>" "/>" "~-" "-~" "~@" "<~" "<~>" "<~~" "~>" "~~" "~~>"
">=" "<=" "<!--" "##" "###" "####" "|-" "-|" "|->" "<-|" ">-|"
"|-<" "|=" "|=>" ">-" "<-" "<--" "-->" "->" "-<" ">->" ">>-"
"<<-" "<->" "->>" "-<<" "<-<" "==>" "=>" "=/=" "!==" "!=" "<=="
">>=" "=>>" ">=>" "<=>" "<=<" "=<=" "=>=" "<<=" "=<<" ".-" ".="
"=:=" "=!=" "==" "===" "::" ":=" ":>" ":<" ">:" "<:" ";;" "=~"
"!~" "::<" "<|" "<|>" "|>" "<>" "<$" "<$>" "$>" "<+" "<+>" "+>"
"?=" "/=" "/==" "/\\" "\\/" "__" "&&" "++" "+++"
))
;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'.
(global-ligature-mode t))
(use-package exec-path-from-shell
:if (memq window-system '(mac ns x))
:ensure t
:init
(setq exec-path-from-shell-variables '("PATH" "MANPATH"))
:config
(exec-path-from-shell-initialize))
(use-package rainbow-delimiters
:ensure t)
(use-package prog-mode
:ensure nil
:hook ((prog-mode . rainbow-delimiters-mode)))
2024-03-08 16:49:14 +01:00
(use-package helpful :ensure t
:bind
("C-h f" . helpful-callable)
("C-h v" . helpful-variable)
("C-h k" . helpful-key)
("C-h F" . helpful-function)
("C-h C" . helpful-command))
(use-package which-key :ensure t :config (which-key-mode))
(defun corfu-enable-in-minibuffer ()
"Enable Corfu in the minibuffer if `completion-at-point' is bound."
(when (where-is-internal #'completion-at-point (list (current-local-map)))
;; (setq-local corfu-auto nil) ;; Enable/disable auto completion
(setq-local
corfu-echo-delay nil ;; Disable automatic echo and (point)opup
corfu-popupinfo-delay nil)
(corfu-mode 1)))
(use-package corfu :ensure t
:bind
(:map
corfu-map
("<escape>" . corfu-quit)
("<return>" . corfu-insert)
("M-n" . corfu-popupinfo-scroll-up)
("M-p" . corfu-popupinfo-scroll-down))
:custom
;; Works with `indent-for-tab-command'. Make sure tab doesn't indent when you
;; want to perform completion
(tab-always-indent 'complete) (corfu-auto nil) (corfu-auto-prefix 2) (corfu-auto-delay 0.25)
(corfu-preview-current 'insert) (corfu-preselect-first t)
:init (global-corfu-mode) (corfu-popupinfo-mode) (corfu-echo-mode)
:hook (minibuffer-setup . corfu-enable-in-minibuffer))
(use-package cape :ensure t
;; Bind dedicated completion commands
;; Alternative prefix keys: C-c p, M-p, M-+, ...
:bind
(("M-/" . completion-at-point) ;; capf
("C-c p t" . complete-tag) ;; etags
("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
("C-c p h" . cape-history)
("C-c p f" . cape-file)
("C-c p k" . cape-keyword)
("C-c p s" . cape-symbol)
("C-c p a" . cape-abbrev)
("C-c p i" . cape-ispell)
("C-c p l" . cape-line)
("C-c p w" . cape-dict)
("C-c p \\" . cape-tex)
("C-c p _" . cape-tex)
("C-c p ^" . cape-tex)
("C-c p &" . cape-sgml)
("C-c p r" . cape-rfc1345))
:init
2024-03-08 16:49:14 +01:00
;; Add `completion-at-point-functions', used by `completion-at-point'.
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-ispell)
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
2024-03-08 16:49:14 +01:00
;; Enable vertico
(use-package vertico :ensure t :init (vertico-mode))
(use-package consult :ensure t
:bind
( ;; C-c bindings (mode-specific-map)
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
("s-b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings (search-map)
("M-s d" . consult-find)
("M-s D" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("C-s" . consult-line)
("M-s L" . consult-line-multi)
("M-s m" . consult-multi-occur)
("M-s u" . consult-focus-lines)
:map
isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map
minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
:hook (completion-list-mode . consult-preview-at-point-mode))
;; Optionally use the `orderless' completion style.
(use-package orderless :ensure t
:init
2024-03-08 16:49:14 +01:00
(setq
completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
2024-03-08 16:49:14 +01:00
;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist :ensure t :init (savehist-mode))
(use-package multiple-cursors :ensure t
:bind ("C->" . 'mc/mark-next-like-this) ("C-<" . 'mc/mark-previous-like-this))
2024-03-08 16:49:14 +01:00
(use-package magit :ensure t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(leuven))
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
2024-03-09 16:57:58 +01:00
'(menu-bar-mode nil)
'(package-selected-packages
2024-03-09 16:57:58 +01:00
'(color-theme-sanityinc-tomorrow ligature magit elixir-yasnippets consult-yasnippet rainbow-delimiters exec-path-from-shell elixir-mode elixir-ts-mode paredit par-edit org))
'(scroll-bar-mode nil)
2024-03-09 16:57:58 +01:00
'(tool-bar-mode nil)
'(tooltip-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
2024-03-09 16:57:58 +01:00
'(default ((t (:family "Victor Mono" :foundry "UKWN" :slant normal :weight regular :height 181 :width normal)))))