From 5f94289d2ea65df6662ada832f24e8e89e168999 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Fri, 24 Nov 2023 18:02:30 +0100 Subject: [PATCH] . --- emacs/emacs.nix | 1 + emacs/init.el | 68 ++++++++++++++++++++++++++++++++++++------------- home.nix | 2 ++ 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/emacs/emacs.nix b/emacs/emacs.nix index 8cd187e..ba06727 100644 --- a/emacs/emacs.nix +++ b/emacs/emacs.nix @@ -81,6 +81,7 @@ wgrep which-key xref-union + zig-mode ]; }; } diff --git a/emacs/init.el b/emacs/init.el index fb3528f..f8ea9cf 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -22,6 +22,9 @@ ;; Description ;; ;;; Code: +;;;; Requirements +;; Since I am using `cl-defun` in this init file, I need to require +;; `cl-macs`. (require 'cl-macs) ;;;; Early Variables @@ -32,6 +35,8 @@ ;;;; Personal Information Setup (setq user-full-name "Daniel Ziltener" user-mail-address "dziltener@lyrion.ch") + +;; I use `pass` as password storage. (auth-source-pass-enable) ;;;; Straight.el @@ -55,8 +60,13 @@ (use-package el-patch) ;;;; Helper Functions -(cl-defun conditional-keybind (filter-fn target-fn - &optional (fail-fn #'self-insert-command)) +(cl-defun conditional-keybind + (filter-fn target-fn + &optional (fail-fn #'self-insert-command)) + "Creates a keybinding that checks `filter-fn`. If it succeeds, + `target-fn` is run, otherwise `fail-fn`. If no fail-fn is given, + `self-insert-command` is run instead. + `target-fn` and `fail-fn` must both be interactive." (lambda (_prefix) (interactive "P") (if (funcall filter-fn) @@ -71,6 +81,7 @@ (display-time-mode t) (enable-recursive-minibuffers t) (enable-remote-dir-locals t) + (fill-column 100) (global-hl-line-mode t) (indent-tabs-mode nil) (menu-bar-mode nil) @@ -85,7 +96,8 @@ :hook (minibuffer-setup . cursor-intangible-mode) :config - (advice-add 'risky-local-variable-p :override #'ignore)) + (advice-add 'risky-local-variable-p :override #'ignore) + (global-display-fill-column-indicator-mode t)) ;;;; Org Mode (use-package org @@ -93,6 +105,7 @@ :hook (org-mode . org-indent-mode) (org-src-mode . hack-local-variables) + (org-mode . auto-fill-mode) :config (setq org-directory "~/org") (add-to-list 'org-modules 'collector)) @@ -165,7 +178,7 @@ :straight (:type git :host github :repo "lambda-emacs/lambda-line") :custom (lambda-line-icon-time t) ;; requires ClockFace font (see below) - (lambda-line-clockface-update-fontset "ClockFace") ;; set clock icon + (lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon (lambda-line-position 'bottom) ;; Set position of status-line (lambda-line-abbrev t) ;; abbreviate major modes (lambda-line-hspace " ") ;; add some cushion @@ -174,14 +187,22 @@ (lambda-line-status-invert nil) ;; no invert colors (lambda-line-gui-ro-symbol " ⨂") ;; symbols (lambda-line-gui-mod-symbol " ⬤") - (lambda-line-gui-rw-symbol " ◯") + (lambda-line-gui-rw-symbol "  ") + (lambda-line-vc-symbol "  ") (lambda-line-space-top +.50) ;; padding on top and bottom of line (lambda-line-space-bottom -.50) (lambda-line-symbol-position 0.1) ;; adjust the vertical placement of symbol :config + ;; add evil indicator + (advice-add 'lambda-line-compose :around + (lambda (orig-fun status name primary tertiary secondary) + (funcall orig-fun + status + (concat name evil-mode-line-tag) + primary tertiary secondary))) ;; activate lambda-line (lambda-line-mode) - (lambda-line-clockface-update-fontset "ClockFace") + (lambda-line-clockface-update-fontset "ClockFaceRect") (customize-set-variable 'flymake-mode-line-counter-format '("" flymake-mode-line-error-counter flymake-mode-line-warning-counter flymake-mode-line-note-counter "")) (customize-set-variable 'flymake-mode-line-format '(" " flymake-mode-line-exception flymake-mode-line-counters)) ;; set divider line in footer @@ -213,7 +234,13 @@ ;; :after evil-leader :ensure t :init - (setq evil-want-keybinding nil) + (setq evil-want-keybinding nil + evil-emacs-state-tag " 󰯸 " + evil-normal-state-tag " 󰰓 " + evil-visual-state-tag " 󰰬 " + evil-insert-state-tag " 󰰅 " + evil-motion-state-tag " 󰬔 " + evil-operator-state-tag " 󰰕 ") :config (evil-set-leader 'normal (kbd "")) (evil-set-leader 'normal (kbd "z") t) @@ -335,16 +362,14 @@ :config (add-to-list 'savehist-additional-variables 'corfu-history) :hook - (global-corfu-mode . corfu-history-mode)) + global-corfu-mode) (use-package corfu-popupinfo - :after (corfu corfu-terminal) + :after corfu :custom (corfu-popupinfo-delay '(0.1 . 0.5)) - :commands - corfu-popupinfo-mode - :init - (corfu-popupinfo-mode)) + :hook + global-corfu-mode) (use-package nerd-icons-corfu :after corfu @@ -354,10 +379,9 @@ (use-package corfu-terminal :if (not (display-graphic-p)) :after corfu - :commands - corfu-terminal-mode - :init - (corfu-terminal-mode +1)) + :hook + global-corfu-mode) + (use-package tempel) (use-package xref-union @@ -377,6 +401,7 @@ (evil-snipe-scope 'whole-visible) (evil-snipe-repeat-scope 'whole-buffer) (evil-snipe-spillover-scope 'whole-buffer) + (evil-snipe-tab-increment t) :hook evil-mode (evil-mode . evil-snipe-override-mode) @@ -608,9 +633,15 @@ Point must be at the beginning of balanced expression (sexp)." ;; (add-hook 'flymake-diagnostic-functions #'flymake-chicken-backend nil t)) ;;;; Other Languages + +(use-package zig-mode + :hook + (zig-mode . eglot-ensure) + :mode ("\\.zig\\'" . zig-mode)) + (use-package nix-mode :hook - eglot-ensure + (nix-mode . eglot-ensure) :mode ("\\.nix\\'" . nix-mode)) ;; (use-package lsp-tailwindcss @@ -664,6 +695,7 @@ Point must be at the beginning of balanced expression (sexp)." :ensure t :hook (circe-chat-mode . enable-circe-color-nicks) + (circe-chat-mode . auto-fill-mode) :custom (circe-network-options '(("Lyrion Libera Chat" diff --git a/home.nix b/home.nix index cb7237d..ec32eef 100644 --- a/home.nix +++ b/home.nix @@ -77,6 +77,8 @@ args@{ config, pkgs, hyprland, split-monitor-workspaces, flatpaks, ... }: unzip usbutils wlr-randr + zig + zls zoom-us ];