From 9198450a9fdd7461c614b20dc8b6b5a121a4f95d Mon Sep 17 00:00:00 2001 From: Luis Guilherme Coelho Date: Wed, 31 Jul 2024 21:59:03 -0300 Subject: [PATCH] radio: files: emacs: Major rework of init.el --- .../radio/files/.config/emacs/init.el | 788 +++++++++++------- 1 file changed, 495 insertions(+), 293 deletions(-) diff --git a/home-environments/radio/files/.config/emacs/init.el b/home-environments/radio/files/.config/emacs/init.el index abe2fef..812c55a 100644 --- a/home-environments/radio/files/.config/emacs/init.el +++ b/home-environments/radio/files/.config/emacs/init.el @@ -1,312 +1,514 @@ -;; Who am I? -(setq user-full-name "Luis Guilherme Coelho" - user-email-address "lgcoelho@disroot.org" - copyright-names-regexp (format "%s <%s>" - user-full-name - user-mail-address)) -(load-file "~/projects/code/scm/guix/etc/copyright.el") +;;; -*- lexical-binding: t; origami-mode: t -*- -;; Emacs directories -(setq user-emacs-directory "~/.config/emacs") +(use-package emacs + :custom ((indent-tabs-mode nil)) + :config + ;; who am I? + (setq user-full-name "Luis Guilherme Coelho" + user-email-address "lgcoelho@disroot.org" + copyright-names-regexp (format "%s <%s>" + user-full-name + user-mail-address)) -;; Organizing backups -(setq backup-directory-alist - '(("." . "~/.local/share/emacs/saves"))) + (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) + (add-to-list 'default-frame-alist '(ns-appearance . dark)) -;; Emacs load path -(add-to-list 'load-path - "~/.guix-home/profile/share/emacs/site-lisp") -(setq-default buffer-file-coding-system - 'utf-8-unix) + ;; load-path + (add-to-list 'load-path + "~/.guix-home/profile/share/emacs/site-lisp") -;; Garbage collection -(setq gc-cons-threshold (* 50 1000 1000)) + ;; display-line-numbers variables + (setq display-line-numbers-current-absolute t + display-line-numbers-grow-only t + display-line-numbers-type 'relative + display-line-numbers-width 4 + display-line-numbers-width-start t) -;; No more tabs -(setq-default indent-line-function 'insert-tab - indent-tabs-mode nil) + ;; guix stuff + (load-file "~/projects/code/scm/guix/etc/copyright.el") -;; Profile emacs startup -(add-hook 'emacs-startup-hook - (lambda () (message - "*:** Emacs loaded in %s seconds with %d garbage collections." - (emacs-init-time "%.2f") - gcs-done))) + ;; keep ~/.config/emacs/ clean + (setq user-emacs-directory (expand-file-name "~/.cache/emacs/")) + (setq url-history-file (expand-file-name "url/history" + user-emacs-directory)) -;; Disable compiler and large file warnings -(setq native-comp-async-report-warnings-errors nil - large-file-warning-threshold nil) + ;; keep customization settings in a temporary file + (setq custom-file + (if (boundp 'server-socket-dir) + (expand-file-name "custom.el" server-socket-dir) + (expand-file-name (format "emacs-custom-%s.el" (user-uid)) + temporary-file-directory))) + (load custom-file t) -;; Remove start message and scratch message -(setq inhibit-startup-message t - initial-scratch-message nil) + ;; backups + (setq backup-directory-alist + `((".*" . ,(expand-file-name "backups" user-emacs-directory))) + auto-save-file-name-transforms + `((".*" ,(expand-file-name "autosave/" user-emacs-directory) t))) + (setq create-lockfiles nil + backup-by-copying t + version-control t + delete-old-versions t + vc-make-backup-files t + kept-old-versions 10 + kept-new-versions 10) -;; Enable some minor modes globally -(dolist (mode '(server-mode ; Emacs server - savehist-mode ; Command history - column-number-mode ; Cursor column number - global-prettify-symbols-mode ; Pretty symbols - delete-selection-mode)) ; Normal selection behavior - (funcall mode 1)) + ;; dialog box + (setq use-dialog-box nil) -;; Disable some minor modes globally -(dolist (mode '(tool-bar-mode menu-bar-mode ; Menus - scroll-bar-mode ; Scroll-bar - tooltip-mode ; Tooltip - indent-tabs-mode ; Tabs - blink-cursor-mode ; Cursor - fringe-mode)) ; Fringe - (funcall mode 0)) + ;; scrolling + (setq scroll-conservatively 101 + scroll-margin 2) -;; Line numbers settings -(setq display-line-numbers-type 'relative - display-line-numbers-current-absolute t - display-line-numbers-grow-only t - display-line-numbers-width-start t) + ;; lmao? + (setq enable-recursive-minibuffers t) -;; Display whitespaces -(setq-default fill-column 80) -(setq whitespace-display-mappings - '((space-mark ?\ [?⋅] [?.]) - (space-mark ?\xA0 [?⋅] [?_]) - (newline-mark ?\n [?¬ ?\n] [?$ ?\n]) - (tab-mark ?\t [?» ?\t] [?\\ ?\t]))) -(dolist (mode '(text-mode-hook - prog-mode-hook - conf-mode-hook)) - (add-hook mode (lambda () - (setq display-line-numbers-witdth - (length (format "%s" (count-lines (point-max) - (point-min))))) - (dolist (mode '(display-line-numbers-mode - rainbow-delimiters-mode - display-fill-column-indicator-mode - whitespace-mode)) - (funcall mode 1))))) -(add-hook 'org-mode-hook - (lambda () - (dolist (mode '(whitespace-mode - display-fill-column-indicator-mode)) - (funcall mode 0)) - (setq org-pretty-entities t))) + ;; radix + (defun radix (dir) + (lambda () + (let* ((radix "~/areas/code/scm/radix") + (default-directory (concat radix "/radix/" dir "/"))) + (call-interactively 'find-file)))) -;; Aesthetics -(load-theme 'meimuna t) -(setq cursor-type 'box) + (defun radix-packages () + (interactive) + (funcall (radix "packages"))) -;; Smooth scroll -(setq scroll-step 1) + (defun radix-services () + (interactive) + (funcall (radix "services"))) -;; Please never show me a dialog box again -(setq use-dialog-box nil) + (defun radix-home-services () + (interactive) + (funcall (radix "home/services"))) -;; IRC -(setq circe-nick "anemofilia") -(setq circe-channels - '("#emacs" "#gnu" "#guile" "#guix" "#libreboot" "#spritely")) + (defun radix-system () + (interactive) + (funcall (radix "system"))) -(require 'meow) -(defun meow-setup () - (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) - (apply 'meow-motion-overwrite-define-key - '(("j" . meow-next) - ("k" . meow-prev) - ("" . ignore))) - (apply 'meow-leader-define-key - '(;; SPC j/k will run the original command in MOTION state. - ("j" . "H-j") - ("k" . "H-k") - ;; Use SPC (0-9) for digit arguments. - ("1" . meow-digit-argument) - ("2" . meow-digit-argument) - ("3" . meow-digit-argument) - ("4" . meow-digit-argument) - ("5" . meow-digit-argument) - ("6" . meow-digit-argument) - ("7" . meow-digit-argument) - ("8" . meow-digit-argument) - ("9" . meow-digit-argument) - ("0" . meow-digit-argument) - ("/" . meow-keypad-describe-key) - ("?" . meow-cheatsheet))) - (apply 'meow-normal-define-key - '(("0" . meow-expand-0) - ("9" . meow-expand-9) - ("8" . meow-expand-8) - ("7" . meow-expand-7) - ("6" . meow-expand-6) - ("5" . meow-expand-5) - ("4" . meow-expand-4) - ("3" . meow-expand-3) - ("2" . meow-expand-2) - ("1" . meow-expand-1) - ("-" . negative-argument) - (";" . meow-reverse) - ("," . meow-inner-of-thing) - ("." . meow-bounds-of-thing) - ("[" . meow-beginning-of-thing) - ("]" . meow-end-of-thing) - ("a" . meow-append) - ("A" . meow-open-below) - ("b" . meow-back-word) - ("B" . meow-back-symbol) - ("c" . meow-change) - ("d" . meow-delete) - ("D" . meow-backward-delete) - ("e" . meow-next-word) - ("E" . meow-next-symbol) - ("f" . meow-find) - ("g" . meow-cancel-selection) - ("G" . meow-grab) - ("h" . meow-left) - ("H" . meow-left-expand) - ("i" . meow-insert) - ("I" . meow-open-above) - ("j" . meow-next) - ("J" . meow-next-expand) - ("k" . meow-prev) - ("K" . meow-prev-expand) - ("l" . meow-right) - ("L" . meow-right-expand) - ("m" . meow-join) - ("n" . meow-search) - ("o" . meow-block) - ("O" . meow-to-block) - ("p" . meow-yank) - ("q" . meow-quit) - ("Q" . meow-goto-line) - ("r" . meow-replace) - ("R" . meow-swap-grab) - ("s" . meow-kill) - ("t" . meow-till) - ("u" . meow-undo) - ("U" . meow-undo-in-selection) - ("v" . meow-visit) - ("w" . meow-mark-word) - ("W" . meow-mark-symbol) - ("x" . meow-line) - ("X" . meow-goto-line) - ("y" . meow-save) - ("Y" . meow-sync-grab) - ("z" . meow-pop-selection) - ("'" . repeat) - ("" . ignore)))) -(meow-setup) -(meow-global-mode) + ;; zero + (defun zero (dir) + (lambda () + (interactive) + (let* ((zero "~/areas/code/scm/zero") + (default-directory (concat zero "/" dir "/"))) + (call-interactively 'find-file)))) -;(require 'setup) -;(setup-define :pkg -; (lambda (feature-or-package) -; `(unless (locate-file ,(symbol-name feature-or-package) -; load-path -; (get-load-suffixes)) -; (:package ',feature-or-package))) -; :documentation "Install PACKAGE if it is not available locally. -;This macro can be used as NAME, and it will replace itself with -;the first PACKAGE." -; :repeatable t -; :shorthand #'cadr) -; -;(setup-define :disabled -; (lambda () `,(setup-quit)) -; :documentation "Always stop evaluating the body.") -; -;(setup-define :load-after -; (lambda (features &rest body) -; (let ((body `(progn -; (require ',(setup-get 'feature)) -; ,@body))) -; (dolist (feature (if (listp features) -; (nreverse features) -; (list features))) -; (setq body `(with-eval-after-load ',feature ,body))) -; body)) -; :documentation "Load the current feature after FEATURES." -; :indent 1) -; -;(setup-define :file-match -; (lambda (regexp) -; `(add-to-list 'auto-mode-alist (cons ,regexp ',(setup-get 'mode)))) -; :documentation "Associate the current mode with files that match REGEXP." -; :debug '(form) -; :repeatable t) -; -;(setup-define :leader -; (lambda (&rest args) -; `(with-eval-after-load 'general -; (general-define-key ,@args -; :states 'normal -; :keymaps 'override -; :prefix "SPC" -; :global-prefix "C-SPC"))) -; :documentation "Define a leader keybind" -; :debug '(form) -; :indent 0) -; -;(setup-define :local-leader -; (lambda (&rest args) -; `(with-eval-after-load 'general -; (let ((map ',(setup-get 'map))) -; (general-define-key ,@args -; :states 'normal -; :keymaps map -; :prefix "SPC m" -; :global-prefix "C-SPC m")))) -; :documentation "Define a local leader keybind" -; :debug '(form) -; :indent 0) -; -;(setup-define :ignore-buffers -; (lambda (&rest buffers) -; `(setq ignored-buffers (append ignored-buffers ',buffers))) -; :documentation "Ignore buffers") -; -;(setup-define :display-rule -; (lambda (condition &rest actions) -; `(add-to-list 'display-buffer-alist '(,condition . ,actions))) -; :documentation "Add to display buffer alist") -; -;(setup (:pkg kakoune) -; (:option ryo-modal-cursor-type 'box -; ryo-modal-cursor-color "#8581E0") -; (:global "" -; (lambda () -; (interactive) -; (if (minibufferp) -; (keyboard-escape-quit) -; (ryo-modal-mode)))) -; (kakoune-setup-keybinds) -; (ryo-modal-keys -; ("M-s" mc/split-region))) -;: -;;; Use a real file manager -;(setup (:pkg dirvish) -; (:hook hl-line-mode) -; (:option dirvish-attributes nil -; dirvish-listing-switches '(--group-directories-first --classify)) -; ;'(vc-state subtree-state all-the-icons collapse git-msg file-time file-size)) -; (dirvish-override-dired-mode)) -; -;(setup (:pkg org-bullets org-present org-roam org-modern)) -;(setup (:pkg elfeed elfeed-org)) -;(setup (:pkg geiser geiser-guile macrostep-geiser)) -;(setup (:pkg cape corfu corfu-doc consult-lsp vertico orderless)) + (defun home () + (interactive) + (funcall (zero "home-environments"))) -(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 '(meimuna)) - '(custom-safe-themes - '("5df271e8c563dcd5b7be07ab5b5a615567b20a36b7c748475df0bb512332f0e1" "c202b7618764218b8ecb21a13c5dc9b318f0879f54105847fa5e1868afb19369" "044d60490c760e63bd39232445702271257a47ab384a3871649ea03a3d2b430a" "322a73057be183963dcd4fbfaa859e636fc8aa5f76f2a24f32a8ee5cc73be484" "671f76d55e2917bcae38168c2363fc21a335683583543b3fe49018cf5542908d" "f2db82bef0fb3e3922053605326d82b3e6494aed5c938440358710e9b78da7d9" "47263df55a6df473a5b9ba13107523f285db25dbbfd793ed5beaf47b7ec11c8e" "452da09d018e5f7bffa1e293c224c8711aa37dc9e7dd1dce24c9be6a0f6067c3" "f2c28b88fc49c9577269afcfdbf4630135c2bc2a4813f379c9a8a3979953e706" "38d107472028475f6d47938a91abf170587b718f4ca84f258ea8d72babe25201" "12bd9d840d3e0f54c607ca63acca59b083eca3cb18b9e5c7b34dfb6a400eaf4b" default)) - '(package-selected-packages - '(eat mines setup kakoune magit-popup edit-indirect bui geiser-guile auctex)) - '(whitespace-style - '(face trailing tabs spaces lines lines-tail lines-char newline missing-newline-at-eof empty indentation::tab indentation::space indentation big-indent space-after-tab::tab space-after-tab::space space-after-tab space-before-tab::tab space-before-tab::space space-before-tab space-mark tab-mark newline-mark))) -(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. - '(whitespace-line ((t nil)))) + (defun system () + (interactive) + (funcall (zero "operating-systems"))) + + (defun files () + (interactive) + (funcall (zero "home-environments/radio/files"))) + + (defun config () + (interactive) + (let* ((default-directory "~/.config/emacs")) + (call-interactively 'find-file))) + + (defun radio-manifests () + (interactive) + (funcall (zero "home-environments/radio/manifests"))) + + (defun radio-packages () + (interactive) + (funcall (zero "home-environments/radio/packages"))) + + ;; misc + (setq-default buffer-file-coding-system 'utf-8-unix) + + :bind ();; unset some keys + ;;("C-x C-b" . nil)) + + :hook (;; globally enabled modes + (after-init . column-number-mode) + (after-init . prettify-symbols-mode) + (after-init . save-place-mode) + (after-init . savehist-mode) + + ((text-mode prog-mode conf-mode) . display-line-numbers-mode) + ((text-mode prog-mode conf-mode) . electric-pair-local-mode) + ((text-mode prog-mode conf-mode) . whitespace-mode))) + +;; server +(use-package server + :config (unless (server-running-p) + (server-start))) + +;; diminish +(use-package diminish) + +;; auto-revert +(use-package autorevert + :diminish auto-revert-mode + :hook ((text-mode prog-mode conf-mode) . auto-revert-mode)) + +;; rainbow-delimiters +(use-package rainbow-delimiters + :hook ((text-mode prog-mode conf-mode) . rainbow-delimiters-mode)) + +;; helpful +(use-package helpful + :custom (help-select-window t) + :bind (("C-h f" . helpful-callable) + ("C-h v" . helpful-variable) + ("C-h k" . helpful-key) + ("C-h C-." . helpful-at-point))) + +;; anzu-mode +(use-package anzu + :diminish anzu-mode + :bind + (([remap query-replace] . anzu-query-replace) + ([remap query-replace-regexp] . anzu-query-replace-regexp) + :map isearch-mode-map + ([remap isearch-query-replace] . anzu-isearch-query-replace) + ([remap isearch-query-replace-regexp] . anzu-isearch-query-replace-regexp)) + :init (global-anzu-mode)) + +;; dirvish +(use-package dirvish + :config + (defun dirvish-dotfiles-toggle () + (interactive) + (setq-default dired-listing-switches + (let ((switches (split-string dired-listing-switches))) + (string-join (if (member "--almost-all" switches) + (remove "--almost-all" switches) + (cons "--almost-all" switches)) + " "))) + (revert-buffer-quick)) + :custom + ((dired-recursive-deletes 'always) + (dired-recursive-copies 'always) + (dired-listing-switches + "-l --human-readable --group-directories-first --no-group") + (dirvish-quick-access-entries + '(("h" "~/" "~") + ("c" "~/.config/" "~/.config") + ("d" "~/media/downloads/" "~/media/downloads") + ("m" "~/media/music/" "~/media/music") + ("p" "~/media/pictures/" "~/media/pictures") + ("v" "~/media/videos/" "~/media/videos") + ("z" "~/areas/code/scm/zero/" "~/areas/code/scm/zero"))) + (dirvish-header-line-format + '(:left (path) :right (free-space))) + (dirvish-mode-line-format + '(:left + (sort file-time " " file-size symlink) + :right + (omit yank index))) + (dirvish-attributes + '(all-the-icons git-msg file-size))) + :bind (("C-x d" . dirvish) + :map dirvish-mode-map + ("h" . dired-up-directory) + ("l" . dired-view-file) + ("RET" . dired-view-file) + ("C-z h" . dirvish-dotfiles-toggle)) + :init (dirvish-override-dired-mode)) + +;; whitespace +(use-package whitespace + :diminish whitespace-mode + :custom ((whitespace-display-mappings + '((space-mark ?\ [?⋅]) + ;; fix strange behaviour with hl-fill-column-mode + ;;(newline-mark ?\n [?↩ ?\n]) + (tab-mark ?\t [?→ ?\t]))))) + +;; hl-fill-column +(use-package hl-fill-column + :config + (set-face-attribute + 'hl-fill-column-face nil + :background (face-attribute 'fill-column-indicator :background) + :inverse-video nil) + (defun hl-fill-column () + "Highlight all spaces in fill-column." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (let ((line-end (line-end-position))) + (when (>= line-end) + (goto-char (+ (line-beginning-position) + (- fill-column 1))) + (overlay-put (make-overlay (- (point) 1) (point)) + 'font-lock-face + '(face :backgound "blue")))) + (forward-line 1))) + (font-lock-fontify-buffer)) + :hook + ;;((text-mode prog-mode conf-mode) . hl-fill-column-mode) + ((text-mode prog-mode conf-mode) . hl-fill-column) + ((text-mode prog-mode conf-mode) . display-fill-column-indicator-mode)) + +;; org +(use-package org + :custom ((org-pretty-entities t) + (org-hide-emphasis-markers t)) + :hook (org-mode . (lambda () + (interactive) + (whitespace-mode 0) + (display-fill-column-indicator-mode 0)))) + +;; irc +(use-package circe + :custom + (circe-nick "anemofilia") + (circe-channels '("#emacs" "#gnu" "#guile" "#guix" "#spritely")) + :hook (circe-mode . circe-server-mode)) + +;; haskell +(use-package haskell + :hook (haskell-mode . haskell-doc-mode)) + +;; mastodon +(use-package mastodon + :custom + (mastodon-instance-url "https://mathstodon.xyz") + (mastodon-active-user "anemofilia") + :hook (mastodon-mode . mastodon-async-mode)) + +;; no-littering +(use-package no-littering) + +;; origami +(use-package origami) + +;; eat +(use-package eat + :hook (eat-mode . meow-insert-mode)) + +;; keys +(use-package which-key + :diminish which-key-mode + :custom ((which-key-idle-delay 0.3) + (which-key-enable-extended-define-key nil)) + :init (which-key-mode)) + +;; pdf-view +(use-package pdf-tools + :custom + (pdf-outline-imenu-use-flat-menus t) + (pdf-view-display-size 1.5) + :bind (:map pdf-view-mode-map + ("r" . pdf-view-rotate) + ("R" . pdf-view-themed-minor-mode) + ("J" . pdf-view-next-page) + ("K" . pdf-view-previous-page) + ("" . imenu)) + :hook + (doc-view-mode . pdf-view-mode) + (pdf-view-mode . pdf-outline-imenu-enable)) + +;; indent s-expr as you type +(use-package isayt + :diminish isayt + :hook ((lisp-mode + emacs-lisp-mode + ielm-mode + scheme-mode + racket-mode + hy-mode + lfe-mode + dune-mode + clojure-mode + fennel-mode) + . isayt-mode) + :commands (isayt-mode)) + +;; lispyville +(use-package lispyville + :diminish lispyville-mode + :custom (lispyville-key-theme + '(operators + slurp/barf-lispy + c-w + additional + text-objects + commentary)) + :hook ((lisp-mode + emacs-lisp-mode + ielm-mode + scheme-mode + racket-mode + hy-mode + lfe-mode + dune-mode + clojure-mode + fennel-mode) + . lispyville-mode)) + +;; scheme +(use-package geiser + :hook ((scheme-mode . geiser-mode) + (geiser-mode . geiser))) + +;; consult +(use-package consult + :bind (("C-x b" . consult-buffer))) + +;; marginalia +(use-package marginalia + :init (marginalia-mode)) + +;; orderless +(use-package orderless + :custom + (orderless-matching-styles '(orderless-initialism orderless-flex)) + (completion-styles '(orderless basic)) + :config + (defun orderless-fast-dispatch (word index total) + (and (= index 0) (= total 1) (length< word 4) + (cons 'orderless-literal-prefix word))) + + (orderless-define-completion-style orderless-fast + (orderless-style-dispatchers '()) + (orderless-matching-styles '(orderless-flexg orderless-regexp)))) + +;; vertico +(use-package vertico + :custom + (vertico-multiform-commands + '((imenu buffer))) + (vertico-buffer-display-action + '(display-buffer-in-direction + (direction . left) + (window-width . 0.3))) + (vertico-buffer-hide-prompt t) + (vertico-cycle nil) + (vertico-scroll-margin 1) + (minibuffer-prompt-properties + (apply #'append '((read-only t) + (cursor-intangible t) + (face minibuffer-prompt)))) + :preface + (defun my-minibuffer-backward-kill (arg) + "When minibuffer is completing a file name delete up to parent + folder, otherwise delete a word" + (interactive "p") + (if minibuffer-completing-file-name + (if (string-match-p "/." (minibuffer-contents)) + (zap-up-to-char (- arg) ?/) + (delete-minibuffer-contents)) + (kill-word (- arg)))) + :hook + (after-init . vertico-multiform-mode) + (minibuffer-setup . cursor-intangible-mode) + :bind (:map vertico-map + ("C-j" . vertico-next) + ("C-k" . vertico-previous) + ("C-f" . vertico-exit)) + :bind (:map minibuffer-local-map + ("C-" . my-minibuffer-backward-kill)) + + :init + (vertico-mode)) + +;; corfu +(use-package corfu + :preface + (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))) + (corfu-mode 1))) + :hook (((prog-mode eshell-mode) . corfu-mode) + (corfu-mode . corfu-popupinfo-mode) + (minibuffer-setup . corfu-enable-in-minibuffer)) + :custom + (corfu-cycle nil) + (corfu-auto t) + (corfu-popupinfo-delay '(1.0 . 0.5)) + (corfu-auto-delay 0.2) + (corfu-auto-prefix 2) + (corfu-quit-no-match 'separator) + (corfu-preselect 'valid) + (corfu-preview-current 'insert) + :bind (:map corfu-map + ("C-s" . corfu-quit) + ("" . corfu-next) + ("" . corfu-previous))) + +;; cape +(use-package cape + :init + (add-hook 'completion-at-point-functions #'cape-file) + (add-hook 'completion-at-point-functions #'cape-tex) + (add-hook 'completion-at-point-functions #'cape-dabbrev) + (add-hook 'completion-at-point-functions #'cape-keyword) + (add-hook 'completion-at-point-functions #'cape-elisp-block) + (add-hook 'completion-at-point-functions #'cape-elisp-symbol)) + +;; (use-package kakoune +;; ;; Having a non-chord way to escape is important, since key-chords don't work in macros +;; :bind ("C-z" . ryo-modal-mode) +;; :hook (after-init . my/kakoune-setup) +;; :config +;; (defun ryo-enter () "Enter normal mode" (interactive) (ryo-modal-mode 1)) +;; (defun my/kakoune-setup () +;; "Call kakoune-setup-keybinds and then add some personal config." +;; (kakoune-setup-keybinds) +;; (setq ryo-modal-cursor-type 'box) +;; (add-hook 'prog-mode-hook #'ryo-enter) +;; (define-key ryo-modal-mode-map (kbd "SPC h") 'help-command) +;; ;; Access all C-x bindings easily +;; (define-key ryo-modal-mode-map (kbd "z") ctl-x-map) +;; (ryo-modal-keys +;; ("," save-buffer) +;; ("P" counsel-yank-pop) +;; ("m" mc/mark-next-like-this) +;; ("M" mc/skip-to-next-like-this) +;; ("n" mc/mark-previous-like-this) +;; ("N" mc/skip-to-previous-like-this) +;; ("M-m" mc/edit-lines) +;; ("*" mc/mark-all-like-this) +;; ("v" er/expand-region) +;; ("C-v" set-rectangular-region-anchor) +;; ("M-s" mc/split-region) +;; (";" (("q" delete-window) +;; ("v" split-window-horizontally) +;; ("s" split-window-vertically))) +;; ("C-h" windmove-left) +;; ("C-j" windmove-down) +;; ("C-k" windmove-up) +;; ("C-l" windmove-right) +;; ("C-u" scroll-down-command :first '(deactivate-mark)) +;; ("C-d" scroll-up-command :first '(deactivate-mark))))) + +(load-file "~/.config/emacs/meow.el") +;;(use-package ryo-modal +;; :custom (ryo-modal-cursor-color "#9688d9")) + +;; This overrides the default mark-in-region with a prettier-looking one, +;; and provides a couple extra commands +;;(use-package visual-regexp +;; :ryo (("s" vr/mc-mark) +;; ("?" vr/replace) +;; ("M-/" vr/query-replace))) +;; +;; Emacs incremental search doesn't work with multiple cursors, but this fixes that +;;(use-package phi-search +;; :bind (("C-s" . phi-search) +;; ("C-r" . phi-search-backward))) + +;; Probably the first thing you'd miss is undo and redo, which requires an extra package +;; to work like it does in kakoune (and almost every other editor). +;;(use-package undo-tree +;; :config +;; (global-undo-tree-mode) +;; :ryo (("u" undo-tree-undo) +;; ("U" undo-tree-redo) +;; ("SPC u" undo-tree-visualize)) +;; :bind (:map undo-tree-visualizer-mode-map +;; ("h" . undo-tree-visualize-switch-branch-left) +;; ("j" . undo-tree-visualize-redo) +;; ("k" . undo-tree-visualize-undo) +;; ("l" . undo-tree-visualize-switch-branch-right)))