Add old dotfiles

This commit is contained in:
venomade committed 2025-02-27 17:06:42 +00:00
commit 1cace80e48
192 files changed
+13538

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
(defun dir-load (dir config)
(load-file
(expand-file-name
(concat dir "/" config ".el")
user-emacs-directory)))
(defun cfg-load (config)
(dir-load "config" config))
(defun pkg-load (config)
(dir-load "packages" config))
(defun lang-load (config)
(dir-load "languages" config))
;; Configs
(cfg-load "straight")
(cfg-load "theme")
(cfg-load "fonts")
(cfg-load "functions")
(cfg-load "shortcuts")
(cfg-load "misc")
(cfg-load "orgmode")
(cfg-load "project")
;; Packages
(pkg-load "avy")
(pkg-load "corfu")
(pkg-load "cape")
(pkg-load "flycheck")
(pkg-load "smartparens")
(pkg-load "devdocs")
(pkg-load "counsel")
(pkg-load "movetext")
(pkg-load "whichkey")
(pkg-load "lsp")
(pkg-load "magit")
(pkg-load "undotree")
(pkg-load "simplemdln")
(pkg-load "multicursor")
(pkg-load "rainbow")
;; Languages
(lang-load "rust")
(lang-load "c-cpp")
(lang-load "scheme")
(lang-load "clojure")
+74
View File
@@ -0,0 +1,74 @@
;; Set Fonts and their size
(defvar customfontsettings
'((mono . "Iosevka")
(variabl . "RobotoCondensed")
(size . 14)))
(set-face-attribute 'variable-pitch nil
:font (cdr (assoc 'variabl customfontsettings))
:height (* (cdr (assoc 'size customfontsettings)) 10)
:weight 'regular)
(set-face-attribute 'fixed-pitch nil
:font (cdr (assoc 'mono customfontsettings))
:height (* (cdr (assoc 'size customfontsettings)) 10)
:weight 'regular)
(set-face-attribute 'default nil
:font (cdr (assoc 'mono customfontsettings))
:height (* (cdr (assoc 'size customfontsettings)) 10)
:weight 'regular)
(add-to-list 'default-frame-alist
`(font . ,(concat (cdr (assoc 'mono customfontsettings)) "-" (number-to-string (cdr (assoc 'size customfontsettings))))))
(set-face-attribute 'font-lock-comment-face nil
:slant 'italic)
(set-face-attribute 'font-lock-keyword-face nil
:slant 'italic)
;; Set mode-line font
(set-face-attribute 'mode-line nil :inherit 'variable-pitch)
(set-face-attribute 'mode-line-inactive nil :inherit 'variable-pitch)
;; Set Usable Ligatures
(dolist (char/ligature-re
`((?- . ,(rx (or (or "-->" "-<<" "->>" "-|" "-~" "-<" "->") (+ "-"))))
(?/ . ,(rx (or (or "/==" "/=" "/>" "/**" "/*") (+ "/"))))
(?* . ,(rx (or (or "*>" "*/") (+ "*"))))
(?< . ,(rx (or (or "<<=" "<<-" "<|||" "<==>" "<!--" "<=>" "<||" "<|>" "<-<"
"<==" "<=<" "<-|" "<~>" "<=|" "<~~" "<$>" "<+>" "</>"
"<*>" "<->" "<=" "<|" "<:" "<>" "<$" "<-" "<~" "<+"
"</" "<*")
(+ "<"))))
(?: . ,(rx (or (or ":?>" "::=" ":>" ":<" ":?" ":=") (+ ":"))))
(?= . ,(rx (or (or "=>>" "==>" "=/=" "=!=" "=>" "=:=") (+ "="))))
(?! . ,(rx (or (or "!==" "!=") (+ "!"))))
(?> . ,(rx (or (or ">>-" ">>=" ">=>" ">]" ">:" ">-" ">=") (+ ">"))))
(?& . ,(rx (+ "&")))
(?| . ,(rx (or (or "|->" "|||>" "||>" "|=>" "||-" "||=" "|-" "|>"
"|]" "|}" "|=")
(+ "|"))))
(?. . ,(rx (or (or ".?" ".=" ".-" "..<") (+ "."))))
(?+ . ,(rx (or "+>" (+ "+"))))
(?\[ . ,(rx (or "[<" "[|")))
(?\{ . ,(rx "{|"))
(?\? . ,(rx (or (or "?." "?=" "?:") (+ "?"))))
(?# . ,(rx (or (or "#_(" "#[" "#{" "#=" "#!" "#:" "#_" "#?" "#(")
(+ "#"))))
(?\; . ,(rx (+ ";")))
(?_ . ,(rx (or "_|_" "__")))
(?~ . ,(rx (or "~~>" "~~" "~>" "~-" "~@")))
(?$ . ,(rx "$>"))
(?^ . ,(rx "^="))
(?\] . ,(rx "]#"))))
(let ((char (car char/ligature-re))
(ligature-re (cdr char/ligature-re)))
(set-char-table-range composition-function-table char
`([,ligature-re 0 font-shape-gstring]))))
;; Font Zooming
(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
+50
View File
@@ -0,0 +1,50 @@
;; Pop Out Buffer
;;; Pops the current buffer out into it's own frame.
(defun pop-out-buffer-into-frame ()
(interactive)
(let* ((current-buffer (current-buffer))
(previous-buffer (other-buffer (current-buffer) t))) ;; Get the previous buffer in the window
;; Switch the current window back to the previous buffer
(set-window-buffer (selected-window) previous-buffer)
;; Create a new frame and show the original buffer there
(select-frame (make-frame))
(set-window-buffer (selected-window) current-Kill)))
;; Kill Current Buffer
;;; kill-this-buffer doesn't work in emacs 30 (relies on menubar visibility?) so this is a small implementation of window.el's /C-x 4 0/.
(defun kill-current-buffer()
(interactive)
(let ((buffer-to-kill (current-buffer))))
(kill-buffer (current-buffer)))
;; Duplicate Line (stolen from https://github.com/rexim/dotfiles)
;;; TODO: Expand function to be able duplicate region if region selected
(defun duplicate-line ()
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
;; Use bind-key to override other bindings
(keymap-global-set "C-c y d" 'duplicate-line)
;; Vim's o and S-o (stolen from https://stackoverflow.com/a/2173393)
(defun vi-open-line-above ()
(interactive)
(unless (bolp)
(beginning-of-line))
(newline)
(forward-line -1)
(indent-according-to-mode))
(defun vi-open-line-below ()
(interactive)
(unless (eolp)
(end-of-line))
(newline-and-indent))
(keymap-global-set "C-c O" 'vi-open-line-below)
(keymap-global-set "C-c o" 'vi-open-line-above)
+43
View File
@@ -0,0 +1,43 @@
;; Hide Warnings
(setq warning-minimum-level :emergency)
;; Disable Bell
(setq ring-bell-function 'ignore)
;; Add Scroll Margin
(setq scroll-margin 12)
;; Setup Line Numbers
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(setq display-line-numbers-type 'relative)
(global-visual-line-mode t)
(add-hook 'prog-mode-hook (lambda () (visual-line-mode -1)))
(setq-default truncate-lines t)
;; Use Spaces over Tabs
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq tab-stop-list (number-sequence 2 200 2))
;; Highlight Column
(setq-default display-fill-column-indicator-column 80)
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
;; Disable GUI Features
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; Set Emacs auto-save directories
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "backups"))))
(setq auto-save-file-name-transforms
`(("." ,(concat user-emacs-directory "autosaves") t)))
(setq lock-file-name-transforms
`(("." ,(concat user-emacs-directory "lock") t)))
;; Go back to old position on file open
(save-place-mode 1)
;; Disable Fringes
(set-fringe-mode 0)
+6
View File
@@ -0,0 +1,6 @@
;; Add shorthands for Org Functions
(require 'org-tempo)
;; Use both Mono and Variable fonts in a single buffer
(use-package mixed-pitch)
(add-hook 'org-mode-hook 'mixed-pitch-mode)
+10
View File
@@ -0,0 +1,10 @@
(require 'project)
(keymap-global-set "C-c p b" 'project-list-buffers)
(keymap-global-set "C-c p c" 'project-compile)
(keymap-global-set "C-c p e" 'project-dired)
(keymap-global-set "C-c p f" 'project-find-file)
(keymap-global-set "C-c f p" 'project-find-file)
(keymap-global-set "C-c p g" 'project-find-regexp)
(keymap-global-set "C-c p o" 'project-find-dir)
(keymap-global-set "C-c p p" 'project-switch-project)
+33
View File
@@ -0,0 +1,33 @@
;; Replace Emacs default behaviour
(keymap-global-set "C-x b" 'counsel-switch-buffer)
(global-set-key (kbd "C-x C-c") (lookup-key global-map (kbd "C-c")))
;; Rebind Emacs Quit
(keymap-global-set "C-M-S-q" 'save-buffers-kill-terminal)
;; Custom C-c keybinds
(keymap-global-set "C-c e c" (lambda () (interactive) (load-file "~/.emacs.d/init.el")))
(keymap-global-set "C-c f c" (lambda () (interactive) (find-file "~/.emacs.d/config.el")))
(keymap-global-set "C-c f t" (lambda () (interactive) (find-file "~/Documents/TODO.org")))
(keymap-global-set "C-c f b" (lambda () (interactive) (find-file "~/Documents/Bookmarks.org")))
(keymap-global-set "C-c b p" 'previous-buffer)
(keymap-global-set "C-c b n" 'next-buffer)
(keymap-global-set "C-c b r" 'revert-buffer)
(keymap-global-set "C-c e b" 'eval-buffer)
(keymap-global-set "C-c e r" 'eval-region)
(keymap-global-set "C-c e s" 'eshell)
(keymap-global-set "C-c r" 'replace-regexp)
(keymap-global-set "C-c y a" 'copy-from-above-command)
(keymap-global-set "C-c v" 'scroll-other-window)
(keymap-global-set "C-c V" 'scroll-other-window-down)
(keymap-global-set "C-c w n" 'other-window)
(keymap-global-set "C-c w f" 'other-window)
(keymap-global-set "C-c w p" (lambda () (interactive) (other-window -1)))
(keymap-global-set "C-c w b" (lambda () (interactive) (other-window -1)))
+15
View File
@@ -0,0 +1,15 @@
;; Setup the straight package manager to use the use-package syntax
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t)
+5
View File
@@ -0,0 +1,5 @@
;; Set Theme
(load-theme 'modus-vivendi t)
;; Add Padding
(set-window-margins nil 0)
+4
View File
@@ -0,0 +1,4 @@
(load-file
(expand-file-name
"config.el"
user-emacs-directory))
+4
View File
@@ -0,0 +1,4 @@
(add-hook 'c++-mode-hook #'lsp)
(add-hook 'c-mode-hook #'lsp)
(setq c-default-style "linux"
c-basic-offset 2)
+5
View File
@@ -0,0 +1,5 @@
;; Clojure
(use-package clojure-mode)
(use-package cider)
(use-package flycheck-clj-kondo)
(use-package clj-refactor)
+11
View File
@@ -0,0 +1,11 @@
(use-package rust-mode)
(setq rust-mode-treesitter-derive t)
(setenv "PATH" (concat (concat
(concat (expand-file-name "~/.cargo/bin") ":")
(getenv "PATH"))))
(setq exec-path (append exec-path (list (expand-file-name "~/.cargo/bin"))))
(use-package flycheck-rust)
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
+10
View File
@@ -0,0 +1,10 @@
;; TODO: Write this header
(use-package geiser)
(use-package geiser-guile)
(use-package flycheck-guile)
(setq geiser-default-implementation 'guile)
(setq geiser-active-implementations '(guile))
(setq geiser-implementations-alist '(((regexp "\\.scm$") guile)))
(setq geiser-guile-binary "guile3.0")
+6
View File
@@ -0,0 +1,6 @@
;; Avy keybinds superfast cursor movement
;;; https://github.com/abo-abo/avy
(use-package avy)
(setq avy-keys '(?a ?r ?s ?t ?n ?e ?i ?o)
avy-all-windows nil)
(bind-key* "C-q" 'avy-goto-char)
+11
View File
@@ -0,0 +1,11 @@
;; Cape adds setting what completions are used where
;;; https://github.com/minad/cape
(use-package cape)
(keymap-global-set "C-c c" 'cape-prefix-map)
;; Fall back to dabbrev without other completions
(setq dabbrev-case-fold-search t)
;;(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'completion-at-point-functions #'cape-file)
(add-hook 'completion-at-point-functions #'cape-elisp-block)
+7
View File
@@ -0,0 +1,7 @@
;; Corfu enables in-text-buffer completion
;;; https://github.com/minad/corfu
(use-package corfu)
(keymap-unset corfu-map "RET")
(setq corfu-auto t)
(global-corfu-mode 1)
(add-hook 'prog-mode-hook 'corfu-popupinfo-mode)
+11
View File
@@ -0,0 +1,11 @@
;; Counsel improves Emacs' minibuffer in many ways
;;; https://github.com/abo-abo/swiper
(use-package counsel)
(counsel-mode 1)
(ivy-mode 1)
(keymap-global-set "C-c f r" 'counsel-buffer-or-recentf)
(keymap-global-set "C-c f f" 'counsel-fzf)
(keymap-global-set "C-c f g" 'counsel-rg)
(keymap-global-set "C-c s" 'swiper)
+5
View File
@@ -0,0 +1,5 @@
;; Devdocs provides documentation browsing within Emacs
;;; https://github.com/astoff/devdocs.el
(use-package devdocs)
;; TODO: Automatically installed documentation if not installed
(keymap-global-set "C-c d" 'devdocs-lookup)
+6
View File
@@ -0,0 +1,6 @@
;; Flycheck shows syntax errors for many languages
;;; https://github.com/flycheck/flycheck
(use-package flycheck)
(add-hook 'prog-mode-hook 'flycheck-mode)
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
(setq flycheck-indication-mode nil)
+13
View File
@@ -0,0 +1,13 @@
;; LSP Mode adds LSP Support to Emacs
;;; https://github.com/emacs-lsp/lsp-mode
(use-package lsp-mode)
(setq lsp-keymap-prefix "C-c l")
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024))
(setq lsp-headerline-breadcrumb-enable nil)
(use-package lsp-ui)
;; Dependency for LSP Completion
(use-package yasnippet)
(yas-global-mode 1)
+3
View File
@@ -0,0 +1,3 @@
;; Magit is a fast GIT GUI in Elisp
;;; https://github.com/magit/magit
(use-package magit)
+4
View File
@@ -0,0 +1,4 @@
;; Move Text up and down easily
(use-package move-text)
(keymap-global-set "M-p" 'move-text-up)
(keymap-global-set "M-n" 'move-text-down)
+6
View File
@@ -0,0 +1,6 @@
;; Multi Cursors enable easier editing than built in rectangles
;;; https://github.com/magnars/multiple-cursors.el
(use-package multiple-cursors)
(keymap-global-set "C-c m" 'mc/edit-lines)
;; TODO: Find out more ways to use multicursors
+4
View File
@@ -0,0 +1,4 @@
;; Rainbow Delimiters colours parentheses and other delimiters for visual matching
;;; https://github.com/Fanael/rainbow-delimiters
(use-package rainbow-delimiters)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
+15
View File
@@ -0,0 +1,15 @@
;; Simple Modeline replaces the default modeline with a minimal one
;;; https://github.com/gexplorer/simple-modeline
(use-package simple-modeline)
(setq simple-modeline-segments
'((;;simple-modeline-segment-modified
simple-modeline-segment-buffer-name
simple-modeline-segment-position)
(simple-modeline-segment-vc
;;simple-modeline-segment-minor-modes
simple-modeline-segment-misc-info
simple-modeline-segment-process
simple-modeline-segment-major-mode)))
(simple-modeline-mode 1)
+5
View File
@@ -0,0 +1,5 @@
;; Smartparens is a package for LISP editing that helps with parentheses paralysis
;;; https://github.com/Fuco1/smartparens
(use-package smartparens)
(require 'smartparens-config)
(add-hook 'prog-mode-hook 'smartparens-mode)
+6
View File
@@ -0,0 +1,6 @@
;; Undo-Tree replaces the normal undo with advanced Undo Control
;;; https://gitlab.com/tsc25/undo-tree
(use-package undo-tree)
(global-undo-tree-mode 1)
(setq undo-tree-history-directory-alist
`(("." . ,(concat user-emacs-directory "undo"))))
+5
View File
@@ -0,0 +1,5 @@
(use-package which-key)
(setq which-key-show-early-on-C-h t)
(setq which-key-idle-delay 10000)
(setq which-key-idle-secondary-delay 0.05)
(which-key-mode 1)