diff options
author | venomade <venomade@venomade.com> | 2025-02-27 17:06:42 +0000 |
---|---|---|
committer | venomade <venomade@venomade.com> | 2025-02-27 17:06:42 +0000 |
commit | 1cace80e4832a5d250ef4b7ccd687996563fb01b (patch) | |
tree | db1ced91d1382ca3cabe37dbae00da51231d6a99 /emacs-elisp/config |
Add old dotfiles
Diffstat (limited to 'emacs-elisp/config')
-rw-r--r-- | emacs-elisp/config/fonts.el | 74 | ||||
-rw-r--r-- | emacs-elisp/config/functions.el | 50 | ||||
-rw-r--r-- | emacs-elisp/config/misc.el | 43 | ||||
-rw-r--r-- | emacs-elisp/config/orgmode.el | 6 | ||||
-rw-r--r-- | emacs-elisp/config/project.el | 10 | ||||
-rw-r--r-- | emacs-elisp/config/shortcuts.el | 33 | ||||
-rw-r--r-- | emacs-elisp/config/straight.el | 15 | ||||
-rw-r--r-- | emacs-elisp/config/theme.el | 5 |
8 files changed, 236 insertions, 0 deletions
diff --git a/emacs-elisp/config/fonts.el b/emacs-elisp/config/fonts.el new file mode 100644 index 0000000..7e951af --- /dev/null +++ b/emacs-elisp/config/fonts.el @@ -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) diff --git a/emacs-elisp/config/functions.el b/emacs-elisp/config/functions.el new file mode 100644 index 0000000..f8f587b --- /dev/null +++ b/emacs-elisp/config/functions.el @@ -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) diff --git a/emacs-elisp/config/misc.el b/emacs-elisp/config/misc.el new file mode 100644 index 0000000..631c1ed --- /dev/null +++ b/emacs-elisp/config/misc.el @@ -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) diff --git a/emacs-elisp/config/orgmode.el b/emacs-elisp/config/orgmode.el new file mode 100644 index 0000000..c8e436b --- /dev/null +++ b/emacs-elisp/config/orgmode.el @@ -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) diff --git a/emacs-elisp/config/project.el b/emacs-elisp/config/project.el new file mode 100644 index 0000000..f0efb03 --- /dev/null +++ b/emacs-elisp/config/project.el @@ -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) diff --git a/emacs-elisp/config/shortcuts.el b/emacs-elisp/config/shortcuts.el new file mode 100644 index 0000000..16024df --- /dev/null +++ b/emacs-elisp/config/shortcuts.el @@ -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))) diff --git a/emacs-elisp/config/straight.el b/emacs-elisp/config/straight.el new file mode 100644 index 0000000..06592a5 --- /dev/null +++ b/emacs-elisp/config/straight.el @@ -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) diff --git a/emacs-elisp/config/theme.el b/emacs-elisp/config/theme.el new file mode 100644 index 0000000..8e812b5 --- /dev/null +++ b/emacs-elisp/config/theme.el @@ -0,0 +1,5 @@ +;; Set Theme +(load-theme 'modus-vivendi t) + +;; Add Padding +(set-window-margins nil 0) |