Last active
April 20, 2024 18:16
-
-
Save hacknightly/ba0d0fea0ebbfb07c42ea991ba62f200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; emacs housekeeping | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(global-auto-revert-mode 1) | |
(setq warning-minimum-level :emergency) | |
;; pixel scroll | |
(setq pixel-scroll-precision-mode 1) | |
;; 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) | |
; Open to inbox file | |
(defun goto-inbox-file () | |
"Open the inbox file." | |
(interactive) | |
(find-file "~/Dropbox/darrellbanks.com/org/tasks/inbox.org")) | |
;; package management | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(package-initialize) | |
(setq package-archives '(("org" . "http://orgmode.org/elpa/") | |
("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
;; path management | |
(use-package exec-path-from-shell | |
:ensure t) | |
(when (memq window-system '(mac ns x)) | |
(exec-path-from-shell-initialize)) | |
;; dashboard | |
;; use-package with package.el: | |
(use-package dashboard | |
:ensure t | |
:config | |
(dashboard-setup-startup-hook)) | |
;; shell / vterm | |
(use-package vterm :ensure t | |
:init | |
(setq vterm-shell "zsh")) | |
(use-package multi-vterm :ensure t) | |
(defun goto-init-file () | |
"Open the init file." | |
(interactive) | |
(find-file user-init-file)) | |
;; magit | |
(use-package magit :ensure t) | |
;; org-mode | |
(use-package org-remark | |
:ensure t | |
:config | |
(setq org-pomodoro-length 40 | |
org-pomodoro-short-break-length 8 | |
org-pomodoro-long-break-length 30) | |
:hook (after-init . org-remark-global-tracking-mode)) | |
(use-package org-pomodoro | |
:ensure t | |
:commands (org-pomodoro)) | |
(use-package org-roam | |
:ensure t | |
:init | |
(setq org-roam-directory "~/Dropbox/darrellbanks.com/org/notes") | |
(setq org-link-file-path-type 'absolute) | |
:config | |
(org-roam-db-autosync-mode)) | |
(use-package org-roam-ui | |
:ensure t | |
: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: howdy@changeset.io\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 | |
(setq | |
;; Basic Settings | |
org-startup-indented t | |
org-return-follows-link t | |
org-confirm-babel-evaluate nil | |
org-agenda-files '("~/Dropbox/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)" "PROGRESS(p)" "|" "DONE(d)" "NOTE(n)")) | |
org-refile-targets `((,(directory-files-recursively "~/Dropbox/darrellbanks.com/org/projects/" "^[a-z0-9]*.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 "~/Dropbox/chime.wav" | |
org-pomodoro-finished-sound "~/Dropbox/chime.wav" | |
org-pomodoro-short-break-sound "~/Dropbox/chime.wav" | |
org-pomodoro-long-break-sound "~/Dropbox/chime.wav" | |
;; Templates | |
org-capture-templates | |
'(("t" "Todo" entry (file+datetree "~/Dropbox/darrellbanks.com/org/tasks/inbox.org") | |
"* TODO %^{Description} %^g | |
Added: %U") | |
("n" "Note" entry (file+datetree "~/Dropbox/darrellbanks.com/org/tasks/inbox.org") | |
"* NOTE %^{Description} %^g %? | |
Added: %U") | |
("a" "Achievement" entry (file+datetree "~/Dropbox/darrellbanks.com/org/tasks/inbox.org") | |
"* ACHIEVEMENT %^{Description} %^g %? | |
Added: %U") | |
) | |
;; 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 ─────────────────────────────────────────────────")) | |
;; Hugo | |
(use-package ox-hugo | |
:ensure t) | |
(setq org-hugo-base-dir "~/Dropbox/darrellbanks.com" | |
time-stamp-active t | |
time-stamp-start "#\\+lastmod:[ \t]*" | |
time-stamp-end "$" | |
time-stamp-format "%04Y-%02m-%02d") | |
(add-hook 'before-save-hook 'time-stamp nil) | |
;; Visual settings | |
;; - org mode | |
(use-package org-modern :ensure t) | |
(with-eval-after-load 'org (global-org-modern-mode)) | |
(with-eval-after-load 'org (auto-fill-mode)) | |
;; - font | |
(set-face-attribute 'default nil :font "RobotoMono Nerd Font" :height 180) | |
;; - icons | |
(use-package all-the-icons :ensure t) | |
;; - company | |
(use-package company | |
:ensure t | |
:init | |
(add-hook 'after-init-hook 'global-company-mode)) | |
;; - modeline | |
(use-package lambda-line | |
:ensure nil | |
:load-path "~/ThirdParty/lambda-line" | |
:custom | |
(lambda-line-icon-time t) ;; requires ClockFace font (see below) | |
(lambda-line-clockface-update-fontset "ClockFaceRect") ;; set clock icon | |
(lambda-line-position 'bottom) ;; Set position of status-line | |
(lambda-line-abbrev t) ;; abbreviate major modes | |
(lambda-line-hspace " ") ;; add some cushion | |
(lambda-line-prefix t) ;; use a prefix symbol | |
(lambda-line-prefix-padding nil) ;; no extra space for prefix | |
(lambda-line-status-invert nil) ;; no invert colors | |
(lambda-line-gui-ro-symbol " ⨂") ;; symbols | |
(lambda-line-gui-mod-symbol " ⬤") | |
(lambda-line-gui-rw-symbol " ◯") | |
(lambda-line-space-top +.50) ;; padding on top and bottom of line | |
(lambda-line-space-bottom -.50) | |
(lambda-line-symbol-position 0.1) ;; adjust the vertical placement of symbol | |
:config | |
;; activate lambda-line | |
(lambda-line-mode) | |
;; set divider line in footer | |
(when (eq lambda-line-position 'top) | |
(setq-default mode-line-format (list "%_")) | |
(setq mode-line-format (list "%_")))) | |
;; - indents | |
(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 | |
:ensure t | |
:config | |
(load-theme 'ef-cherie)) | |
;; use-package | |
(unless (package-installed-p 'use-package) ; unless it is already installed | |
(package-refresh-contents) ; update packages archive | |
(package-install 'use-package)) ; and install the most recent version of use-package | |
;; projectile | |
(use-package projectile :ensure t | |
:config | |
(projectile-global-mode) | |
(setq projectile-globally-ignored-directories '("dist")) | |
(setq projectile-indexing-method 'hybrid)) | |
;; Editing | |
;; - brackets | |
(electric-pair-mode 1) | |
;; copilot | |
(use-package s :ensure t) | |
(use-package dash :ensure t) | |
(use-package editorconfig :ensure t) | |
(add-to-list 'load-path (expand-file-name "~/ThirdParty/copilot.el")) | |
(require 'copilot) | |
(add-hook 'tsx-ts-mode-hook 'copilot-mode) | |
(add-hook 'typescript-ts-mode-hook 'copilot-mode) | |
(add-hook 'web-mode-hook 'copilot-mode) | |
(define-key copilot-completion-map (kbd "<backtab>") 'copilot-accept-completion) | |
;; LLMS | |
(exec-path-from-shell-copy-env "OPENAI_API_KEY") | |
(use-package gptel :ensure t | |
:config | |
(setq gptel-api-key (getenv "OPENAI_API_KEY")) | |
(gptel-make-ollama "Ollama" | |
:host "localhost:11434" | |
:stream t | |
:models '("llama2:latest"))) | |
;; Languages | |
;; tree sitter | |
(setq treesit-extra-load-path '("~/ThirdParty/tree-sitter-module/dist")) | |
(add-to-list 'auto-mode-alist '("\\.css\\'" . css-ts-mode)) | |
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-ts-mode)) | |
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) | |
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) | |
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yml-ts-mode)) | |
;; PlantUML | |
(use-package plantuml-mode :ensure t | |
:mode (("\\.plantuml$" . plantuml-mode))) | |
(setq plantuml-executable-path "/opt/homebrew/bin/plantuml") | |
(setq plantuml-default-exec-mode 'executable) | |
;; Markdown | |
(use-package markdown-mode :ensure t) | |
;; - Eglot | |
(use-package eglot | |
:config | |
(add-to-list 'eglot-server-programs | |
'(web-mode . ("svelteserver" "--stdio"))) | |
:hook | |
(typescript-ts-mode . eglot-ensure) | |
(tsx-ts-mode . eglot-ensure) | |
(python-ts-mode . eglot-ensure) | |
(json-ts-mode . eglot-ensure) | |
(js-ts-mode . eglot-ensure) | |
(web-mode . eglot-ensure) | |
(erlang-mode . eglot-ensure) | |
(rust-mode . eglot-ensure)) | |
;; - web | |
(use-package web-mode :ensure t | |
:mode (("\\.html$" . web-mode) | |
("\\.svelte$" . web-mode))) | |
(use-package emmet-mode :ensure t | |
:init | |
(add-hook 'web-mode-hook 'emmet-mode)) | |
;; rust | |
(use-package rust-mode :ensure t | |
:mode (("\\.rs$" . rust-mode) | |
)) | |
;; - prettier | |
(use-package prettier-js :ensure t | |
:init | |
(add-hook 'typescript-ts-mode-hook 'prettier-js-mode) | |
(add-hook 'tsx-ts-mode-hook 'prettier-js-mode) | |
(add-hook 'js-mode-hook 'prettier-js-mode) | |
(add-hook 'svelte-mode-hook 'prettier-js-mode) | |
(add-hook 'web-mode-hook 'prettier-js-mode)) | |
;; flycheck | |
(use-package flycheck :ensure t) | |
;; treemacs | |
(use-package treemacs :ensure t) | |
(use-package treemacs-evil :ensure t) | |
(use-package treemacs-projectile :ensure t) | |
(use-package treemacs-all-the-icons :ensure t) | |
;; evil-mc | |
(use-package evil-mc | |
:ensure t | |
:config | |
(global-evil-mc-mode 1)) | |
;; ivy | |
(use-package ivy | |
:ensure t | |
:custom | |
(ivy-use-selectable-prompt t) | |
(ivy-count-format "(%d/%d) ") | |
(ivy-use-virtual-buffers t) | |
:config | |
(ivy-mode)) | |
(use-package ivy-rich | |
:ensure t | |
: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 | |
:ensure t | |
:init (add-hook 'after-init-hook 'all-the-icons-ivy-setup)) | |
(use-package counsel | |
:after ivy | |
:ensure t | |
:config | |
(counsel-mode)) | |
(use-package counsel-projectile :ensure t) | |
;; movement | |
(use-package avy :ensure t) | |
(use-package wgrep :ensure t) | |
(use-package swiper :ensure t) | |
(use-package imenu-list :ensure t | |
:init | |
(setq imenu-list-auto-resize t) | |
(setq imenu-list-focus-after-activation t)) | |
;; Evil Mode | |
(use-package evil | |
:ensure t | |
:config | |
(evil-set-undo-system 'undo-redo) | |
(evil-mode)) | |
;; Key Bindings | |
(use-package which-key :ensure t | |
:init (which-key-mode)) | |
(use-package general :ensure t | |
:config | |
(general-evil-setup t) | |
;; 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") | |
"bi" 'org-insert-structure-template | |
"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 | |
"RET" 'org-meta-return | |
"TAB" 'org-demote-subtree | |
) | |
;; general keys | |
(general-define-key | |
:states '(normal visual insert emacs treemacs) | |
:prefix "SPC" | |
:non-normal-prefix "C-SPC" | |
;; M-x | |
"SPC" '(counsel-M-x :which-key "M-x") | |
;; Applications | |
"a" '(:ignore t :which-key "Applications") | |
"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 "GPT Buffer") | |
"aim" '(gptel-menu :which-key "GPT Menu") | |
"ao" '(:ignore t :which-key "Org") | |
"aoa" '(org-agenda :which-key "Agenda") | |
"aoc" '(org-capture :which-key "Capture") | |
"ao>" '(org-goto-calendar :which-key "Go To Calendar") | |
"aot" '(org-tags-view :which-key "Tags View") | |
"aop" '(org-pomodoro :which-key "Pomodoro") | |
"at" '(:ignore t :which-key "Treemacs") | |
"atd" '(treemacs-select-directory :which-key "Select Directory") | |
"aor" '(:ignore t :which-key "Org Roam") | |
"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") | |
"ag>" '(magit-push :which-key "Magit Push") | |
"ag<" '(magit-pull :which-key "Magit Pull") | |
"ags" '(magit-status :which-key "Magit Status") | |
"av" '(:ignore t :which-key "VTerm") | |
"avn" '(multi-vterm :which-key "New Terminal") | |
"av>" '(multi-vterm-next :which-key "Next Terminal") | |
"av<" '(multi-vterm-previous :which-key "Previous Terminal") | |
;; 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") | |
;; Toggles | |
"t" '(:ignore t :which-key "Toggles") | |
"tl" '(display-line-numbers-mode :which-key "Line Numbers") | |
"ti" '(imenu-list-smart-toggle :which-key "IMenu List") | |
;; 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") | |
"fed" '(goto-init-file :which-key "Go to init file") | |
"fei" '(goto-inbox-file :which-key "Go to inbox file") | |
"ft" '(treemacs :which-key "Treemacs Filetree") | |
;; 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") | |
;; Eglot | |
"gg" '(eglot-find-typeDefinition :which-key "Find Definition") | |
"gi" '(eglot-find-implementation :which-key "Find Implementation") | |
;; 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. | |
'(org-agenda-files nil) | |
'(package-selected-packages | |
'(modus-themes jsonrpc all-the-icons-ivy company counsel-projectile dashboard editorconfig ef-themes evil-mc exec-path-from-shell flycheck general gptel imenu-list ivy-rich magit markdown-mode multi-vterm org-modern org-pomodoro org-remark org-roam-ui ox-hugo plantuml-mode prettier-js rust-mode treemacs-all-the-icons treemacs-evil treemacs-projectile web-mode wgrep which-key))) | |
(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. | |
'(default ((t (:background nil))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment