Skip to content

Instantly share code, notes, and snippets.

@hacknightly
Last active December 8, 2025 20:52
Show Gist options
  • Select an option

  • Save hacknightly/ba0d0fea0ebbfb07c42ea991ba62f200 to your computer and use it in GitHub Desktop.

Select an option

Save hacknightly/ba0d0fea0ebbfb07c42ea991ba62f200 to your computer and use it in GitHub Desktop.
;; package management
(setq package-enable-at-startup nil)
(setq use-package-always-ensure t)
(setq package-archives
'(("gnu-elpa" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(require 'use-package)
;; Find this file
(defun goto-init-file ()
"Open the init fie."
(interactive)
(find-file user-init-file))
;; Housekeeping
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(global-auto-revert-mode 1)
(set-fringe-mode 0)
(setq warning-minimum-level :emergency)
;; don't create lock files
(setq create-lockfiles nil)
; delete excess backup versions silently
(setq delete-old-versions -1)
; use version control
(setq version-control t)
; make backups file even when in version controlled dir
(setq vc-make-backup-files t)
; which directory to put backups file
(setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
; don't ask for confirmation when opening symlinked file
(setq vc-follow-symlinks t)
; transform backups file name
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list/" t)))
; inhibit useless and old-school startup screen
(setq inhibit-startup-screen t)
; silent bell when you make a mistake
(setq ring-bell-function 'ignore)
; use utf-8 by default
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)
; sentence SHOULD end with only a point.
(setq sentence-end-double-space nil)
; toggle wrapping text at the 80th character
(setq default-fill-column 80)
(defun goto-projects-file ()
"Open the projects file."
(interactive)
(find-file "~/Sync/darrellbanks.com/org/projects.org"))
;; fun
(use-package fireplace)
;; pixel scroll
(use-package good-scroll
:config
(good-scroll-mode 1))
;; eglot
(add-hook 'web-mode-hook 'eglot-ensure)
(add-hook 'typescript-ts-mode-hook 'eglot-ensure)
(add-hook 'tsx-ts-mode-hook 'eglot-ensure)
(add-hook 'css-ts-mode-hook 'eglot-ensure)
(add-hook 'csharp-ts-mode 'eglot-ensure)
(add-hook 'haskell-mode-hook 'eglot-ensure)
;; Eldoc
(use-package eldoc-box
:config
(add-hook 'eldoc-box-buffer-setup-hook #'eldoc-box-prettify-ts-errors 0 t)
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-at-point-mode t)
(setq eglot-code-action-indicator "*"))
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(csharp-ts-mode . ("csharp-ls"))))
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(web-mode . ("svelteserver" "--stdio"))))
;; completion
(use-package nerd-icons)
(use-package nerd-icons-corfu
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package corfu
:config
(setq
eglot-events-buffer-size 0
corfu-auto t
corfu-auto-delay 0.1
corfu-auto-prefix 1
corfu-cycle t
corfu-quit-at-boundary t
corfu-quit-no-match t
corfu-preview-current nil
corfu-max-width 100
completion-styles '(basic)
corfu-on-exact-match nil)
:init
(global-corfu-mode))
;; path management
(use-package exec-path-from-shell)
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))
;; dashboard
(use-package dashboard
:config
(dashboard-setup-startup-hook))
;; shell (vterm)
;; - vterm
(use-package vterm)
(use-package multi-vterm)
;; magit
(use-package magit)
;; jj
(use-package jj-mode
:vc (:url "https://github.com/bolivier/jj-mode.el"))
;; org-mode
(use-package org-remark
:hook (after-init . org-remark-global-tracking-mode))
(use-package org-pomodoro
:config
(setq org-pomodoro-length 25
org-pomodoro-short-break-length 5
org-pomodoro-long-break-length 15)
:commands (org-pomodoro))
(use-package org-roam
:init
(setq org-roam-directory "~/Sync/darrellbanks.com/org/roam")
(setq org-link-file-path-type 'absolute)
(setq org-roam-capture-templates
'(
("n" "note" plain
"\n*Connections*: %?\n\n"
:if-new (file+head "notes/${slug}.org" "#+title: ${title}\n#+filetags: :notes:\n#+hugo_section: notes\n#+hugo_front_matter_format: yaml\n#+date: %u\n#+hugo_lastmod: %u\n#+hugo_tags: noexport\n")
:unnarrowed t
:empty-lines-after 1)
("p" "post" plain
"\n*Connections*: %?\n\n"
:if-new (file+head "posts/${slug}.org" "#+title: ${title}\n#+filetags: :posts:\n#+hugo_section: posts\n#+hugo_front_matter_format: yaml\n#+date: %u\n#+hugo_lastmod: %u\n#+hugo_tags: noexport\n")
:unnarrowed t
:empty-lines-after 1)
("c" "category" plain
"\n*Connections*: %?\n\n"
:if-new (file+head "categories/${slug}.org" "#+title: ${title}\n#+filetags: :category:\n#+hugo_section: categories\n#+hugo_front_matter_format: yaml\n#+date: %u\n#+hugo_lastmod: %u\n")
:unnarrowed t
:empty-lines-after 1)
))
:config
(org-roam-db-autosync-mode))
(use-package org-roam-ui
:config
(setq org-roam-ui-sync-theme t
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
(define-skeleton babel-skeleton
"Header info for a emacs-org file."
"#+TITLE:" str " \n"
"#+AUTHOR: Darrell Banks\n"
"#+email: [email protected]\n"
"#+INFOJS_OPT: \n"
"#+BABEL: :session *js* :session *python* :cache yes :results output graphics :exports both :tangle yes \n"
"-----"
)
(org-babel-do-load-languages
'org-babel-load-languages
'((shell . t)
(js . t)
(python . t)))
(use-package org
:config
(add-hook 'before-save-hook 'time-stamp)
(org-hugo-auto-export-mode)
(setq
;; Basic Settings
org-startup-indented t
org-return-follows-link t
org-confirm-babel-evaluate nil
org-agenda-files '("~/Sync/darrellbanks.com/org")
org-outline-path-complete-in-steps nil
org-refile-use-outline-path nil
org-todo-keyword-faces '(("NOTE" . "#ffb951") ("ACHIEVEMENT" . "#32a852"))
org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "NOTE(N)" "IN-PROGRESS(i!)" "WAITING(w!)" "|" "DONE(d!)" "CANCELED(c!)" "DELEGATED(p!)"))
org-refile-targets '(("~/Sync/darrellbanks.com/org/projects.org" :maxlevel . 3)
("~/Sync/darrellbanks.com/org/someday.org" :maxlevel . 1)
("~/Sync/darrellbanks.com/org/nudge.org" :maxlevel . 1)
("~/Sync/darrellbanks.com/org/repeat.org" :maxlevel . 1)
)
org-refile-use-outline-path 'file
;; Edit settings
org-auto-align-tags nil
org-tags-column 0
org-catch-invisible-edits 'show-and-error
org-special-ctrl-a/e t
org-insert-heading-respect-content t
;; Org styling, hide markup etc.
org-hide-emphasis-markers t
org-pretty-entities t
org-ellipsis ""
;; Pomodoro Settings
org-pomodoro-start-sound "~/Sync/chime.wav"
org-pomodoro-finished-sound "~/Sync/chime.wav"
org-pomodoro-short-break-sound "~/Sync/chime.wav"
org-pomodoro-long-break-sound "~/Sync/chime.wav"
;; Agenda styling
org-agenda-tags-column 0
org-agenda-block-separator ?─
org-agenda-time-grid
'((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
" ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
org-agenda-current-time-string
"◀── now ─────────────────────────────────────────────────")
;; Timestamp settings
time-stamp-active t)
;; Hugo
(use-package ox-hugo)
(setq org-hugo-base-dir "~/Sync/darrellbanks.com")
(setq
time-stamp-start "#\\+hugo_lastmod:[ \t]*"
time-stamp-end "$"
time-stamp-format "\[%Y-%m-%d %3a\]")
;; Visual settings
;; - mode line
(use-package doom-modeline
:config
(doom-modeline-mode)
(setq doom-modeline-height 40))
;; - org mode
(use-package org-modern)
(with-eval-after-load 'org (global-org-modern-mode))
(with-eval-after-load 'org (auto-fill-mode))
(set-face-attribute 'org-modern-symbol nil :family "Iosevka")
(add-hook 'org-mode-hook 'auto-fill-mode)
(add-hook 'org-mode-hook 'display-fill-column-indicator-mode)
;; - font
(set-face-attribute 'default nil :font "Cascadia Code NF" :height 185)
;; - emojis
(use-package emojify
:hook (after-init . global-emojify-mode)
:config
(setq emojify-emoji-styles '(unicode github)))
;; - icons
(use-package all-the-icons)
(use-package all-the-icons-dired)
;; - indents
(use-package indent-guide
:vc (:fetcher github :repo zk-phi/indent-guides)
:hook (after-init . indent-guide-global-mode))
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-space)
;; - themes
(setq custom-safe-themes t)
(use-package ef-themes
:config
(load-theme 'ef-cyprus))
;; projectile
(use-package projectile
:config
(projectile-global-mode)
(setq projectile-globally-ignored-directories '("dist"))
(setq projectile-indexing-method 'hybrid))
;; Editing
;; - brackets
(electric-pair-mode 1)
;; - folding
(use-package origami
:config
(global-origami-mode))
;; Copilot
(use-package copilot
:vc (:url "https://github.com/copilot-emacs/copilot.el"
:rev :newest
:branch "main")
:hook ((typescript-ts-mode . copilot-mode)
(tsx-ts-mode . copilot-mode)
(css-ts-mode . copilot-mode)
(web-mode . copilot-mode))
:bind
(("<backtab>" . copilot-accept-completion)))
;; LLMS
;; Anthropic
(exec-path-from-shell-copy-env "ANTHROPIC_API_KEY")
(setq anthropic-api-key (getenv "ANTHROPIC_API_KEY"))
;; Claude Code
;; - required inheritenv dependency:
(use-package inheritenv
:vc (:url "https://github.com/purcell/inheritenv" :rev :newest))
;; - monet/websockets
(use-package emacs-websocket
:vc (:url "https://github.com/ahyatt/emacs-websocket" :rev :newest))
(use-package monet
:vc (:url "https://github.com/stevemolitor/monet" :rev :newest))
(use-package claude-code
:config
;; optional IDE integration with Monet
(add-hook 'claude-code-process-environment-functions #'monet-start-server-function)
(monet-mode 1)
(claude-code-mode))
;; GPT.el
(use-package gptel)
(setq gptel-api-key anthropic-api-key)
(setq
gptel-model 'claude-3-sonnet-20240229 ; "claude-3-opus-20240229" also available
gptel-backend (gptel-make-anthropic "Claude"
:stream t :key anthropic-api-key))
;; Languages
;; tree sitter
(use-package treesit-auto
:custom
(treesit-auto-install t)
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode)
(load-file "./fix-csharp.el"))
;; Web
(defconst treesit-language-source-alist
'((svelte . ("https://github.com/Himujjal/tree-sitter-svelte"))
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" nil
"typescript/src"))
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript"))
(css . ("https://github.com/tree-sitter/tree-sitter-css"))
(haskell . ("https://github.com/tree-sitter/tree-sitter-haskell" "v0.23.1"))))
(use-package treesit
:mode (("\\.tsx\\'" . tsx-ts-mode)
("\\.js\\'" . typescript-ts-mode)
("\\.mjs\\'" . typescript-ts-mode)
("\\.mts\\'" . typescript-ts-mode)
("\\.cjs\\'" . typescript-ts-mode)
("\\.ts\\'" . typescript-ts-mode)
("\\.jsx\\'" . tsx-ts-mode)
("\\.json\\'" . json-ts-mode)
("\\.svelte\\'" . web-mode)
("\\.Dockerfile\\'" . dockerfile-ts-mode)))
;; Haskell
(use-package haskell-mode)
;; PlantUML
(use-package plantuml-mode
:mode (("\\.plantuml$" . plantuml-mode)))
(setq plantuml-executable-path "/opt/homebrew/bin/plantuml")
(setq plantuml-default-exec-mode 'executable)
;; Markdown
(use-package markdown-mode)
;; Yasnippet
(use-package yasnippet)
(require 'yasnippet)
(yas-global-mode 1)
;; - web
(use-package web-mode :mode (("\\.html$" . web-mode)))
(use-package emmet-mode
:init
(add-hook 'tsx-ts-mode-hook 'emmet-mode))
;; cucumber
(use-package feature-mode
:mode (("\\.feature$" . feature-mode)))
;; biome
(use-package biome-js-format
:vc (:url "https://github.com/yadex205/emacs-biomejs-format"))
(require 'biomejs-format)
(add-hook 'typescript-ts-mode-hook 'biomejs-format-mode)
(add-hook 'tsx-ts-mode-hook 'biomejs-format-mode)
(add-hook 'js-ts-mode 'biomejs-format-mode)
(add-hook 'js-mode-hook 'biomejs-format-mode)
(add-hook 'web-mode-hook 'biomejs-format-mode)
(add-hook 'css-ts-mode-hook 'biomejs-format-mode)
;; dired
(require 'ls-lisp)
(setq ls-lisp-dirs-first t)
(setq ls-lisp-use-insert-directory-program nil)
;; dirvish
(use-package dirvish
:init
(dirvish-override-dired-mode)
:config
;; (dirvish-peek-mode) ; Preview files in minibuffer
;; (dirvish-side-follow-mode) ; similar to `treemacs-follow-mode'
(setq dirvish-mode-line-format
'(:left (sort symlink) :right (omit yank index)))
(setq dirvish-attributes ; The order *MATTERS* for some attributes
'(vc-state subtree-state nerd-icons collapse git-msg file-time file-size)
dirvish-side-attributes
'(vc-state nerd-icons collapse file-size)))
;; evil-mc
(use-package evil-mc
:config
(global-evil-mc-mode 1))
;; ivy
(use-package ivy
:custom
(ivy-use-selectable-prompt t)
(ivy-count-format "(%d/%d) ")
(ivy-use-virtual-buffers t)
:config
(ivy-mode))
(use-package ivy-rich
:after ivy
:custom
(ivy-virtual-abbreviate 'full
ivy-rich-switch-buffer-align-virtual-buffer t
ivy-rich-path-style 'abbrev))
(use-package all-the-icons-ivy
:init (add-hook 'after-init-hook 'all-the-icons-ivy-setup))
(use-package counsel
:after ivy
:config
(counsel-mode))
(use-package counsel-projectile)
;; movement
(use-package smex)
(use-package avy)
(use-package wgrep)
(use-package swiper)
(use-package imenu-list
:init
(setq imenu-list-auto-resize t)
(setq imenu-list-focus-after-activation t))
;; Evil Mode
(use-package evil
:config
(evil-set-undo-system 'undo-redo)
(evil-mode))
;; Key Bindings
(use-package which-key)
(which-key-mode)
(use-package general
:config
(general-evil-setup t)
;; dired keys
(general-define-key
:states '(normal visual)
:keymaps 'dired-mode-map
"N" 'find-file)
;; web keys
(general-define-key
:states '(insert)
:keymaps 'web-mode-map
"TAB" 'emmet-expand-line)
;; xref keys
(general-define-key
:states '(normal)
:keymaps 'xref--xref-buffer-mode-map
"TAB" 'xref-goto-xref)
;; llm keys
(general-define-key
:states '(normal visual)
:prefix ","
:keymaps 'markdown-mode-map
"RET" 'gptel-send)
;; org keys
(general-define-key
:states '(normal visual)
:keymaps 'org-mode-map
"T" 'org-todo
"." 'org-time-stamp
"-" 'org-ctrl-c-minus
"+" 'org-ctrl-c-ctrl-c
"*" 'org-ctrl-c-star
"^" 'org-sort
"{" 'org-edit-src-code
"|" 'org-table-create-or-convert-from-region
"RET" 'org-open-at-point
"TAB" 'org-cycle)
(general-define-key
:states '(normal)
:prefix ","
:keymaps 'org-mode-map
"<backtab>" 'org-promote-subtree
"," "C-c C-c"
"/" 'org-sparse-tree
"b" '(:ignore t :which-key "Babel")
"bx" 'org-babel-execute-src-block
"bh" 'org-babel-insert-header-arg
"bn" 'org-babel-next-src-block
"bp" 'org-babel-previous-src-block
"bs" 'babel-skeleton
"c" '(:ignore t :which-key "Clocks")
"ci" 'org-clock-in
"co" 'org-clock-out
"cs" 'org-schedule
"cd" 'org-deadline
"cp" 'org-pomodoro
"t" 'org-set-tags-command
"o" 'org-occur
"r" 'org-refile
"A" 'org-archive-subtree
"il" 'org-insert-link
"it" 'org-insert-structure-template
"RET" 'org-meta-return
"TAB" 'org-demote-subtree)
;; eglot keys
(general-define-key
:states '(normal visual)
:prefix ","
"d" 'eglot-find-typeDefinition
"f" 'eglot-format
"a" 'eglot-code-actions
"i" 'eglot-find-implementation
"R" 'eglot-reconnect)
;; llm keys
(general-define-key
:states '(normal visual)
:prefix ","
:keymaps 'markdown-mode-map
"RET" 'gptel-send)
;; jj keys
;; eglot keys
(general-define-key
:states '(normal visual)
:prefix ","
:keymaps 'jj-mode-map
"," "C-c C-c"
"k" "C-c C-k")
;; application keys
(general-override-mode)
(general-define-key
:states '(normal visual insert emacs)
:prefix "SPC"
:keymaps 'override
:non-normal-prefix "C-SPC"
;; M-x
"SPC" '(smex :which-key "M-x")
"M" '(smex-major-mode-commands :which-key "M-x major")
;; Dirvish
"d" '(dired-jump :which-key "Dired jump")
;; Applications
"a" '(:ignore t :which-key "Applications")
"ad" '(dired :which-key "Dired")
"ae" '(:ignore t :which-key "Eldoc")
"aed" '(eldoc-doc-buffer :which-key "Doc Buffer")
"ai" '(:ignore t :which-key "AI")
"ai>" '(gptel-send :which-key "Send Line")
"aig" '(gptel :which-key "Claude buffer")
"aim" '(gptel-menu :which-key "LLM Menu")
"aic" '(claude-code-transient :which-key "Claude Code")
"ao" '(:ignore t :which-key "Org")
"aoa" '(org-agenda :which-key "Agenda")
"ao>" '(org-goto-calendar :which-key "Go To Calendar")
"aot" '(org-tags-view :which-key "Tags View")
"aop" '(org-pomodoro :which-key "Pomodoro")
"aor" '(:ignore t :which-key "Org Roam")
"aorc" '(org-roam-capture :which-key "Capture Node")
"aori" '(org-roam-node-insert :which-key "Insert Node")
"aorf" '(org-roam-node-find :which-key "Find Node")
"aoru" '(org-roam-ui-open :which-key "Open UI")
"aos" '(org-edit-src-exit :which-key "Exit Src Edit")
"ag" '(:ignore t :which-key "Magit")
"agb" '(magit-blame :which-key "Magit Blame")
"agc" '(magit-branch-checkout :which-key "Magit Branch Checkout")
"ag," '(magit-commit :which-key "Magit Commit")
"agn" '(magit-branch-create :which-key "Magit Branch Create")
"agr" '(magit-rebase-interactive :which-key "Magit Rebase")
"ag>" '(magit-push :which-key "Magit Push")
"ag<" '(magit-pull :which-key "Magit Pull")
"ags" '(magit-status :which-key "Magit Status")
"aj" '(:ignore t :which-key "jj")
"ajj" '(jj-log :which-key "jj log")
;; Buffers
"b" '(:ignore t :which-key "Buffers")
"bl" '(list-buffers :which-key "List Buffers")
"bb" '(switch-to-buffer :which-key "Switch Buffer")
"bd" '(kill-this-buffer :which-key "Kill Buffer")
"bp" '(previous-buffer :which-key "Previous Buffer")
"bn" '(next-buffer :which-key "Next Buffer")
"bs" '(scratch-buffer :which-key "Scratch Buffer")
"br" '(rename-buffer :which-key "Rename Buffer")
;; Directories
"c" '(:ignore t :which-key "Create file/directory")
"cd" '(make-directory :which-key "Create or find directory")
"cf" '(find-file :which-key "Create or find file")
;; Terminal
"T" '(multi-vterm :which-key "Open terminal")
;; Toggles
"t" '(:ignore t :which-key "Toggles")
"tt" '(multi-vterm-dedicated-toggle :which-key "Terminal")
"tT" '(load-theme :which-key "Theme")
"tl" '(display-line-numbers-mode :which-key "Line Numbers")
"ti" '(imenu-list-smart-toggle :which-key "IMenu List")
"t/" '(comment-or-uncomment-region :which-key "Comment Region")
;; Avy
"j" '(:ignore t :which-key "Jump To")
"jl" '(avy-goto-line :which-key "Jump To Line (avy)")
"jw" '(avy-goto-word-1 :which-key "Jump To Worg (avy)")
;; Counsel
"/" '(counsel-rg :which-key "Search in project")
"p" '(:ignore t :which-key "Projectile")
"pp" '(counsel-projectile-switch-project :which-key "Switch Project (projectile)")
"pf" '(counsel-projectile-find-file :which-key "Find Files In Project (projectile)")
;; Files
"f" '(:ignore t :which-key "Files")
"ff" '(find-file :which-key "Find file")
"fed" '(goto-init-file :which-key "Go to init file")
"fep" '(goto-projects-file :which-key "Go to projects file")
;; Windows
"w" '(:ignore t :which-key "Windows")
"wd" '(delete-window :which-key "Delete Window")
"w/" '(split-window-right :which-key "Split Window Right")
"w-" '(split-window-below :which-key "Split Window Below")
"wh" '(windmove-left :which-key "Move to Window on Left")
"wl" '(windmove-right :which-key "Move to Window on Right")
"wj" '(windmove-down :which-key "Move to Window Below")
"wk" '(windmove-up :which-key "Move to Window Above")
;; Emacs
"q" '(:ignore t :which-key "Quit")
"qr" '(restart-emacs :which-key "Restart Emacs")
;; Images
"i" '(:ignore t :which-key "Images")
"ii" '(image-increase-size :which-key "Increase Size")
))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ignored-local-variable-values
'((org-hugo-front-matter-format . "yaml")
(org-hugo-base-dir . "~/Sync/darrellbanks.com/")))
'(org-agenda-files nil)
'(package-selected-packages nil)
'(package-vc-selected-packages
'((ultra-scroll :url "https://github.com/jdtsmith/ultra-scroll"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(mode-line ((t (:background "floral white" :foreground "#6c6b5a" :box nil))))
'(mode-line-active ((t (:inherit modus-themes-ui-variable-pitch :background "old lace" :foreground "#142010" :box (:line-width (1 . 1) :color "#c4c0b6")))))
'(region ((t (:extend t :background "cornsilk2")))))

Comments are disabled for this gist.