From be9123f40c8c09d92529e1cdcbe995b9435ede09 Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 3 Dec 2024 22:00:18 +0100 Subject: (caladan) emacs config updates --- nix/hosts/caladan/home_emile.nix | 254 ++++++++++++++------------------------- 1 file changed, 88 insertions(+), 166 deletions(-) (limited to 'nix/hosts/caladan') diff --git a/nix/hosts/caladan/home_emile.nix b/nix/hosts/caladan/home_emile.nix index 70abebc..475b9dc 100644 --- a/nix/hosts/caladan/home_emile.nix +++ b/nix/hosts/caladan/home_emile.nix @@ -1,3 +1,4 @@ + { pkgs, ... }: { @@ -67,173 +68,78 @@ epkgs: with epkgs; [ nix-mode magit - meow + parinfer-rust-mode + tuareg ]; extraConfig = '' - (setq standard-indent 2) - - ;; MELPA Packages (require 'package) (package-initialize) - (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + (add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/") t) (unless package-archive-contents (package-refresh-contents)) - ;; Install packages. (dolist (package '(use-package sly corfu org)) (unless (package-installed-p package) (package-install package))) - (use-package org) - - ;(use-package evil-colemak-basics) - (when (display-graphic-p) (tool-bar-mode 0) - (scroll-bar-mode 0)) - (setq inhibit-startup-screen t) + (scroll-bar-mode 'left)) (load-theme 'leuven) ;; light theme - - ;; pixel perfect scrolling (setq pixel-scroll-precision-mode 1) - ;; dont create lockfiles + (setq standard-indent 2) (setq create-lockfiles nil) - - ;; delete excess backup version silently (setq delete-old-versions -1) (setq make-backup-files nil) ; stop creating ~ files - - ;; use version controll (setq version-control t) - - ;; utf8 by default(setq coding-system-for-read 'utf-8) (setq coding-system-for-write 'utf-8) - - ;; org-mode - (require 'org) - (define-key global-map "\C-cl" 'org-store-link) - (define-key global-map "\C-ca" 'org-agenda) - (setq org-log-done t) - - ;; random emacs foo (setq-default indent-tabs-mode nil) ;; use spaces, not tabs (setq show-paren-delay 0) (show-paren-mode) - ;; write customizations to a custom file (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) - ;; Configure SBCL as the Lisp program for SLIME - (add-to-list 'exec-path "/Users/emile/.nix-profile/bin") - (defvar inferior-lisp-program "clisp") + (add-to-list 'display-buffer-alist + '("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'" + (display-buffer-no-window) + (allow-no-window . t))) - ;; configure parinfer to be enabled as a mode when the major lisp mode is enabled - (add-to-list 'load-path "/Users/emile/parinfer-rust") - (add-hook 'emacs-lisp-mode 'parinfer-rust-mode) - (add-hook 'emacs-lisp-mods (lambda () (lispy-mode 1))) + ;; general purpose emacs settings + (use-package emacs + :init + + ;; do not allow cursor in the minibuffer prompt + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + + ;; support opening new minibuffers from inside existing minibuffers + (setq enable-recursive-minibuffers t) - (require 'meow) - - (defun meow-setup () - "My colemak-dh meow keybindings with some helix influence." - (setq meow-cheatsheet-layout meow-cheatsheet-layout-colemak-dh) - (meow-motion-overwrite-define-key - ;; Use e to move up, n to move down. - ;; Since special modes usually use n to move down, we only overwrite e here. - '("e" . meow-prev) - '("" . ignore)) - (meow-leader-define-key - '("?" . meow-cheatsheet) - ;; To execute the originally e in MOTION state, use SPC e. - '("e" . "H-e") - '("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-normal-define-key - '("0" . meow-expand-0) - '("1" . meow-expand-1) - '("2" . meow-expand-2) - '("3" . meow-expand-3) - '("4" . meow-expand-4) - '("5" . meow-expand-5) - '("6" . meow-expand-6) - '("7" . meow-expand-7) - '("8" . meow-expand-8) - '("9" . meow-expand-9) - '("-" . negative-argument) - '(";" . meow-reverse) - '("," . meow-inner-of-thing) - '("." . meow-bounds-of-thing) - '("[" . meow-beginning-of-thing) - '("]" . meow-end-of-thing) - '("/" . meow-visit) - '("a" . meow-append) - '("A" . meow-open-below) - '("b" . meow-back-word) - '("B" . meow-back-symbol) - '("c" . meow-change) - ; '("C" . ) - '("d" . meow-delete) - ;'("D" . delete-window) - '("e" . meow-next) - '("E" . meow-next-expand) - '("f" . find-file) - '("F" . flycheck-list-errors) - '("g" . meow-cancel-selection) - '("G" . meow-grab) - '("h" . meow-mark-word) - '("H" . meow-mark-symbol) - '("i" . meow-prev) - '("I" . meow-prev-expand) - '("j" . meow-join) - ; '("J" . ) - '("k" . meow-kill) - '("K" . meow-paren-mode) - '("l" . meow-line) - '("L" . meow-goto-line) - '("m" . meow-block) - '("M" . meow-to-block) - '("n" . meow-left) - '("N" . meow-left-expand) - '("o" . meow-right) - '("O" . meow-right-expand) - '("p" . meow-yank) - ; '("P" . ) - '("q" . meow-quit) - ; '("Q" . ) - '("r" . meow-replace) - '("R" . undo-redo) - '("s" . meow-insert) - '("S" . meow-open-above) - '("t" . meow-till) - ; '("T" . ) - '("u" . meow-undo) - '("U" . meow-undo-in-selection) - '("v" . meow-search) - '("w" . meow-next-word) - '("W" . meow-next-symbol) - '("x" . meow-delete) - '("X" . meow-backward-delete) - '("y" . meow-save) - '("z" . meow-pop-selection) - ; '("Z" . ) - '("'" . repeat) - '("" . ignore))) - - - (meow-setup) - (meow-global-mode 1) - - ;; Corfu completion + ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current + ;; mode. Vertico commands are hidden in normal buffers. This setting is + ;; useful beyond Vertico. + (setq read-extended-command-predicate #'command-completion-default-include-p)) + + ;; Add "lisp" to the list of languages babel is allowed to eval + ;(setq-default org-babel-lisp-eval-fn #'sly-eval) + (org-babel-do-load-languages + 'org-babel-load-languages + '((lisp . t))) + + ;; org-mode + (use-package org) + (define-key global-map "\C-cl" 'org-store-link) + (define-key global-map "\C-ca" 'org-agenda) + (setq org-log-done t) + + ;; =============== plugins ================== + + ;; Corfu - COmpletion in Region FUnction + ;; https://github.com/minad/corfu (use-package corfu :custom (corfu-cycle-tab t) @@ -264,7 +170,8 @@ corfu-auto nil) (corfu-mode)))) - ;; In-margin annotations + ;; Marginalia - Marginalia in the minibuffer + ;; https://github.com/minad/marginalia (use-package marginalia :custom (marginalia-max-relative-age 0) @@ -272,13 +179,20 @@ :init (marginalia-mode)) - ;; Fancy icons + ;; == Fancy icons == + ;; all-the-icons + ;; https://github.com/domtronn/all-the-icons.el + (use-package all-the-icons + :if (display-graphic-p)) + + ;; ... also in completions (use-package all-the-icons-completion :after (marginalia all-the-icons) :hook (marginalia . all-the-icons-completion-marginalia-setup) :init (all-the-icons-completion-mode)) - ;; Usable minibuffers + ;; vectico.el - VERTical Interactive COmpletion + ;; https://github.com/minad/vertico (use-package vertico :init (vertico-mode) :custom (vertico-count 13) @@ -286,44 +200,25 @@ (vertico-cycle nil) :config (vertico-mode)) - ;; orderless completion + ;; orderless - completion ;; This allows searching for space separated terms in any order + ;; https://github.com/oantolin/orderless (use-package orderless :init (setq completion-styles '(orderless basic) completion-category-defaults nil completion-category-overrides '((file (styles partial-completion))) )) - ;; general purpose emacs settings - (use-package emacs - :init - - ;; do not allow cursor in the minibuffer prompt - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - - ;; support opening new minibuffers from inside existing minibuffers - (setq enable-recursive-minibuffers t) - - ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current - ;; mode. Vertico commands are hidden in normal buffers. This setting is - ;; useful beyond Vertico. - (setq read-extended-command-predicate #'command-completion-default-include-p)) - - ;; Add "lisp" to the list of languages babel is allowed to eval - ;(setq-default org-babel-lisp-eval-fn #'sly-eval) - (org-babel-do-load-languages - 'org-babel-load-languages - '((lisp . t))) ;; markdown mode + ;; https://jblevins.org/projects/markdown-mode/ (use-package markdown-mode :ensure t :mode ("README\\.md\\'" . gfm-mode) :init (setq markdown-command "multimarkdown")) - ;; minibuffer with help when waiting too long + ;; Minibuffer with help when waiting too long + ;; In emacs per default with Emacs v30 (use-package which-key :ensure t :config @@ -331,17 +226,44 @@ (setq which-key-idle-secondary-delay 0.1) (which-key-mode)) - ;; Display imenu (symbols) in a separate buffer + ;; imenu-list - Display imenu (symbols) in a separate buffer + ;; https://github.com/bmag/imenu-list (use-package imenu-list :ensure t :init (setq imenu-list-auto-resize t) (setq imenu-list-focus-after-activation t)) - ;; error checking + ;; flycheck - Syntax checking for GNU EmacsĀ¶ + ;; https://www.flycheck.org/en/latest/ (use-package flycheck :ensure t :init (global-flycheck-mode)) + ;; allow the deletion of selected text (don't know why this isn't implemented by default) + (use-package delsel + :ensure nil ; no need to install it as it is built-in, but needs to be activated + :hook (after-init . delete-selection-mode)) + + ; OCaml mode + (use-package tuareg) + (setq tuareg-indent-align-with-first-arg t) + + (defun insert-date () + "Insert today's date at point" + (interactive "*") + (insert (format-time-string "%F"))) + (global-set-key (kbd "C-c C-.") #'insert-date) + + + ;; Configure the Lisp program for SLIME + (add-to-list 'exec-path "/Users/emile/.nix-profile/bin") + (defvar inferior-lisp-program "sbcl") + + ;; configure parinfer to be enabled as a mode when the major lisp mode is enabled + (add-to-list 'load-path "/Users/emile/parinfer-rust") + (add-hook 'emacs-lisp-mode 'parinfer-rust-mode) + (add-hook 'emacs-lisp-mods (lambda () (lispy-mode 1))) + (provide '.emacs) ; makes flycheck happy ''; }; -- cgit 1.4.1