From 22bc1e1879da0d99e5e1d79b10742b8cc9fd0521 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 30 May 2024 12:47:11 -0500 Subject: Initial commit --- README | 31 +++ bash_profile | 3 + bashrc | 20 ++ csirc | 36 +++ dots.sh | 81 +++++++ emacs | 647 ++++++++++++++++++++++++++++++++++++++++++++++++++ emacs.d/early-init.el | 21 ++ inputrc | 22 ++ profile | 62 +++++ shrc | 72 ++++++ xautostart | 18 ++ xinitrc | 33 +++ xmodmap | 8 + xresources | 48 ++++ 14 files changed, 1102 insertions(+) create mode 100644 README create mode 100644 bash_profile create mode 100644 bashrc create mode 100644 csirc create mode 100755 dots.sh create mode 100644 emacs create mode 100644 emacs.d/early-init.el create mode 100644 inputrc create mode 100644 profile create mode 100644 shrc create mode 100755 xautostart create mode 100644 xinitrc create mode 100644 xmodmap create mode 100644 xresources diff --git a/README b/README new file mode 100644 index 0000000..5c229a7 --- /dev/null +++ b/README @@ -0,0 +1,31 @@ +My dotfiles +there are many like them +but these ones are mine + +---------- +Installing +---------- + +- ./dots.sh + +see ./dots.sh -h for more details + +I don't remember what -d means. + +----------- +What's here +----------- + +- bash / shell stuff +- emacs +- x stuff +- various other repl type stuff + +------ +TO ADD +------ + +- i3 config +- msmtp config (must remove PII) +- keepassxc ?? (can it do the two part config thing?) +- ... ? \ No newline at end of file diff --git a/bash_profile b/bash_profile new file mode 100644 index 0000000..4d6b5b3 --- /dev/null +++ b/bash_profile @@ -0,0 +1,3 @@ +# ~/.bash_profile + +test -f $HOME/.bashrc && . $HOME/.bashrc diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..66a0bc3 --- /dev/null +++ b/bashrc @@ -0,0 +1,20 @@ +# ~/.bashrc + +test -f $HOME/.shrc && . $HOME/.shrc + +# History +HISTFILESIZE=-1 +HISTSIZE=100000 + +shopt -s histappend + +shopt -s histreedit +shopt -s histverify + +HISTTIMEFORMAT="%FT%T%z" + +HISTCONTROL=erasedups +HISTIGNORE='&:[ ]*' +HISTIGNORE="$HISTIGNORE:ls:exit:cd" + +PROMPT_COMMAND="history -a;${PROMPT_COMMAND:-:}" diff --git a/csirc b/csirc new file mode 100644 index 0000000..4e9ce0e --- /dev/null +++ b/csirc @@ -0,0 +1,36 @@ +;;; ~/.csirc -*- scheme -*- + +(set! ##sys#notices-enabled #f) +(import (chicken load)) +(load-verbose #f) +(require-library chicken-doc) + +(let () + (import (chicken format)) + (import (chicken process-context)) + (import (chicken process signal)) + (unless (get-environment-variable "INSIDE_EMACS") + (import breadline) + (import breadline-scheme-completion) + (history-file (format "~a/.csi_history" (get-environment-variable "HOME"))) + (stifle-history! 10000) + (completer-word-break-characters-set! "\"\'`;|()[] ") + (completer-set! scheme-completer) + (basic-quote-characters-set! "\"|") + (variable-bind! "blink-matching-paren" "on") + (paren-blink-timeout-set! 200000) + (let ((handler (signal-handler signal/int))) + (set-signal-handler! signal/int + (lambda (s) + (cleanup-after-signal!) + (reset-after-signal!) + (handler s)))) + (on-exit reset-terminal!) + (current-input-port (make-readline-port)))) + +;; (import (beaker system)) +;; (import (beaker egg info)) + +(set! ##sys#notices-enabled #t) + + diff --git a/dots.sh b/dots.sh new file mode 100755 index 0000000..5036e30 --- /dev/null +++ b/dots.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +QUIET=false +NORUN=false +FORCE=false +DIR="$(dirname "$(realpath "$0")")" + +main() { + action=homify + while getopts hqnfdx OPT + do + case "$OPT" in + (h) usage; exit 0 ;; + (q) QUIET=true ;; + (n) NORUN=true ;; + (f) FORCE=true ;; + (d) action=dotify ;; + (x) set -x ;; + (*) usage; exit 1 ;; + esac + done + shift $((OPTIND - 1)) + "$action" "$@" +} + +usage() { + cat<&2 "* $@"; } +run() { log "$@"; $NORUN || "$@"; } + +mklink() { # mklink SOURCE DEST + # make hardlinks to DEST from SOURCE -- making directories + $NORUN || test -d "$(dirname "$2")" || run mkdir -p "$(dirname "$2")" + if ! test -f "$2" + then run ln "$1" "$2" + elif test -f "$2" && "$FORCE" + then run ln -f "$1" "$2" + else log "$2 exists: skipping" + fi +} + +getfiles() { + d="$1"; shift + find "$d" -type f -a -not -name "$(basename "$0")" "$@" +} + +homify() { + getfiles "$DIR" "$@" | + while read -r dot + do mklink "$dot" "$HOME/.${dot#$DIR/}" + done +} + +dotify() { + getfiles "$@" | + while read -r file + do mklink "$file" "$DIR/${file#.}" + done +} + +main "$@" diff --git a/emacs b/emacs new file mode 100644 index 0000000..e1df5dc --- /dev/null +++ b/emacs @@ -0,0 +1,647 @@ +;;; ~/.emacs -*- lexical-binding: t; -*- +;; Author Case Duckworth +;; Bankruptcy: 12 + +;;; Initialization -- see also ~/.emacs.d/early-init.el + +(setopt custom-file (locate-user-emacs-file "custom.el")) +(load custom-file :no-error) + +(defvar private-file (locate-user-emacs-file "private.el") + "Private customizations") +(load private-file :no-error) ; might as well do this now + +;; (load-theme 'modus-operandi :no-confirm) + +(define-advice startup-echo-area-message (:override ()) + (if (get-buffer "*Warnings*") + ";_;" + "^_^")) + +(defun create-missing-directories () + "Automatically create missing directories." + (let ((target-dir (file-name-directory buffer-file-name))) + (unless (file-exists-p target-dir) + (make-directory target-dir :parents)))) + +(defun delete-trailing-whitespace-except-current-line () + (save-excursion + (delete-trailing-whitespace (point-min) + (line-beginning-position)) + (delete-trailing-whitespace (line-end-position) + (point-max)))) + +(defun run-after-frame-init (func) + "Run FUNC after the first frame is initialized. +If already so, run FUNC immediately." + (cond + ((daemonp) + (add-hook 'server-after-make-frame-hook func) + (advice-add func :after (lambda () + (remove-hook 'server-after-make-frame-hook + func) + (advice-remove func + 'after-frame-init-removing-advice)) + + + '((name . after-frame-init-removing-advice)))) + ((not after-init-time) + (add-hook 'after-init-hook func)) + (:else (funcall func)))) + +(defun first-found-font (&rest cands) + "Return the first font of CANDS that is installed, or nil." + (cl-loop with ffl = (font-family-list) + for font in cands + if (member font ffl) + return font)) + +(defun setup-faces () + "Setup Emacs faces." + (set-face-attribute 'variable-pitch nil + :family (first-found-font "Public Sans") + :height 1.0) + (set-face-attribute 'fixed-pitch-serif nil + :inherit 'default) + + ;; Emojis + (cl-loop with ffl = (font-family-list) + for font in '("Noto Emoji" "Noto Color Emoji" + "Segoe UI Emoji" "Apple Color Emoji" + "FreeSans" "FreeMono" "FreeSerif" + "Unifont" "Symbola") + if (member font ffl) + do (set-fontset-font t 'symbol font)) + + ;; International fonts + (cl-loop with ffl = (font-family-list) + for (charset . font) + in '((latin . "Noto Sans") + (han . "Noto Sans CJK SC Regular") + (kana . "Noto Sans CJK JP Regular") + (hangul . "Noto Sans CJK KR Regular") + (cjk-misc . "Noto Sans CJK KR Regular") + (khmer . "Noto Sans Khmer") + (lao . "Noto Sans Lao") + (burmese . "Noto Sans Myanmar") + (thai . "Noto Sans Thai") + (ethiopic . "Noto Sans Ethiopic") + (hebrew . "Noto Sans Hebrew") + (arabic . "Noto Sans Arabic") + (gujarati . "Noto Sans Gujarati") + (devanagari . "Noto Sans Devanagari") + (kannada . "Noto Sans Kannada") + (malayalam . "Noto Sans Malayalam") + (oriya . "Noto Sans Oriya") + (sinhala . "Noto Sans Sinhala") + (tamil . "Noto Sans Tamil") + (telugu . "Noto Sans Telugu") + (tibetan . "Noto Sans Tibetan")) + if (member font ffl) + do (set-fontset-font t charset font))) + +(defun cancel-colors () + (mapatoms + (lambda (atom) + (when (facep atom) + (set-face-attribute atom nil + :foreground 'unspecified + :background 'unspecified + :weight 'unspecified + :slant 'unspecified + :underline 'unspecified + :overline 'unspecified + :strike-through 'unspecified + :box 'unspecified + :inverse-video nil + :stipple nil + :extend nil))))) + +(defun set-faces (faces) + (dolist (face faces) + (apply #'set-face-attribute (car face) nil (cdr face)))) + +(font-lock-mode -1) +(cancel-colors) +(run-after-frame-init + (defun uncancel-colors () + (set-faces `((font-lock-comment-face :italic t) + (font-lock-comment-delimiter-face :italic t) + (font-lock-doc-face :italic t) + (font-lock-keyword-face :bold t) + (bold :bold t) (italic :italic t) (underline :underline t) + (mode-line-active :box t :background "light goldenrod") + (mode-line-inactive :box "pale goldenrod" + :background "pale goldenrod") + (link :foreground "navy" :underline t) + (completions-annotations :inherit 'italic) + (highlight :background "wheat") + (match :background "wheat") + (isearch :background "sea green" :foreground "white") + (isearch-fail :background "tomato") + (lazy-highlight :background "dark sea green") + (region :background "papaya whip") + (query-replace :background "wheat") + (shadow :foreground "orchid") + (show-paren-match :background "goldenrod") + (success :foreground "sea green" :italic t) + (warning :foreground "brown" :italic t) + (error :foreground "red" :italic t) + (trailing-whitespace :background "tomato") + (vertical-border :foreground "gray") + (completions-highlight :background "wheat"))))) + +(defun recancel-colors () + (interactive) + (cancel-colors) + (uncancel-colors)) + +(defmacro inhibit-messages (&rest body) + "Inhibit all messages in BODY." + (declare (indent defun)) + `(cl-letf (((symbol-function 'message) #'ignore)) + ,@body)) + +(defun kill-buffer-dwim (&optional buffer-or-name) + "Kill BUFFER-OR-NAME or the current buffer." + (interactive "P") + (cond + ((bufferp buffer-or-name) + (kill-buffer buffer-or-name)) + ((null buffer-or-name) + (kill-current-buffer)) + (:else + (kill-buffer (read-buffer "Kill: " nil :require-match))))) + +(defun other-window-dwim (&optional arg) + "Switch to another window/buffer. +Calls `other-window', which see, unless +- the current window is alone on its frame +- `other-window-dwim' is called with \\[universal-argument] +In these cases, switch to the last-used buffer." + (interactive "P") + (if (or arg (one-window-p)) + (switch-to-buffer (other-buffer) nil t) + (other-window 1))) + +(defun delete-window-dwim () + "Delete the current window or bury its buffer. +If the current window is alone in its frame, bury the buffer +instead." + (interactive) + (unless (ignore-errors (delete-window) t) + (bury-buffer))) + +(defun cycle-spacing* (&optional n) + "Negate N argument on `cycle-spacing'." + (interactive "*p") + (cycle-spacing (- n))) + +(defun find-user-init-file (&optional arg) + "Edit `user-init-file' in current window. +With ARG, edit in other window." + (interactive "P") + (funcall (if arg #'find-file-other-window #'find-file) + user-init-file)) + +(defun find-user-private-file (&optional arg) + "Edit `private-file'. +With ARG, edit in other window." + (interactive "P") + (funcall (if arg #'find-file-other-window #'find-file) + private-file)) + +(defun package-ensure (pkg) + "Install PKG if it's not already installed." + (unless (package-installed-p pkg) + (package-install pkg))) + +;;; Basic settings + +(tooltip-mode -1) + +;; Dialogs +(setopt use-dialog-box nil) +(setopt use-file-dialog nil) +(setopt read-answer-short t) +(setopt use-short-answers t) +(setopt echo-keystrokes 0.01) + +;; Cursor +(blink-cursor-mode -1) + +;; Fonts +(setopt x-underline-at-descent-line t) +(run-after-frame-init #'setup-faces) + +;;; Look and feel + +;; Whitespace +(setopt whitespace-style '(face trailing tabs tab-mark)) +(global-whitespace-mode) +(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line) +(set-face-attribute 'whitespace-tab nil :background nil :foreground "#888") +(setf (alist-get 'tab-mark whitespace-display-mappings) + '(9 [?· 9] [?» 9] [?\\ 9])) + +;;; Completions + +(setopt tab-always-indent 'complete) +(setopt completion-styles '(basic partial-completion substring flex)) + +(setopt completion-ignore-case t) +(setopt read-buffer-completion-ignore-case t) +(setopt read-file-name-completion-ignore-case t) +(setopt completion-flex-nospace t) + +(setopt completion-show-help nil) +(setopt completions-detailed t) +(setopt completions-group t) +(setopt completion-auto-help 'visible) +(setopt completion-auto-select 'second-tab) +(setopt completions-header-format nil) +(setopt completions-format 'one-column) +(setopt completions-max-height 10) + +(keymap-set minibuffer-local-map "C-p" #'minibuffer-previous-completion) +(keymap-set minibuffer-local-map "C-n" #'minibuffer-next-completion) + +(setopt enable-recursive-minibuffers t) +(setopt minibuffer-default-prompt-format " [%s]") +(minibuffer-depth-indicate-mode) +(minibuffer-electric-default-mode) + +(setopt file-name-shadow-properties '(invisible t intangible t)) +(file-name-shadow-mode) + +(setopt history-length t) +(setopt history-delete-duplicates t) +(setopt savehist-save-minibuffer-history t) +(setopt savehist-autosave-interval 5) +(savehist-mode) + +(define-minor-mode truncate-lines-local-mode + "Toggle `truncate-lines' in the current buffer." + :lighter "" + (setq-local truncate-lines truncate-lines-local-mode)) + +(add-hook 'completion-list-mode-hook #'truncate-lines-local-mode) +(add-hook 'minibuffer-setup-hook #'truncate-lines-local-mode) + +;; Consult/Marginalia + +(package-ensure 'consult) +(require 'consult) +(keymap-global-set "C-x b" #'consult-buffer) +(keymap-global-set "C-x 4 b" #'consult-buffer-other-window) +(keymap-global-set "C-x 5 b" #'consult-buffer-other-frame) +(keymap-global-set "C-x r b" #'consult-bookmark) +(keymap-global-set "M-y" #'consult-yank-pop) +(keymap-global-set "M-g g" #'consult-goto-line) +(keymap-global-set "M-g M-g" #'consult-goto-line) +(keymap-global-set "M-g o" #'consult-outline) +(keymap-global-set "M-g m" #'consult-mark) +(keymap-global-set "M-g i" #'consult-imenu) +(keymap-global-set "M-s d" #'consult-find) +(keymap-global-set "M-s D" #'consult-locate) +(keymap-global-set "M-s l" #'consult-line) +(keymap-global-set "M-s k" #'consult-keep-lines) +(keymap-global-set "M-s u" #'consult-focus-lines) +(keymap-global-set "M-s e" #'consult-isearch-history) +(keymap-set isearch-mode-map "M-e" #'consult-isearch-history) +(keymap-set isearch-mode-map "M-s e" #'consult-isearch-history) +(keymap-set isearch-mode-map "M-s l" #'consult-line) +(setopt xref-show-xrefs-function #'consult-xref) +(setopt xref-show-definitions-function + #'xref-show-definitions-completing-read) +(setopt consult-preview-key "M-.") + +(package-ensure 'marginalia) +(marginalia-mode) + +;;; Files + +(setopt auto-revert-verbose nil) +(setopt global-auto-revert-non-file-buffers t) +(global-auto-revert-mode) + +(setopt create-lockfiles nil) +(setopt mode-require-final-newline t) +(setopt view-read-only t) +(setopt save-silently t) +(setopt delete-by-moving-to-trash t) +(setopt auto-save-default nil) +(setopt auto-save-no-message t) +(setopt auto-save-interval 2) +(setopt auto-save-timeout 2) +(setopt auto-save-visited-interval 2) +(setopt remote-file-name-inhibit-auto-save t) +(setopt remote-file-name-inhibit-auto-save-visited t) +(add-to-list 'auto-save-file-name-transforms + `(".*" ,(locate-user-emacs-file "auto-save/") t)) +(auto-save-visited-mode) + +(setopt backup-by-copying t) +(setopt version-control t) +(setopt kept-new-versions 3) +(setopt kept-old-versions 3) +(setopt delete-old-versions t) +(add-to-list 'backup-directory-alist '("^/dev/shm/" . nil)) +(add-to-list 'backup-directory-alist '("^/tmp/" . nil)) +(when-let ((xrd (getenv "XDG_RUNTIME_DIR"))) + (add-to-list 'backup-directory-alist (cons xrd nil))) +(add-to-list 'backup-directory-alist + (cons "." (locate-user-emacs-file "backup/")) + :append) + +(setopt recentf-max-menu-items 100) +(setopt recentf-max-saved-items nil) +(setopt recentf-case-fold-search t) +(with-eval-after-load 'recentf + (add-to-list 'recentf-exclude "-autoloads.el\\'")) +(add-hook 'buffer-list-update-hook #'recentf-track-opened-file) +(add-hook 'after-save-hook #'recentf-save-list) +(recentf-mode) + +(setopt save-place-forget-unreadable-files (eq system-type 'gnu/linux)) +(save-place-mode) + +(add-hook 'find-file-not-found-functions #'create-missing-directories) + +;;; Buffers + +(setopt uniquify-buffer-name-style 'forward) + +;; Encodings +(set-language-environment "UTF-8") +(setopt buffer-file-coding-system 'utf-8-unix) +(setopt coding-system-for-read 'utf-8-unix) +(setopt coding-system-for-write 'utf-8-unix) +(setopt default-process-coding-system '(utf-8-unix . utf-8-unix)) +(setopt locale-coding-system 'utf-8-unix) +(set-charset-priority 'unicode) +(prefer-coding-system 'utf-8-unix) +(set-default-coding-systems 'utf-8-unix) +(set-terminal-coding-system 'utf-8-unix) +(set-keyboard-coding-system 'utf-8-unix) +(pcase system-type + ((or 'ms-dos 'windows-nt) + (set-clipboard-coding-system 'utf-16-le) + (set-selection-coding-system 'utf-16-le)) + (_ + (set-selection-coding-system 'utf-8) + (set-clipboard-coding-system 'utf-8))) + +;;; Search + +(setopt isearch-lazy-count t) +(setopt isearch-regexp-lax-whitespace t) +(setopt isearch-wrap-pause 'no) +(setopt search-default-mode t) +(setopt search-whitespace-regexp ".*?") ; swiper-style +(setopt search-ring-max 256) +(setopt regexp-search-ring-max 256) + +(define-advice isearch-cancel (:before () add-to-history) + "Add search string to history when canceling isearch." + (unless (string-equal "" isearch-string) + (isearch-update-ring isearch-string isearch-regexp))) + +(package-ensure 'isearch-mb) +(with-eval-after-load 'isearch-mb + (with-eval-after-load 'consult + (add-to-list 'isearch-mb--with-buffer #'consult-isearch-history) + (keymap-set isearch-mb-minibuffer-map "M-r" #'consult-isearch-history) + (add-to-list 'isearch-mb--after-exit #'consult-line) + (keymap-set isearch-mb-minibuffer-map "M-s l" #'consult-line))) +(isearch-mb-mode) + +;;; Keybinds + +(keymap-global-set "C-x C-c" #'save-buffers-kill-terminal) +(keymap-global-set "C-x C-k" #'kill-buffer-dwim) +(keymap-global-set "M-o" #'other-window-dwim) +(keymap-global-set "C-x o" #'other-window-dwim) +(keymap-global-set "C-x 0" #'delete-window-dwim) +(keymap-global-set "M-SPC" #'cycle-spacing*) +(keymap-global-set "C-x C-b" #'ibuffer) +(keymap-global-set "M-/" #'hippie-expand) +(keymap-global-set "M-u" #'universal-argument) +(keymap-set universal-argument-map "M-u" #'universal-argument-more) +(keymap-global-set "C-c i" #'find-user-init-file) +(keymap-global-set "C-c p" #'find-user-private-file) +(keymap-global-set "C-c s" #'eshell) + +(keymap-global-set "C-c t" + (defun insert-current-iso8601 () + (interactive) + (insert (format-time-string "%FT%TZ" (current-time) t)))) + +(keymap-global-set "C-M-\\" + (defun indent-buffer () + (interactive) + (save-mark-and-excursion + (indent-region (point-min) (point-max))))) + +;; Un-keybinds +(keymap-global-unset "C-" t) +(keymap-global-unset "C-" t) +;; I only ever fat-finger this key and never want to change encoding +(keymap-global-unset "C-\\" t) +(keymap-global-unset "C-z" t) + +;; Key settings +(setopt set-mark-command-repeat-pop t) + +;;; Writing + +(add-hook 'text-mode-hook #'visual-line-mode) + +;;; Hungry delete +;; I was using the hungry-delete package, but it turns out I can get *most* of +;; the features with just these functions. + +(defun %hungry-delete (skip-fn del-key) + (let ((here (point))) + (funcall skip-fn " \t") + (if (or (= (point) here) + (apply 'derived-mode-p + '(eshell-mode ; add other modes to skip here. + nim-mode + pyton-mode))) + (call-interactively (keymap-lookup (list (current-local-map) + (current-global-map)) + del-key)) + (delete-region (point) here)))) + +(defun hungry-delete-forward () + "Delete forward, hungrily." + (interactive) + (%hungry-delete #'skip-chars-forward "C-d")) + +(defun hungry-delete-backward () + "Delete backward, hungrily." + (interactive) + (%hungry-delete #'skip-chars-backward "DEL")) + +(define-minor-mode hungry-delete-mode + "Hungrily delete stuff." + :global t + :lighter " h" + :keymap (define-keymap + "DEL" #'hungry-delete-backward + "C-d" #'hungry-delete-forward)) + +(hungry-delete-mode) + +;;; Programming + +(add-hook 'prog-mode-hook #'electric-pair-local-mode) +(setopt tab-width 8) +(setopt sh-basic-offset tab-width) +(setopt perl-indent-level tab-width) +(setopt c-basic-offset tab-width) + +;; Elisp +(defun pulse@eval (start end &rest _) + (pulse-momentary-highlight-region start end)) + +(keymap-set emacs-lisp-mode-map "C-c C-c" #'eval-defun) +(keymap-set emacs-lisp-mode-map "C-c C-b" + (defun eval-buffer@pulse () (interactive) + (eval-buffer) + (pulse@eval (point-min) (point-max)))) +(advice-add 'eval-region :after #'pulse@eval) + +(defvar space-indent-modes '(emacs-lisp-mode + lisp-interaction-mode + lisp-mode + scheme-mode + python-mode + haskell-mode + text-mode + web-mode + css-mode) + "Modes to indent with spaces, not tabs.") + +(defun indent-tabs-mode-maybe () + (setq indent-tabs-mode + (if (apply #'derived-mode-p space-indent-modes) nil t))) +(add-hook 'prog-mode-hook #'indent-tabs-mode-maybe) + +;; Makefile +(setopt makefile-backslash-align nil) +(setopt makefile-cleanup-continuations t) + +(add-hook 'makefile-mode-hook + (defun makefile-stop-complaining () + (remove-hook 'write-file-functions + 'makefile-warn-suspicious-lines t) + (remove-hook 'write-file-functions + 'makefile-warn-continuations t))) + +;; Scheme -- CHICKEN +(setopt scheme-program-name (or (executable-find "csi"))) +(add-to-list 'auto-mode-alist '("\\.egg\\'" . scheme-mode)) + +;; Scheme Indentation +(defun scheme-module-indent (state indent-point normal-indent) 0) +(put 'module 'scheme-indent-function 'scheme-module-indent) +(put 'and-let* 'scheme-indent-function 1) +(put 'parameterize 'scheme-indent-function 1) +(put 'handle-exceptions 'scheme-indent-function 1) +(put 'when 'scheme-indent-function 1) +(put 'unless 'scheme-indent-function 1) +(put 'match 'scheme-indent-function 1) + +;; Geiser +(package-ensure 'geiser) +(package-ensure 'geiser-chicken) +(setopt geiser-mode-auto-p nil) +(setopt geiser-repl-history-filename "~/.emacs.d/geiser-history") +(setopt geiser-chicken-init-file "~/.csirc") +(add-hook 'scheme-mode-hook #'geiser-mode) +(add-hook 'geiser-repl-mode-hook #'electric-pair-local-mode) +(advice-add 'geiser-eval-region :after #'pulse@eval) + +;; VC +(add-hook 'vc-dir-mode-hook #'hl-line-mode) +(defun vc-jump () + (interactive) + (vc-dir default-directory)) +(keymap-global-set "C-x v j" #'vc-jump) + +;;; Compilation + +(setopt compilation-always-kill t) +(setopt compilation-ask-about-save nil) + +;;; Miscellaneous settings + +(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) +(add-hook 'prog-mode-hook #'auto-fill-mode) +(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) +(add-hook 'prog-mode-hook #'electric-pair-local-mode) +(delete-selection-mode) +(global-so-long-mode) +(setopt display-fill-column-indicator-character ?·) +(setopt disabled-command-function nil) +(setopt electric-pair-skip-whitespace 'chomp) +(setopt fill-column 80) +(setopt recenter-positions '(top middle bottom)) +(setopt show-paren-delay 0.01) +(setopt show-paren-style 'parenthesis) +(setopt show-paren-when-point-in-periphery t) +(setopt show-paren-when-point-inside-paren t) +(show-paren-mode) + +(with-eval-after-load 'ibuffer + (add-hook 'ibuffer-mode-hook #'hl-line-mode)) + +(with-eval-after-load 'proced + (add-hook 'proced-mode-hook #'hl-line-mode)) + +;;; RCIRC + +(setopt rcirc-kill-channel-buffers t) +(setopt rcirc-display-server-buffer nil) + +(defun run-rcirc () + (interactive) + (shell-command "chat up") + (call-interactively #'rcirc)) + +(add-hook 'rcirc-mode-hook + (defun @rcirc-mode () + (whitespace-mode -1))) + +(add-hook 'rcirc-mode-hook #'rcirc-track-minor-mode) +(add-hook 'rcirc-mode-hook #'rcirc-omit-mode) +(add-hook 'rcirc-mode-hook #'visual-line-mode) +(add-hook 'rcirc-mode-hook + (lambda () (whitespace-mode -1))) + +;;; Eshell + +(setopt eshell-prompt-function + (defun @eshell-prompt () + (concat "* " (abbreviate-file-name (eshell/pwd)) + (if (zerop (user-uid)) " # " " $ ")))) + +;;; Browsing + +;; Dired (files) +(with-eval-after-load 'dired + (setopt dired-dwim-target t) + (setopt dired-listing-switches "-alF") + (setopt dired-ls-F-marks-symlinks t) + (keymap-set dired-mode-map "C-j" #'dired-up-directory) + (add-hook 'dired-mode-hook #'hl-line-mode)) + +;; Elpher (gemini/gopher) +(package-ensure 'elpher) + +;; Browse-url (http) +(setopt browse-url-new-window-flag t) +(setopt browse-url-firefox-arguments '("--new-tab")) +(setopt browse-url-firefox-new-window-is-tab t) diff --git a/emacs.d/early-init.el b/emacs.d/early-init.el new file mode 100644 index 0000000..7e7c431 --- /dev/null +++ b/emacs.d/early-init.el @@ -0,0 +1,21 @@ +;;; ~/.emacs.d/early-init.el -*- lexical-binding: t -*- +;; Author: Case Duckworth + +(setopt frame-inhibit-implied-resize t) +(setopt frame-resize-pixelwise t) +(setopt window-resize-pixelwise t) +(setopt default-frame-alist + '((background-color . "alice blue") + (font . "Recursive Mono Casual Static 10") + (menu-bar-lines . 0) + (tool-bar-lines . 0) + (vertical-scroll-bars) + (horizontal-scroll-bars))) + +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(package-initialize) + +(setopt inhibit-startup-screen t) +(setopt initial-buffer-choice #'eshell) +(setopt initial-scratch-message nil) diff --git a/inputrc b/inputrc new file mode 100644 index 0000000..9c1fc09 --- /dev/null +++ b/inputrc @@ -0,0 +1,22 @@ +# ~/.inputrc -*- conf -*- + +# Include the system inputrc +$include /etc/inputrc + +# Emacs shell-like history navigation +"\ep": history-search-backward +"\en": history-search-forward + +# Global settings + +set mark-symlinked-directories on +set visible-stats on +set blink-matching-paren on + +set completion-ignore-case on +set completion-prefix-display-length 3 +set show-all-if-ambiguous on +set show-all-if-unmodified on + +set enable-bracketed-paste on + diff --git a/profile b/profile new file mode 100644 index 0000000..3625f86 --- /dev/null +++ b/profile @@ -0,0 +1,62 @@ +# ~/.profile -*- sh -*- + +. /etc/profile + +# History +mkdir -p ~/.history +export HISTFILE=~/.history/sh +export HISTSIZE=1000000000000 + +# Environment variables +export ENV="$HOME/.shrc" +export PATH="$HOME/bin:$PATH" +export LC_ALL=en_US.UTF-8 +export CDPATH=:~ +export SUDO=/usr/bin/doas +export EXINIT='set ai ic sm ts=8' +export MISC="$HOME/.misc" +export EDITOR="$(which ed)" +export VISUAL="$(which vi)" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}" + +export XDG_DESKTOP_DIR="$HOME/" +export XDG_DOCUMENTS_DIR="$HOME/doc" +export XDG_DOWNLOAD_DIR="$HOME/tmp" +export XDG_MUSIC_DIR="$HOME/music" +export XDG_PICTURES_DIR="$HOME/img" +export XDG_PUBLICSHARE_DIR="$HOME/.local/share/public" +export XDG_TEMPLATES_DIR="$HOME/.local/templates" +export XDG_VIDEOS_DIR="$HOME/video" + +if test -z "$XDG_RUNTIME_DIR" +then export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir +fi +if ! test -d "$XDG_RUNTIME_DIR" +then + mkdir "$XDG_RUNTIME_DIR" + chmod 0700 "$XDG_RUNTIME_DIR" +fi + +installedp() { which "$1" >/dev/null 2>&1; } + +# SSH +if installedp keychain +then eval $(keychain --quiet --eval --dir "$XDG_RUNTIME_DIR/" --agents ssh) +elif installedp ssh-agent +then eval $(ssh-agent -s) +fi + +# RLWRAP +if installedp rlwrap +then export RLWRAP_HOME=$XDG_DATA_HOME/rlwrap +fi + +# Start X on login +# if test /dev/tty1 = "$(tty)" && test -z "$DISPLAY" +# then startx +# fi diff --git a/shrc b/shrc new file mode 100644 index 0000000..8b23731 --- /dev/null +++ b/shrc @@ -0,0 +1,72 @@ +# ~/.shrc -*- sh -*- + +case $- in # only do these things in interactive shells + *i*) . ~/.profile ;; + *) return ;; +esac + +# Prompt +# smileycode() { +# case $? in +# (0) printf '\e[32m%s\e[0m' '^_^' ;; +# (*) printf '\e[31m%s\e[0m' ';_;' ;; +# esac +# } + +ecdollar() { + case $? in + (0) return ;; + (*) printf '*%s ' "$?" ;; + esac +} + +pwd_tilde() { + printf '%s' "$PWD" | sed 's,'"$HOME"',~,' +} + +case "$0" in + *ksh) + PS1=$'\1\r$(smileycode)\1 ' + PS1+=$'\1\e[34m\1$(pwd_tilde)\1\e[0m\1 ' + PS1+=$'$ ' + ;; + *) PS1='$(ecdollar)\$ \[\e[4m\]\w\[\e[0m\] > ' + ;; +esac + +# Aliases +alias ls='ls --color=none -F ' +alias ll='ls -Al' + +alias sudo=$SUDO +for cmd in shutdown reboot halt mount umount poweroff zzz ZZZ +do alias $cmd="$SUDO $cmd" +done + +# installedp is in ~/.profile +if installedp bc +then export BC_ENV_ARGS='-lq' +fi + +if installedp less +then export LESS='--mouse --RAW-CONTROL-CHARS' +fi + +if installedp apk +then + _apk() ( + apk=$(which apk) + case "$1" in + (add|del|update|upgrade) $SUDO "$apk" "$@" ;; + (*) "$apk" "$@" ;; + esac + ) + alias apk=_apk +fi + +if installedp rlwrap +then + for cmd in sbcl + do alias $cmd="rlwrap $cmd" + done +fi diff --git a/xautostart b/xautostart new file mode 100755 index 0000000..321101c --- /dev/null +++ b/xautostart @@ -0,0 +1,18 @@ +#!/bin/sh + +once() { + printf '%s ... ' "$*" + if pgrep -x "$1" + then + echo up + else + "$@" 2>&1 | + sed "s/.*/$1\t&/g" \ + >> ~/.local/share/xorg/autostart.log & + echo ok + fi +} + +once keepassxc +once nextcloud +once emacs --daemon diff --git a/xinitrc b/xinitrc new file mode 100644 index 0000000..508257c --- /dev/null +++ b/xinitrc @@ -0,0 +1,33 @@ +# Set up X.org +xrdb ~/.xresources +xmodmap ~/.xmodmap +#xsetroot -cursor_name left_ptr +xhost +SI:localhost:$USER + +# https://wiki.archlinux.org/title/Libinput and libinput(4) +touchpad_set(){ + # get 9 from xinput list, then run xinput list-props 9 + (sleep 2 && xinput set-prop 9 "$@") & +} +touchpad_set "libinput Natural Scrolling Enabled" 1 +touchpad_set "libinput Horizontal Scroll Enabled" 1 +touchpad_set "libinput Tapping Enabled" 1 +touchpad_set "libinput Tapping Drag Enabled" 1 +touchpad_set "libinput Tapping Drag Lock Enabled" 1 + +# Environment variables +export GTK_OVERLAY_SCROLLING=0 + +# Autostart +eval $(dbus-launch --sh-syntax --exit-with-x11) +/usr/libexec/pipewire-launcher & +brightnessctl set 40% +if test -x ~/.fehbg +then ~/.fehbg +else xsetroot -grey +fi + +keepassxc & + +# WM +exec dbus-run-session i3 diff --git a/xmodmap b/xmodmap new file mode 100644 index 0000000..970c277 --- /dev/null +++ b/xmodmap @@ -0,0 +1,8 @@ +! ~/.Xmodmap -*- conf-xdefaults-mode -*- + +! make Caps Lock the Menu key and Shift+CapsLock Caps Lock +clear lock +keycode 66 = Menu Caps_Lock NoSymbol NoSymbol + +! "natural" scrolling +pointer = 1 2 3 5 4 7 6 8 9 10 11 12 \ No newline at end of file diff --git a/xresources b/xresources new file mode 100644 index 0000000..8213fad --- /dev/null +++ b/xresources @@ -0,0 +1,48 @@ +!!! ~/.Xresources -*- conf-xdefaults -*- + +!!! XTerm + +! Many of these settings are pulled from +! https://aduros.com/blog/xterm-its-better-than-you-thought/ + +!! Sensible defaults +*.vt100.locale: false +*.vt100.utf8: true +*.vt100.scrollTtyOutput: false +*.vt100.scrollKey: true +*.vt100.bellIsUrgent: true +*.vt100.metaSendsEscape: true + +!! Styling +*.vt100.faceName: Recursive Mono Casual Static +*.vt100.boldMode: false +*.vt100.faceSize: 11 +*.vt100.internalBorder: 2 +*.borderWidth: 0 + +!! Keybinds +!XTerm.vt100.printerCommand: select-url +!XTerm.vt100.printAttributes: 0 +! C-S-c: copy to clipboard +! C-S-v: paste from clipboard +XTerm.vt100.translations: #override \n\ + Ctrl Shift C: copy-selection(CLIPBOARD) \n\ + Ctrl Shift V: insert-selection(CLIPBOARD) \n\ + Ctrl Shift H: set-altscreen(toggle) + +! Security +*allowFontOps: false + +!!! Fonts + +Xft.antialias: 1 +Xft.rgba: rgb +Xft.autohint: 0 +Xft.hinting: 1 +Xft.hintstyle: hintslight + +!!! Xclock +!XClock*width: 60 +!XClock*height: 60 +XClock*x: 0 +XClock*y: 0 \ No newline at end of file -- cgit 1.4.1-21-gabe81