If Emacs is built with native compilation support, activate it¹, if not, disable it².
;;; -*- lexical-binding: t -*-
;; 1
(if (and (featurep 'native-compile)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
(setq native-comp-jit-compilation t
package-native-compile t)
;; 2
(setq features (delq 'native-compile features)))
Moves the Native Compilation Cache folder out of the Emacs base folder.
(when (fboundp 'startup-redirect-eln-cache)
(startup-redirect-eln-cache
(convert-standard-filename
(expand-file-name "var/eln-cache/" user-emacs-directory))))
Variables used to reference to specific directories, using convert-standard-filename
for multiple OS support.
(defcustom gs-101/projects-code-directory (convert-standard-filename (expand-file-name "~/Projects/Code/"))
"Path for project related to code, like applications."
:type 'directory
)
(defcustom gs-101/modules-directory (convert-standard-filename (expand-file-name "modules" user-emacs-directory))
"Path for this configuration's modules."
:type 'directory
)
;;; -*- lexical-binding: t -*-
(add-to-list 'load-path (expand-file-name gs-101/modules-directory))
(require 'gs-package)
(require 'gs-settings)
(require 'gs-fm)
(require 'gs-keys)
(require 'gs-org)
(require 'gs-org-roam)
(require 'gs-citar)
(require 'gs-cmd)
(require 'gs-dev)
(require 'gs-completion)
(require 'gs-utils)
(require 'gs-chat)
(require 'gs-elfeed)
;;(require 'gs-keys-evil)
(require 'gs-keys-meow)
(require 'gs-ui)
Simple package system […].
;;; -*- lexical-binding: t -*-
(require 'package)
(package-initialize)
(mapc (lambda (archive)
(add-to-list 'package-archives archive)) '(
("melpa" . "https://melpa.org/packages/")
("jcs-elpa" . "https://jcs-emacs.github.io/jcs-elpa/packages/")
))
A configuration macro for simplifying your .emacs.
If use-package
is not installed, refresh the package list and install it¹.
;; 1
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile (require 'use-package))
(provide 'gs-package)
Configuration of default Emacs packages.
;;; -*- lexical-binding: t -*-
An overloading mechanism for Emacs Lisp functions.
(use-package advice
:custom
(ad-redefinition-action 'accept)
)
The Emacs Lisp byte compiler. This crunches Lisp source into a sort of p-code (
lapcode
) which takes up less space and can be interpreted faster.
(use-package bytecomp
:custom
(byte-compile-warnings '(not obsolete))
)
This file contains all the code needed to drive async compilations and any Lisp code needed at runtime to run native code.
(use-package comp-run
:custom
(native-comp-async-query-on-exit t)
(native-comp-async-report-warnings-errors 'silent)
)
window manipulation utilities.
(use-package ediff-wind
:custom
(ediff-window-setup-function 'ediff-setup-windows-plain)
)
Generic package used to configure functions and variables not included in any Emacs Lisp files. This is mainly used for files defied in C code.
(use-package emacs
:config
(setq define-coding-system-alias '(UTF-8 'utf-8))
:custom
(auto-save-include-big-deletions)
(auto-window-vscroll nil) ;; 3
(bidi-inhibit-bpa t) ;; 3
(completion-ignore-case t) ;; 4
(cursor-in-non-selected-windows nil) ;; 3
(debugger-stack-frame-as-list t) ;; 5
(enable-recursive-minibuffers t)
(fast-but-imprecise-scrolling t) ;; 3
(frame-resize-pixelwise t) ;; 1
(history-delete-duplicates t) ;; 5
(hscroll-margin 2) ;; 3
(hscroll-step 1) ;; 3
(inhibit-compacting-font-caches t) ;; 3
(load-prefer-newer t) ;; 2
(locale-coding-system 'utf-8)
;; Disable the cursor in the minibuffer prompt
(minibuffer-prompt-properties '(
cursor-intangible t
read-only t
face minibuffer-prompt
)) ;; 4
(read-buffer-completion-ignore-case t) ;; 4
(read-process-output-max (* 512 1024)) ;; 3
(resize-mini-windows 'grow-only)
(scroll-conservatively 100000)
(scroll-margin 2)
(scroll-step 1)
(text-mode-ispell-word-completion nil)
(user-full-name "Gabriel Santos")
(window-resize-pixelwise nil) ;; 1
(words-include-escapes t)
:hook
(minibuffer-setup . cursor-intangible-mode) ;; 4
)
- ashton;
- gopar;
- jamescherti;
- minad;
- oantolin.
Configuration of the EasyPG Library.
(use-package epg-config
:custom
(epg-pinentry-mode 'loopback)
)
allow-emacs-pinentry
allow-loopback-pinentry
Defines most of Emacs’s file- and directory-handling functions, including basic file visiting, backup generation, link handling, ITS-id version control, load- and write-hook handling, and the like.
(use-package files
:config
(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) ;; 3
(add-to-list 'find-file-not-found-functions #'xenodium/files-create-non-existent-directory) ;; 4
:custom
(auto-mode-case-fold nil)
(backup-by-copying t) ;; 2
(backup-by-copying-when-linked t) ;; 2
(delete-old-versions t)
(find-file-suppress-same-file-warnings t)
(find-file-visit-truename t)
(kept-new-versions 5) ;; 2
(kept-old-versions 5) ;; 2
(revert-without-query '("")) ;; 3
(version-control t) ;; 2
(view-read-only t) ;; 3
:preface
(defun xenodium/files-create-non-existent-directory ()
"Create a non-existent directory."
(when-let* ((file-name buffer-file-name)
(parent-directory (file-name-parent-directory file-name)))
(when (and (not (file-exists-p parent-directory))
(y-or-n-p (format "Create `%s' dir? " parent-directory)))
(make-directory parent-directory t))))
)
Multi-frame management independent of window systems.
This is just to remove the suspend-frame
command, which I don’t find useful. This liberates C-z
to have it used as a prefix.
(use-package frame
:bind
("C-z" . nil)
)
run `grep’ and display the results.
(use-package grep
:custom
(grep-use-headings t)
)
Help commands for Emacs.
(use-package help
:custom
(help-window-select t)
)
Extensions for iBuffer.
(use-package ibuf-ext
:defer t
:hook
(ibuffer-mode . ibuffer-auto-mode)
)
Support for visiting image files.
(use-package image-mode
:after dired
:custom
(image-animate-loop t)
)
Purpose of this package:
- To present a framework for mode-specific buffer indexes;
- A buffer index is an alist of names and buffer positions.
(use-package imenu
:custom
(imenu-flatten 'annotation)
(imenu-space-replacement nil)
)
Commands for making and changing indentation in text. These are described in the Emacs manual.
(use-package indent
:custom
(tab-always-indent 'complete)
:defer t
)
Incremental search minor mode.
(use-package isearch
:custom
(isearch-allow-scroll t)
(isearch-lazy-count t)
(lazy-count-prefix-format "(%s/%s) ")
(lazy-count-suffix-format nil)
(lazy-highlight-initial-delay 0.0)
)
(use-package minibuffer
:custom
(completions-detailed t) ;; 1
(completions-format 'vertical)
(completions-group t) ;; 1
(read-file-name-completion-ignore-case t) ;; 2
(resize-mini-windows t)
:init
(minibuffer-depth-indicate-mode)
(minibuffer-electric-default-mode)
)
This package provides various useful commands (including help system access) through the mouse. All this code assumes that mouse interpretation has been abstracted into Emacs input events.
(use-package mouse
:custom
(mouse-yank-at-point t)
)
Multilingual Enviroment.
(use-package mule
:config
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
:defer t
)
Commands for Multilingual Enviroment.
(use-package mule-cmds
:config
(set-language-environment 'utf-8)
(prefer-coding-system 'utf-8)
:custom
(current-language-environment "UTF-8") ;; 2
(default-input-method nil) ;; 1
:defer t
)
Utility functions for Multilingual Enviroment.
(use-package mule-util
:custom
(truncate-string-ellipsis "…")
)
(un)comment regions of buffers.
(use-package newcomment
:custom
(comment-empty-lines t)
)
Highlight matching paren.
(use-package paren
:config
(set-face-attribute 'show-paren-match nil :box '(:line-width (-1 . -1)))
:custom
(show-paren-delay 0)
:init
(show-paren-mode)
)
Read passwords, possibly using a password cache.
(use-package password-cache
:custom
(password-cache-expiry 60)
)
Scroll a line smoothly.
(use-package pixel-scroll
:init
(pixel-scroll-precision-mode)
)
Save minibuffer history.
(use-package savehist
:custom
(history-length 300)
:init
(savehist-mode)
)
This mode provides mail-sending facilities from within Emacs.
(use-package sendmail
:custom
(sendmail-program "msmtp")
:defer t
)
A grab-bag of basic Emacs commands not specifically related to some major mode or to file-handling.
(use-package simple
:custom
(blink-matching-paren nil)
(column-number-mode t)
(completion-auto-select 'second-tab) ;; 1
(indent-tabs-mode nil)
(kill-do-not-save-duplicates t) ;; 5
(kill-read-only-ok t) ;; 5
(kill-region-dwim 'emacs-word)
(kill-whole-line t) ;; 5
;; Hides commands in completion that are not usable in the current mode
(read-extended-command-predicate #'command-completion-default-include-p) ;; 4
(save-interprogram-paste-before-kill t)
(set-mark-command-repeat-pop t) ;; 5
)
- ashton;
- gopar;
- jamescherti;
- minad;
- oantolin.
Transient is the library used to implement the keyboard-driven menus in Magit.
(use-package transient
:custom
(transient-mode-line-format nil)
)
After losing one hour of work on an accident, this might come in handy.
(use-package emacs
:custom
(undo-limit 67108864) ;; 64 mb
(undo-strong-limit 100663296) ;; 96 mb
(undo-outer-limit 1006632960) ;; 960 mb
)
Unique buffer names dependent on file name.
(use-package uniquify
:custom
(uniquify-buffer-name-style 'forward)
)
A configuration macro for simplifying your .emacs.
(use-package use-package
:custom
(use-package-compute-statistics t)
(use-package-enable-imenu-support t)
(use-package-vc-prefer-newest t)
)
When Visual Line mode is enabled, `word-wrap’ is turned on in this buffer, and simple editing commands are redefined to act on visual lines, not logical lines.
(use-package simple
:hook
(text-mode . visual-line-mode)
)
Log and display warnings.
(use-package warnings
:custom
(warning-suppress-log-types '((comp) (bytecomp)))
)
Packages which I think should be part of Emacs core.
Transient interface for managing and interacting with projects.
(use-package disproject
:bind
(
:map ctl-x-map
("p" . disproject-dispatch)
)
:ensure t
)
Enforce a sneaky Garbage Collection strategy to minimize GC interference with user activity.
(use-package gcmh
:ensure t
:init
(gcmh-mode)
)
Emacs Markdown Mode.
(use-package markdown-mode
:defer t
:ensure t
:custom
(markdown-fontify-code-blocks-natively t)
)
A major mode meant for doing nothing in Emacs.
(use-package nil-mode
:vc (:url "https://github.com/gs-101/nil-mode")
:ensure t
)
The default paths used to store configuration files and persistent data are not consistent across Emacs packages. This isn’t just a problem with third-party packages but even with built-in packages.
(use-package no-littering
:ensure t
:init
(no-littering-theme-backups)
)
(use-package no-littering
:after no-littering
:config
(let ((dir (no-littering-expand-var-file-name "lock-files/")))
(make-directory dir t)
(setq lock-file-name-transforms `((".*" ,dir t))))
)
Keep track of recently opened files.
(use-package recentf
:after no-littering
:custom
(recentf-max-saved-items 1000)
:config
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory)
(recentf-expand-file-name no-littering-var-directory))
:config
(recentf-mode)
)
(use-package no-littering
:after no-littering
:config
(when (file-exists-p custom-file)
(load-file custom-file))
:custom
(custom-file (no-littering-expand-etc-file-name "custom.el"))
)
Minor mode to automatically balance window margins.
(use-package olivetti
:custom
(olivetti-body-width 132)
:defer t
:ensure t
)
Automatically create a tab per project, providing a light tab-bar based workspace management for Emacs.
(use-package otpp
:after project
:config
(otpp-mode)
(otpp-override-mode)
:ensure t
)
Make Emacs use the $PATH set up by the user’s shell.
(use-package exec-path-from-shell
:ensure t
:init
(setq exec-path-from-shell-arguments nil)
(exec-path-from-shell-initialize)
)
Like sudo-edit, but just a single, non-packaged command.
(use-package emacs
:init
(defun karthinks/sudo-find-file (file)
"Open FILE as root."
(interactive "FOpen file as root: ")
(when (file-writable-p file)
(user-error "File is user-writable, aborting sudo"))
(find-file (if (file-remote-p file)
(concat "/" (file-remote-p file 'method) ":"
(file-remote-p file 'user) "@" (file-remote-p file 'host)
"|sudo@root@"
(file-remote-p file 'host) ":" (file-remote-p file 'localname))
(concat "/sudo:root@localhost:" file))))
)
Visualize the undo tree.
(use-package vundo
:bind
(
([remap undo] . vundo)
([remap undo-redo] . vundo)
:map vundo-mode-map
("C-n" . vundo-next)
("C-p" . vundo-previous)
("C-f" . vundo-forward)
("C-b" . vundo-previous)
("C-a" . vundo-stem-root)
("C-e" . vundo-stem-end)
("l" . nil)
("j" . vundo-goto-last-saved)
)
:custom
(vundo-compact-display t)
(vundo-glyph-alist vundo-unicode-symbols)
:ensure t
)
(provide 'gs-settings)
;;; -*- lexical-binding: t -*-
Whenever a file that Emacs is editing has been changed by another program the user normally has to execute the command
revert-buffer
to load the new content of the file into Emacs. This package contains two minor modes: Global Auto-Revert Mode and Auto-Revert Mode. Both modes automatically revert buffers whenever the corresponding files have been changed on disk and the buffer contains no unsaved changes.
(use-package autorevert
:custom
(auto-revert-stop-on-user-input nil)
(auto-revert-verbose nil)
(global-auto-revert-non-file-buffers t)
:init
(global-auto-revert-mode t)
:preface
(add-to-list 'window-state-change-functions
(defun xenodium/window-state-state-change (state)
"Enable `global-auto-revert-mode' per active window."
(let* ((old-selected-window (old-selected-window))
(old-buffer (when old-selected-window
(window-buffer old-selected-window)))
(selected-window (selected-window))
(new-buffer (when selected-window
(window-buffer selected-window))))
(when old-buffer
(with-current-buffer old-buffer
(when buffer-file-name
(auto-revert-mode -1))))
(when new-buffer
(with-current-buffer new-buffer
(when buffer-file-name
(auto-revert-mode +1)))))))
)
[…] major mode for directory browsing and editing.
(use-package dired
:custom
(dired-auto-revert-buffer t)
(dired-clean-confirm-killing-deleted-buffers nil)
(dired-dwim-target t)
(dired-kill-when-opening-new-dired-buffer t)
(dired-listing-switches "-agho --group-directories-first") ;;1
(dired-mouse-drag-files t)
(dired-recursive-copies 'always)
:defer t
)
Less commonly used parts of Dired.
(use-package dired-aux
:after dired
:custom
(dired-do-revert-buffer t)
)
Asynchronous dired actions.
(use-package dired-async
:hook
(dired-mode . dired-async-mode)
)
(use-package emacs
:custom
(delete-by-moving-to-trash t)
)
(use-package mouse
:custom
(mouse-drag-and-drop-region-cross-program t)
)
Major mode for reading EPUBs in Emacs.
(use-package nov
:custom
(nov-header-line-format nil)
:ensure t
)
A lightweight major mode to open media (audio/video) files in an Emacs buffer.
(use-package ready-player
:custom
(ready-player-previous-icon "")
(ready-player-play-icon "")
(ready-player-stop-icon "")
(ready-player-next-icon "")
(ready-player-search-icon "")
(ready-player-set-global-bindings nil)
(ready-player-shuffle-icon "")
(ready-player-open-externally-icon "")
(ready-player-repeat-icon "")
(ready-player-autoplay-icon "")
:ensure t
:hook
(dired-mode . ready-player-mode)
)
Show font features in an Emacs buffer.
(use-package show-font
:ensure t
)
(provide 'gs-fm)
Key bindings for default packages.
- Don’t define C-c letter as a key in Lisp programs. Sequences consisting of C-c and a letter (either upper or lower case; ASCII or non-ASCII) are reserved for users […];
- Function keys F5 through F9 without modifier keys are also reserved for users to define.
- Sequences consisting of C-c followed by a control character or a digit are reserved for major modes;
- Sequences consisting of C-c followed by {, }, <, >, : or ; are also reserved for major modes;
- Sequences consisting of C-c followed by any other ASCII punctuation or symbol character are allocated for minor modes […];
- Don’t bind C-h following any prefix character (including C-c);
- […] don’t bind a key sequence ending in C-g, since that is commonly used to cancel a key sequence.
;;; -*- lexical-binding: t -*-
(use-package align
:bind
("C-x |" . align-regexp)
)
(use-package apropos
:bind
("<f1> a" . apropos)
("<f1> A" . apropos-documentation)
)
(use-package custom
:bind
("<f1> t" . load-theme)
)
(use-package descr-text
:bind
("<f1> '". describe-char)
)
(use-package compile
:bind
("C-c c" . compile)
("C-c C" . recompile)
)
(use-package eglot
:bind
(
:map prog-mode-map
("C-c t e" . eglot)
:map eglot-mode-map
("C-c e a" . eglot-code-actions)
("C-c e o" . eglot-code-action-organize-imports)
("C-c e i" . eglot-find-implementation)
("C-c e t" . eglot-find-typeDefinition)
("C-c e f" . eglot-format)
("C-c e r" . eglot-rename)
)
)
(use-package elisp-mode
:bind
(
:map emacs-lisp-mode-map
("C-c m C-b" . elisp-byte-compile-buffer)
("C-c m e d" . eval-defun)
("C-c m C-e" . elisp-eval-region-or-buffer)
)
)
(use-package emacs
:bind
(
:map emacs-lisp-mode-map
("C-c C-c" . gs-101/eval-dwim)
("C-c m e b" . eval-buffer)
("C-c m e r" . eval-region)
("C-c C-p" . ielm)
)
:config
(defun gs-101/eval-dwim ()
"Evaluate region if it is active; if not, evaluate the buffer.
If the region is active, this function calls `eval-region'.
Otherwise, it calls `eval-buffer'.
If the character before point is a closed parenthesis,
this calls `eval-last-sexp'."
(interactive)
(cond
((use-region-p) (eval-region (region-beginning) (region-end) t)
(message "Region evaluated"))
((eq (char-before) ?\)) (eval-last-sexp nil)
(message "Sexp evaluated"))
(t (eval-buffer nil nil)
(message "Buffer evaluated"))))
)
(use-package files
:bind
(
:map emacs-lisp-mode-map
("C-c m l" . load-library)
)
)
(use-package find-func
:bind
(
:map emacs-lisp-mode-map
("C-c m g f" . find-function)
("C-c m g l" . find-library)
("C-c m g v" . find-variable)
)
)
(use-package flymake
:bind
(
:map flymake-mode-map
([remap next-error] . flymake-goto-next-error)
([remap previous-error] . flymake-goto-prev-error)
:map project-prefix-map
("t f" . flymake-show-project-diagnostics)
:map prog-mode-map
("C-c t f" . flymake-start)
)
)
(use-package dired
:after dired
:bind
(
:map dired-mode-map
("b" . dired-up-directory)
)
)
(use-package emacs
:bind
("C-c q f" . delete-frame)
("C-c i c" . insert-char)
)
(use-package files
:bind
("C-c f r" . recover-this-file)
("C-c b r" . revert-buffer)
("C-c q r" . restart-emacs)
("C-c q e" . save-buffers-kill-emacs)
)
(use-package find-func
:bind
("<f1> P" . find-library)
)
(use-package vc-git
:bind
("M-s g v" . vc-git-grep)
)
(use-package grep
:bind
("M-s g g" . grep)
("M-s g l" . lgrep)
("M-s g r" . rgrep)
)
(use-package help
:bind
("<f1> M" . describe-minor-mode)
("C-h C-b" . describe-prefix-bindings)
)
(use-package help-fns
:bind
("<f1> F" . describe-face)
)
(use-package ibuffer
:bind
("C-x B" . ibuffer)
)
(use-package org
:bind
(
:map org-mode-map
([remap org-narrow-to-subtree] . org-toggle-narrow-to-subtree)
([remap save-buffer] . org-save-all-org-buffers)
("M-p" . org-move-subtree-up)
("M-n" . org-move-subtree-down)
("C-c m s e" . org-sort-entries)
)
)
(use-package org-agenda
:bind
("C-c o a" . org-agenda)
(
:map org-mode-map
("C-c m m" . (lambda ()
(interactive)
;; Filter tasks by tag
(org-tags-view t)))
)
)
(use-package org-clock
:bind
(
:map org-mode-map
("C-c m c" . org-clock-in-last)
("C-c m C" . org-clock-cancel)
)
)
(use-package ox
:bind
(
:map org-mode-map
("C-c m x" . org-export-dispatch)
)
)
(use-package org-keys
:custom
(org-use-speed-commands t)
)
(use-package ol
:bind
(
:map org-mode-map
("C-c m l i" . org-insert-link)
("C-c m l s" . org-store-link)
)
)
(use-package org-list
:bind
(
:map org-mode-map
("C-c m s l" . org-sort-list)
)
)
(use-package org-refile
:bind
(
:map org-mode-map
("C-c m r" . org-refile)
)
)
(use-package org-table
:bind
(
:map org-mode-map
("C-c m -" . org-table-insert-hline)
)
)
(use-package paragraphs
:bind
("M-h" . mark-paragraph)
)
(use-package profiler
:bind
("<f1> T" . profiler-start)
)
Convenient way to repeat the previous command.
(use-package repeat
:init
(repeat-mode)
)
(use-package sort
:bind
("C-c l d" . delete-duplicate-lines)
)
(use-package simple
:bind
("M-g M-c" . gs-101/switch-to-minibuffer-dwim)
("C-?" . undo-redo)
("M-\\" . nil) ;; unbind `delete-horizontal-space', use `cycle-spacing' instead
([remap capitalize-word] . capitalize-dwim)
([remap upcase-word] . upcase-dwim)
([remap downcase-word] . downcase-dwim)
:config
(defun gs-101/switch-to-minibuffer-dwim ()
"Switch to minibuffer in a regular window. In minibuffer, switch to previous window.
If currently in the minibuffer, this function calls `previous-window-any-frame'.
Otherwise, it calls `switch-to-minibuffer'."
(interactive)
(if (minibufferp)
(previous-window-any-frame)
(switch-to-minibuffer)))
)
(use-package shell
:bind
("C-c t s" . shell)
)
A collection of opinionated keyboard-driven user interfaces for various built-in Emacs modes.
(use-package casual
:custom
(casual-lib-use-unicode t)
:ensure t
)
(use-package casual-agenda
:bind
(
:map org-agenda-mode-map
("J" . bookmark-jump)
("M-o" . casual-agenda-tmenu)
("M-j" . org-agenda-clock-goto)
)
)
(use-package casual-bookmarks
:bind
(
:map bookmark-bmenu-mode-map
("J" . bookmark-jump)
("M-o" . casual-bookmarks-tmenu)
)
:config
(easy-menu-add-item global-map '(menu-bar)
casual-bookmarks-main-menu
"Tools")
)
(use-package casual-calc
:bind
(
:map calc-alg-map
("M-o" . casual-calc-tmenu)
:map calc-mode-map
("M-o" . casual-calc-tmenu)
)
)
(use-package casual-calendar
:bind
(
:map calendar-mode-map
("M-o" . casual-calendar)
)
)
(use-package casual-dired
:bind
(
:map dired-mode-map
("/" . casual-dired-search-replace-tmenu)
("s" . casual-dired-sort-by-tmenu)
("M-o" . casual-dired-tmenu)
)
:config
(defun kv/casual-dired-context-menu-addons (menu click)
"Customize context Menu with CLICK event."
(easy-menu-add-item menu nil casual-dired-sort-menu)
menu)
:hook
(context-menu-functions . kv/casual-dired-context-menu-addons)
)
(use-package casual-editkit
:bind
("M-o" . casual-editkit-main-tmenu)
)
(use-package casual-ibuffer
:bind
(
:map ibuffer-mode-map
("F" . casual-ibuffer-filter-tmenu)
("s" . casual-ibuffer-sortby-tmenu)
("M-o" . casual-ibuffer-tmenu)
("]" . ibuffer-forward-filter-group)
("[" . ibuffer-backward-filter-group)
("}" . ibuffer-forward-next-marked)
("{" . ibuffer-backwards-next-marked)
("$" . ibuffer-toggle-filter-group)
)
)
(use-package casual-info
:bind
(
:map Info-mode-map
("B" . bookmark-set)
("n" . casual-info-browse-forward-paragraph)
("p" . casual-info-browse-backward-paragraph)
("M-o" . casual-info-tmenu)
("M-]" . Info-history-forward)
("M-[" . Info-history-back)
("l" . Info-next)
("h" . Info-prev)
("j" . Info-next-reference)
("k" . Info-prev-reference)
("/" . Info-search)
)
)
(use-package casual-isearch
:bind
(
:map isearch-mode-map
("M-o" . casual-isearch-tmenu)
)
)
(use-package casual-re-builder
:bind
(
:map reb-mode-map
("M-o" . casual-re-builder-tmenu)
:map reb-lisp-mode-map
("M-o" . casual-re-builder-tmenu)
)
)
(provide 'gs-keys)
Org is a mode for keeping notes, maintaining ToDo lists, and doing project planning with a fast and effective plain-text system.
;;; -*- lexical-binding: t -*-
(use-package org
:custom
(org-adapt-indentation t)
(org-auto-align-tags nil)
(org-directory (convert-standard-filename (expand-file-name "~/Documents/Org")))
(org-format-latex-options '(
:foreground default
:background nil
:scale 1.0
:html-foreground "Black"
:html-background "Transparent"
:html-scale 1.0
:matchers
("begin" "$1" "$" "$$" "\\(" "\\[")
))
(org-log-done 'time)
(org-log-into-drawer t)
(org-reverse-note-order t)
(org-startup-indented t)
(org-tags-column 0)
(org-todo-repeat-to-state t)
(org-use-sub-superscripts '{})
:hook
(org-mode . variable-pitch-mode)
)
(use-package startup
:custom
(initial-major-mode 'org-mode)
:defer t
)
(use-package org
:config
(org-babel-do-load-languages
'org-babel-load-languages
'(
(C . t)
(clojure . t)
(css . t)
(emacs-lisp . t)
(java . t)
(js . t)
(latex . t)
(python . t)
(scheme . t)
(shell . t)
(sql . t)
(sqlite . t)
))
(push '("conf-unix" . conf-unix) org-src-lang-modes)
(nconc org-babel-default-header-args:java
'((:dir . nil)
(:results . "output")))
:custom
(org-export-babel-evaluate nil)
)
(use-package ob-csharp
:vc (:url "https://github.com/samwdp/ob-csharp")
:after org
:ensure t
:config
(add-to-list 'org-babel-load-languages '(csharp . t))
)
(use-package ob-http
:vc (:url "https://github.com/ag91/ob-http")
:after org
:ensure t
:config
(add-to-list 'org-babel-load-languages '(http . t))
)
Dynamic task and appointment lists for Org.
(use-package org-agenda
:config
(add-to-list 'org-agenda-prefix-format '(agenda . "%-12t% s "))
:custom
(org-agenda-custom-commands
'((
"d" "Daily Agenda"
(
(agenda ""
((org-agenda-overriding-header "* High Priority Tasks")
(org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp "\#A"))
(org-agenda-span 'day)
(org-deadline-warning-days 0)))
(agenda ""
((org-agenda-overriding-header "* Medium Priority Tasks")
(org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp "\#B"))
(org-agenda-span 'day)
(org-deadline-warning-days 0)))
(agenda ""
((org-agenda-overriding-header "* Low Priority Tasks")
(org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp "\#C"))
(org-agenda-span 'day)
(org-deadline-warning-days 0)))
)
)
))
(org-agenda-restore-windows-after-quit t)
(org-agenda-skip-scheduled-if-done t)
(org-agenda-skip-timestamp-if-done t)
(org-agenda-start-with-log-mode t)
(org-agenda-tags-column 0)
(org-agenda-window-setup 'only-window)
)
(use-package org-agenda
:hook
(org-agenda-mode . mlk/org-agenda-fold)
:preface
(defun mlk/org-agenda-fold()
"Fold headers of the agenda starting with \"* \"."
(interactive)
(setq-local outline-regexp "^\\* ")
(setq-local outline-heading-end-regexp "\n")
(setq-local outline-minor-mode-prefix (kbd "C-'"))
(outline-minor-mode)
(local-set-key outline-minor-mode-prefix outline-mode-prefix-map)
(org-defkey org-agenda-mode-map [(tab)] #'outline-toggle-children)
)
)
The habit tracking code for Org.
(use-package org-habit
:custom
(org-habit-graph-column 100)
)
(use-package org
:after org
:config
(defun liron/org-hook-for-repeat-not-on-weekend ()
"Makes repeating tasks skip weekends."
(when (org-property-values "NO_WEEKEND")
;; Get time from item at POINT
(let* ((scheduled-time (org-get-scheduled-time (point)))
;; Convert to timestamp - required for the next step
(seconds-timestamp (time-to-seconds scheduled-time))
;; Convert to decoded time - required to find out the weekday
(decoded-time (decode-time seconds-timestamp))
;; Get weekday
(weekday (decoded-time-weekday decoded-time)))
(when (> weekday 5) ;; Saturday -> move to Sunday
(setq decoded-time
(decoded-time-add decoded-time (make-decoded-time :day 2))))
(when (> weekday 6) ;; Sunday - move to Monday
(setq decoded-time
(decoded-time-add decoded-time (make-decoded-time :day 1))))
(let ((encoded-time (encode-time decoded-time)))
(org-schedule nil encoded-time))
))
)
:hook
(org-todo-repeat . liron/org-hook-for-repeat-not-on-weekend)
)
The time clocking code for Org mode.
(use-package org-clock
:custom
(org-clock-clocked-in-display 'frame-title)
(org-clock-persist t)
(org-clock-report-include-clocking-task t)
)
This file contains code needed for compatibility with older versions of GNU Emacs and integration with other packages.
Support for standard YouTube links is also included, translating them to embbeded links in export.
(use-package org-compat
:config
(org-add-link-type
"youtube"
(lambda (handle)
(browse-url (concat "https://www.youtube.com/watch?v=" handle)))
(lambda (path desc backend)
(cl-case backend
(html (format
"<p style='text-align:center;'>
<iframe width='420' height='315' align='middle'
src='https://youtube.com/embed/W4LxHn5Y_l4?controls=0'
allowFullScreen>
</iframe>
</p>"
path (or desc "")))
(latex (format "\href{%s}{%s}" path (or desc "video"))))))
:custom
(org-fold-catch-invisible-edits 'show-and-error)
)
Visibility cycling of Org entries.
(use-package org-cycle
:custom
(org-cycle-emulate-tab 'whitestart)
)
LaTeX Backend for Org Export Engine.
(use-package ox-latex
:custom
(org-latex-tables-centered nil)
(org-latex-toc-command "\\tableofcontents \\pagebreak")
(org-startup-with-latex-preview t)
(org-preview-latex-default-process 'dvisvgm) ;; 1
(org-preview-latex-image-directory (convert-standard-filename (expand-file-name "ltximg/" temporary-file-directory)))
:config
(add-to-list 'org-latex-classes
'("org-plain-latex"
"\\documentclass{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
:defer t
)
dvipng
doesn’t work for me for some reason.
There are some great packages for Exporting buffers to particular formats, but each one seems to reinvent the core mechanism of processing the font-lock in a buffer such that it can be exported to a particular format.
This package aims to produce a versatile generic core which can process a fontified buffer and elegantly pass the data to any number of backends which can deal with specific output formats.
(use-package engrave-faces
:after ox-latex
:ensure t
:custom
(org-latex-src-block-backend 'engraved)
)
src_bash{sudo dnf install texlive-collection-basic texlive-bookmark texlive-cancel texlive-chemfig texlive-circuitikz texlive-dvipng texlive-dvisvgm texlive-stackengine texlive-pgfplots texlive-mlmodern texlive-titling texlive-hyphenat texlive-fvextra texlive-tcolorbox}
Plain lists for Org.
(use-package org-list
:custom
(org-list-allow-alphabetical t)
)
(use-package org
:config
(add-to-list 'org-modules '(
org-habit
org-id
org-protocol
))
)
Paragraph and sentence parsing.
(use-package paragraphs
:custom
(sentence-end-double-space nil)
:defer t
)
Org refile allows you to refile subtrees to various locations.
(use-package org-refile
:config
(advice-add 'org-refile :after 'org-save-all-org-buffers)
:custom
(org-outline-path-complete-in-steps nil)
(org-refile-allow-creating-parent-nodes 'confirm)
(org-refile-targets '(
(nil :maxlevel . 1)
(org-agenda-files :maxlevel . 1)
))
(org-refile-use-outline-path t)
)
(use-package org
:custom
(org-todo-keywords '(
(sequence
"TODO(t)"
"WRITE(W)"
"WAIT(w!)"
"|"
"DONE(d!)"
"BACKLOG(b)"
"CANCELLED(c@)"
)
(sequence
"GOAL(g)"
"PROJ(p)"
"|"
"DONE(d!)"
)
(sequence
"FIX(f@)"
"FEAT(F@)"
"STYLE(s)"
"REFACTOR(r)"
"CHORE(C@)"
"|"
"MERGED(m)"
"CLOSED(x@)"
)
))
)
(use-package org-src
:custom
(org-src-window-setup 'current-window)
)
Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them.
(use-package org-fragtog
:ensure t
:hook
(org-mode . org-fragtog-mode)
)
Toggle visibility of hidden Org mode element parts upon entering and leaving an element.
(use-package org-appear
:custom
(org-appear-autoentities t)
(org-appear-autolinks t)
(org-appear-autosubmarkers t)
:ensure t
:hook
(org-mode . org-appear-mode)
)
Highlight & annotate text, EWW, Info, and EPUB.
(use-package org-remark
:bind
(
:map org-remark-mode-map
("C-z M m" . org-remark-mark)
("C-z M o" . org-remark-open)
("C-z M n" . org-remark-view-next)
("C-z M p" . org-remark-view-prev)
("C-z M DEL" . org-remark-delete)
)
:ensure t
:config
(org-remark-global-tracking-mode)
)
(use-package org-remark-eww
:hook
(eww-mode . org-remark-eww-mode)
)
(use-package org-remark-info
:hook
(info-mode . org-remark-info-mode)
)
(use-package org-remark
:hook
(nov-mode . org-remark-nov-mode)
)
(use-package fsrs
:vc (:url "https://github.com/bohonghuang/lisp-fsrs")
:defer t
:ensure t
)
(use-package org-srs
:vc (:url "https://github.com/bohonghuang/org-srs")
:bind
(
:map org-mode-map
("C-z m r n" . org-srs-item-create)
("C-z m r e" . org-srs-review-rate-easy)
("C-z m r g" . org-srs-review-rate-good)
("C-z m r h" . org-srs-review-rate-hard)
("C-z m r RET" . org-srs-review-start)
("C-z m r DEL" . org-srs-review-quit)
("C-z m r a" . org-srs-item-cloze-dwim)
("C-z m r k" . org-srs-item-uncloze-dwim)
)
:ensure t
)
(provide 'gs-org)
Rudimentary Roam replica with Org-mode.
;;; -*- lexical-binding: t -*-
REFACTOR: Separate use-package org-roam
into its different files.
(use-package org-roam
:bind
("C-z r f" . org-roam-node-find)
(
:map org-mode-map
("C-z r i" . org-roam-node-insert)
)
:custom
(org-roam-completion-everywhere t)
(org-roam-directory (convert-standard-filename (expand-file-name "~/Documents/Org Roam")))
:demand t
:ensure t
:init
(org-roam-db-autosync-mode)
)
(use-package org-roam
:custom
(org-roam-capture-templates '(
("d" "default" plain
(file "~/Documents/Org Roam/Templates/default.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n")
:unnarrowed t)
("p" "padrão" plain
(file "~/Documents/Org Roam/Templates/padrão.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n\n")
:unnarrowed t)
("n" "notegpt.io" plain
(file "~/Documents/Org Roam/Templates/notegpt.io.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: :notegpt_io:hacker_news:\n\n")
:unnarrowed t)
("r" "redação" plain
(file "~/Documents/Org Roam/Templates/redação.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: :redação:\n\n")
:unnarrowed t)
("s" "summarize.ing" plain
(file "~/Documents/Org Roam/Templates/summarize.ing.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: :summarize_ing:\n\n")
:unnarrowed t)
))
)
(use-package org-roam-dailies
:bind-keymap
("C-z r d" . org-roam-dailies-map)
:bind
(
:map org-roam-dailies-map
("Y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow)
)
:custom
(dw/daily-note-filename "%<%Y-%m-%d>.org")
(dw/daily-note-header "#+title: %<%Y-%m-%d %a>\n\n[[roam:%<%Y-%B>]]\n\n")
)
(use-package org-roam-dailies
:after org-roam-dailies
:custom
(org-roam-dailies-capture-templates '(
("d" "default" entry
"* %?"
:if-new (file+head ,dw/daily-note-filename
,dw/daily-note-header))
("t" "task" entry
"* TODO %?\n %U\n %a\n %i"
:if-new (file+head+olp ,dw/daily-note-filename
,dw/daily-note-header
("Tasks"))
:empty-lines 1)
("l" "log entry" entry
"* %<%I:%M %p> - %?"
:if-new (file+head+olp ,dw/daily-note-filename
,dw/daily-note-header
("Log")))
("j" "journal" entry
"* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
:if-new (file+head+olp ,dw/daily-note-filename
,dw/daily-note-header
("Log")))
("m" "meeting" entry
"* %<%I:%M %p> - %^{Meeting Title} :meetings:\n\n%?\n\n"
:if-new (file+head+olp ,dw/daily-note-filename
,dw/daily-note-header
("Log")))
))
)
(use-package org-agenda
:bind
("C-z r b" . dw/org-roam-capture-inbox)
:preface
(defun dw/org-roam-filter-by-tag (tag-name)
"Filter org roam files by their tags."
(lambda (node)
(member tag-name (org-roam-node-tags node))))
(defun dw/org-roam-list-notes-by-tag (tag-name)
"List org roam files by their tags."
(mapcar #'org-roam-node-file
(seq-filter
(dw/org-roam-filter-by-tag tag-name)
(org-roam-node-list))))
(defun dw/org-roam-refresh-agenda-list () ;; 1
"Refresh the current agenda list, and add the files with the currosponding tag to the agenda list."
(interactive)
(setq org-agenda-files (dw/org-roam-list-notes-by-tag "agenda")))
;; Build the agenda list the first time for the session
(dw/org-roam-refresh-agenda-list)
(defun dw/org-roam-project-finalize-hook ()
"Adds the captured project file to "org-agenda-file" if the capture was not aborted."
;; Remove the hook since it was added temporarily
(remove-hook 'org-capture-after-finalize-hook #'dw/org-roam-project-finalize-hook)
;; Add project file to the agenda list if the capture was confirmed
(unless org-note-abort
(with-current-buffer (org-capture-get :buffer)
(add-to-list 'org-agenda-files (buffer-file-name)))))
(defun dw/org-roam-capture-inbox ()
"Create a org roam inbox file."
(interactive)
(org-roam-capture- :node (org-roam-node-create)
:templates '(("i" "inbox" plain "* %?"
:if-new (file+head "inbox.org" "#+title: Inbox\n#+filetags: :agenda:\n\n")))))
(defun dw/org-roam-goto-month ()
"Lists the files of the selected month with the set tag."
(interactive)
(org-roam-capture- :goto (when (org-roam-node-from-title-or-alias (format-time-string "%Y-%B")) '(4))
:node (org-roam-node-create)
:templates '(("m" "month" plain "\n* Goals\n\n%?* Summary\n\n"
:if-new (file+head "%<%Y-%B>.org"
"#+title: %<%Y-%B>\n#+filetags: :agenda:\n\n")
:unnarrowed t))))
(defun dw/org-roam-goto-year ()
"Lists the files of the selected year with the set tag."
(interactive)
(org-roam-capture- :goto (when (org-roam-node-from-title-or-alias (format-time-string "%Y")) '(4))
:node (org-roam-node-create)
:templates '(("y" "year" plain "\n* Goals\n\n%?* Summary\n\n"
:if-new (file+head "%<%Y>.org"
"#+title: %<%Y>\n#+filetags: :agenda:\n\n")
:unnarrowed t))))
:custom
(org-agenda-hide-tags-regexp "agenda")
)
A graphical frontend for exploring your org-roam Zettelkasten.
(use-package org-roam-ui
:bind
("C-z r u" . org-roam-ui-open)
:custom
(org-roam-ui-sync-theme t)
(org-roam-ui-follow t)
(org-roam-ui-update-on-save t)
(org-roam-ui-open-on-start nil)
(org-roam-ui-browser-function #'browse-url-chromium)
:ensure t
)
(provide 'gs-org-roam)
Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
;;; -*- lexical-binding: t -*-
(use-package citar
:custom
(citar-bibliography "~/Documents/Bibliography.bib")
(citar-citeproc-csl-styles-dir "~/Documents/Zotero/styles/")
(citar-citeproc-csl-style "harvard-cite-them-right.csl")
(citar-format-reference-function 'citar-citeproc-format-reference)
(citar-library-paths '("~/Documents/Zotero/storage/"))
(citar-open-entry-function 'citar-open-entry-in-zotero)
(citar-templates '((main . "${author editor:30%sn} ${date year issued:4} ${title:48}") (suffix . " ${=key= id:15} ${tags keywords keywords:*} ${abstract abstract:*}") (preview . "${author editor:%etal} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.
") (note . "Notes on ${author editor:%etal}, ${title}")))
:hook
(org-mode . citar-capf-setup)
:ensure t
)
(use-package citar-embark
:after citar embark
:custom
(citar-at-point-function 'embark-act)
:ensure t
:hook
(text-mode . citar-embark-mode)
)
(use-package citar-embark
:after citar-embark
:config
(setf (alist-get
'key-at-point
(alist-get '(org-mode) citar-major-mode-functions nil nil #'equal))
#'bdarcus/citar-org-key-at-point)
(defun bdarcus/citar-org-key-at-point ()
"Return citekey at point, when in org property drawer.
Citekey must be formatted as `@key'."
(or (citar-org-key-at-point)
(when (and (equal (org-element-type (org-element-at-point)) 'node-property)
(org-in-regexp (concat "[[:space:]]" org-element-citation-key-re)))
(cons (substring (match-string 0) 2)
(cons (match-beginning 0)
(match-end 0))))))
(add-to-list 'embark-keymap-alist '(bib-reference . citar-map))
)
(use-package oc
:bind
(
:map org-mode-map
("C-c m q" . org-cite-insert)
)
:custom
(org-cite-global-bibliography '("~/Documents/Bibliography.bib"))
(org-cite-insert-processor 'citar)
(org-cite-follow-processor 'citar)
(org-cite-activate-processor 'citar)
)
(use-package oc-csl
:after oc
:custom
(org-cite-csl-styles-dir "~/Documents/Zotero/styles/")
(org-cite-export-processors '((t . (csl "harvard-cite-them-right.csl"))))
)
(use-package citar-org-roam
:bind
("C-z r c" . citar-create-note)
:after citar org-roam
:config
(citar-org-roam-mode)
(add-to-list 'org-roam-capture-templates
'("b" "bibliographic" plain
(file "~/Documents/Org Roam/Templates/default.org")
:if-new
(file+head "%<%Y%m%d%H%M%S>-${citar-citekey}.org" "#+title: ${title}\n\n")
:unnarrowed t))
:custom
(citar-org-roam-capture-template-key "b")
(citar-org-roam-note-title-template "${title}")
:ensure t
)
(provide 'gs-citar)
;;; -*- lexical-binding: t -*-
Emulate A Terminal, in a region, in a buffer and in Eshell.
(use-package eat
:bind
([remap shell] . eat)
:ensure t
:hook
(eshell-load . eat-eshell-mode)
(eshell-load . eat-eshell-visual-command-mode)
)
(use-package vterm
:after vterm
:bind
([remap project-shell] . mocompute/project-shell)
:config
(defun mocompute/project-shell ()
"Start an inferior shell in the current project's root directory.
If a buffer already exists for running a shell in the project's root,
switch to it. Otherwise, create a new shell buffer.
With \\[universal-argument] prefix arg, create a new inferior shell buffer even
if one already exists."
(interactive)
(let* ((default-directory (project-root (project-current t)))
(default-project-shell-name (project-prefixed-buffer-name "shell"))
(shell-buffer (get-buffer default-project-shell-name)))
(if (and shell-buffer (not current-prefix-arg))
(if (comint-check-proc shell-buffer)
(pop-to-buffer shell-buffer (bound-and-true-p display-comint-buffer-action))
(eat shell-buffer))
(eat (generate-new-buffer-name default-project-shell-name)))))
)
(provide 'gs-cmd)
;;; -*- lexical-binding: t -*-
tree-sitter utilities.
(use-package treesit
:custom
(treesit-font-lock-level 4)
)
Source code examples in Org.
(use-package org-src
:config
(mapc (lambda (lang)
(add-to-list 'org-src-lang-modes lang)) '(
("bash" . bash-ts)
("C" . c-ts)
("clojure" . clojure-ts)
("csharp" . csharp-ts)
("css" . css-ts)
("go" . go-ts)
("html" . html-ts)
("java" . java-ts)
("js" . js-ts)
("json" . json-ts)
("python" . python-ts)
("ruby" . ruby-ts)
("rust" . rust-ts)
("toml" . toml-ts)
("yaml" . yaml-ts)
))
)
Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29.
(use-package treesit-auto
:vc (:url "https://github.com/gs-101/treesit-auto" :branch custom)
:config
(global-treesit-auto-mode)
(treesit-auto-add-to-auto-mode-alist 'all)
:custom
(treesit-auto-install t)
:ensure t
)
(use-package git-commit-ts-mode
:vc (:url "https://github.com/danilshvalov/git-commit-ts-mode")
:ensure t
)
(use-package magit
:after git-commit-ts-mode magit
:custom
(git-commit-major-mode 'git-commit-ts-mode)
)
Run compiler as inferior of Emacs, parse error messages.
(use-package compile
:bind
(
:map compilation-mode-map
("n" . next-error-no-select)
("p" . previous-error-no-select)
("q" . kill-buffer-and-window)
)
:custom
(compilation-auto-jump-to-first-error t)
(compilation-max-output-line-length nil)
(compilation-scroll-output t)
(compilation-skip-threshold 2)
:defer t
:hook
(compilation-mode . goto-address-mode)
(compilation-filter . ansi-color-compilation-filter)
)
(use-package compile
:after rust-ts-mode
:config
(push '(cargo "^\\ \\ -->\\ \\([/a-z_\\.]+\\):\\([0-9]+\\):\\([0-9]+\\)" 1 2 3)
compilation-error-regexp-alist-alist)
(push 'cargo compilation-error-regexp-alist)
)
Multi target interface to compile.
(use-package compile-multi
:bind
([remap compile] . compile-multi)
:ensure t
)
(use-package consult-compile-multi
:after compile-multi consult
:ensure t
:config
(consult-compile-multi-mode)
)
(use-package compile-multi-embark
:after compile-multi embark
:ensure t
:config
(compile-multi-embark-mode)
)
Provides support for font-lock, outline, navigation commands, editing and various conversions as well as jumping to the corresponding source file.
(use-package diff-mode
:custom
(diff-add-log-use-relative-names t)
:defer t
)
Eglot (“Emacs Polyglot”) is an Emacs LSP client that stays out of your way.
(use-package eglot
:custom
(eglot-autoshutdown t)
(eglot-connect-timeout nil)
(eglot-sync-connect nil)
:defer t
)
Boost eglot using lsp-booster.
(use-package eglot-booster
:vc (:url "https://github.com/jdtsmith/eglot-booster")
:ensure t
:hook
(eglot-managed-mode . eglot-booster-mode)
)
Eglot adds extensive support of the language server protocol to Emacs. However, one feature it lacks is Code Lens support.
This shows how many references (mentions in comments) a given symbol has throughout the project.
(use-package eglot-codelens
:vc (:url "https://github.com/Gavinok/eglot-codelens")
:hook
(eglot-managed-mode . eglot-codelens-mode)
:ensure t
)
Support for even more LSP extesnions, primarily for functionality introduced by rust-analyzer.
(use-package eglot-x
:vc (:url "https://github.com/nemethf/eglot-x")
:bind
(
:map eglot-mode-map
([remap compile] . eglot-x-ask-runnables)
([remap newline] . eglot-x-on-enter)
)
:custom
(eglot-x-enable-server-status nil)
:ensure t
)
Additional language server functionality implemented with Eglot. There’s also support for semantic tokens, but I didn’t use it here as it messes with the font lock. Only changes I’d make with font-locking are those with Prism.
(use-package eglot-supplements
:vc (:url "https://codeberg.org/harald/eglot-supplements")
:defer t
:ensure t
)
(use-package eglot-cthier
:after eglot
:bind
(
:map eglot-mode-map
("C-c e H" . eglot-cthier-request-call-hierarchy)
)
)
(use-package eglot-marocc
:after eglot
:bind
(
:map eglot-mode-map
("C-c e h" . eglot-marocc-request-highlights)
("C-c e n" . eglot-marocc-goto-next-highlight)
("C-c e p" . eglot-marocc-goto-previous-highlight)
)
)
(use-package eglot-marocc
:after eglot-marocc catppuccin-theme
:custom
(set-face-attribute 'eglot-marocc-occurence-text nil :foreground (catppuccin-color 'green))
)
Emacs Eglot support for clangd inactiveRegions LSP extension and ccls skippedRegions. Make ifdef code semitransparent following build time flags and defines.
(use-package eglot-inactive-regions
:ensure t
:custom
(eglot-inactive-regions-style 'darken-foreground)
(eglot-inactive-regions-opacity 0.3)
:hook
(eglot-connect . eglot-inactive-regions-mode)
)
Show function arglist or variable docstring in echo area.
(use-package eldoc
:custom
(eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
(eldoc-echo-area-use-multiline-p nil)
(eldoc-idle-delay 0)
)
Makes Eglot spew out more documentation information from the language server than it already does.
(use-package eglot-signature-eldoc-talkative
:after eglot
:config
(advice-add #'eglot-signature-eldoc-function :override #'eglot-signature-eldoc-talkative)
:ensure t
)
Make VCS diffstat available via eldoc.
(use-package eldoc-diffstat
:vc (:url "https://github.com/kljohann/eldoc-diffstat/")
:after eldoc
:ensure t
:hook
(magit-log-mode . eldoc-diffstat-mode)
)
Automatic parenthesis pairing.
(use-package elec-pair
:hook
(prog-mode . electric-pair-local-mode)
)
A universal on-the-fly syntax checker.
;; (use-package flymake
;; :hook
;; (prog-mode . flymake-mode)
;; )
Collection of checkers for flymake.
(use-package flymake-collection
:ensure t
:config
(push '((c-mode c-ts-mode) flymake-collection-gcc (flymake-collection-clang :disabled t)) flymake-collection-hook-config)
(push '((python-mode python-ts-mode) flymake-collection-flake8 (flymake-collection-pycodestyle :disabled t)) flymake-collection-hook-config)
:hook
(flymake-mode . flymake-collection-hook-setup)
)
The next generation Clojure major mode for Emacs, powered by TreeSitter.
(use-package clojure-ts-mode
:custom
(clojure-ts-comment-macro-font-lock-body t)
(clojure-ts-indent-style 'fixed)
(clojure-ts-toplevel-inside-comment-form t)
:defer t
:ensure t
)
The Clojure Interactive Development Environment that Rocks for Emacs.
(use-package cider
:after clojure-ts-mode
:bind
(
:map cider-mode-map
("C-c C-p" . cider-jack-in-clj)
)
:ensure t
:hook
(clojure-ts-mode . cider-mode)
)
tree-sitter support for Go.
(use-package go-ts-mode
:bind
(
:map go-ts-mode-map
("C-c m t f" . go-ts-mode-test-this-file)
("C-c m t p" . go-ts-mode-test-this-package)
("C-c m t ." . go-ts-mode-test-this-function-at-point)
)
:defer t
)
Lisp editing for Emacs.
(use-package lisp
:bind
(
:map lisp-mode-map
("C-c C-p" . run-lisp)
)
:custom
(inferior-lisp-program "sbcl")
(narrow-to-defun-include-comments t)
:defer t
)
Emacs editing PostgreSQL databases.
;; Library
(use-package pg
:vc (:url "https://github.com/emarsden/pg-el/")
:ensure t
)
(use-package pgmacs
:vc (:url "https://github.com/emarsden/pgmacs")
:defer t
:ensure t
)
Python’s flying circus support for Emacs.
(use-package python
:custom
(python-indent-guess-indent-offset-verbose nil)
:defer t
)
Emacs support for direnv which operates buffer-locally.
(use-package envrc
:ensure t
:hook
(change-major-mode-after-body . envrc-mode)
)
src_bash{sudo dnf install direnv}
Python Executable Tracker. Keeps track of virtual enviroments.
(use-package pet
:custom
(pet-toml-to-json-program "yq")
:ensure t
;; :hook
;; (eglot-server-initialized . pet-eglot-setup)
)
src_bash{sudo dnf install yq}
Automatically activate python virtualenv using virtualenvwrapper.el.
(use-package auto-virtualenvwrapper
:ensure t
:hook
(python-base-mode . (lambda ()
(auto-virtualenvwrapper-activate)
(pet-mode)
(setq-local
python-shell-interpreter (pet-executable-find "python")
python-shell-virtualenv-root (pet-virtualenv-root))))
)
Run pytest inside Emacs.
(use-package python-pytest
:bind
(
:map python-base-mode-map
("C-c m t" . python-pytest-dispatch)
)
:ensure t
)
A transient UI for Cargo, Rust’s package manager.
(use-package cargo-transient
:bind
(
:map rust-ts-mode-map
("C-c C-p" . cargo-transient)
)
:ensure t
:custom
(cargo-transient-buffer-name-function 'project-prefixed-buffer-name)
)
Collection of modes for working with different Scheme interpreters.
(use-package geiser-guile
:bind
(
:map scheme-mode-map
("C-c C-p" . geiser)
("C-c C-c" . gs-101/geiser-eval-dwim)
)
:config
(defun gs-101/geiser-eval-dwim ()
"Evaluate region if it is active; if not, evaluate the buffer.
If the region is active, this function calls `geiser-eval-region'.
Otherwise, it calls `geiser-eval-buffer'.
If the character before point is a closed parenthesis,
this calls `geiser-eval-last-sexp'."
(interactive)
(cond
((use-region-p) (geiser-eval-region (region-beginning) (region-end) t)
(message "Region evaluated"))
((eq (char-before) ?\)) (eval-last-sexp nil)
(message "Sexp evaluated"))
(t (eval-buffer nil nil)
(message "Buffer evaluated"))))
:custom
(geiser-guile-binary "guile3.0")
:defer t
:ensure t
)
Major mode for editing shell scripts. Bourne, C and rc shells as well as various derivatives are supported and easily derived from. Structured statements can be inserted with one command or abbrev. Completion is available for filenames, variables known from the script, the shell and the environment as well as commands
(use-package sh-script
:bind
(
:map bash-ts-mode-map
("C-c C-p" . shell)
:map sh-mode-map
("C-c C-p" . shell)
)
:defer t
)
Minor mode to resolve diff3 conflicts.
(use-package smerge-mode
:init
(smerge-mode)
)
Handling capitalized subwords in a nomenclature.
(use-package subword
:hook
(prog-mode . subword-mode)
)
Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
(use-package aggressive-indent
:config
(defun gs-101/aggressive-indent-mode-lisp ()
"Check if MAJOR-MODE is a Lisp mode.
If it is, enable `aggressive-indent-mode'."
(when (string-match-p "clojure.*-mode\\'" (symbol-name major-mode))
(aggressive-indent-mode))
(when (string-match-p "lisp.*-mode\\'" (symbol-name major-mode))
(aggressive-indent-mode))
(when (derived-mode-p 'scheme-mode)
(aggressive-indent-mode)))
:ensure t
:hook
(css-mode . aggressive-indent-mode)
(prog-mode . gs-101/aggressive-indent-mode-lisp)
)
Run code formatter on buffer contents without moving point, using RCS patches and dynamic programming.
(use-package apheleia
:ensure t
:config
(setf (alist-get 'clang-format apheleia-formatters)
'("clang-format" "--style=microsoft" "--assume-filename"
(or (apheleia-formatters-local-buffer-file-name)
(apheleia-formatters-mode-extension)
".c"))
)
:hook
(prog-mode . apheleia-mode)
)
src_bash{sudo dnf install black}
An unofficial Copilot plugin for Emacs.
(use-package copilot
:ensure t
:bind
(
:map prog-mode-map
("C-z t c" . gs-101/copilot-toggle)
:map copilot-completion-map
("<tab>" . copilot-accept-completion)
("TAB" . copilot-accept-completion)
("C-<tab>" . copilot-accept-completion-by-word)
("C-TAB" . copilot-accept-completion-by-word)
("C-n" . copilot-next-completion)
("C-p" . copilot-previous-completion)
)
:config
(defun gs-101/copilot-toggle ()
"Toggle `copilot-mode' on or off."
(interactive)
(if copilot-mode
(progn
(copilot-mode -1)
(message "Copilot mode deactivated"))
(progn
(copilot-mode 1)
(message "Copilot mode activated"))))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2))
(add-to-list 'copilot-indentation-alist '(org-mode 2))
)
Structured Editing and Navigation in Emacs with Tree-Sitter.
(use-package combobulate
:vc (:url "https://github.com/mickeynp/combobulate")
:bind
(
:map combobulate-key-map
([query-replace-regexp] . combobulate-cursor-edit-node-by-text-dwim)
)
:config
(defun cxa/activate-combobulate-on-ts-mode ()
"Check if MAJOR MODE is a tree-sitter mode. If it is, enable `combobulate-mode'."
(when (string-match-p "-ts-mode\\'" (symbol-name major-mode))
(combobulate-mode)))
:custom
(combobulate-key-prefix "C-z t c")
:ensure t
:hook
(text-mode . cxa/activate-combobulate-on-ts-mode)
(prog-mode . cxa/activate-combobulate-on-ts-mode)
)
Debug Adapter Protocol for Emacs.
(use-package dape
:defer t
:ensure t
:hook
(dape-display-source . pulse-momentary-highlight-one-line)
)
src_bash{sudo dnf install delve}
Emacs integration for Exercism.
(use-package exercism
:commands
(exercism)
:custom
(exercism--workspace (convert-standard-filename (expand-file-name "study/exercism/" gs-101/projects-code-directory)))
:defer t
:ensure t
)
Emacs major modes for Git configuration files.
(use-package git-modes
:defer t
:ensure t
)
A simple LLM client for Emacs.
(use-package gptel
:bind
("C-z g b" . gptel)
("C-z g DEL" . gptel-abort)
("C-z g a" . gptel-add)
("C-z g C-x C-f" . gptel-add-file)
("C-z g m" . gptel-menu)
("C-z g r" . gptel-rewrite)
("C-z g RET" . gptel-send)
("C-z g p" . gptel-system-prompt)
:custom
(gptel-default-mode 'org-mode)
(gptel-org-branching-context t)
:ensure t
)
Try, test, and deploy from a wide range of model types, sizes, and specializations.
(use-package gptel-openai
:after gptel
:config
(gptel-make-openai "Github Models"
:host "models.inference.ai.azure.com"
:endpoint "/chat/completions"
:stream t
:key #'gptel-api-key
:models '(
gpt-4o
gpt-4o-mini
meta-llama-3.1-405b-instruct
llama-3.2-90B-vision-instruct
))
)
Quick LLM lookups in Emacs.
(use-package gptel-quick
:vc (:url "https://github.com/karthink/gptel-quick")
:after gptel
:ensure t
)
(use-package gptel-quick
:after gptel-quick embark
:bind
(
:map embark-general-map
("g" . gptel-quick)
)
)
An Emacs LeetCode client.
(use-package leetcode
:custom
(leetcode-directory (convert-standard-filename (expand-file-name "study/leetcode-solutions/" gs-101/projects-code-directory)))
(leetcode--paid "$")
(leetcode-save-solutions t)
(leetcode--User-Agent ("User Agent" . "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.1"))
:defer t
:ensure t
)
It’s Magit! A Git Porcelain inside Emacs.
(use-package magit
:bind
("C-c v B" . magit-blame)
("C-c v C" . magit-clone)
("C-c v /" . magit-dispatch)
("C-c v F" . magit-fetch)
("C-c M-g" . magit-file-dispatch)
("C-c v x" . magit-file-delete)
("C-c v ." . magit-file-dispatch)
("C-c v L" . magit-log)
("C-c v g" . magit-status)
("C-c v G" . magit-status-here)
("C-c v c c" . magit-commit)
("C-c v c f" . magit-commit-fixup)
("C-c v l s" . magit-list-submodules)
:custom
(magit-diff-refine-hunk t)
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
:ensure t
:hook
(magit-mode . magit-wip-mode)
(magit-process-find-password-functions . magit-process-password-auth-source)
)
Work with Git forges from the comfort of Magit.
To make use of this package a token must be generated.
(use-package forge
:after magit
:bind
("C-c v '". forge-dispatch)
("C-c v c i" . forge-create-issue)
("C-c v c p" . forge-create-pullreq)
("C-c v f c" . forge-browse-commit)
("C-c v f i" . forge-browse-issue)
("C-c v f p" . forge-browse-pullreq)
("C-c v l i" . forge-list-issues)
("C-c v l n" . forge-list-notifications)
("C-c v l p" . forge-list-pullreqs)
("C-c v l r" . forge-list-repositories)
:ensure t
)
Support for Org links to Magit buffers.
(use-package orgit
:after magit
:bind
(
:map magit-mode-map
("C-c m l s" . org-store-link)
)
:ensure t
)
A linting library for elisp package metadata.
(use-package package-lint
:ensure t
)
(use-package package-lint-flymake
:after package-lint flymake
:ensure t
:hook
(emacs-lisp-mode . package-lint-flymake-setup)
)
Projectile like project management library built on Emacs project.el.
(use-package projection
:ensure t
:bind-keymap
("C-z p" . projection-map)
:bind
(
:map projection-map
("C" . projection-commands-build-project)
("e" . projection-recentf)
)
:init
(global-projection-hook-mode)
)
(use-package projection-multi
:after projection compile-multi
:ensure t
:bind
(
:map projection-map
("c" . projection-multi-compile)
)
)
(use-package projection-multi-embark
:after projection compile-multi embark
:ensure t
:config
(projection-multi-embark-setup-command-map)
)
Emacs plugin for automatic time tracking and metrics generated from your programming activity.
(use-package wakatime-mode
:custom
(wakatime-api-key (auth-source-pick-first-password :host "wakatime.com"))
:ensure t
:hook
(prog-mode . global-wakatime-mode)
)
(provide 'gs-dev)
;;; -*- lexical-binding: t -*-
Emacs completion style that matches multiple regexps in any order.
(use-package orderless
:config
(orderless-define-completion-style minad/orderless-initialism
(orderless-matching-styles '(
orderless-initialism
orderless-literal
orderless-regexp
)))
(orderless-define-completion-style minad/orderless-simple
(orderless-style-dispatchers nil)
(orderless-matching-styles '(orderless-literal)))
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '(
(file (styles partial-completion))
(command (styles minad/orderless-initialism))
(variable (styles minad/orderless-initialism))
(symbol (styles minad/orderless-initialism))
(minibuffer (styles minad/orderless-initialism))
))
(orderless-comment-separator #'orderless-escapable-split-on-space)
(orderless-style-dispatchers (list
#'minad/orderless-consult-dispatch
#'orderless-affix-dispatch
))
:ensure t
:preface
(defun minad/orderless--consult-suffix ()
"Regexp which matches the end of string with Consult tofu support."
(if (and (boundp 'consult--tofu-char) (boundp 'consult--tofu-range))
(format "[%c-%c]*$"
consult--tofu-char
(+ consult--tofu-char consult--tofu-range -1))
"$"))
;; Recognizes the following patterns:
;; * .ext (file extension)
;; * regexp$ (regexp matching at end)
(defun minad/orderless-consult-dispatch (word _index _total)
"Ensure that $ works with Consult commands, witch add disambiguation suffixes."
(cond
((string-suffix-p "$" word)
`(orderless-regexp . ,(concat (substring word 0 -1) (minad/orderless--consult-suffix))))
;; File extensions
((and (or minibuffer-completing-file-name
(derived-mode-p 'eshell-mode))
(string-match-p "\\`\\.." word))
`(orderless-regexp . ,(concat "\\." (substring word 1) (minad/orderless--consult-suffix))))))
)
Completion At Point Extensions.
(use-package cape
:ensure t
:hook
(completion-at-point-functions . cape-dabbrev)
(completion-at-point-functions . cape-emoji)
(completion-at-point-functions . cape-file)
)
(use-package cape
:config
(defun minad/emacs-lisp-ignore-keywords (cand)
"Remove keywords from the CAND list, unless the completion text starts with a `:'."
(or (not (keywordp cand))
(eq (char-after (car completion-in-region--data)) ?:)))
(defun minad/emacs-lisp-capf ()
"`completion-at-point-functions' for `emacs-lisp-mode', including support for symbols currently unknown to Emacs, using `cape-dabbrev'.
Also adds `cape-file' as a fallback."
(setq-local completion-at-point-functions
`(,(cape-capf-super
(cape-capf-predicate
#'elisp-completion-at-point
#'minad/emacs-lisp-ignore-keywords)
#'cape-dabbrev)
cape-file)
cape-dabbrev-min-length 5))
:hook
(emacs-lisp-mode . minad/emacs-lisp-capf)
)
Auto complete org-mode headers seamlessly.
(use-package corg
:vc (:url "https://github.com/isamert/corg.el")
:ensure t
:hook
(org-mode . corg-setup)
)
Simple templates for Emacs.
(use-package tempel
:bind
("C-z i s" . tempel-insert)
:ensure t
)
Bridge for tempel templates with eglot.
(use-package eglot-tempel
:after eglot tempel
:ensure t
:config
(eglot-tempel-mode)
)
Effort to translate all the yasnippet snippets to Tempel, inspired on tempel-collection.
(use-package tempel-snippets
:vc (:url "https://github.com/gs-101/tempel-snippets")
:after tempel
:ensure t
)
COmpletion in Region FUnction.
(use-package corfu
:bind
(
:map corfu-map
("M-SPC" . corfu-insert-separator)
("RET" . nil)
)
:config
(corfu-history-mode)
(corfu-popupinfo-mode)
:custom
(corfu-auto nil)
(corfu-auto-delay 0.0)
(corfu-auto-prefix 2)
(corfu-cycle t)
(corfu-popupinfo-delay '(0.5 . 0.2))
(corfu-preselect 'directory)
:ensure t
:init
(global-corfu-mode)
)
(use-package corfu
:after orderless
:hook
(corfu-mode . (lambda () (setq-local completion-styles '(minad/orderless-simple))))
)
(use-package minibuffer
:after eglot
:custom
(completion-category-defaults nil)
)
(use-package cape
:after corfu cape
:config
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
)
With the combined features of cape and tempel, create a super capf for eglot completion.
(use-package emacs
:after corfu cape tempel
:preface
(defun minad/eglot-capf ()
"eglot capf with tempel and cape features."
(setq-local completion-at-point-functions
(list (cape-capf-super
#'cape-file
#'eglot-completion-at-point
#'tempel-expand
))))
:hook
(eglot-managed-mode . minad/eglot-capf)
)
VERTical Interactive COmpletion.
(use-package vertico
:custom
(vertico-cycle t)
:ensure t
:init
(vertico-mode)
(vertico-multiform-mode)
)
Commands for Ido-like directory navigation.
(use-package vertico-directory
:after vertico
:bind
(
:map vertico-map
("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word)
)
:hook
(rfn-eshadow-update-overlay . vertico-directory-tidy)
)
(use-package vertico-multiform
:after vertico
:config
(defun minad/sort-directories-first (files)
"Sort FILES by directories first, but still maintain the history, length and alphabetical sorting.
Hidden directories have a higher priority."
(setq files (vertico-sort-history-length-alpha files))
(nconc (seq-filter (lambda (x) (string-suffix-p "/" x)) files)
(seq-remove (lambda (x) (string-suffix-p "/" x)) files)))
:custom
(vertico-multiform-categories '(
(symbol (vertico-sort-function . vertico-sort-alpha))
(file (vertico-sort-function . minad/sort-directories-first))
))
)
Marginalia in the minibuffer.
(use-package marginalia
:ensure t
:init
(marginalia-mode)
)
(provide 'gs-completion)
Generally useful packages for productivity and other aspects.
;;; -*- lexical-binding: t -*-
A Growl-like alerts notifier for Emacs.
(use-package alert
:custom
(alert-default-style 'notifications)
:ensure t
)
Implementation of Pomodoro and Third Time techniques for Emacs.
(use-package pomm
:config
(pomm-mode-line-mode)
:custom
(pomm-audio-enabled t)
:defer t
:ensure t
:hook
(pomm-on-status-changed . pomm--sync-org-clock)
(pomm-third-time-on-status-changed . pomm-third-time--sync-org-clock)
)
Jump to things in Emacs tree-style.
(use-package avy
:bind
("M-g a" . avy-goto-char-timer)
([remap goto-char] . avy-goto-char)
([remap goto-line] . avy-goto-line)
("M-g w" . avy-goto-word-0)
(
:map isearch-mode-map
("M-j" . avy-isearch)
)
:custom
;; (avy-keys '(
;; ?q ?e ?r ?y ?u ?o ?p
;; ?a ?s ?d ?f ?g ?h ?j ?k ?l ?~
;; ?x ?c ?v ?b ?n ?, ?/
;; ))
(avy-keys '(?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?0))
(avy-style 'de-bruijn) ;; More uniform style, most jumps start with the same character
:config
(defun karthinks/avy-action-kill-whole-line (pt)
"Jump to target at marker PT, killing its whole line after the jump."
(save-excursion
(goto-char pt)
(kill-whole-line))
(select-window
(cdr
(ring-ref avy-ring 0))) t)
(defun karthinks/avy-action-copy-whole-line (pt)
"Jumpt to target at marker PT, copying its whole line to the kill ring,
without killing it."
(save-excursion
(goto-char pt)
(cl-destructuring-bind (start . end)
(bounds-of-thing-at-point 'line)
(copy-region-as-kill start end)))
(select-window
(cdr
(ring-ref avy-ring 0))) t)
(defun karthinks/avy-action-yank-whole-line (pt)
"Jump to target at marker PT, yanking its whole line to the current point."
(karthinks/avy-action-kill-ring-save-whole-line pt)
(save-excursion (yank)) t)
(defun karthinks/avy-action-teleport-whole-line (pt)
"Jump to target at marker PT, transposing it to the current point."
(karthinks/avy-action-kill-whole-line pt)
(save-excursion (yank)) t)
(defun karthinks/avy-action-mark-to-char (pt)
"Start mark at current point, then jump to target at marker PT
with the mark active. This sets an inclusive region selection between them."
(activate-mark)
(goto-char (+ pt 1)))
(setf
(alist-get ?w avy-dispatch-alist) 'avy-action-copy
(alist-get ?W avy-dispatch-alist) 'karthinks/avy-action-copy-whole-line
(alist-get ?k avy-dispatch-alist) 'avy-action-kill-stay
(alist-get ?K avy-dispatch-alist) 'karthinks/avy-action-kill-whole-line
(alist-get ? avy-dispatch-alist) 'karthinks/avy-action-mark-to-char ;; This is bound to a space!
(alist-get ?t avy-dispatch-alist) 'avy-action-teleport
(alist-get ?y avy-dispatch-alist) 'avy-action-yank
(alist-get ?Y avy-dispatch-alist) 'karthinks/avy-action-yank-whole-line
)
:ensure t
)
(use-package avy
:after avy helpful
:config
(defun karthinks/avy-action-helpful (pt)
"Jump to target at marker PT, and view its documentation
using Helpful."
(save-excursion
(goto-char pt)
(helpful-at-point))
(select-window
(cdr (ring-ref avy-ring 0)))
t)
(setf (alist-get ?H avy-dispatch-alist) 'karthinks/avy-action-helpful)
)
An opinionated Transient menu for Avy.
(use-package casual-avy
:bind
("M-g A" . casual-avy-tmenu)
:ensure t
)
Consulting completing-read.
(use-package consult
:bind
(
([remap bookmark-jump] . consult-bookmark)
([remap flymake-start] . consult-flymake)
([remap goto-line] . consult-goto-line)
([remap grep] . consult-grep)
([remap imenu] . consult-imenu)
([remap info] . consult-info)
([remap info-search] . consult-info)
([remap isearch-forward] . consult-line)
([remap isearch-forward-word] . consult-line)
([remap kmacro-menu] . consult-kmacro)
([remap list-buffers] . consult-buffer)
([remap load-theme] . consult-theme)
([remap locate] . consult-locate)
([remap man] . consult-man)
([remap pop-global-mark] . consult-global-mark)
([remap pop-to-mark-command] . consult-mark)
([remap project-find-regexp] . consult-grep)
([remap project-list-buffers] . consult-project-buffer)
([remap project-switch-to-buffer] . consult-project-buffer)
([remap rgrep] . consult-ripgrep)
([remap switch-to-buffer] . consult-buffer)
([remap switch-to-buffer-other-frame] . consult-buffer-other-frame)
([remap switch-to-buffer-other-tab] . consult-buffer-other-tab)
([remap switch-to-buffer-other-window] . consult-buffer-other-window)
([remap vc-git-grep] . consult-git-grep)
([remap yank-from-kill-ring] . consult-yank-from-kill-ring)
([remap yank-pop] . consult-yank-pop)
("M-g I" . consult-imenu-multi)
("C-z M-x" . consult-mode-command)
)
:config
(defun oantolin/choose-completion-in-region ()
"Use default `completion--in-region' unless we are not completing."
(when minibuffer-completion-table
(setq-local completion-in-region-function #'completion--in-region)))
(advice-add #'register-preview :override #'consult-register-window)
(setf (alist-get 'log-edit-mode consult-mode-histories)
'log-edit-comment-ring)
(defvar minad/consult-line-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-s" #'previous-history-element)
map)
"History keymap which is added to the local `consult-line' map.")
(consult-customize consult-line :keymap minad/consult-line-map)
:custom
(register-preview-function #'consult-register-format)
(xref-show-xrefs-function #'consult-xref)
(xref-show-definitions-function #'consult-xref)
:ensure t
:hook
(minibuffer-setup . oantolin/choose-completion-in-region)
)
Insert paths into the minibuffer prompt in Emacs.
(use-package consult-dir
:after consult
:bind
([remap list-directory] . consult-dir)
([remap dired-jump] . consult-dir-jump-file)
:ensure t
)
An Interactive interface for “GitHub CLI” client inside GNU Emacs using Consult.
(use-package consult-gh
:after consult
:custom
(consult-gh-code-action #'consult-gh--code-view-action)
(consult-gh-default-clone-directory (expand-file-name gs-101/projects-code-directory))
(consult-gh-default-orgs-list "gs-101")
:defer t
:ensure t
)
(use-package consult-gh-embark
:after consult-gh embark
:ensure t
)
(use-package consult-gh-forge
:after consult-gh forge
:custom
(consult-gh-file-action #'consult-gh--files-view-action)
(consult-gh-issue-action #'consult-gh-forge--issue-view-action)
(consult-gh-pr-action #'consult-gh--forge-pr-view-action)
(consult-gh-repo-action #'consult-gh--repo-browse-files-action)
:ensure t
)
(use-package consult-gh-transient
:after consult-gh
)
Use consult to search notes.
(use-package consult-notes
:ensure t
)
(use-package consult-notes
:after org-roam
:config
(consult-notes-org-roam-mode)
)
Navigate the Xref stack with Consult.
(use-package consult-xref-stack
:vc (:url "https://github.com/brett-lempereur/consult-xref-stack")
:bind
([remap xref-go-back] . consult-xref-stack-backward)
([remap xref-go-forward] . consult-xref-stack-forward)
:ensure t
)
(use-package consult
:after consult orderless
:config
(defun minad/consult--orderless-regexp-compiler (input type &rest _config)
"Regular expression pattern compiler based on `orderless'."
(setq input (cdr (orderless-compile input)))
(cons
(mapcar (lambda (r) (consult--convert-regexp r type)) input)
(lambda (str) (orderless--highlight input t str))))
:custom
(consult--regexp-compiler 'minad/consult--orderless-regexp-compiler)
)
Emacs Mini-Buffer Actions Rooted in Keymaps.
(use-package embark
:bind
([remap describe-bindings]. embark-bindings)
("C-;" . embark-act)
(
:map embark-collect-mode-map
("j" . goto-char)
)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none))))
:custom
(prefix-help-command #'embark-prefix-help-command)
;; Disable quitting after killing a buffer in an action
(embark-quit-after-action '(
(kill-buffer . nil)
))
:ensure t
)
(use-package avy-embark-collect
:after embark avy
:bind
(
:map embark-collect-mode-map
([remap goto-char] . avy-embark-collect-act)
)
:config
(defun karthinks/avy-action-embark (pt)
"Jump to target at marker PT, and act on it using Embark."
(unwind-protect
(save-excursion
(goto-char pt)
(embark-act))
(select-window
(cdr (ring-ref avy-ring 0)))))
(setf (alist-get ?\; avy-dispatch-alist) 'karthinks/avy-action-embark)
:demand t
:ensure t
)
(use-package embark-consult
:defer t
:ensure t
:hook
(embark-collect-mode . consult-preview-at-point-mode)
)
(use-package embark
:after embark
:config
(defun oantolin/embark-collect-resize-window (&rest _)
"Resize the `embark-collect' window to match its contents."
(when (memq embark-collect--kind '(:live :completions))
(fit-window-to-buffer (get-buffer-window)
(floor (frame-height) 2) 1)))
:hook
(embark-collect-post-revert . oantolin/embark-collect-resize-window)
)
(use-package embark
:after embark
:if (functionp 'karthinks/sudo-find-file)
:bind
(
:map embark-file-map
("S" . karthinks/sudo-find-file)
)
)
(use-package embark
:after embark
:custom
(embark-indicators '(
embark-which-key-indicator
embark-highlight-indicator
embark-isearch-highlight-indicator
))
:config
(defun embark-which-key-indicator ()
"An embark indicator that displays keymaps using which-key.
The which-key help message will show the type and value of the
current target followed by an ellipsis if there are further
targets."
(lambda (&optional keymap targets prefix)
(if (null keymap)
(which-key--hide-popup-ignore-command)
(which-key--show-keymap
(if (eq (plist-get (car targets) :type) 'embark-become)
"Become"
(format "Act on %s '%s'%s"
(plist-get (car targets) :type)
(embark--truncate-target (plist-get (car targets) :target))
(if (cdr targets) "…" "")))
(if prefix
(pcase (lookup-key keymap prefix 'accept-default)
((and (pred keymapp) km) km)
(_ (key-binding prefix 'accept-default)))
keymap)
nil nil t (lambda (binding)
(not (string-suffix-p "-argument" (car binding))))))))
(defun embark-hide-which-key-indicator (fn &rest args)
"Hide the which-key indicator immediately when using the completing-read prompter."
(which-key--hide-popup-ignore-command)
(let ((embark-indicators
(remq #'embark-which-key-indicator embark-indicators)))
(apply fn args)))
(advice-add #'embark-completing-read-prompter :around #'embark-hide-which-key-indicator)
)
p-search is an Emacs tool to find things. It combines concepts from information retrievial and Bayesian search theory to assist a user in finding documents.
(use-package p-search
:vc (:url "https://github.com/zkry/p-search")
:bind
("M-s p" . p-search)
:ensure t
)
Emacs minor-mode to summon and dismiss buffers easily.
(use-package popper
:bind
("M-]" . popper-cycle)
("M-[" . popper-toggle)
:custom
(popper-display-control t)
(popper-group-function 'popper-group-by-project)
(popper-reference-buffers '(
cider-repl-mode
compilation-mode
eat-mode
geiser-repl-mode
vterm-mode
inferior-emacs-lisp-mode
inferior-lisp-mode
inferior-python-mode
shell-mode
"\\*Async Shell Command\\*"
"\\*Backtrace\\*"
"\\*compilation\\*"
"\\*Dtache Shell Command\\*"
"\\*eldoc\\*"
"\\*Ement Notifications\\*"
"*Flymake diagnostics.*"
"\\*GDB.*out\\*"
"\\*Messages\\*"
"\\*mu4e-update\\*"
"Output\\*$"
"^*tex"
"\\*Warnings\\*"
"\\*xref\\*"
))
:ensure t
:demand t
:init
(popper-mode)
(popper-echo-mode)
)
Easily draw UNICODE lines and boxes.
(use-package uniline
:bind
("C-z i l" . uniline-mode)
:ensure t
)
(provide 'gs-utils)
Configuration for different chat clients.
maildir indexer/searcher + emacs mail client + guile bindings.
;;; -*- lexical-binding: t -*-
(use-package mu4e
:load-path "/usr/share/emacs/site-lisp/mu4e/"
:commands
(mu4e)
:custom
(mu4e-compose-format-flowed t)
(mu4e-change-filenames-when-moving t)
(mu4e-get-mail-command "mbsync -a")
(mu4e-maildir (expand-file-name "!Mail-Provider/Personal/" mail-source-directory))
(mu4e-view-show-addresses 't)
(mu4e-view-show-images t)
(mu4e-drafts-folder "/Drafts")
(mu4e-sent-folder "/Sent")
(mu4e-refile-folder "/All Mail")
(mu4e-trash-folder "/Trash")
(mu4e-maildir-shortcuts '(
("/Inbox" . ?i)
("/Drafts" . ?d)
("/Sent" . ?s)
("/Trash" . ?t)
("/All Mail" . ?a)
))
)
(use-package mu4e-column-faces
:after mu4e
:config
(mu4e-column-faces-mode)
:ensure t
)
(use-package simple
:after mu4e
:custom
(mail-user-agent 'mu4e-user-agent)
)
(use-package message
:after mu4e
:custom
(message-kill-buffer-on-exit t)
(message-mail-user-agent t)
(message-send-mail-function 'smtpmail-send-it)
(smtpmail-smtp-server "!mailprovider")
(smtpmail-local-domain "!domain")
(smtpmail-smtp-service 465)
(smtpmail-stream-type 'ssl)
)
(use-package startup
:custom
(user-mail-address "!email")
:defer t
)
OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
(use-package org-msg
:after mu4e
:custom
(org-msg-greeting-fmt "\nGreetings,\n\n")
(org-msg-default-alternatives '(
(new . (text html))
(reply-to-html . (text html))
(reply-to-text . (text))
))
(org-msg-convert-citation t)
(org-msg-signature
"Regards,
--
Gabriel Santos
)
:ensure t
:config
(org-msg-mode)
)
Jabber/XMPP client for Emacs.
(use-package jabber
:bind-keymap
("C-z j" . jabber-global-keymap)
:defer t
:ensure t
)
(provide 'gs-chat)
Elfeed is an extensible web feed reader for Emacs, supporting both Atom and RSS.
;;; -*- lexical-binding: t -*-
(use-package elfeed
:bind
(
:map elfeed-search-mode-map
("R" . kaushal-modi/elfeed-search-mark-all-as-read)
:map elfeed-show-mode-map
("C-c C-o" . shr-browse-url)
)
:config
;; https://emacs.stackexchange.com/a/2441
(defun kaushal-modi/elfeed-search-mark-all-as-read ()
"Call `mark-whole-buffer' and `elfeed-search-untag-all-undead' in unison,
marking all current messages as read."
(interactive)
(mark-whole-buffer)
(elfeed-search-untag-all-unread))
:defer t
:ensure t
)
Configure the Elfeed RSS reader with an Orgmode file.
(use-package elfeed-org
:after elfeed org
:config
(elfeed-org)
:custom
(rmh-elfeed-org-files (list (expand-file-name "elfeed.org" org-directory)))
:ensure t
)
(use-package elfeed
:bind
(
:map elfeed-show-mode-map
("B" . karthinks/elfeed-show-eww-open)
:map elfeed-search-mode-map
("B" . karthinks/elfeed-search-eww-open)
)
:config
(defun karthinks/elfeed-show-eww-open (&optional use-generic-p)
"Open elfeed show entry with \\[eww]."
(interactive "P")
(let ((browse-url-browser-function #'eww-browse-url))
(elfeed-show-visit use-generic-p)))
(defun karthinks/elfeed-search-eww-open (&optional use-generic-p)
"Open elfeed search entry with \\[eww]."
(interactive "P")
(let ((browse-url-browser-function #'eww-browse-url))
(elfeed-search-browse-url use-generic-p)))
)
(provide 'gs-elfeed)
The extensible vi layer for Emacs.
;;; -*- lexical-binding: t -*-
Bind the universal argument to another key to avoid conflicts.
(use-package simple
:bind
("C-M-u" . universal-argument)
)
This is needed for evil-collection
.
(use-package emacs
:custom
(evil-want-keybinding nil)
)
The extensible vi layer for Emacs.
(use-package evil
:ensure t
)
Core functionality.
(use-package evil-core
:config
;; Use visual line motions even outside of visual-line-mode buffers
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
:init
(evil-mode)
)
Settings and variables.
(use-package evil-vars
:custom
(evil-disable-insert-state-bindings t) ;; 2
(evil-respect-visual-line-mode t) ;; 1
(evil-undo-system 'undo-redo)
(evil-split-window-below t) ;; 1
(evil-v$-excludes-newline t) ;; 1
(evil-vsplit-window-right t) ;; 1
(evil-want-C-i-jump nil) ;; 1
(evil-want-C-u-scroll t)
(evil-want-Y-yank-to-eol t) ;; 2
)
Evil commands and operators.
(use-package evil-commands
:bind
(
:map evil-normal-state-map
("C-n" . evil-next-line)
("C-p" . evil-previous-line)
(")" . evil-next-close-paren)
("(" . evil-previous-open-paren)
)
)
Search and substitute.
(use-package evil-search
:custom
(evil-search-module 'evil-search)
)
The different states found in Evil Mode.
(use-package evil-states
:bind
(
:map evil-insert-state-map
;; In insert state, use the default quit command to return to normal state
("C-g" . evil-normal-state)
:map evil-motion-state-map
;; Disabled to avoid conflict with Org Mode
("RET" . nil)
)
)
Toggles org-appear based on the current evil state.
(use-package evil-core
:after org-appear
:custom
(org-appear-trigger 'manual)
:config
(add-hook 'org-mode-hook (lambda ()
(add-hook 'evil-insert-state-entry-hook
#'org-appear-manual-start
nil
t)
(add-hook 'evil-insert-state-exit-hook
#'org-appear-manual-stop
nil
t)))
)
(use-package evil-core
:after vertico
:bind
(
:map vertico-map
("C-j" . vertico-next)
("C-k" . vertico-previous)
)
)
(use-package evil-core
:config
(evil-set-leader nil (kbd "SPC"))
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>B") 'ibuffer)
(evil-define-key 'normal 'global (kbd "<leader>b") 'switch-to-buffer)
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>ie") 'emoji-insert)
(evil-define-key 'normal 'global (kbd "<leader>ic") 'insert-char)
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>fe") '(lambda () (interactive) (find-file (expand-file-name "emacs.org" user-emacs-directory))))
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>oa") 'org-agenda)
(evil-define-key 'normal 'global (kbd "<leader>oc") 'org-clock-report)
(evil-define-key 'normal 'global (kbd "<leader>od") 'org-deadline)
(evil-define-key 'normal 'global (kbd "<leader>ol") 'org-insert-link)
(evil-define-key 'normal 'global (kbd "<leader>os") 'org-schedule)
(evil-define-key 'normal 'global (kbd "<leader>op") 'org-set-property)
(evil-define-key 'normal 'global (kbd "<leader>ot") 'org-todo)
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>wo") 'other-window)
(evil-define-key 'normal 'global (kbd "<leader>wk") 'windmove-up)
(evil-define-key 'normal 'global (kbd "<leader>wj") 'windmove-down)
(evil-define-key 'normal 'global (kbd "<leader>wh") 'windmove-left)
(evil-define-key 'normal 'global (kbd "<leader>wl") 'windmove-right)
)
(use-package evil-core
:config
(evil-define-key 'normal 'global (kbd "<leader>ts") 'shell)
)
(use-package evil-core
:after magit
:config
(evil-define-key 'normal 'global (kbd "<leader>mc") 'magit-clone)
(evil-define-key 'normal 'global (kbd "<leader>ms") 'magit-status)
)
(use-package evil-core
:after org-roam
:config
(evil-define-key 'normal 'global (kbd "<leader>rb") 'dw/org-roam-capture-inbox)
(evil-define-key 'normal 'global (kbd "<leader>rd") 'org-roam-dailies-map)
(evil-define-key 'normal 'global (kbd "<leader>rf") 'org-roam-node-find)
(evil-define-key 'normal 'global (kbd "<leader>ri") 'org-roam-node-insert)
)
(use-package evil-core
:after org-roam-ui
:config
(evil-define-key 'normal 'global (kbd "<leader>ru") 'org-roam-ui-open)
)
(use-package evil-core
:after nerd-icons
:config
(evil-define-key 'normal 'global (kbd "<leader>in") 'nerd-icons-insert)
)
A set of keybindings for evil-mode.
(use-package evil-collection
:ensure t
:init
(evil-collection-init)
)
Supplemental evil-mode keybindings to emacs org-mode
Why is this one not included in the collection?
(use-package evil-org
:hook
(
(org-agenda-mode . evil-org-mode)
(org-mode . evil-org-mode)
)
:config
(evil-org-set-key-theme '(navigation todo insert textobjects additional))
:ensure t
)
(use-package evil-org-agenda
:config
(evil-org-agenda-set-keys)
)
(use-package which-key
:custom
(which-key-allow-evil-operators t)
)
(provide 'gs-keys-evil)
Yet another modal editing on Emacs.
;;; -*- lexical-binding: t -*-
(use-package meow
:ensure t
)
Modes definition in Meow.
(use-package meow-core
:init
(meow-global-mode)
)
Internal variables and customizable variables.
(use-package meow-var
:config
(add-to-list 'meow-char-thing-table '(?a . arrow))
:custom
(meow-use-clipboard t)
)
Cheatsheet for Meow.
(use-package meow-cheatsheet
:custom
(meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
)
Cheatsheet layouts for Meow.
(use-package meow-cheatsheet-layout
:custom
(meow-cheatsheet-layout-qwerty t)
)
Implementation of all commands in Meow.
(use-package meow-command
:config
(defun gs-101/meow-super-prev ()
"Runs different upwards navigation commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-navigate-up'
- `markdown-mode' :: `markdown-previous-visible-heading'
- `org-mode' :: `org-previous-visible-heading'
- `prog-mode' :: `backward-up-list'
- Other :: `meow-prev-expand'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-navigate-up))
((derived-mode-p 'markdown-mode) (markdown-previous-visible-heading 1))
((derived-mode-p 'org-mode) (org-previous-visible-heading 1))
((derived-mode-p 'prog-mode) (backward-up-list))
(t (meow-prev-expand 1)))
)
(defun gs-101/meow-super-next ()
"Runs different downwards navigation commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-navigate-down'
- `markdown-mode' :: `markdown-next-visible-heading'
- `org-mode' :: `org-next-visible-heading'
- `prog-mode' :: `down-list'
- Other :: `meow-next-expand'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-navigate-down))
((derived-mode-p 'markdown-mode) (markdown-next-visible-heading 1))
((derived-mode-p 'org-mode) (org-next-visible-heading 1))
((derived-mode-p 'prog-mode) (down-list))
(t (meow-next-expand 1)))
)
(defun gs-101/meow-super-left ()
"Runs different leftwards navigation commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-navigate-previous'
- `prog-mode' :: `backward-sexp'
- `text-mode' :: `meow-back-word'
- Other :: `meow-left-expand'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-navigate-previous))
((derived-mode-p 'prog-mode) (backward-sexp))
((derived-mode-p 'text-mode) (meow-back-word 1))
(t (meow-left-expand)))
)
(defun gs-101/meow-super-right ()
"Runs different rightwards navigation commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-navigate-next'
- `prog-mode' :: `forward-sexp'
- `text-mode' :: `meow-next-word'
- Other :: `meow-right-expand'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-navigate-next))
((derived-mode-p 'prog-mode) (forward-sexp))
((derived-mode-p 'text-mode) (meow-next-word 1))
(t (meow-right-expand)))
)
(defun gs-101/meow-super-kill ()
"Runs different kill commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-kill-node-dwim'
- `prog-mode' :: `kill-sexp'
- Other :: `meow-kill-whole-line'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-kill-node-dwim))
((derived-mode-p 'prog-mode) (kill-sexp))
(t (meow-kill-whole-line)))
)
(defun gs-101/meow-super-mark ()
"Runs different mark commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-mark-node-dwim'
- `prog-mode' :: `meow-block'
- Other :: `meow-mark-word'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-mark-node-dwim))
((derived-mode-p 'prog-mode) (meow-block 1))
(t (meow-mark-word 1)))
)
(defun gs-101/meow-transpose ()
"Runs different transposition commands based on the current major or minor mode.
- `combobulate-mode' :: `combobulate-transpose-sexps'
- `prog-mode' :: `meow-transpose-sexp'
- Other :: `transpose-words'"
(interactive)
(cond
((seq-some (lambda (mode) (string-match-p "combobulate" (symbol-name mode))) local-minor-modes) (combobulate-transpose-sexps))
((derived-mode-p 'prog-mode) (meow-transpose-sexp))
(t (transpose-words)))
)
(defvar gs-101/meow-beginning-of-line "C-a"
"KBD macro for command`beginning-of-line'.")
(defun gs-101/meow-super-beginning ()
"Runs different beginning commands depending on current major mode.
- `prog-mode' :: `meow-back-to-indentation'
- Other :: `beginning-of-line'"
(interactive)
(cond
((derived-mode-p 'prog-mode) (meow-back-to-indentation))
(t (meow--execute-kbd-macro gs-101/meow-beginning-of-line))))
)
Meow helpers for customization.
(use-package meow-helpers
:config
(meow-leader-define-key
'("z" . "C-z")
;; Use SPC (0-9) for digit arguments.
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet)
'("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-motion-overwrite-define-key
'("<escape>" . ignore)
)
)
(use-package meow-helpers
:config
(meow-normal-define-key
'("-" . negative-argument)
'("+" . meow-universal-argument)
'("," . meow-pop-marker)
'("." . meow-find-ref)
'("[" . meow-inner-of-thing)
'("]" . meow-bounds-of-thing)
'("<" . beginning-of-buffer)
'(">" . end-of-buffer)
'("'" . repeat)
'("=" . meow-indent)
'("|" . align-regexp)
'("<escape>" . ignore)
'("?" . meow-comment)
'("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)
'("a" . gs-101/meow-super-beginning)
'("A" . meow-beginning-of-thing)
'("b" . meow-left)
'("B" . gs-101/meow-super-left)
'("c" . meow-change)
'("d" . meow-delete)
'("e" . move-end-of-line)
'("E" . meow-end-of-thing)
'("f" . meow-right)
'("F" . gs-101/meow-super-right)
'("g" . meow-grab)
'("G" . meow-swap-grab)
'("h" . meow-mark-word)
'("H" . gs-101/meow-super-mark)
'("i" . meow-insert)
'("I" . meow-append)
'("j" . meow-pop-to-mark)
'("J" . meow-pop-to-global-mark)
'("k" . meow-kill)
'("K" . gs-101/meow-super-kill)
'("l" . meow-visual-line)
'("L" . meow-visual-line-expand)
'("n" . meow-next)
'("N" . gs-101/meow-super-next)
'("p" . meow-prev)
'("P" . gs-101/meow-super-prev)
'("q" . meow-quit)
'("r" . meow-replace)
'("R" . meow-query-replace-regexp)
'("s" . isearch-forward)
'("t" . gs-101/meow-transpose)
'("u" . undo)
'("U" . undo-redo)
'("v" . meow-visit)
'("w" . meow-save)
'("y" . meow-yank)
'("Y" . meow-yank-pop)
'("z" . meow-till)
'("Z" . meow-till-expand)
)
)
(use-package meow-command
:after meow avy
:bind
(
:map meow-normal-state-keymap
([remap meow-pop-to-mark] . favetelinguis/meow-jumper)
)
:config
(defun gs-101/meow-avy-action-kill-whole-line (pt)
"Jump to target at marker PT, killing its whole line after the jump.
This follows the parameters set by `meow-kill-whole-line'."
(save-excursion
(goto-char pt)
(meow-kill-whole-line)))
(defun gs-101/meow-avy-action-block (pt)
"Mark block at PT."
(goto-char pt)
(meow-block pt))
(setf
(alist-get ?K avy-dispatch-alist) 'gs-101/meow-avy-action-kill-whole-line
(alist-get ?m avy-dispatch-alist) 'gs-101/meow-avy-action-block
)
(defun favetelinguis/meow-jumper (&optional arg)
"Switch between Meow search and Avy,
depending on if the region is active.
If the region is active, this function calls `meow-search'.
Otherwise, it calls `avy-goto-char-timer'."
(interactive)
(if (region-active-p)
(meow-search arg)
(avy-goto-char-timer)))
)
Tree-sitter powered motions for Meow.
(use-package meow-tree-sitter
:ensure t
:config
(meow-tree-sitter-register-defaults)
)
(use-package meow-helpers
:after embark
:config
(meow-normal-define-key
'(";" . embark-act))
)
(use-package meow-core
:after org-appear
:custom
(org-appear-trigger 'manual)
:config
(add-hook 'org-mode-hook (lambda ()
(add-hook 'meow-insert-enter-hook
#'org-appear-manual-start
nil
t)
(add-hook 'meow-insert-exit-hook
#'org-appear-manual-stop
nil
t)))
)
(provide 'gs-keys-meow)
Structured editing (soft deletion, expression navigating & manipulating) that supports many major modes out of the box.
;;; -*- lexical-binding: t -*-
(use-package puni
:bind
(
:map puni-mode-map
("C-M-e" . puni-end-of-sexp)
("C-M-a" . puni-beginning-of-sexp)
("M-h" . puni-expand-region)
("C-k" . puni-kill-line)
("C-M-<right>" . puni-forward-sexp-or-up-list)
("C-M-<left>" . puni-backward-sexp-or-up-list)
("C-M-@" . puni-mark-sexp-at-point)
("M-k" . Gavinok/puni-kill-thing-at-point)
("C-M-t" . puni-transpose)
("C-)" . puni-slurp-forward)
("C-(" . puni-slurp-backward)
("C-M-)" . puni-barf-forward)
("C-M-(" . puni-barf-backward)
)
:defer t
:config
(defun gs-101/puni-wrap-pick (&optional n)
"Completing read interface for wrapping S-expressions.
If a ‘C-u’ prefix argument is given, wrap all S-expressions
following the point until the end of the buffer or of the
enclosing list. If a numeric prefix argument N is given, wrap N
S-expressions. Automatically indent the newly wrapped
S-expression."
(interactive "P")
(let ((choice (completing-read "Choose a wrapper: "
'("Angle" "Curly" "Round" "Square"))))
(pcase choice
("Angle" (puni-wrap-angle n))
("Curly" (puni-wrap-curly n))
("Round" (puni-wrap-round n))
("Square" (puni-wrap-square n)))))
(defun Gavinok/puni-kill-thing-at-point (&optional arg)
"Kill the next puni based thing at point."
(interactive)
(unless buffer-read-only
(puni-expand-region)
(kill-region (region-beginning) (region-end))))
(advice-add #'puni-kill-active-region :override
(defun AmaiKinono/puni-kill-active-region ()
"Kill active region.
When this will cause unbalanced state, ask the user to confirm,
unless `puni-confirm-when-delete-unbalanced-active-region' is
nil.
When `rectangle-mark-mode' is enabled, kill the marked
rectangular region instead."
(interactive)
(if (use-region-p)
(puni-kill-region)
;; Fall back to Emacs default behavior which is signaling an error or what
;; `kill-region-dwim' defines (since Emacs 31).
(call-interactively #'kill-region))))
:ensure t
:custom
(cursor-type 'bar)
:hook
(org-mode . puni-disable-puni-mode)
(markdown-mode . puni-disable-puni-mode)
:init
(puni-global-mode)
)
(provide 'gs-keys-puni)
;;; -*- lexical-binding: t -*-
Enable the menu bar if you’re a new user. It may not look good, but it is a really useful tool. You can disable it after getting used to Emacs.
(use-package emacs
:custom
(menu-bar-mode nil)
(ring-bell-function #'ignore)
(scroll-preserve-screen-position t)
(tool-bar-mode nil)
(tooltip-mode nil)
(use-dialog-box nil)
(use-file-dialog nil)
(visible-bell nil)
(x-stretch-cursor t)
(x-underline-at-descent-line nil)
)
Interface for display-line-numbers.
(use-package display-line-numbers
:hook
(prog-mode . display-line-numbers-mode)
)
Lisp faces.
(use-package faces
:preface
(defun dw/set-font-faces ()
;; Set the default face
(set-face-attribute 'default nil :font "Cascadia Code NF")
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font "Cascadia Mono NF")
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font "Cascadia Code NF" :weight 'regular))
:init
(dw/set-font-faces)
)
(use-package faces
:if (daemonp)
:config
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(dw/set-font-faces))))
)
Multi-frame management independent of window systems.
(use-package frame
:custom
(window-divider-default-bottom-width 1)
(window-divider-default-places t)
(window-divider-default-right-width 1)
:hook
(doc-view-mode . (lambda () (setq-local blink-cursor-mode nil)))
:init
(window-divider-mode)
)
Highlight the current line.
(use-package hl-line
:init
(global-hl-line-mode)
:hook
;; Disable in some modes where I dislike how it looks
(dashboard-mode . (lambda () (setq-local global-hl-line-mode nil)))
(eat-mode . (lambda () (setq-local global-hl-line-mode nil)))
(vterm-mode . (lambda () (setq-local global-hl-line-mode nil)))
(vundo-mode . (lambda () (setq-local global-hl-line-mode nil)))
)
(use-package mouse
:if (display-graphic-p)
:init
(context-menu-mode)
)
(use-package mouse
:if (daemonp)
:config
(add-hook 'after-make-frame-functions
(lambda (frame)
(context-menu-mode)))
)
(use-package org-faces
:config
(dolist
(face '(
(org-level-1 . 1.30)
(org-level-2 . 1.29)
(org-level-3 . 1.28)
(org-level-4 . 1.27)
(org-level-5 . 1.26)
(org-level-6 . 1.25)
(org-level-7 . 1.24)
(org-level-8 . 1.23)
)
)
(set-face-attribute (car face) nil :font "Cascadia Code NF" :weight 'medium :height (cdr face)))
(set-face-attribute 'org-document-title nil :font "Cascadia Code NF" :weight 'medium :height 1.40)
)
(use-package org
:custom
(org-ellipsis "…")
(org-fontify-done-headline t)
(org-fontify-quote-and-verse-blocks t)
(org-fontify-whole-heading-line t)
(org-hide-emphasis-markers t)
(org-hide-leading-stars)
)
(use-package org
:custom
(org-pretty-entities t)
(org-pretty-entities-include-sub-superscripts t)
)
Modern Org Style.
(use-package org-modern
:custom
(org-modern-star 'replace)
(org-modern-replace-stars "")
(org-modern-table-vertical 1)
:ensure t
:init
(global-org-modern-mode)
)
(use-package org-agenda
:custom
(org-agenda-block-separator ?─)
(org-agenda-current-time-string
"←──────────────")
(org-agenda-time-grid
'((daily today require-timed)
(600 800 1000 1200 1400 1600 1800 2000 2200)
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄"))
)
(use-package org-modern-indent
:after org-modern
:when (org-indent-mode)
:ensure t
:custom
(org-modern-block-name '("" . ""))
:hook
(org-mode . org-modern-indent-mode)
)
Window system-independent scroll bar support.
(use-package scroll-bar
:custom
(scroll-bar-mode nil)
)
This file parses the command line and gets Emacs running. Options on the command line are handled in precedence order.
(use-package startup
:config
(advice-add #'display-startup-echo-area-message :override #'ignore)
(advice-add #'display-startup-screen :override #'ignore)
:custom
(initial-scratch-message nil)
(inhibit-startup-echo-area-message t)
(inhibit-startup-message t)
(inhibit-startup-screen t)
:defer t
)
Window tree functions.
(use-package window
:custom
(recenter-positions '(top middle bottom)) ;; 2
(scroll-error-top-bottom t) ;; 1
(split-height-threshold nil) ;;1
(split-width-threshold 170) ;; 1
(switch-to-buffer-obey-display-actions t) ;; 2
)
Display available keybindings in popup.
(use-package which-key
:custom
(which-key-add-column-padding 1)
(which-key-idle-delay 0.5)
(which-key-min-display-lines 6)
(which-key-separator " = ")
(which-key-side-window-slot -10)
(which-key-sort-order #'which-key-key-order-alpha)
(which-key-sort-uppercase-first nil)
:init
(which-key-mode)
)
Soothing pastel theme for Emacs.
(use-package catppuccin-theme
:preface
(load-theme 'catppuccin t)
:ensure t
)
Emacs minor mode to highlight each source code identifier uniquely based on its name.
(use-package color-identifiers-mode
:ensure t
:config
(defun gs-101/color-identifiers-toggle-on-ts-mode ()
"Check if MAJOR MODE is a tree-sitter mode.
If it is, enable `color-identifiers-mode'."
(when (string-match-p "-ts-mode\\'" (symbol-name major-mode))
(color-identifiers-mode))
(when (bound-and-true-p prism-mode)
(setq-local color-identifiers-mode nil)))
:hook
(prog-mode . gs-101/color-identifiers-toggle-on-ts-mode)
)
An extensible emacs dashboard.
(use-package dashboard
:bind
("C-z <home>" . dashboard-open)
(
:map dashboard-mode-map
("j" . nil)
("k" . nil)
("n" . dashboard-next-line)
("p" . dashboard-previous-line)
)
:custom
(dashboard-center-content t)
(dashboard-vertically-center-content t)
(dashboard-startupify-list '(
dashboard-insert-banner
dashboard-insert-banner-title
dashboard-insert-newline
dashboard-insert-init-info
dashboard-insert-items
dashboard-insert-newline
dashboard-insert-navigator
dashboard-insert-newline
dashboard-insert-footer
))
:ensure t
:init
(dashboard-setup-startup-hook)
)
A startup screen extracted from Spacemacs.
(use-package dashboard-widgets
:after dashboard
:custom
(dashboard-agenda-prefix-format "%-12t% s ")
(dashboard-agenda-tags-format 'ignore)
(dashboard-banner-logo-title "The Extensible Computing Enviroment")
(dashboard-items '(
(agenda . 5)
(projects . 5)
(recents . 5)
))
(dashboard-startup-banner (expand-file-name "emacs.png" user-emacs-directory))
(dashboard-week-agenda nil)
)
(use-package dashboard-widgets
:after dashboard nerd-icons
:custom
(dashboard-display-icons-p t)
(dashboard-icon-type 'nerd-icons)
(dashboard-set-file-icons t)
(dashboard-set-heading-icons t)
:config
(dashboard-modify-heading-icons '(
(agenda . "nf-oct-calendar")
(projects . "nf-oct-project")
(recents . "nf-oct-clock")
))
)
(use-package dashboard-widgets
:after dashboard nerd-icons
:custom
(dashboard-navigator-buttons
`(;; line1
(
(,(nerd-icons-mdicon "nf-md-github")
"Source Repository"
"Open the source repository in the browser"
(lambda (&rest _) (browse-url "https://github.com/gs-101/.emacs.d"))
'default)
)
;;line 2
(
(,(nerd-icons-mdicon "nf-md-note_outline")
"Open Scratch Buffer"
"Switch to the scratch buffer"
(lambda (&rest _) (scratch-buffer))
'default)
(,(nerd-icons-mdicon "nf-md-calendar_outline")
"Open Org Agenda"
"Switch to the agenda buffer"
(lambda (&rest _) (org-agenda))
'default)
(,(nerd-icons-mdicon "nf-md-cog")
"Open Config"
"Switch to the configuration file buffer"
(lambda (&rest _) (interactive) (find-file (expand-file-name "emacs.org" user-emacs-directory)))
'default)
)
))
)
(use-package startup
:after dashboard
:custom
(initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
:defer t
)
A fancy and fast mode-line inspired by minimalism design.
(use-package doom-modeline
:config
(advice-add #'doom-modeline-lsp-icon :override
(defun gs-101/doom-modeline-lsp-icon (text face)
"Display LSP icon (or TEXT in terminal) with FACE.
This advice replaces the rocket icon with a electric plug icon."
(if doom-modeline-lsp-icon
(doom-modeline-icon 'mdicon "nf-md-connection" "🔌" text :face face)
(propertize text 'face face))))
:custom
(doom-modeline-buffer-encoding nil)
(doom-modeline-ellipsis "…")
(doom-modeline-enable-word-count t)
(doom-modeline-modal-modern-icon nil)
:ensure t
:init
(doom-modeline-mode)
)
(use-package doom-modeline
:after doom-modeline
:if (daemonp)
:config
(add-hook 'after-make-frame-functions
(lambda (frame)
(setq doom-modeline-icon t)))
)
Extra Emacs font lock rules for a more colourful dired.
(use-package diredfl
:ensure t
:hook
(dired-mode . diredfl-mode)
)
Childframe doc for eglot and anything that uses eldoc.
(use-package eldoc-box
:after eldoc
:ensure t
:hook
(eldoc-mode . eldoc-box-hover-mode)
)
A better Emacs help buffer.
(use-package helpful
:bind
([remap describe-command] . helpful-command)
([remap describe-function] . helpful-callable)
([remap describe-key] . helpful-key)
([remap describe-symbol] . helpful-symbol)
([remap describe-variable] . helpful-variable)
:config
(set-face-attribute 'helpful-heading nil :height 1.5)
:ensure t
)
Highlight TODO keywords.
(use-package hl-todo
:custom
(hl-todo-keyword-faces '(
("FIXME" . "red")
("NOTE" . "yellow")
("QUESTION" . "yellow")
("ANSWER" . "green")
("FIX" . "red")
("FEAT" . "yellow")
("HACK" . "green")
("STYLE" . "orange")
("REFACTOR" . "white")
("REVIEW" . "white")
("CHORE" . "grey")
("MERGED" . "green")
("CLOSED" . "red")
))
:ensure t
:hook
(prog-mode . hl-todo-mode)
(text-mode . hl-todo-mode)
)
(use-package hl-todo
:after hl-todo catppuccin-theme
:custom
(hl-todo-keyword-faces
(mapcar (lambda (keyword-color)
(cons (car keyword-color)
(catppuccin-get-color (cdr keyword-color))))
'(
("FIXME" . red)
("NOTE" . yellow)
("QUESTION" . yellow)
("ANSWER" . green)
("FIX" . red)
("FEAT" . yellow)
("HACK" . green)
("STYLE" . lavender)
("REFACTOR" . sapphire)
("REVIEW" . sapphire)
("CHORE" . overlay0)
("MERGED" . green)
("CLOSED" . red)
)))
)
Show current command and its key in the mode line.
(use-package keycast
:config
(set-face-attribute 'keycast-key nil :background nil :foreground "default" :box nil)
:ensure t
:init
(define-minor-mode keycast-mode
"Show current command and its key binding in the mode line (fix for use with `doom-modeline')."
:global t
(if keycast-mode
(add-hook 'pre-command-hook 'keycast--update t)
(remove-hook 'pre-command-hook 'keycast--update)))
(add-to-list 'global-mode-string '("" keycast-mode-line))
(keycast-mode)
)
(use-package keycast
:after keycast
:config
(mapc (lambda (command)
(add-to-list 'keycast-substitute-alist command)) '(
(backward-delete-char-untabify "" "Erasing...")
(delete-backward-char "" "Erasing...")
(org-delete-backward-char "" "Erasing...")
(self-insert-command "" "Typing...")
(org-self-insert-command "" "Typing...")
(vertico-next nil nil)
(vertico-previous nil nil)
))
)
(use-package keycast
:if (daemonp)
:config
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(set-face-attribute 'keycast-key nil :background nil :foreground "default" :box nil))))
)
(use-package keycast
:after embark
:config
(defun oantolin/keycast-store-action-key-cmd (cmd)
"Store key and CMD command information for `keycast' use."
(force-mode-line-update t)
(setq this-command cmd
keycast--this-command-keys (this-single-command-keys)
keycast--this-command-desc cmd))
(advice-add 'embark-keymap-prompter :filter-return #'oantolin/keycast-store-action-key-cmd)
(defun oantolin/keycast--update-force (&rest _)
"Version of `keycast--update' that accepts (and ignore) parameters."
(keycast--update))
(advice-add 'embark-act :before #'oantolin/keycast--update-force)
)
Display typographical ligatures in Emacs.
(use-package ligature
:config
(ligature-set-ligatures 't '("www"))
;; Enable traditional ligature support in eww-mode, if the `variable-pitch' face supports it
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
;; Enable all Cascadia and Fira Code ligatures in programming modes
(ligature-set-ligatures 'prog-mode
'(;; == === ==== => =| =>>=>=|=>==>> ==< =/=//=// =~
;; =:= =!=
("=" (rx (+ (or ">" "<" "|" "/" "~" ":" "!" "="))))
;; ;; ;;;
(";" (rx (+ ";")))
;; && &&&
("&" (rx (+ "&")))
;; !! !!! !. !: !!. != !== !~
("!" (rx (+ (or "=" "!" "\." ":" "~"))))
;; ?? ??? ?: ?= ?.
("?" (rx (or ":" "=" "\." (+ "?"))))
;; %% %%%
("%" (rx (+ "%")))
;; |> ||> |||> ||||> |] |} || ||| |-> ||-||
;; |->>-||-<<-| |- |== ||=||
;; |==>>==<<==<=>==//==/=!==:===>
("|" (rx (+ (or ">" "<" "|" "/" ":" "!" "}" "\]"
"-" "=" ))))
;; \\ \\\ \/
("\\" (rx (or "/" (+ "\\"))))
;; ++ +++ ++++ +>
("+" (rx (or ">" (+ "+"))))
;; :: ::: :::: :> :< := :// ::=
(":" (rx (or ">" "<" "=" "//" ":=" (+ ":"))))
;; // /// //// /\ /* /> /===:===!=//===>>==>==/
("/" (rx (+ (or ">" "<" "|" "/" "\\" "\*" ":" "!"
"="))))
;; .. ... .... .= .- .? ..= ..<
("\." (rx (or "=" "-" "\?" "\.=" "\.<" (+ "\."))))
;; -- --- ---- -~ -> ->> -| -|->-->>->--<<-|
("-" (rx (+ (or ">" "<" "|" "~" "-"))))
;; *> */ *) ** *** ****
("*" (rx (or ">" "/" ")" (+ "*"))))
;; www wwww
("w" (rx (+ "w")))
;; <> <!-- <|> <: <~ <~> <~~ <+ <* <$ </ <+> <*>
;; <$> </> <| <|| <||| <|||| <- <-| <-<<-|-> <->>
;; <<-> <= <=> <<==<<==>=|=>==/==//=!==:=>
;; << <<< <<<<
("<" (rx (+ (or "\+" "\*" "\$" "<" ">" ":" "~" "!"
"-" "/" "|" "="))))
;; >: >- >>- >--|-> >>-|-> >= >== >>== >=|=:=>>
;; >> >>> >>>>
(">" (rx (+ (or ">" "<" "|" "/" ":" "=" "-"))))
;; #: #= #! #( #? #[ #{ #_ #_( ## ### #####
("#" (rx (or ":" "=" "!" "(" "\?" "\[" "{" "_(" "_"
(+ "#"))))
;; ~~ ~~~ ~= ~- ~@ ~> ~~>
("~" (rx (or ">" "=" "-" "@" "~>" (+ "~"))))
;; __ ___ ____ _|_ __|____|_
("_" (rx (+ (or "_" "|"))))
;; The few not covered by the regexps.
"{|" "[|" "]#" "(*" "}#" "$>" "^="))
:ensure t
:hook
(prog-mode . ligature-mode)
)
(use-package markdown-mode
:after markdown-mode
:custom
(markdown-enable-highlighting-syntax t)
(markdown-hide-markup t)
)
A Library for Nerd Font icons.
(use-package nerd-icons
:bind
("C-z i n" . nerd-icons-insert)
:demand t
:ensure t
)
(use-package citar
:after citar nerd-icons
:config
(defvar citar-indicator-cited-icons
(citar-indicator-create
:symbol (nerd-icons-mdicon
"nf-md-record"
:face 'nerd-icons-lgreen)
:function #'citar-is-cited
:padding " "
:tag "is:cited"))
(defvar citar-indicator-files-icons
(citar-indicator-create
:symbol (nerd-icons-mdicon
"nf-md-file"
:face 'nerd-icons-blue
:v-adjust -0.1)
:function #'citar-has-files
:padding " " ; need this because the default padding is too low for these icons
:tag "has:files"))
(defvar citar-indicator-links-icons
(citar-indicator-create
:symbol (nerd-icons-mdicon
"nf-md-link"
:face 'nerd-icons-lblue
:v-adjust 0.01)
:function #'citar-has-links
:padding " "
:tag "has:links"))
(defvar citar-indicator-notes-icons
(citar-indicator-create
:symbol (nerd-icons-mdicon
"nf-md-text"
:face 'nerd-icons-blue
:v-adjust -0.3)
:function #'citar-has-notes
:padding " "
:tag "has:notes"))
(setq citar-indicators
(list
citar-indicator-cited-icons
citar-indicator-files-icons
citar-indicator-links-icons
citar-indicator-notes-icons
))
)
(use-package nerd-icons-completion
:after nerd-icons
:ensure t
:config
(nerd-icons-completion-mode)
)
(use-package nerd-icons-completion
:after nerd-icons
:hook
(marginalia-mode . nerd-icons-completion-marginalia-setup)
)
(use-package compile-multi-nerd-icons
:after nerd-icons compile-multi
:ensure t
)
(use-package nerd-icons-corfu
:after nerd-icons corfu
:custom
(corfu-margin-formatters 'nerd-icons-corfu-formatter)
(nerd-icons-corfu-mapping '(
(array :style "md" :icon "code_array" :face font-lock-type-face)
(boolean :style "md" :icon "checkbox_intermediate" :face font-lock-builtin-face)
(class :style "md" :icon "file_tree" :face font-lock-type-face)
(color :style "md" :icon "format_paint" :face success)
(command :style "dev" :icon "terminal" :face default)
(constant :style "md" :icon "card_text_outline" :face font-lock-constant-face)
(constructor :style "md" :icon "arrow_right" :face font-lock-function-name-face)
(enummember :style "md" :icon "cards_outline" :face font-lock-builtin-face)
(enum-member :style "md" :icon "cards_outline" :face font-lock-builtin-face)
(enum :style "md" :icon "card_text_outline" :face font-lock-builtin-face)
(event :style "md" :icon "lightning_bolts" :face font-lock-warning-face)
(field :style "md" :icon "toy_brick" :face font-lock-variable-name-face)
(file :style "md" :icon "file" :face font-lock-string-face)
(folder :style "md" :icon "folder" :face font-lock-doc-face)
(interface :style "md" :icon "transit_connection_variant" :face font-lock-type-face)
(keyword :style "md" :icon "text" :face font-lock-keyword-face)
(macro :style "md" :icon "arrow_expand" :face font-lock-keyword-face)
(magic :style "md" :icon "magic_staff" :face font-lock-builtin-face)
(method :style "md" :icon "cube_outline" :face font-lock-function-name-face)
(function :style "md" :icon "function" :face font-lock-function-name-face)
(module :style "md" :icon "file_send" :face font-lock-preprocessor-face)
(numeric :style "md" :icon "numeric" :face font-lock-builtin-face)
(operator :style "cod" :icon "symbol_operator" :face font-lock-comment-delimiter-face)
(param :style "md" :icon "code_parentheses" :face default)
(property :style "md" :icon "wrench" :face font-lock-variable-name-face)
(reference :style "md" :icon "file_link" :face font-lock-variable-name-face)
(snippet :style "md" :icon "note_text" :face font-lock-string-face)
(string :style "md" :icon "code_string" :face font-lock-string-face)
(struct :style "md" :icon "new_box" :face font-lock-variable-name-face)
(text :style "md" :icon "format_text" :face font-lock-doc-face)
(typeparameter :style "md" :icon "format_list_bulleted" :face font-lock-type-face)
(type-parameter :style "md" :icon "format_list_bulleted" :face font-lock-type-face)
(unit :style "md" :icon "ruler" :face font-lock-constant-face)
(value :style "md" :icon "toy_brick" :face font-lock-builtin-face)
(variable :style "md" :icon "toy_brick_outline" :face font-lock-variable-name-face)
(t :style "md" :icon "code_tags" :face font-lock-variable-name-face)
))
:ensure t
)
(use-package nerd-icons-dired
:after nerd-icons
:ensure t
:hook
(dired-mode . nerd-icons-dired-mode)
)
(use-package emacs
:custom
(flymake-indicator-type 'margins)
(flymake-margin-indicators-string '(
(error "" compilation-error)
(warning "" compilation-warning)
(note "" compilation-info)
))
)
Use a Gopher for walrus operators (:=
).
(use-package go-ts-mode
:after nerd-icons go-ts-mode
:config
(defvar gs-101/go-prettify-symbols-alist
'((":=" . ?))
"Value for `prettify-symbols-alist' in `go-ts-mode'.")
:hook
(go-ts-mode . (lambda () (setq-local prettify-symbols-alist gs-101/go-prettify-symbols-alist)))
(go-ts-mode . prettify-symbols-mode)
)
(use-package nerd-icons-ibuffer
:after nerd-icons
:ensure t
:hook
(ibuffer-mode . nerd-icons-ibuffer-mode)
)
(use-package magit-file-icons
:after nerd-icons magit
:ensure t
:hook
(magit-mode . magit-file-icons-mode)
)
Disperse Lisp forms (and other languages) into a spectrum of colors by depth.
(use-package prism
:config
(defun gs-101/prism-mode-lisp ()
"Check if MAJOR-MODE is a Lisp mode.
If it is, enable `prism-mode'."
(when (string-match-p "clojure.*-mode\\'" (symbol-name major-mode))
(prism-mode))
(when (string-match-p "lisp.*-mode\\'" (symbol-name major-mode))
(prism-mode))
(when (derived-mode-p 'scheme-mode)
(prism-mode)))
:ensure t
:hook
(prog-mode . gs-101/prism-mode-lisp)
(python-base-mode . prism-whitespace-mode)
)
(use-package prism
:after prism catppuccin-theme
:config
(defun prism-catppuccin-colors ()
"Grab color definitions from catppuccin and use them to set prism's colors."
(prism-set-colors
:lightens '(0 5 10)
:desaturations '(-2.5 0 2.5)
:colors (-map #'catppuccin-get-color '(
red
peach
yellow
green
sapphire
lavender
mauve
))))
(prism-catppuccin-colors)
)
(use-package prism
:if (daemonp)
:after prism catppuccin-theme
:config
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(prism-catppuccin-colors))))
)
Pops the transient menu to a posframe (floating window).
(use-package posframe
:after transient
:ensure t
:custom
(transient-display-buffer-action
(list
(lambda (buffer _)
(posframe-show
buffer
:poshandler #'posframe-poshandler-frame-center
:min-width transient-minimal-frame-width ;; Use the same minimal width as transient, to avoid weird resizing
:lines-truncate t ;; Truncate lines instead of wrapping them
:internal-border-color (transient--prefix-color) ;; Use transient colors to indicate that the current frame is a transient
:internal-border-width 1)
(get-buffer-window transient--buffer t))))
)
(provide 'gs-ui)