2024-10-13 01:00:36 -04:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
2024-10-03 20:26:12 -04:00
|
|
|
#+TITLE: Emacs Configuration
|
|
|
|
#+AUTHOR: Mars (@pupbrained)
|
|
|
|
#+EMAIL: mars@pupbrained.xyz
|
|
|
|
|
2024-10-14 17:28:00 -04:00
|
|
|
* Helpers
|
2024-10-03 20:26:12 -04:00
|
|
|
|
|
|
|
** Server
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(require 'bind-key)
|
|
|
|
(load "server")
|
|
|
|
(unless (server-running-p) (server-start))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-08 23:56:00 -04:00
|
|
|
** Disable Built-In Auto-Save and Backup
|
2024-10-03 20:26:12 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-04 21:53:37 -04:00
|
|
|
(setq auto-save-default nil
|
|
|
|
make-backup-files nil)
|
2024-10-03 20:26:12 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** No Scratch On Open
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq initial-scratch-message nil)
|
|
|
|
(setq initial-buffer-choice nil)
|
2024-10-04 19:01:46 -04:00
|
|
|
|
2024-10-03 20:26:12 -04:00
|
|
|
(add-hook 'emacs-startup-hook
|
|
|
|
(lambda ()
|
|
|
|
(when (and (get-buffer "*scratch*")
|
|
|
|
(not (eq (current-buffer) (get-buffer "*scratch*"))))
|
|
|
|
(kill-buffer "*scratch*"))))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 19:01:46 -04:00
|
|
|
** Dirvish
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-04 21:40:04 -04:00
|
|
|
(add-hook 'dired-mode-hook 'dired-omit-mode)
|
|
|
|
|
2024-10-05 16:51:21 -04:00
|
|
|
(use-package ethan-wspace
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(setq mode-require-final-newline nil)
|
|
|
|
(global-ethan-wspace-mode 1))
|
|
|
|
|
2024-10-04 21:40:04 -04:00
|
|
|
(defun my/dirvish-create-file ()
|
|
|
|
"Create a new file in the current directory."
|
|
|
|
(interactive)
|
|
|
|
(let ((new-file (read-file-name "New file name: " (dired-current-directory))))
|
|
|
|
(if (file-exists-p new-file)
|
|
|
|
(message "File already exists!")
|
|
|
|
(write-region "" nil new-file)
|
|
|
|
(revert-buffer) ;; Refresh the directory listing
|
|
|
|
(message "File created: %s" new-file))))
|
|
|
|
|
2024-10-12 18:58:32 -04:00
|
|
|
(use-package nerd-icons
|
|
|
|
:ensure t)
|
|
|
|
|
2024-10-04 19:01:46 -04:00
|
|
|
(use-package dirvish
|
|
|
|
:ensure t
|
2024-10-04 21:40:04 -04:00
|
|
|
:init
|
2024-10-04 19:01:46 -04:00
|
|
|
(dirvish-override-dired-mode)
|
2024-10-04 21:40:04 -04:00
|
|
|
:config
|
|
|
|
(dirvish-peek-mode)
|
2024-10-04 19:01:46 -04:00
|
|
|
(dirvish-side-follow-mode)
|
2024-10-04 22:24:03 -04:00
|
|
|
(setq dired-listing-switches "-al --human-readable --group-directories-first"
|
2024-10-04 21:53:37 -04:00
|
|
|
dired-mouse-drag-files t
|
2024-10-04 22:24:03 -04:00
|
|
|
dired-omit-files (rx (or (seq bol (? ".") "#")
|
|
|
|
(seq bol "." eol)
|
|
|
|
(seq bol ".git" eol)))
|
2024-10-04 21:53:37 -04:00
|
|
|
dirvish-attributes '(vc-state subtree-state nerd-icons collapse git-msg file-time file-size)
|
|
|
|
dirvish-mode-line-format '(:left (sort symlink) :right (omit yank index))
|
2024-10-04 22:24:03 -04:00
|
|
|
dirvish-mode-line-height 25
|
2024-10-04 21:53:37 -04:00
|
|
|
dirvish-subtree-state-style 'nerd
|
|
|
|
mouse-drag-and-drop-region-cross-program t))
|
2024-10-04 19:01:46 -04:00
|
|
|
|
|
|
|
;; Addtional syntax highlighting for dired
|
|
|
|
(use-package diredfl
|
|
|
|
:ensure t
|
|
|
|
:hook
|
|
|
|
((dired-mode . diredfl-mode)
|
|
|
|
(dirvish-directory-view-mode . diredfl-mode))
|
|
|
|
:config
|
|
|
|
(set-face-attribute 'diredfl-dir-name nil :bold t))
|
|
|
|
|
|
|
|
(use-package ns-auto-titlebar
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(when (eq system-type 'darwin) (ns-auto-titlebar-mode)))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 22:24:03 -04:00
|
|
|
** Doom Modeline
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package doom-modeline
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(doom-modeline-mode))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-16 18:01:03 -04:00
|
|
|
** Projectile
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package projectile
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(projectile-mode +1)
|
|
|
|
(setq projectile-completion-system 'ivy))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Centaur Tabs
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package centaur-tabs
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(setq centaur-tabs-cycle-scope 'tabs
|
|
|
|
centaur-tabs-height 32
|
|
|
|
centaur-tabs-icon-type 'nerd-icons
|
|
|
|
centaur-tabs-left-edge-margin nil
|
|
|
|
centaur-tabs-set-bar 'under
|
|
|
|
centaur-tabs-set-close-button nil
|
|
|
|
centaur-tabs-set-icons t
|
|
|
|
centaur-tabs-set-modified-marker t
|
|
|
|
centaur-tabs-show-count nil
|
|
|
|
centaur-tabs-show-new-tab-button t
|
|
|
|
centaur-tabs-style "bar"
|
|
|
|
x-underline-at-descent-line t)
|
|
|
|
(centaur-tabs-group-by-projectile-project)
|
2024-10-16 18:48:44 -04:00
|
|
|
(centaur-tabs-headline-match)
|
2024-10-16 18:01:03 -04:00
|
|
|
(centaur-tabs-mode t)
|
2024-10-16 18:48:44 -04:00
|
|
|
(centaur-tabs-change-fonts "Iosevka Comfy Motion Duo" 120)
|
2024-10-16 18:01:03 -04:00
|
|
|
(defun centaur-tabs-hide-tab (x)
|
|
|
|
(let ((name (format "%s" x)))
|
|
|
|
(or
|
|
|
|
(window-dedicated-p (selected-window))
|
|
|
|
(string-prefix-p "*" name)
|
|
|
|
(string-prefix-p "magit" name)
|
|
|
|
(derived-mode-p 'dired-mode))))
|
|
|
|
:hook
|
|
|
|
(dashboard-mode . centaur-tabs-local-mode)
|
|
|
|
(spacemacs-buffer-mode . centaur-tabs-local-mode)
|
|
|
|
(term-mode . centaur-tabs-local-mode)
|
|
|
|
(calendar-mode . centaur-tabs-local-mode)
|
|
|
|
(org-agenda-mode . centaur-tabs-local-mode)
|
|
|
|
(helpful-mode . centaur-tabs-local-mode)
|
|
|
|
(dired-mode . centaur-tabs-local-mode)
|
|
|
|
(zone-mode . centaur-tabs-local-mode)
|
|
|
|
(helm-mode . centaur-tabs-local-mode))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-05 23:08:56 -04:00
|
|
|
** VTerm
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package vterm
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(setq vterm-timer-delay 0.01))
|
|
|
|
|
|
|
|
(use-package shackle
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(setq shackle-rules
|
|
|
|
'(("\\*vterm\\*" :regexp t :popup t :align 'below :size 0.4 :select t)))
|
|
|
|
(shackle-mode 1))
|
|
|
|
|
|
|
|
(use-package vterm-toggle
|
|
|
|
:ensure t)
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 22:24:03 -04:00
|
|
|
** Nix
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package nix-mode
|
|
|
|
:mode "\\.nix\\'")
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
** Indents and Autopairs
|
2024-10-04 22:24:03 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-11 21:45:08 -04:00
|
|
|
(electric-indent-mode -1)
|
|
|
|
(electric-pair-mode 1)
|
2024-10-04 22:24:03 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
** Evil Mode
|
2024-10-03 20:26:12 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-09 14:52:14 -04:00
|
|
|
(defun indent-tabs-hook ()
|
|
|
|
(setq tab-width 2
|
2024-10-14 17:28:00 -04:00
|
|
|
indent-tabs-mode nil
|
|
|
|
evil-auto-indent t))
|
2024-10-09 14:52:14 -04:00
|
|
|
|
2024-10-16 18:01:03 -04:00
|
|
|
(dolist (hook '(c++-mode-hook c-mode-hook c++-ts-mode-hook c-ts-mode-hook org-mode-hook)) (add-hook hook 'indent-tabs-hook))
|
2024-10-03 20:26:12 -04:00
|
|
|
|
|
|
|
(use-package evil
|
|
|
|
:ensure t
|
|
|
|
:init
|
2024-10-14 17:28:00 -04:00
|
|
|
(setq indent-line-function 'evil-indent-line
|
|
|
|
evil-shift-width 2
|
|
|
|
evil-split-window-below t
|
|
|
|
evil-undo-system 'undo-tree
|
|
|
|
evil-vsplit-window-right t
|
|
|
|
evil-want-C-i-jump nil
|
|
|
|
evil-want-C-u-scroll t
|
|
|
|
evil-want-integration t
|
|
|
|
evil-want-keybinding nil)
|
|
|
|
|
2024-10-03 20:26:12 -04:00
|
|
|
:config
|
2024-10-05 00:40:51 -04:00
|
|
|
(evil-mode 1)
|
2024-10-14 17:28:00 -04:00
|
|
|
(evil-define-key 'insert prog-mode-map (kbd "TAB") 'tab-to-tab-stop)
|
|
|
|
(evil-define-key 'insert 'global
|
|
|
|
(kbd "C-c") 'cua-copy-region
|
|
|
|
(kbd "C-v") 'cua-paste
|
|
|
|
(kbd "C-x") 'cua-cut-region)
|
|
|
|
(evil-define-key 'normal 'global
|
|
|
|
(kbd "gm") 'magit-status
|
|
|
|
(kbd "gp") 'diff-hl-show-hunk
|
|
|
|
(kbd "gr") 'diff-hl-revert-hunk
|
2024-10-16 22:58:14 -04:00
|
|
|
(kbd "gs") 'diff-hl-stage-current-hunk)
|
|
|
|
(global-subword-mode))
|
2024-10-05 16:51:21 -04:00
|
|
|
|
2024-10-12 00:12:21 -04:00
|
|
|
(use-package evil-surround
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(global-evil-surround-mode 1))
|
|
|
|
|
2024-10-05 16:51:21 -04:00
|
|
|
(setq-default whitespace-action
|
|
|
|
'(cleanup auto-cleanup))
|
|
|
|
|
2024-10-12 19:41:12 -04:00
|
|
|
(defun my/vterm-toggle-project-root ()
|
|
|
|
"Open or toggle vterm at the project root."
|
|
|
|
(interactive)
|
|
|
|
(let ((default-directory (or (project-root (project-current))
|
|
|
|
default-directory)))
|
|
|
|
(vterm-toggle)))
|
|
|
|
|
2024-10-05 16:51:21 -04:00
|
|
|
(use-package general
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(general-define-key
|
2024-10-05 23:08:56 -04:00
|
|
|
:states '(normal visual emacs)
|
|
|
|
:keymaps 'override
|
2024-10-16 18:01:03 -04:00
|
|
|
"H" '(centaur-tabs-backward :wk "Previous tab")
|
|
|
|
"L" '(centaur-tabs-forward :wk "Next tab")
|
|
|
|
"K" '(eldoc-box-help-at-point :wk "Hover")
|
|
|
|
"C-t" '(my/vterm-toggle-project-root :wk "Toggle VTerm")))
|
2024-10-03 20:26:12 -04:00
|
|
|
|
2024-10-04 19:01:46 -04:00
|
|
|
(use-package evil-collection
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(evil-collection-init))
|
|
|
|
|
|
|
|
(use-package evil-leader
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(global-evil-leader-mode)
|
|
|
|
(setq evil-leader/leader "<SPC>")
|
2024-10-16 18:01:03 -04:00
|
|
|
(evil-leader/set-key "bt" #'centaur-tabs-ace-jump)
|
|
|
|
(evil-leader/set-key "bg" #'centaur-tabs-counsel-switch-group)
|
2024-10-04 21:40:04 -04:00
|
|
|
(evil-leader/set-key "bb" #'switch-to-buffer)
|
2024-10-12 18:58:32 -04:00
|
|
|
(evil-leader/set-key "bj" #'breadcrumb-jump)
|
2024-10-05 20:28:10 -04:00
|
|
|
(evil-leader/set-key "e" #'dirvish-side)
|
2024-10-07 23:43:23 -04:00
|
|
|
(evil-leader/set-key "d" #'flymake-show-diagnostic)
|
|
|
|
(evil-leader/set-key "n" #'flymake-goto-next-error)
|
|
|
|
(evil-leader/set-key "N" #'flymake-goto-prev-error)
|
|
|
|
(evil-leader/set-key "n" #'flymake-goto-next-error)
|
|
|
|
(evil-leader/set-key "a" #'eglot-code-actions))
|
2024-10-11 21:45:08 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Catppuccin Theme
|
2024-10-04 19:01:46 -04:00
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
#+begin_src emacs-lisp
|
2024-10-04 22:29:50 -04:00
|
|
|
(use-package catppuccin-theme
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(load-theme 'catppuccin t))
|
2024-10-11 21:45:08 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Disable Autosave and Backup Files
|
2024-10-04 22:29:50 -04:00
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
#+begin_src emacs-lisp
|
2024-10-04 22:29:50 -04:00
|
|
|
(setq auto-save-default nil
|
|
|
|
make-backup-files nil)
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-06 01:27:04 -04:00
|
|
|
** Ligatures
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package ligature
|
|
|
|
:config
|
2024-10-08 23:56:00 -04:00
|
|
|
(let ((common-ligatures '("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--"
|
|
|
|
"<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---"
|
|
|
|
"<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!=="
|
|
|
|
":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++")))
|
|
|
|
(dolist (mode '(prog-mode org-mode))
|
|
|
|
(ligature-set-ligatures mode common-ligatures)))
|
2024-10-06 01:27:04 -04:00
|
|
|
(global-ligature-mode t))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 22:29:50 -04:00
|
|
|
** LSP
|
|
|
|
|
2024-10-07 23:43:23 -04:00
|
|
|
*** Eglot
|
2024-10-04 22:29:50 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-13 19:52:09 -04:00
|
|
|
(use-package markdown-mode
|
|
|
|
:ensure t
|
|
|
|
:mode ("README\\.md\\'" . gfm-mode)
|
|
|
|
:init (setq markdown-command "multimarkdown")
|
|
|
|
:bind (:map markdown-mode-map
|
|
|
|
("C-c C-e" . markdown-do)))
|
|
|
|
|
|
|
|
(use-package eglot-booster
|
|
|
|
:after eglot
|
|
|
|
:ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
|
|
|
|
:config (eglot-booster-mode))
|
|
|
|
|
|
|
|
(use-package eglot
|
|
|
|
:ensure nil
|
|
|
|
:config
|
|
|
|
(defun my-eglot-rename (newname)
|
|
|
|
"Rename the current symbol to NEWNAME with initial input a."
|
|
|
|
(interactive
|
|
|
|
(list (read-from-minibuffer
|
|
|
|
(format "Rename `%s' to: " (or (thing-at-point 'symbol t)
|
|
|
|
(error "no symbol at point")))
|
|
|
|
(or (thing-at-point 'symbol t) "") nil nil nil
|
|
|
|
(symbol-name (symbol-at-point)))))
|
|
|
|
(eglot--server-capable-or-lose :renameProvider)
|
|
|
|
(eglot--apply-workspace-edit
|
|
|
|
(jsonrpc-request (eglot--current-server-or-lose)
|
|
|
|
:textDocument/rename `(,@(eglot--TextDocumentPositionParams)
|
|
|
|
:newName ,newname))
|
|
|
|
current-prefix-arg))
|
|
|
|
(fset #'jsonrpc--log-event #'ignore)
|
|
|
|
(setopt eglot-events-buffer-size 0)
|
|
|
|
(defun eglot-format-buffer-on-save ()
|
|
|
|
(when (not (derived-mode-p 'python-ts-mode))
|
|
|
|
(add-hook 'before-save-hook #'eglot-format-buffer -10 t)))
|
|
|
|
(add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save)
|
2024-10-14 17:28:00 -04:00
|
|
|
(setq eglot-server-programs
|
|
|
|
`(,@eglot-server-programs
|
|
|
|
'(nix-mode . ("nixd"))
|
|
|
|
'(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))))
|
2024-10-13 19:52:09 -04:00
|
|
|
:hook
|
|
|
|
(rust-mode . eglot-ensure)
|
|
|
|
(rust-ts-mode . eglot-ensure)
|
|
|
|
(sh-script-mode . eglot-ensure)
|
|
|
|
(python-mode . eglot-ensure)
|
|
|
|
(python-ts-mode . eglot-ensure)
|
|
|
|
(json-mode . eglot-ensure)
|
|
|
|
(json-ts-mode . eglot-ensure)
|
|
|
|
(nix-mode . eglot-ensure)
|
|
|
|
(yaml-mode . eglot-ensure)
|
|
|
|
(yaml-ts-mode . eglot-ensure)
|
|
|
|
(c-mode . eglot-ensure)
|
|
|
|
(c-ts-mode . eglot-ensure)
|
|
|
|
(c++-mode . eglot-ensure)
|
|
|
|
(c++-ts-mode . eglot-ensure)
|
|
|
|
(c3-ts-mode . eglot-ensure)
|
|
|
|
(rust-mode . eglot-ensure)
|
|
|
|
(go-mode . eglot-ensure)
|
|
|
|
(go-ts-mode . eglot-ensure))
|
|
|
|
|
|
|
|
(add-hook 'c-mode-hook 'hide-ifdef-mode)
|
|
|
|
(add-hook 'c++-mode-hook 'hide-ifdef-mode)
|
|
|
|
(setq hide-ifdef-initially t)
|
|
|
|
(setq hide-ifdef-shadow 'font-lock-comment-face)
|
|
|
|
|
|
|
|
(use-package rust-mode
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
(use-package tuareg
|
|
|
|
:ensure t
|
|
|
|
:mode ("\\.ml\\'" . tuareg-mode)
|
|
|
|
:hook (tuareg-mode . eglot-ensure))
|
|
|
|
|
|
|
|
(use-package merlin
|
|
|
|
:ensure t
|
|
|
|
:hook (tuareg-mode . merlin-mode))
|
|
|
|
|
|
|
|
(use-package glsl-mode
|
|
|
|
:ensure t
|
|
|
|
:mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))
|
|
|
|
|
|
|
|
(use-package eldoc-box
|
|
|
|
:custom
|
|
|
|
(eldoc-box-max-pixel-width 1024)
|
|
|
|
:custom-face
|
2024-10-14 17:28:00 -04:00
|
|
|
(eldoc-box-body ((t (:family "Iosevka Comfy Motion" :height 140 :background "#181825" :foreground "#cdd6f4"))))
|
2024-10-13 19:52:09 -04:00
|
|
|
:config
|
|
|
|
(setq eldoc-message-function #'ignore
|
|
|
|
eldoc-idle-delay 0))
|
2024-10-04 22:29:50 -04:00
|
|
|
#+end_src
|
2024-10-04 22:24:03 -04:00
|
|
|
|
2024-10-06 01:27:04 -04:00
|
|
|
*** Apheleia
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package apheleia
|
|
|
|
:ensure t
|
|
|
|
:config
|
2024-10-14 17:28:00 -04:00
|
|
|
(setq apheleia-formatters
|
|
|
|
`(,@apheleia-formatters '(alejandra "alejandra" "--quiet" "-") '(clang-format "clang-format")))
|
|
|
|
(setq apheleia-mode-alist
|
|
|
|
`(,@apheleia-mode-alist '(nix-mode . alejandra) '(c-mode . clang-format) '(c++-mode . clang-format)))
|
2024-10-06 01:27:04 -04:00
|
|
|
(apheleia-global-mode +1))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 22:29:50 -04:00
|
|
|
*** TreeSitter
|
2024-10-03 20:26:12 -04:00
|
|
|
|
2024-10-04 22:29:50 -04:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package tree-sitter
|
2024-10-03 20:26:12 -04:00
|
|
|
:ensure t
|
2024-10-04 22:29:50 -04:00
|
|
|
:hook
|
|
|
|
(prog-mode . tree-sitter-hl-mode)
|
2024-10-03 20:26:12 -04:00
|
|
|
:config
|
2024-10-04 22:29:50 -04:00
|
|
|
(global-tree-sitter-mode))
|
2024-10-03 20:26:12 -04:00
|
|
|
|
2024-10-04 22:29:50 -04:00
|
|
|
(use-package tree-sitter-langs
|
|
|
|
:ensure t)
|
2024-10-19 22:02:34 -04:00
|
|
|
|
|
|
|
(use-package highlight-doxygen
|
|
|
|
:ensure (highlight-doxygen :type git :host github :repo "pupbrained/highlight-doxygen")
|
|
|
|
:config
|
|
|
|
(custom-set-faces
|
2024-10-20 14:22:23 -04:00
|
|
|
'(highlight-doxygen-comment ((t (:inherit font-lock-comment-face))))
|
|
|
|
'(highlight-doxygen-code-block ((t (:inherit font-lock-type-face)))))
|
|
|
|
(highlight-doxygen-global-mode 1))
|
2024-10-03 20:26:12 -04:00
|
|
|
#+end_src
|
2024-10-04 19:01:46 -04:00
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
*** GitHub Copilot
|
2024-10-08 23:56:00 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-09 23:02:14 -04:00
|
|
|
(use-package copilot
|
|
|
|
:ensure (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
|
|
|
|
:hook (prog-mode . copilot-mode)
|
2024-10-11 21:45:08 -04:00
|
|
|
:bind (("C-<tab>" . 'copilot-complete)
|
2024-10-09 23:02:14 -04:00
|
|
|
:map copilot-completion-map
|
|
|
|
("<tab>" . 'copilot-accept-completion)
|
|
|
|
("C-<tab>" . 'copilot-accept-completion-by-word)
|
|
|
|
("C-<return>" . 'copilot-accept-completion-by-line)))
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
(use-package copilot-chat
|
|
|
|
:ensure (:host github :repo "chep/copilot-chat.el" :files ("*.el"))
|
|
|
|
:after (request))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Corfu
|
2024-10-09 23:02:14 -04:00
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
#+begin_src emacs-lisp
|
2024-10-08 23:56:00 -04:00
|
|
|
(use-package corfu
|
|
|
|
:ensure t
|
|
|
|
:custom
|
2024-10-14 17:28:00 -04:00
|
|
|
(corfu-cycle t)
|
|
|
|
(corfu-auto t)
|
|
|
|
(corfu-auto-prefix 1)
|
|
|
|
(corfu-auto-delay 0.0)
|
2024-10-08 23:56:00 -04:00
|
|
|
:bind (:map corfu-map ("<escape>" . corfu-quit))
|
|
|
|
:init (global-corfu-mode))
|
|
|
|
|
|
|
|
(use-package cape :ensure t)
|
|
|
|
|
|
|
|
;; get eglot to play nice with corfu
|
|
|
|
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
|
|
|
|
|
|
|
(use-package kind-icon
|
|
|
|
:ensure t
|
|
|
|
:after corfu
|
|
|
|
:custom
|
|
|
|
(kind-icon-use-icons t)
|
|
|
|
(kind-icon-default-face 'corfu-default)
|
|
|
|
(kind-icon-blend-background nil)
|
|
|
|
(kind-icon-blend-frac 0.08)
|
|
|
|
:config
|
|
|
|
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 19:01:46 -04:00
|
|
|
** Rainbow Delimiters
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Line Numbers
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(global-display-line-numbers-mode t)
|
|
|
|
|
|
|
|
(setq display-line-numbers-type 'relative)
|
|
|
|
|
2024-10-04 21:40:04 -04:00
|
|
|
(dolist (mode
|
|
|
|
'(term-mode-hook
|
|
|
|
vterm-mode-hook
|
|
|
|
shell-mode-hook
|
|
|
|
org-mode-hook
|
|
|
|
dirvish-setup-hook
|
|
|
|
eshell-mode-hook))
|
2024-10-04 19:01:46 -04:00
|
|
|
(add-hook mode (lambda () (display-line-numbers-mode 0))))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Vim-Style Scrolling
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq scroll-step 3
|
|
|
|
scroll-conservatively 9999)
|
|
|
|
#+end_src
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
** Sticky Headers
|
2024-10-04 19:01:46 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-11 21:45:08 -04:00
|
|
|
(use-package breadcrumb
|
|
|
|
:ensure t
|
|
|
|
:hook
|
|
|
|
(prog-mode . breadcrumb-mode))
|
2024-10-04 19:01:46 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
** System-Specific Settings
|
2024-10-04 19:01:46 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-11 21:45:08 -04:00
|
|
|
(defun apply-my-fonts (frame)
|
|
|
|
(with-selected-frame frame
|
|
|
|
(cond
|
|
|
|
((eq system-type 'darwin)
|
2024-10-14 17:28:00 -04:00
|
|
|
(set-face-attribute 'default frame :font "Iosevka Comfy Motion-16")
|
|
|
|
(set-face-attribute 'fixed-pitch frame :font "Iosevka Comfy Motion-16")
|
2024-10-11 21:45:08 -04:00
|
|
|
(set-face-attribute 'variable-pitch frame :font "Iosevka Comfy Motion Duo-16")
|
|
|
|
(modify-frame-parameters frame
|
2024-10-14 17:28:00 -04:00
|
|
|
'((font . "Iosevka Comfy Motion-16")
|
2024-10-11 21:45:08 -04:00
|
|
|
(vertical-scroll-bars . nil))))
|
|
|
|
((eq system-type 'gnu/linux)
|
2024-10-12 18:58:32 -04:00
|
|
|
(set-face-attribute 'default frame :font "Iosevka Comfy Motion Medium-12")
|
|
|
|
(set-face-attribute 'fixed-pitch frame :font "Iosevka Comfy Motion Medium-12")
|
2024-10-11 21:45:08 -04:00
|
|
|
(set-face-attribute 'variable-pitch frame :font "Iosevka Comfy Motion Duo Md-14")
|
|
|
|
(modify-frame-parameters frame
|
2024-10-12 18:58:32 -04:00
|
|
|
'((font . "Iosevka Comfy Motion Medium-12")
|
2024-10-11 21:45:08 -04:00
|
|
|
(undecorated . t)
|
|
|
|
(vertical-scroll-bars . nil)))))))
|
|
|
|
|
|
|
|
;; Apply the settings for both regular Emacs and emacsclient frames
|
|
|
|
(if (daemonp)
|
|
|
|
(add-hook 'after-make-frame-functions 'apply-my-fonts)
|
|
|
|
(apply-my-fonts (selected-frame)))
|
2024-10-04 19:01:46 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
** Use Short Answers
|
2024-10-04 21:40:04 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-11 21:45:08 -04:00
|
|
|
(setq use-short-answers t)
|
2024-10-04 21:40:04 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 19:01:46 -04:00
|
|
|
** Undo Tree
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package undo-tree
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(global-undo-tree-mode)
|
|
|
|
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Dashboard
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package dashboard
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(dashboard-setup-startup-hook)
|
2024-10-04 21:53:37 -04:00
|
|
|
(setq dashboard-startup-banner 'logo
|
|
|
|
dashboard-center-content t
|
|
|
|
dashboard-vertically-center-content t
|
|
|
|
dashboard-startup-banner 'logo
|
|
|
|
initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))))
|
2024-10-04 21:40:04 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 22:24:03 -04:00
|
|
|
** Git Integration
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package transient :ensure t)
|
|
|
|
|
|
|
|
(use-package magit
|
|
|
|
:ensure t
|
2024-10-14 17:28:00 -04:00
|
|
|
:commands
|
|
|
|
magit-status
|
|
|
|
magit-blame
|
|
|
|
magit-version
|
2024-10-04 22:24:03 -04:00
|
|
|
:init
|
|
|
|
(defadvice magit-status (around magit-fullscreen activate)
|
|
|
|
(window-configuration-to-register :magit-fullscreen) ad-do-it
|
|
|
|
(delete-other-windows))
|
|
|
|
:config
|
|
|
|
(setq magit-branch-arguments nil
|
|
|
|
magit-default-tracking-name-function 'magit-default-tracking-name-branch-only
|
|
|
|
magit-push-always-verify nil
|
2024-10-05 01:31:57 -04:00
|
|
|
magit-restore-window-configuration t))
|
2024-10-04 22:24:03 -04:00
|
|
|
|
2024-10-05 01:25:11 -04:00
|
|
|
(use-package diff-hl
|
|
|
|
:ensure t
|
|
|
|
:hook ((magit-post-refresh . diff-hl-magit-post-refresh))
|
|
|
|
:config
|
|
|
|
(global-diff-hl-mode))
|
|
|
|
|
2024-10-04 22:24:03 -04:00
|
|
|
(use-package git-gutter
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(global-git-gutter-mode +1))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Direnv
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-05 20:28:10 -04:00
|
|
|
(use-package envrc
|
|
|
|
:ensure t
|
2024-10-04 22:24:03 -04:00
|
|
|
:config
|
2024-10-05 20:28:10 -04:00
|
|
|
(envrc-global-mode))
|
2024-10-04 22:24:03 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 21:40:04 -04:00
|
|
|
** Better M-x
|
|
|
|
|
|
|
|
*** Ivy Mode (Completions)
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq ivy-ignore-buffers '("\\` " "\\`\\*"))
|
|
|
|
|
|
|
|
(use-package ivy
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(ivy-mode)
|
2024-10-04 21:53:37 -04:00
|
|
|
(setq ivy-use-virtual-buffers t
|
|
|
|
enable-recursive-minibuffers t))
|
2024-10-04 21:40:04 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Amx Mode (Better Interface)
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package amx
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(amx-mode))
|
2024-10-04 19:01:46 -04:00
|
|
|
#+end_src
|
|
|
|
|
2024-10-04 21:53:37 -04:00
|
|
|
** Org Mode Improvements
|
2024-10-04 19:50:51 -04:00
|
|
|
|
|
|
|
#+begin_src emacs-lisp
|
2024-10-14 17:28:00 -04:00
|
|
|
(setq-default org-src-tab-acts-natively t
|
|
|
|
org-indent-indentation-per-level 2
|
|
|
|
org-indent-mode-turns-on-hiding-stars nil)
|
|
|
|
|
2024-10-04 21:53:37 -04:00
|
|
|
(add-hook 'org-mode-hook 'visual-line-mode)
|
2024-10-04 19:50:51 -04:00
|
|
|
|
2024-10-14 17:28:00 -04:00
|
|
|
(require 'org-tempo)
|
|
|
|
(add-to-list 'org-modules 'org-tempo t)
|
|
|
|
|
2024-10-04 21:40:04 -04:00
|
|
|
(use-package mixed-pitch
|
|
|
|
:hook
|
|
|
|
(org-mode . mixed-pitch-mode))
|
|
|
|
|
|
|
|
(use-package org-modern
|
|
|
|
:ensure t
|
|
|
|
:hook (org-mode . org-modern-mode)
|
|
|
|
:config
|
2024-10-04 21:53:37 -04:00
|
|
|
(setq org-ellipsis "…")
|
2024-10-04 21:40:04 -04:00
|
|
|
(setq org-modern-star 'replace))
|
|
|
|
|
2024-10-11 21:45:08 -04:00
|
|
|
;; Inhibits autopairs from running for <> in org mode
|
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(setq-local electric-pair-inhibit-predicate
|
|
|
|
`(lambda (c) (if (char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))
|
|
|
|
|
|
|
|
(defun org-babel-edit-prep:emacs-lisp (babel-info)
|
|
|
|
(setq-local buffer-file-name (->> babel-info caddr (alist-get :tangle)))
|
|
|
|
(lsp))
|
|
|
|
|
2024-10-08 17:44:27 -04:00
|
|
|
(add-hook 'eglot-managed-mode-hook #'flymake-mode)
|
2024-10-04 19:50:51 -04:00
|
|
|
#+end_src
|