From a3412c9fdf7a2f7eff9bf02c3a20a04137221ef4 Mon Sep 17 00:00:00 2001 From: Michael Chalupiak Date: Sun, 18 Jan 2026 00:51:56 -0500 Subject: [PATCH] more emacs tweaks --- config/.emacs.d/config/keymap.el | 6 +++-- config/.emacs.d/plugins/lang.el | 7 ++++++ config/.emacs.d/plugins/ui.el | 39 +++++++++++++++++++++++++++++++- config/.emacs.d/plugins/utils.el | 8 ++++++- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/config/.emacs.d/config/keymap.el b/config/.emacs.d/config/keymap.el index f82dc1a..d7a41a4 100644 --- a/config/.emacs.d/config/keymap.el +++ b/config/.emacs.d/config/keymap.el @@ -1,7 +1,9 @@ ;;; -*- lexical-binding: t; -*- (global-set-key (kbd "C-c f") #'consult-fd) +(global-set-key (kbd "C-c C-f") #'find-file-at-point) (global-set-key (kbd "C-c r") #'recentf) +(global-set-key (kbd "C-c 0") (lambda () (interactive) (other-window 1) (kill-buffer-and-window))) (global-set-key (kbd "C-c g") #'consult-ripgrep) (global-set-key (kbd "C-c i") #'consult-info) (global-set-key (kbd "C-c s") #'ispell-word) @@ -18,7 +20,7 @@ (global-set-key (kbd "C-c l D") #'eglot-find-declaration) (global-set-key (kbd "C-c l i") #'eglot-find-implementation) (global-set-key (kbd "C-c l t") #'eglot-find-typeDefinition) -(global-set-key (kbd "C-x C-;") (lambda () (interactive) (if (region-active-p) (comment-region) (comment-line)))) +;; (global-set-key (kbd "C-x C-;") (lambda () (interactive) (if (region-active-p) (comment-region) (comment-line)))) (global-set-key (kbd "C-c b") #'ibuffer) (global-set-key (kbd "C-c x") #'kill-current-buffer) @@ -26,7 +28,7 @@ (global-set-key (kbd "C-c k") #'eldoc) (global-set-key (kbd "C-c m") #'man) (global-set-key (kbd "C-c o c") (lambda () (interactive) (dired user-init-dir))) -(global-set-key (kbd "C-c o t") #'eshell) +(global-set-key (kbd "C-c o t") (lambda () (interactive) (eshell 'N))) (global-set-key (kbd "C-c o m") #'magit) ;; multi-cursor diff --git a/config/.emacs.d/plugins/lang.el b/config/.emacs.d/plugins/lang.el index e9e336b..b3b2d8f 100644 --- a/config/.emacs.d/plugins/lang.el +++ b/config/.emacs.d/plugins/lang.el @@ -50,6 +50,13 @@ :defer t :straight '(:type git :host github :repo "nemethf/eglot-x")) +(use-package sly + :ensure t + :defer t + :hook common-lisp-mode + :config + (setq inferior-lisp-program "sbcl")) + (dolist (mode '(c-ts-mode-hook rust-ts-mode-hook odin-ts-mode-hook diff --git a/config/.emacs.d/plugins/ui.el b/config/.emacs.d/plugins/ui.el index 594536c..12ca07b 100644 --- a/config/.emacs.d/plugins/ui.el +++ b/config/.emacs.d/plugins/ui.el @@ -94,11 +94,48 @@ ;; (vertico-count 20) ;; Show more candidates ;; (vertico-resize t) ;; Grow and shrink the Vertico minibuffer (vertico-cycle t) ;; Enable cycling for `vertico-next/previous' - (vertico-multiform-mode) :init + (vertico-multiform-mode) (vertico-mode) (define-key vertico-map (kbd "DEL") #'vertico-directory-delete-char)) +(defvar +vertico-transform-functions nil) + +(cl-defmethod vertico--format-candidate :around + (cand prefix suffix index start &context ((not +vertico-transform-functions) null)) + (dolist (fun (ensure-list +vertico-transform-functions)) + (setq cand (funcall fun cand))) + (cl-call-next-method cand prefix suffix index start)) + +(defun +vertico-highlight-directory (file) + "If FILE ends with a slash, highlight it as a directory." + (if (string-suffix-p "/" file) + (propertize file 'face 'marginalia-file-priv-dir) ; or face 'dired-directory + file)) + +;; function to highlight enabled modes similar to counsel-M-x +(defun +vertico-highlight-enabled-mode (cmd) + "If MODE is enabled, highlight it as font-lock-constant-face." + (let ((sym (intern cmd))) + (if (or (eq sym major-mode) + (and + (memq sym minor-mode-list) + (boundp sym))) + (propertize cmd 'face 'font-lock-constant-face) + cmd))) + +;; add-to-list works if 'file isn't already in the alist +;; setq can be used but will overwrite all existing values +(add-to-list 'vertico-multiform-categories + '(file + ;; this is also defined in the wiki, uncomment if used + ;; (vertico-sort-function . vertico-sort-directories-first) + (+vertico-transform-functions . +vertico-highlight-directory))) +(add-to-list 'vertico-multiform-commands + '(execute-extended-command + (+vertico-transform-functions . +vertico-highlight-enabled-mode))) + + ;; Enable rich annotations using the Marginalia package (use-package marginalia ;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding diff --git a/config/.emacs.d/plugins/utils.el b/config/.emacs.d/plugins/utils.el index 7ebe34b..a047cfe 100644 --- a/config/.emacs.d/plugins/utils.el +++ b/config/.emacs.d/plugins/utils.el @@ -91,7 +91,7 @@ (use-package parinfer-rust-mode :ensure t :defer t - :hook emacs-lisp-mode + :hook ((emacs-lisp-mode common-lisp-mode lisp-mode scheme-mode) . parinfer-rust-mode) :config (electric-pair-mode -1)) @@ -99,5 +99,11 @@ :ensure t :defer t) +;; (use-package zoxide +;; :ensure t +;; :defer t +;; :hook eshell-mode +;; :straight '(:type git host: sourcehut :repo "vonfry/zoxide.el")) + (provide 'utils) ;;; utils.el ends here