More stuff

This commit is contained in:
Nate Anderson 2025-03-28 14:56:16 -06:00
parent 2b5cba96ec
commit 89dccfb79e
2 changed files with 558 additions and 57 deletions

226
init.el
View File

@ -11,7 +11,15 @@
(require 'use-package)
(setq use-package-always-ensure t) ;; Auto-install packages
;; Bell Settings
;; autosave everything!!
(use-package super-save
:config
(super-save-mode +1))
;;
;; UI enhancements
;;
(setq ring-bell-function 'ignore)
(setq visible-bell t)
@ -19,7 +27,7 @@
(set-face-attribute 'default nil
:family "Hurmit Nerd Font Mono"
:foundry "PfEd"
:height 120
:height 140
:background "#000000"
:foreground "#ffffff")
@ -32,59 +40,72 @@
(scroll-bar-mode -1)
(global-display-line-numbers-mode 1)
(use-package super-save
:ensure t
(use-package beacon
:defer 2
:config
(super-save-mode +1))
(beacon-mode 1))
;; magit
(use-package magit
:ensure t)
;; Packages with deferred loading
(use-package helm
:defer 1
:bind (("M-x" . helm-M-x)
("C-c h" . helm-command-prefix))
(use-package dashboard
:config
(global-unset-key (kbd "C-x c"))
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z") 'helm-select-action)
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-split-window-in-side-p t
helm-move-to-line-cycle-in-source t
helm-ff-search-library-in-sexp t
helm-scroll-amount 8
helm-ff-file-name-history-use-recentf t
helm-echo-input-in-header-line t
helm-autoresize-max-height 0
helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(helm-mode 1))
(dashboard-setup-startup-hook)
(use-package catppuccin-theme
:config
(setq catppuccin-flavor 'macchiato)
(load-theme 'catppuccin t)
(add-hook 'after-init-hook (lambda () (run-with-timer 0.5 nil #'catppuccin-reload))))
(use-package which-key
:defer 1
:config
(setq which-key-idle-delay 0.01
which-key-idle-secondary-delay 0.01)
(which-key-setup-side-window-right-bottom)
(which-key-mode))
(setq dashboard-projects-backend 'projectile)
(setq dashboard-items '((recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)
(registers . 5)))
;; (use-package nerd-icons)
;; (setq dashboard-display-icons-p t) ; display icons on both GUI and terminal
;; (setq dashboard-icon-type 'nerd-icons) ; use `nerd-icons' package
;; (setq dashboard-set-heading-icons t)
;; (setq dashboard-set-file-icons t)
(use-package page-break-lines))
(use-package git-gutter
:defer 2
:config
(global-git-gutter-mode +1))
(use-package catppuccin-theme
:config
(setq catppuccin-flavor 'macchiato)
(load-theme 'catppuccin t)
(add-hook 'after-init-hook (lambda () (run-with-timer 0.5 nil #'catppuccin-reload)))
)
(use-package which-key
:defer 1
:config
(setq which-key-idle-delay 0
which-key-idle-secondary-delay 0)
(which-key-setup-side-window-right-bottom)
(which-key-mode))
;; cleaner modeline
(use-package mood-line
:config
(mood-line-mode)
;:custom ()
)
;;
;; MEOW!!
;;
(use-package meow
:config
;; Add selection back after using meow-save
(defun my/after-meow-save (&rest _args)
"Reactivate the selection after saving."
(let ((selection (meow--make-selection
'select
(region-beginning)
(region-end))))
(meow--select selection)))
(advice-add 'meow-save :after #'my/after-meow-save)
(advice-add 'meow-clipboard-save :after #'my/after-meow-save)
(defvar meow-lsp-keymap
(let ((keymap (make-sparse-keymap)))
(define-key keymap (kbd "d") #'xref-find-definitions)
@ -119,10 +140,11 @@
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . helm-do-grep-ag)
'("/" . projectile-ripgrep)
'("a" . eglot-code-actions)
'("b" . helm-mini)
'("f" . helm-find-files))
'("f" . projectile-find-file)
'("d" . helm-find-files))
(meow-normal-define-key
'("0" . meow-expand-0)
'("1" . meow-expand-1)
@ -142,6 +164,9 @@
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("/" . meow-visit)
'(">" . meow-indent)
'("<" . meow-indent)
'("%" . mark-whole-buffer)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
@ -185,29 +210,112 @@
'("." . repeat)
'("~" . upcase-region)
'("`" . downcase-region)
'("<up>" . windmove-up)
'("<down>" . windmove-down)
'("<left>" . windmove-left)
'("<right>" . windmove-right)
'("<escape>" . ignore)))
(meow-setup)
(meow-global-mode 1))
;; Lazy load other packages that are only needed for specific file types
(use-package markdown-mode :defer t)
(use-package go-mode :defer t)
;; (use-package cider :defer t)
(use-package eglot :defer t)
(add-hook 'go-mode-hook 'eglot-ensure)
;;
;; Other goodies
;;
(use-package magit
:defer t)
(use-package projectile
:defer t
:config
(use-package helm
:defer t
:bind (("M-x" . helm-M-x)
("C-c h" . helm-command-prefix))
:config
(global-unset-key (kbd "C-x c"))
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
(define-key helm-map (kbd "C-z") 'helm-select-action)
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-split-window-in-side-p t
helm-move-to-line-cycle-in-source t
helm-ff-search-library-in-sexp t
helm-scroll-amount 8
helm-ff-file-name-history-use-recentf t
helm-echo-input-in-header-line t
helm-autoresize-max-height 0
helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(helm-mode 1))
(use-package helm-projectile
:defer t)
(use-package helm-rg
:defer t)
(use-package ripgrep
:defer t)
)
;;
;; LSP
;;
(use-package eglot
:defer t
:hook (prog-mode . eglot-ensure) ; hook eglot for any programming-mode-derived mode
)
;; If using Company (recommended)
(use-package company
:ensure t
:defer t
:hook (eglot-managed-mode . company-mode)
:config
(setq company-idle-delay 0.1
company-minimum-prefix-length 1))
;; Coding Specific
(use-package yaml-mode
:defer t)
(use-package markdown-mode
:defer t)
(use-package go-mode
:defer t)
(use-package dockerfile-mode
:defer t)
(use-package docker-compose-mode
:defer t)
(use-package cider
:defer t)
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode)
:defer t)
(use-package hl-todo
:hook (prog-mode . hl-todo-mode)
:config
(setq hl-todo-keyword-faces
'(("TODO" . "#FF0000")
("FIXME" . "#FF0000")
("DEBUG" . "#A020F0")
("GOTCHA" . "#FF4500")
("STUB" . "#1E90FF"))))
;; Optionally, measure startup time
;; LLM
(use-package gptel
:defer t
:config
(setq
gptel-model 'claude-3-5-haiku-20241022
gptel-backend (gptel-make-anthropic "Claude"
:stream t :key gptel-api-key)))
;; vterm
(use-package vterm
:defer t)
;;
;; Startup
;;
(add-hook 'emacs-startup-hook
(lambda ()
(message "Emacs loaded in %s seconds"
@ -218,11 +326,15 @@
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(magit super-save company which-key use-package-hydra meow markdown-mode helm go-mode git-gutter eglot-inactive-regions cider catppuccin-theme)))
'(beacon catppuccin-theme cider company dashboard docker-compose-mode
dockerfile-mode eglot-inactive-regions git-gutter go-mode
gptel helm-projectile helm-rg hl-todo magit markdown-mode
meow mood-line nerd-icons page-break-lines
rainbow-delimiters ripgrep super-save use-package-hydra
vterm which-key yaml-mode)))
(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.
)
(put 'downcase-region 'disabled nil)

389
vline.el Normal file
View File

@ -0,0 +1,389 @@
;;; vline.el --- show vertical line (column highlighting) mode.
;; Copyright (C) 2002, 2008-2012 by Taiki SUGAWARA <buzz.taiki@gmail.com>
;; Author: Taiki SUGAWARA <buzz.taiki@gmail.com>
;; Maintainer: Taiki SUGAWARA <buzz.taiki@gmail.com>
;; Keywords: faces, editing, emulating
;; Version: 1.11
;; Time-stamp: <2012-01-08 12:40:18 UTC taiki>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/vline.el
;; URL: http://bitbucket.org/buzztaiki/elisp/src/tip/vline.el
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; put followings your .emacs
;; (require 'vline)
;;
;; if you display a vertical line, type M-x vline-mode. `vline-mode' doesn't
;; effect other buffers, because it is a buffer local minor mode. if you hide
;; a vertical line, type M-x vline-mode again.
;;
;; if you display a vertical line in all buffers, type M-x vline-global-mode.
;;
;; `vline-style' provides a display style of vertical line. see
;; `vline-style' docstring.
;;
;; if you don't want to visual line highlighting (ex. for performance
;; issue), please to set `vline-visual' to nil.
;;
;; if you don't want to use timer (ex. you want to highlight column
;; during moving cursors), please to set `vline-use-timer' to nil.
;;; Change Log:
;; 2012-01-08 taiki
;; fix for the Lint warnings.
;; 2010-02-02 taiki
;; improve performance.
;; 2009-08-26 taiki
;; support org-mode, outline-mode
;; 2009-08-18 taiki
;; add autoload cookies.
;; 2009-08-18 taiki
;; fix last line highlighting probrem.
;; 2009-08-18 taiki
;; support visual line highlighting.
;; - Added face vline-visual.
;; - Added defcustom vline-visual-face.
;; - Added defcustom vline-visual.
;;
;; 2009-08-17 taiki
;; fix continuas line problem.
;; - Don't display vline when cursor into fringe
;; - Don't expand eol more than window width.
;;
;; 2008-10-22 taiki
;; fix coding-system problem.
;; - Added vline-multiwidth-space-list
;; - Use ucs code-point for japanese fullwidth space.
;;
;; 2008-01-22 taiki
;; applied patch from Lennart Borgman
;; - Added :group 'vline
;; - Added defcustom vline-current-window-only
;; - Added header items to simplify for users
;;; TODO:
;; - track window-scroll-functions, window-size-change-functions.
;; - consider other minor modes (using {after,before}-string overlay).
;; - don't use {post,after}-command-hook for performance??
;;; Code:
(defvar vline-overlay-table-size 200)
(defvar vline-overlay-table (make-vector vline-overlay-table-size nil))
(defvar vline-line-char ?|)
(defvar vline-multiwidth-space-list
(list
?\t
(decode-char 'ucs #x3000) ; japanese fullwidth space
))
(defvar vline-timer nil)
(defcustom vline-style 'face
"This variable holds vertical line display style.
Available values are followings:
`face' : use face.
`compose' : use composit char.
`mixed' : use face and composit char."
:type '(radio
(const face)
(const compose)
(const mixed))
:group 'vline)
(defface vline
'((t (:background "light steel blue")))
"A default face for vertical line highlighting."
:group 'vline)
(defface vline-visual
'((t (:background "gray90")))
"A default face for vertical line highlighting in visual lines."
:group 'vline)
(defcustom vline-face 'vline
"A face for vertical line highlighting."
:type 'face
:group 'vline)
(defcustom vline-visual-face 'vline-visual
"A face for vertical line highlighting in visual lines."
:type 'face
:group 'vline)
(defcustom vline-current-window-only nil
"If non-nil then highlight column in current window only.
If the buffer is shown in several windows then highlight column only
in the currently selected window."
:type 'boolean
:group 'vline)
(defcustom vline-visual t
"If non-nil then highlight column in visual lines.
If you specified `force' then use force visual line highlighting even
if `truncate-lines' is non-nil."
:type '(radio
(const nil)
(const t)
(const force))
:group 'vline)
(defcustom vline-use-timer t
"If non-nil, use idle timer instead of (post|after)-command-hook."
:type 'boolean
:group 'vline)
(defcustom vline-idle-time 0.02
"Idle time for highlighting column."
:type 'number
:group 'vline)
;;;###autoload
(define-minor-mode vline-mode
"Display vertical line mode."
:global nil
:lighter " VL"
:group 'vline
(if vline-mode
(progn
(add-hook 'pre-command-hook 'vline-pre-command-hook nil t)
(if vline-use-timer
(vline-set-timer)
(add-hook 'post-command-hook 'vline-post-command-hook nil t)))
(vline-cancel-timer)
(vline-clear)
(remove-hook 'pre-command-hook 'vline-pre-command-hook t)
(remove-hook 'post-command-hook 'vline-post-command-hook t)))
;;;###autoload
(define-global-minor-mode vline-global-mode
vline-mode
(lambda ()
(unless (minibufferp)
(vline-mode 1)))
:group 'vline)
(defun vline-pre-command-hook ()
(when (and vline-mode (not (minibufferp)))
(vline-clear)))
(defun vline-post-command-hook ()
(when (and vline-mode (not (minibufferp)))
(vline-show)))
(defun vline-set-timer ()
(setq vline-timer
(run-with-idle-timer
vline-idle-time t 'vline-timer-callback)))
(defun vline-cancel-timer ()
(when (timerp vline-timer)
(cancel-timer vline-timer)))
(defun vline-timer-callback ()
(when (and vline-mode (not (minibufferp)))
(vline-show)))
(defun vline-clear ()
(mapcar (lambda (ovr)
(and ovr (delete-overlay ovr)))
vline-overlay-table))
(defsubst vline-into-fringe-p ()
(eq (nth 1 (posn-at-point)) 'right-fringe))
(defsubst vline-visual-p ()
(or (eq vline-visual 'force)
(and (not truncate-lines)
vline-visual)))
(defsubst vline-current-column ()
(if (or (not (vline-visual-p))
;; margin for full-width char
(< (1+ (current-column)) (window-width)))
(current-column)
;; hmm.. posn-at-point is not consider tab width.
(- (current-column)
(save-excursion
(vertical-motion 0)
(current-column)))))
(defsubst vline-move-to-column (col &optional bol-p)
(if (or (not (vline-visual-p))
;; margin for full-width char
(< (1+ (current-column)) (window-width)))
(move-to-column col)
(unless bol-p
(vertical-motion 0))
(let ((bol-col (current-column)))
(- (move-to-column (+ bol-col col))
bol-col))))
(defsubst vline-invisible-p (pos)
(let ((inv (get-char-property pos 'invisible)))
(and inv
(or (eq buffer-invisibility-spec t)
(memq inv buffer-invisibility-spec)
(assq inv buffer-invisibility-spec)))))
(defsubst vline-forward (n)
(unless (memq n '(-1 0 1))
(error "n(%s) must be 0 or 1" n))
(if (not (vline-visual-p))
(progn
(forward-line n)
;; take care of org-mode, outline-mode
(when (and (not (bobp))
(vline-invisible-p (1- (point))))
(goto-char (1- (point))))
(when (vline-invisible-p (point))
(if (< n 0)
(while (and (not (bobp)) (vline-invisible-p (point)))
(goto-char (previous-char-property-change (point))))
(while (and (not (bobp)) (vline-invisible-p (point)))
(goto-char (next-char-property-change (point))))
(forward-line 1))))
(vertical-motion n)))
(defun vline-face (visual-p)
(if visual-p
vline-visual-face
vline-face))
(defun vline-show (&optional point)
(vline-clear)
(save-window-excursion
(save-excursion
(if point
(goto-char point)
(setq point (point)))
(let* ((column (vline-current-column))
(lcolumn (current-column))
(i 0)
(compose-p (memq vline-style '(compose mixed)))
(face-p (memq vline-style '(face mixed)))
(line-char (if compose-p vline-line-char ? ))
(line-str (make-string 1 line-char))
(visual-line-str line-str)
(in-fringe-p (vline-into-fringe-p)))
(when face-p
(setq line-str (propertize line-str 'face (vline-face nil)))
(setq visual-line-str (propertize visual-line-str 'face (vline-face t))))
(goto-char (window-end nil t))
(vline-forward 0)
(while (and (not in-fringe-p)
(< i (window-height))
(< i (length vline-overlay-table))
(not (bobp)))
(let ((cur-column (vline-move-to-column column t))
(cur-lcolumn (current-column)))
;; non-cursor line only (workaround of eol probrem.
(unless (= (point) point)
;; if column over the cursor's column (when tab or wide char is appered.
(when (> cur-column column)
(let ((lcol (current-column)))
(backward-char)
(setq cur-column (- cur-column (- lcol (current-column))))))
(let* ((ovr (aref vline-overlay-table i))
(visual-p (or (< lcolumn (current-column))
(> lcolumn (+ (current-column)
(- column cur-column)))))
;; consider a newline, tab and wide char.
(str (concat (make-string (- column cur-column) ? )
(if visual-p visual-line-str line-str)))
(char (char-after)))
;; create overlay if not found.
(unless ovr
(setq ovr (make-overlay 0 0))
(overlay-put ovr 'rear-nonsticky t)
(aset vline-overlay-table i ovr))
;; initialize overlay.
(overlay-put ovr 'face nil)
(overlay-put ovr 'before-string nil)
(overlay-put ovr 'after-string nil)
(overlay-put ovr 'invisible nil)
(overlay-put ovr 'window
(if vline-current-window-only
(selected-window)
nil))
(cond
;; multiwidth space
((memq char vline-multiwidth-space-list)
(setq str
(concat str
(make-string (- (save-excursion (forward-char)
(current-column))
(current-column)
(string-width str))
? )))
(move-overlay ovr (point) (1+ (point)))
(overlay-put ovr 'invisible t)
(overlay-put ovr 'after-string str))
;; eol
((eolp)
(move-overlay ovr (point) (point))
(overlay-put ovr 'after-string str)
;; don't expand eol more than window width
(when (and (not truncate-lines)
(>= (1+ column) (window-width))
(>= column (vline-current-column))
(not (vline-into-fringe-p)))
(delete-overlay ovr)))
(t
(cond
(compose-p
(let (str)
(when char
(setq str (compose-chars
char
(cond ((= (char-width char) 1)
'(tc . tc))
((= cur-column column)
'(tc . tr))
(t
'(tc . tl)))
line-char))
(when face-p
(setq str (propertize str 'face (vline-face visual-p))))
(move-overlay ovr (point) (1+ (point)))
(overlay-put ovr 'invisible t)
(overlay-put ovr 'after-string str))))
(face-p
(move-overlay ovr (point) (1+ (point)))
(overlay-put ovr 'face (vline-face visual-p))))))))
(setq i (1+ i))
(vline-forward -1)))))))
(provide 'vline)
;;; Local Variables:
;;; time-stamp-format: "%:y-%02m-%02d %02H:%02M:%02S %Z %u"
;;; time-stamp-line-limit: 16
;;; End:
;;; vline.el ends here