323 lines
11 KiB
EmacsLisp
323 lines
11 KiB
EmacsLisp
;;; -*- lexical-binding: t -*-
|
|
(use-package savehist
|
|
:config (savehist-mode))
|
|
|
|
(use-package orderless
|
|
:straight t
|
|
:config
|
|
(setq completion-styles '(orderless basic)
|
|
completion-category-defaults nil
|
|
completion-category-overrides '((file (styles partial-completion)))))
|
|
|
|
|
|
(use-package marginalia
|
|
:straight t
|
|
:bind (:map minibuffer-local-map
|
|
("M-A" . marginalia-cycle))
|
|
:config
|
|
(marginalia-mode))
|
|
|
|
(use-package consult
|
|
:straight t
|
|
:bind (;; global binds
|
|
("C-c M-x" . consult-mode-command)
|
|
("C-c h" . consult-history)
|
|
("C-c k" . consult-kmacro)
|
|
("C-c m" . consult-man)
|
|
("C-c i" . consult-info)
|
|
("M-y" . consult-yank-pop)
|
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
|
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
|
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
|
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
|
;; goto-map
|
|
("M-g e" . consult-compile-error)
|
|
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
|
("M-g g" . consult-goto-line) ;; orig. goto-line
|
|
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
|
("M-g m" . consult-mark)
|
|
("M-g k" . consult-global-mark)
|
|
("M-g i" . consult-imenu)
|
|
("M-g I" . consult-imenu-multi)
|
|
;; 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)
|
|
("M-s L" . consult-line-multi)
|
|
("M-s k" . consult-keep-lines)
|
|
("M-s u" . consult-focus-lines)
|
|
:map minibuffer-local-map
|
|
("M-s" . consult-history)
|
|
("M-r" . consult-history))
|
|
:config
|
|
(setq consult-narrow-key "<"))
|
|
|
|
(use-package vertico
|
|
:straight t
|
|
:bind (:map vertico-map
|
|
("?" . minibuffer-completion-help)
|
|
("M-TAB" . minibuffer-complete))
|
|
:init
|
|
(vertico-mode))
|
|
|
|
(use-package emacs
|
|
:custom
|
|
(context-menu-mode 1)
|
|
(enable-recursive-minibuffers t))
|
|
|
|
;; (use-package org
|
|
;; :straight t
|
|
;; :bind (("C-c a" . org-agenda)
|
|
;; ("C-c c" . org-capture)
|
|
;; ("C-c l" . org-store-link)
|
|
;; :map org-mode-map
|
|
;; ("C-c 1" . org-time-stamp-inactive))
|
|
;; :config
|
|
;; ;; autosave advises for agenda and org-capture
|
|
;; (advice-add 'org-agenda-quit :before 'org-save-all-org-buffers)
|
|
;; (advice-add 'org-capture-finalize :after 'org-save-all-org-buffers)
|
|
;; (advice-add 'org-capture-refile :after 'org-save-all-org-buffers)
|
|
;;
|
|
;; ;; latex preview settings
|
|
;; (setq org-preview-latex-image-directory "~/.emacs.d/org-latex-preview/") ; Hide all previews in one place
|
|
;;
|
|
;; ;; habits support
|
|
;; (require 'org-habit)
|
|
;; (add-to-list 'org-modules 'org-habit)
|
|
;;
|
|
;; ;; babel
|
|
;; (org-babel-do-load-languages
|
|
;; 'org-babel-load-languages
|
|
;; '((R . t)))
|
|
;;
|
|
;; ;; org-id - link by UUID
|
|
;; (require 'org-id)
|
|
;; (setq org-id-method 'uuid
|
|
;; org-id-link-to-org-use-id t)
|
|
;; ;; abbrev expansion in org-mode
|
|
;; (require 'org-tempo)
|
|
;;
|
|
;; ;; we need indentation
|
|
;; (setq org-startup-indented nil
|
|
;; org-indent-mode-turns-on-hiding-stars nil
|
|
;; org-hide-leading-stars nil
|
|
;; org-startup-folded 'content)
|
|
;; ;; default agenda files
|
|
;; (setq org-agenda-files '("~/org/"))
|
|
;;
|
|
;; ;; default agenda view
|
|
;; (setq org-agenda-start-day "-3d"
|
|
;; org-agenda-span 13)
|
|
;; ;; templates
|
|
;; (setq org-capture-templates
|
|
;; '(("n" "note" entry
|
|
;; (file+headline "~/org/inbox.org" "Notes")
|
|
;; "** %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
|
|
;; ("t" "TODO" entry
|
|
;; (file+headline "~/org/inbox.org" "Tasks")
|
|
;; "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
|
|
;; ("j" "Journal" entry
|
|
;; (file+olp+datetree "~/org/log.org.gpg")
|
|
;; "**** %U %?\n")
|
|
;; ("b" "Bookmark" entry
|
|
;; (file+headline "~/org/bookmarks.org" "bookmarks-inbox")
|
|
;; "** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n[[%x]]\n"))))
|
|
|
|
(use-package tex-site
|
|
:straight auctex
|
|
:hook ((LaTeX-mode . TeX-PDF-mode)
|
|
(LaTeX-mode . reftex-mode)
|
|
(LaTeX-mode . LaTeX-math-mode))
|
|
:config
|
|
(require 'auctex)
|
|
(setq TeX-parse-self t)
|
|
(setq reftex-plug-into-AUCTeX t))
|
|
|
|
(use-package mu4e
|
|
:commands mu4e
|
|
:config
|
|
(setq mu4e-change-filenames-when-moving t)
|
|
(setq mu4e-maildir "~/mail")
|
|
(setq mu4e-update-interval (* 11 60))
|
|
(setq mu4e-contexts
|
|
(list
|
|
(make-mu4e-context
|
|
:name "oxapentane.com"
|
|
:match-func (lambda (msg)
|
|
(when msg
|
|
(string-prefix-p "/grigory@shipunov.xyz" (mu4e-message-field msg :maildir))))
|
|
:vars '((user-mail-address . "grigory@shipunov.xyz")
|
|
(user-full-name . "Grisha Shipunov")
|
|
(mu4e-drafts-folder . "/grigory@shipunov.xyz/Drafts")
|
|
(mu4e-sent-folder . "/grigory@shipunov.xyz/Sent")
|
|
(mu4e-trash-folder . "/grigory@shipunov.xyz/Trash")
|
|
(mu4e-refile-folder . "/grigory@shipunov.xyz/Archive")
|
|
(mu4e-maildir-shortcuts . (("/grigory@shipunov.xyz/INBOX" . "?i")
|
|
("/grigory@shipunov.xyz/Drafts" . "?d")
|
|
("/grigory@shipunov.xyz/Sent" . "?s")))))
|
|
(make-mu4e-context
|
|
:name "oxapentane.com"
|
|
:match-func (lambda (msg)
|
|
(when msg
|
|
(string-prefix-p "/mail@oxapentane.com" (mu4e-message-field msg :maildir))))
|
|
:vars '((user-mail-address . "mail@oxapentane.com")
|
|
(user-full-name . "Grisha Shipunov")
|
|
(mu4e-drafts-folder . "/mail@oxapentane.com/Drafts")
|
|
(mu4e-sent-folder . "/mail@oxapentane.com/Sent")
|
|
(mu4e-trash-folder . "/mail@oxapentane.com/Trash")
|
|
(mu4e-refile-folder . "/mail@oxapentane.com/Archive")
|
|
(mu4e-maildir-shortcuts . (("/mail@oxapentane.com/INBOX" . "?i")
|
|
("/mail@oxapentane.com/Drafts" . "?d")
|
|
("/mail@oxapentane.com/Sent" . "?s")
|
|
("/mail@oxapentane.com/sinkhole" . "?S"))))))))
|
|
|
|
|
|
(use-package modus-themes
|
|
:straight t
|
|
:demand t
|
|
:init
|
|
(setq modus-themes-italic-constructs t
|
|
modus-themes-bold-constructs t)
|
|
:config
|
|
(load-theme 'modus-operandi 1)
|
|
(setq-default indicate-empty-lines t)
|
|
(setq-default show-trailing-whitespace t)
|
|
(add-hook 'prog-mode-hook #'(lambda () (whitespace-mode t)))
|
|
|
|
(if (eq system-type 'gnu/linux)
|
|
(progn
|
|
;; match system theme
|
|
;; https://freerangebits.com/posts/2025/02/emacs-light-dark/
|
|
(defvar oxa:dark-theme 'modus-vivendi)
|
|
(defvar oxa:light-theme 'modus-operandi)
|
|
(defun oxa:theme-from-dbus (value)
|
|
(load-theme (if (= 1 (car (flatten-list value)))
|
|
oxa:dark-theme
|
|
oxa:light-theme)
|
|
t))
|
|
|
|
(require 'dbus)
|
|
|
|
;; Set the current theme based on what the system theme is right now:
|
|
(dbus-call-method-asynchronously
|
|
:session "org.freedesktop.portal.Desktop"
|
|
"/org/freedesktop/portal/desktop"
|
|
"org.freedesktop.portal.Settings"
|
|
"Read"
|
|
#'oxa:theme-from-dbus
|
|
"org.freedesktop.appearance"
|
|
"color-scheme")
|
|
|
|
;; Register to be notified when the system theme changes:
|
|
(dbus-register-signal
|
|
:session "org.freedesktop.portal.Desktop"
|
|
"/org/freedesktop/portal/desktop"
|
|
"org.freedesktop.portal.Settings"
|
|
"SettingChanged"
|
|
(lambda (path var value)
|
|
(when (and (string-equal path "org.freedesktop.appearance")
|
|
(string-equal var "color-scheme"))
|
|
(oxa:theme-from-dbus value)))))))
|
|
|
|
(use-package expand-region
|
|
:straight t
|
|
:bind ("C-=" . er/expand-region))
|
|
|
|
(use-package move-text
|
|
:straight t
|
|
:bind (("M-n" . move-text-down)
|
|
("M-p" . move-text-up)))
|
|
|
|
(use-package direnv
|
|
:straight t
|
|
:config (direnv-mode 1))
|
|
|
|
(use-package magit
|
|
:straight t
|
|
:bind (("C-x g" . magit-status)
|
|
("C-x M-g" . magit-dispatch)
|
|
("C-c M-g" . magit-file-dispatch)))
|
|
|
|
(use-package dired-sidebar
|
|
:straight t
|
|
:bind (:map oxamap
|
|
("t" . dired-sidebar-toggle-sidebar))
|
|
:config
|
|
(setq dired-sidebar-theme 'ascii))
|
|
|
|
(use-package nyan-mode
|
|
:straight t
|
|
:config
|
|
(setq nyan-animate-nyancat t
|
|
nyan-wavy-trail t)
|
|
(nyan-mode 1))
|
|
|
|
(use-package company
|
|
:straight t
|
|
:config
|
|
(global-company-mode))
|
|
|
|
;; language support
|
|
|
|
(use-package nix-mode
|
|
:straight t
|
|
:init (setq nix-nixfmt-bin "nixpkgs-fmt"))
|
|
|
|
(use-package markdown-mode
|
|
:straight t)
|
|
|
|
(use-package yaml-mode
|
|
:straight t)
|
|
|
|
(use-package rust-mode
|
|
:straight t)
|
|
|
|
(use-package ess
|
|
:straight t)
|
|
|
|
(use-package cc-mode
|
|
:config
|
|
;;; Copypasta of llvm/utils/emacs/emacs.el
|
|
;; LLVM codi style guidelines in emacs
|
|
;; Maintainer: LLVM Team, http://llvm.org/
|
|
(defun llvm-lineup-statement (langelem)
|
|
(let ((in-assign (c-lineup-assignments langelem)))
|
|
(if (not in-assign)
|
|
'++
|
|
(aset in-assign 0
|
|
(+ (aref in-assign 0)
|
|
(* 2 c-basic-offset)))
|
|
in-assign)))
|
|
|
|
;; Add a cc-mode style for editing LLVM C and C++ code
|
|
(c-add-style "llvm.org"
|
|
'("gnu"
|
|
(fill-column . 80)
|
|
(c++-indent-level . 2)
|
|
(c-basic-offset . 2)
|
|
(indent-tabs-mode . nil)
|
|
(c-offsets-alist . ((arglist-intro . ++)
|
|
(innamespace . 0)
|
|
(member-init-intro . ++)
|
|
(statement-cont . llvm-lineup-statement)))))
|
|
|
|
;; Files with "llvm" in their names will automatically be set to the
|
|
;; llvm.org coding style.
|
|
(add-hook 'c-mode-common-hook
|
|
(function
|
|
(lambda nil
|
|
(if (string-match "llvm" buffer-file-name)
|
|
(progn
|
|
(c-set-style "llvm.org"))))))
|
|
|
|
(setq c-default-style '((java-mode . "java")
|
|
(awk-mode . "awk")
|
|
(c-mode . "linux")
|
|
(c++-mode . "llvm.org")
|
|
(other . "stroustrup"))))
|