aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules
diff options
context:
space:
mode:
authorspl3g <spleefer6@yandex.ru>2025-04-13 00:03:06 +0300
committerspl3g <spleefer6@yandex.ru>2025-05-01 14:58:57 +0300
commit19f9c72bd9a453794ac9968b4a506d6915c34b02 (patch)
tree9c67e8506b2b4e5ec581148fe5bbe9b8c8f20014 /home-manager/homeModules
parent8a11ef819a3b730158f20ed7fbeed3807865c97e (diff)
fix(emacs): cleanup the config a bit
Diffstat (limited to 'home-manager/homeModules')
-rw-r--r--home-manager/homeModules/emacs/early-init.el9
-rw-r--r--home-manager/homeModules/emacs/init.el488
2 files changed, 252 insertions, 245 deletions
diff --git a/home-manager/homeModules/emacs/early-init.el b/home-manager/homeModules/emacs/early-init.el
index ce8d960..3a7d48a 100644
--- a/home-manager/homeModules/emacs/early-init.el
+++ b/home-manager/homeModules/emacs/early-init.el
@@ -189,9 +189,14 @@
;;; And that's mine
(setq package-enable-at-startup nil)
-(setenv "LSP_USE_PLISTS" "true")
(setq-default pgtk-wait-for-event-timeout 0)
-(setq vc-follow-symlinks t)
+
+(let ((mono-spaced-font "FiraCode Nerd Font")
+ (proportionately-spaced-font "Inconsonata"))
+ (set-face-attribute 'default nil :family mono-spaced-font :height 110 :weight 'medium)
+ (set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0)
+ (set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0)
+ (set-face-attribute 'italic nil :underline nil))
(provide 'early-init)
;;; early-init.el ends here
diff --git a/home-manager/homeModules/emacs/init.el b/home-manager/homeModules/emacs/init.el
index 2c0331e..805c74f 100644
--- a/home-manager/homeModules/emacs/init.el
+++ b/home-manager/homeModules/emacs/init.el
@@ -1,4 +1,4 @@
-(setq custom-file (locate-user-emacs-file "custom.el"))
+(setopt custom-file (locate-user-emacs-file "custom.el"))
(load custom-file :no-error-if-file-is-missing)
@@ -9,34 +9,32 @@
;;; Basic behaviour
-(use-package delsel
- :ensure nil
- :hook (elpaca-after-init . delete-selection-mode))
+(setopt uniquify-buffer-name-style 'forward)
-(setq uniquify-buffer-name-style 'forward)
+(setopt enable-recursive-minibuffers t)
;; Auto save
-(setq auto-save-default t)
-(setq auto-save-include-big-deletions t)
-(setq kill-buffer-delete-auto-save-files t)
+(setopt auto-save-default t)
+(setopt auto-save-include-big-deletions t)
+(setopt kill-buffer-delete-auto-save-files t)
;; Auto revert
-(setq revert-without-query (list ".") ; Do not prompt
- auto-revert-stop-on-user-input nil
- auto-revert-verbose t)
+(setopt revert-without-query (list ".") ; Do not prompt
+ auto-revert-stop-on-user-input nil
+ auto-revert-verbose t)
;; Revert other buffers (e.g, Dired)
-(setq global-auto-revert-non-file-buffers t)
-(add-hook 'after-init-hook #'global-auto-revert-mode)
+(setopt global-auto-revert-non-file-buffers t)
+(add-hook 'elpaca-after-init-hook #'global-auto-revert-mode)
;; Save place in buffer
-(setq save-place-limit 600)
-(add-hook 'after-init-hook #'save-place-mode)
+(setopt save-place-limit 600)
+(add-hook 'elpaca-after-init-hook #'save-place-mode)
(defun prot/keyboard-quit-dwim ()
@@ -67,7 +65,6 @@ The DWIM behaviour of this command is as follows:
(use-package no-littering
- :demand t
:config
(no-littering-theme-backups))
@@ -78,9 +75,26 @@ The DWIM behaviour of this command is as follows:
(which-key-mode))
-(use-package undo-tree
- :init
- (global-undo-tree-mode))
+(use-package vundo
+ :commands (vundo)
+ :hook (vundo-mode . (lambda () (visual-line-mode -1) (setopt truncate-lines t))))
+
+
+(use-package winner
+ :ensure nil
+ :bind ("C-0" . winner-undo)
+ :custom
+ (winner-dont-bind-my-keys t)
+ :hook (elpaca-after-init . winner-mode))
+
+
+(use-package repeat
+ :ensure nil
+ :hook (elpaca-after-init . repeat-mode))
+
+
+(use-package avy
+ :bind ("M-j" . avy-goto-char-timer))
(use-package helpful
@@ -92,8 +106,8 @@ The DWIM behaviour of this command is as follows:
("C-h F" . helpful-function)))
-(setq ediff-window-setup-function #'ediff-setup-windows-plain
- ediff-split-window-function #'split-window-horizontally)
+(setopt ediff-window-setup-function #'ediff-setup-windows-plain
+ ediff-split-window-function #'split-window-horizontally)
(electric-pair-mode t)
@@ -102,20 +116,12 @@ The DWIM behaviour of this command is as follows:
(global-set-key [remap list-buffers] 'ibuffer)
;;; Tweak the looks of Emacs
-(setq-default tab-width 4)
+(setopt-default tab-width 4)
(global-word-wrap-whitespace-mode t)
(global-visual-line-mode t)
-(let ((mono-spaced-font "FiraCode Nerd Font")
- (proportionately-spaced-font "Noto Serif"))
- (set-face-attribute 'default nil :family mono-spaced-font :height 110 :weight 'medium)
- (set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0)
- (set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0)
- (set-face-attribute 'italic nil :underline nil))
-
-
;; Mode Line
(use-package mood-line
;; Enable mood-line
@@ -163,39 +169,25 @@ The DWIM behaviour of this command is as follows:
;; Scrolling
-(setq scroll-conservatively 101)
-(setq scroll-margin 5)
-(setq mouse-wheel-progressive-speed nil)
-(setq fast-but-imprecise-scrolling t)
-(setq scroll-error-top-bottom t)
-(setq scroll-preserve-screen-position t)
+(setopt scroll-conservatively 101)
+(setopt scroll-margin 5)
+(setopt mouse-wheel-progressive-speed nil)
+(setopt fast-but-imprecise-scrolling t)
+(setopt scroll-error-top-bottom t)
+(setopt scroll-preserve-screen-position t)
;; Annoyances
(blink-cursor-mode -1)
-(setq visible-bell nil)
-(setq ring-bell-function #'ignore)
-(setq delete-pair-blink-delay 0.03)
-(setq blink-matching-paren nil)
+(setopt visible-bell nil)
+(setopt ring-bell-function #'ignore)
+(setopt delete-pair-blink-delay 0.03)
+(setopt blink-matching-paren nil)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
+(setopt display-line-numbers-width 3)
-
-;; Remember to do M-x and run `nerd-icons-install-fonts' to get the
-;; font files. Then restart Emacs to see the effect.
-(use-package nerd-icons
- :ensure t)
-
-(use-package nerd-icons-corfu
- :ensure t
- :after corfu
- :config
- (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
-
-
-(use-package indent-guide
- :hook (prog-mode . indent-guide-mode))
-
+(kill-ring-deindent-mode)
;;; Configure the minibuffer and completions
@@ -203,8 +195,6 @@ The DWIM behaviour of this command is as follows:
:ensure t
:hook (elpaca-after-init . vertico-mode)
:bind (:map vertico-map
- ("M-j" . vertico-next)
- ("M-k" . vertico-previous)
("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word)))
@@ -215,23 +205,10 @@ The DWIM behaviour of this command is as follows:
:hook (elpaca-after-init . marginalia-mode))
-(use-package prescient
- :config
- (prescient-persist-mode)
- (setq completion-styles '(prescient basic)
- completion-category-overrides '((file (styles basic partial-completion))))
- :custom-face
- (prescient-primary-highlight ((t (:inherit 'font-lock-keyword-face)))))
-
-(use-package corfu-prescient
- :after corfu
- :config
- (corfu-prescient-mode))
-
-(use-package vertico-prescient
- :after vertico
- :config
- (vertico-prescient-mode))
+(use-package orderless
+ :custom
+ (completion-styles '(orderless basic))
+ (completion-category-overrides '((file (styles basic partial-completion)))))
(use-package savehist
@@ -267,10 +244,12 @@ The DWIM behaviour of this command is as follows:
:hook (elpaca-after-init . global-corfu-mode)
:bind (:map corfu-map
("M-j" . corfu-next)
- ("M-k" . corfu-previous))
+ ("M-k" . corfu-previous)
+ ([remap previous-line] . nil)
+ ([remap next-line] . nil))
:custom
(corfu-preselect 'prompt)
- (corfu-auto t)
+ (corfu-auto nil)
(corfu-popupinfo-delay '(1.25 . 0.5))
(corfu-auto-delay 0)
(corfu-auto-prefix 2)
@@ -282,7 +261,32 @@ The DWIM behaviour of this command is as follows:
(tab-always-indent 'complete)
(corfu-cycle t)
:config
- (corfu-popupinfo-mode 1))
+ (corfu-popupinfo-mode 1)
+ (corfu-history-mode 1))
+
+
+(use-package completion-preview
+ :ensure nil
+ :hook (elpaca-after-init . global-completion-preview-mode)
+ :bind (:map completion-preview-active-mode-map
+ ("TAB" . (lambda ()
+ (interactive)
+ (completion-preview-complete)
+ (completion-at-point)))
+
+ ("M-i" . (lambda ()
+ (interactive)
+ (let ((com (completion-preview--get 'completion-preview-common))
+ (ind (completion-preview--get 'completion-preview-index))
+ (all (completion-preview--get 'completion-preview-suffixes)))
+ (add-to-history 'corfu-history
+ (substring-no-properties
+ (concat com (nth ind all)))))
+ (completion-preview-insert)))
+ ("M-n" . completion-preview-next-candidate)
+ ("M-p" . completion-preview-prev-candidate))
+ :custom
+ (completion-preview-minimum-symbol-length 2))
@@ -330,120 +334,110 @@ The DWIM behaviour of this command is as follows:
;;; Eshell
-(add-hook 'eshell-mode-hook
- (lambda ()
- (setq-local corfu-auto nil)))
-
-
-(add-hook 'eshell-exec-hook (lambda (p)
- (buffer-disable-undo)))
-
-(add-hook 'eshell-kill-hook (lambda (p s)
- (buffer-enable-undo)))
-
-
-(setq eshell-history-size 500
- eshell-history-append t)
-
-
-
-(defun spl3g/eshell-dwim ()
- (interactive)
- (defvar current-prefix-arg)
- (let* ((project (project-current))
- (func (if project
- 'project-eshell
- 'eshell))
- (buffer-name (if project
- (format "*%s-eshell*" (project-name project))
- "*eshell*"))
- (current-prefix-arg t))
- (if (not (get-buffer buffer-name))
- (let ((buf (funcall func)))
- (switch-to-buffer (other-buffer buf))
- (switch-to-buffer-other-window buf))
- (switch-to-buffer-other-window buffer-name))))
-
-(defun spl3g/select-eshell ()
- (interactive)
- (let* ((eshell-buffers (seq-filter (lambda (buffer)
- (eq (with-current-buffer buffer major-mode)
- 'eshell-mode))
- (buffer-list)))
-
- (eshell-windows (remove nil (mapcar (lambda (buffer)
- (let* ((window (get-buffer-window buffer))
- (name (buffer-name buffer)))
- (when window
- (cons name window))))
- eshell-buffers)))
-
- (eshell-names (seq-filter (lambda (buffer) (not (eq buffer (buffer-name (current-buffer)))))
- (mapcar (lambda (buffer) (buffer-name buffer)) eshell-buffers)))
-
- (selected-buffer (if (length> eshell-buffers 1)
- (completing-read "Select eshell buffer: " eshell-names)
- (car eshell-buffers)))
- (selected-window (if (length> eshell-windows 1)
- (cdr (assoc (completing-read "Select window to place the buffer in: " eshell-windows) eshell-windows))
- (cdar eshell-windows))))
- (if selected-window
- (progn
- (select-window selected-window)
- (switch-to-buffer selected-buffer))
- (switch-to-buffer-other-window selected-buffer))))
-
-(defun spl3g/rename-current-eshell ()
- "Add NAME in <> to the current project eshell buffer"
- (interactive)
- (let* ((eshell-buffers (seq-filter (lambda (buffer)
- (eq (with-current-buffer buffer major-mode)
- 'eshell-mode))
- (buffer-list)))
- (eshell-names (mapcar (lambda (buffer) (buffer-name buffer)) eshell-buffers))
- (eshell-windows (remove nil (mapcar (lambda (buffer)
- (let* ((window (get-buffer-window buffer))
- (name (buffer-name buffer)))
- (when window
- (cons name window))))
- eshell-buffers)))
- (selected-window (if (and (sequencep eshell-windows) (length> eshell-windows 1))
- (assoc (completing-read "Select window to place the buffer in: " eshell-windows) eshell-windows)
- (car eshell-windows)))
- (additional-name (when selected-window
- (read-string "Additional name: ")))
- (buffer-name (when selected-window
- (car (split-string (car selected-window) "<"))))
- (formatted-name (if (length> additional-name 0)
- (format "%s<%s>" buffer-name additional-name)
- buffer-name))
- )
- (if selected-window
- (with-current-buffer (car selected-window)
- (rename-buffer formatted-name))
- (message "No eshell buffers"))))
-
-(keymap-global-set "C-c o t" 'spl3g/eshell-dwim)
-(keymap-global-set "C-c o s" 'spl3g/select-eshell)
-(keymap-global-set "C-c o r" 'spl3g/rename-current-eshell)
-
-
-;; Save history on every command
-(with-eval-after-load 'eshell
- (setq eshell-save-history-on-exit nil)
+(use-package eshell
+ :ensure nil
+ :hook
+ (eshell-exec . (lambda (p) (buffer-disable-undo)))
+ (eshell-kill . (lambda (p s) (buffer-enable-undo)))
+ (eshell-pre-command . eshell-append-history)
+
+ :bind (("C-c o t" . spl3g/eshell-dwim)
+ ("C-c o s" . spl3g/select-eshell)
+ ("C-c o r" . spl3g/rename-current-eshell))
+
+ :custom
+ (eshell-history-size 500)
+ (eshell-history-append t)
+ (eshell-save-history-on-exit nil)
+
+ :config
+ (add-to-list 'eshell-modules-list 'eshell-tramp)
+
+ ;; Save history on every command
(defun eshell-append-history ()
"Call `eshell-write-history' with the `append' parameter set to `t'."
(when eshell-history-ring
- (let ((newest-cmd-ring (make-ring 1)))
+ (let ((newest-cmd-ring (make-ring 1)))
(ring-insert newest-cmd-ring (car (ring-elements eshell-history-ring)))
(let ((eshell-history-ring newest-cmd-ring))
- (eshell-write-history eshell-history-file-name t)))))
-
- (add-hook 'eshell-pre-command-hook 'eshell-append-history))
-
-
-(with-eval-after-load 'eshell
- (add-to-list 'eshell-modules-list 'eshell-tramp))
+ (eshell-write-history eshell-history-file-name t)))))
+
+
+ (defun spl3g/eshell-dwim ()
+ (interactive)
+ (defvar current-prefix-arg)
+ (let* ((project (project-current))
+ (func (if project
+ 'project-eshell
+ 'eshell))
+ (buffer-name (if project
+ (format "*%s-eshell*" (project-name project))
+ "*eshell*"))
+ (current-prefix-arg t))
+ (if (not (get-buffer buffer-name))
+ (let ((buf (funcall func)))
+ (switch-to-buffer (other-buffer buf))
+ (switch-to-buffer-other-window buf))
+ (switch-to-buffer-other-window buffer-name))))
+
+ (defun spl3g/select-eshell ()
+ (interactive)
+ (let* ((eshell-buffers (seq-filter (lambda (buffer)
+ (eq (with-current-buffer buffer major-mode)
+ 'eshell-mode))
+ (buffer-list)))
+
+ (eshell-windows (remove nil (mapcar (lambda (buffer)
+ (let* ((window (get-buffer-window buffer))
+ (name (buffer-name buffer)))
+ (when window
+ (cons name window))))
+ eshell-buffers)))
+
+ (eshell-names (seq-filter (lambda (buffer) (not (eq buffer (buffer-name (current-buffer)))))
+ (mapcar (lambda (buffer) (buffer-name buffer)) eshell-buffers)))
+
+ (selected-buffer (if (length> eshell-buffers 1)
+ (completing-read "Select eshell buffer: " eshell-names)
+ (car eshell-buffers)))
+ (selected-window (if (length> eshell-windows 1)
+ (cdr (assoc (completing-read "Select window to place the buffer in: " eshell-windows) eshell-windows))
+ (cdar eshell-windows))))
+ (if selected-window
+ (progn
+ (select-window selected-window)
+ (switch-to-buffer selected-buffer))
+ (switch-to-buffer-other-window selected-buffer))))
+
+ (defun spl3g/rename-current-eshell ()
+ "Add NAME in <> to the current project eshell buffer"
+ (interactive)
+ (let* ((eshell-buffers (seq-filter (lambda (buffer)
+ (eq (with-current-buffer buffer major-mode)
+ 'eshell-mode))
+ (buffer-list)))
+ (eshell-names (mapcar (lambda (buffer) (buffer-name buffer)) eshell-buffers))
+ (eshell-windows (remove nil (mapcar (lambda (buffer)
+ (let* ((window (get-buffer-window buffer))
+ (name (buffer-name buffer)))
+ (when window
+ (cons name window))))
+ eshell-buffers)))
+ (selected-window (if (and (sequencep eshell-windows) (length> eshell-windows 1))
+ (assoc (completing-read "Select window to place the buffer in: " eshell-windows) eshell-windows)
+ (car eshell-windows)))
+ (additional-name (when selected-window
+ (read-string "Additional name: ")))
+ (buffer-name (when selected-window
+ (car (split-string (car selected-window) "<"))))
+ (formatted-name (if (length> additional-name 0)
+ (format "%s<%s>" buffer-name additional-name)
+ buffer-name))
+ )
+ (if selected-window
+ (with-current-buffer (car selected-window)
+ (rename-buffer formatted-name))
+ (message "No eshell buffers")))))
(use-package eat
@@ -468,23 +462,16 @@ The DWIM behaviour of this command is as follows:
:hook (eshell-mode . eshell-syntax-highlighting-mode))
-(use-package fish-completion
- :hook (eshell-mode . fish-completion-mode))
+;;; Programming things
-;;; Programming things
-(use-package tempel
- :bind (:map tempel-map
- ("M-TAB" . tempel-next))
- :custom
- (tempel-trigger-prefix "<")
- :init
- (add-hook 'completion-at-point-functions #'tempel-complete))
+(use-package yasnippet
+ :hook (elpaca-after-init . yas-global-mode))
-(use-package tempel-collection
- :ensure t
- :after tempel)
+
+(use-package yasnippet-snippets
+ :after yasnippet)
(use-package apheleia
@@ -501,6 +488,8 @@ The DWIM behaviour of this command is as follows:
:commands scratch)
+(use-package transient)
+
(use-package magit
:after transient
:bind (("C-c o g" . magit)))
@@ -542,7 +531,7 @@ The DWIM behaviour of this command is as follows:
:config
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
- (setq-default
+ (setopt-default
eglot-workspace-configuration
`(:nixd ( :nixpkgs (:expr "import <nixpkgs> { }")
:formatting (:command ["nixpkgs-fmt"])
@@ -550,40 +539,13 @@ The DWIM behaviour of this command is as follows:
:home-manager (:expr "(builtins.getFlake \"/home/jerpo/nixfiles\").homeConfigurations.\"jerpo@ltrr-mini\".options"))))))
-(use-package lsp-snippet-tempel
- :ensure (:host github :repo "tpeacock19/lsp-snippet")
- :config
- (lsp-snippet-tempel-eglot-init))
-
-
-(use-package flycheck-eglot
- :hook (global-flycheck-mode . global-flycheck-eglot-mode))
-
-(use-package flycheck
- :config
- (add-to-list 'display-buffer-alist
- '("\\*Flycheck"
- (display-buffer-reuse-window display-buffer-at-bottom)
- (reusable-frames . visible)
- (window-height . 0.35)))
- (add-to-list 'flycheck-checkers 'python-ruff)
- :hook (elpaca-after-init . global-flycheck-mode))
-
+(use-package dumb-jump
+ :commands (dumb-jump-xref-activate)
+ :init
+ (add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
-(use-package sideline
- :custom
- (sideline-truncate t))
-(use-package sideline-flycheck
- :after (flycheck sideline)
- :hook
- (flycheck-mode . sideline-mode)
- (flycheck-mode . sideline-flycheck-setup)
- :custom
- (flycheck-display-errors-function nil)
- (sideline-flycheck-display-mode 'line)
- :init
- (add-to-list 'sideline-backends-right 'sideline-flycheck))
+(use-package dape)
@@ -612,21 +574,22 @@ The DWIM behaviour of this command is as follows:
:hook (web-mode . emmet-mode))
-(use-package org-mode
- :ensure nil
- :custom
- (org-startup-indented t)
- :mode "\\.org\\'")
-
-
(use-package nix-mode
:mode ("\\.nix\\'" "\\.nix.in\\'"))
(use-package typescript-ts-mode
:ensure nil
- :hook (typescript-ts-mode . (lambda () (setq forward-sexp-function nil)))
- :custom (typescript-ts-mode-indent-offset tab-width))
+ :mode ("\\.ts\\'")
+ :hook (typescript-ts-mode . (lambda () (setopt-local forward-sexp-function nil)))
+ :custom
+ (typescript-ts-mode-indent-offset tab-width))
+
+
+(use-package go-ts-mode
+ :ensure nil
+ :custom
+ (go-ts-mode-indent-offset tab-width))
(use-package markdown-mode
@@ -636,7 +599,46 @@ The DWIM behaviour of this command is as follows:
(use-package sql-indent
:hook (sql-mode . sqlind-minor-mode))
-(setq sql-sqlite-program "sqlite3")
+(setopt sql-connection-alist
+ '(("postgres-sirius"
+ (sql-product 'postgres)
+ (sql-user "college")
+ (sql-server "127.0.0.1")
+ (sql-database "coll")
+ (sql-port 5432))))
+
+(setopt sql-sqlite-program "sqlite3")
+
+
+(use-package elm-mode
+ :mode "\\.elm\\'")
+
+
+(use-package verb
+ :after org
+ :config (define-key org-mode-map (kbd "C-c C-r") verb-command-map))
+
+
+;; Notetaking
+
+
+(use-package org-mode
+ :ensure nil
+ :hook (org-mode . variable-pitch-mode)
+ :custom
+ (org-startup-indented t)
+ :mode "\\.org\\'"
+ :config
+ (set-face-attribute 'org-table nil :inherit 'fixed-pitch))
+
+(use-package visual-fill-column
+ :hook
+ (org-mode . visual-fill-column-mode)
+ (org-mode . (lambda () (set-fill-column 90))))
+
+
+(use-package denote
+ :commands (denote denote-create-note denote-journal-extras-new-entry))
(provide 'init)