about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-05-30 12:47:11 -0500
committerCase Duckworth2024-05-30 12:47:11 -0500
commit22bc1e1879da0d99e5e1d79b10742b8cc9fd0521 (patch)
treecd813c6d8bfeebe83901b2d749ce97f1231dd547
downloaddots-22bc1e1879da0d99e5e1d79b10742b8cc9fd0521.tar.gz
dots-22bc1e1879da0d99e5e1d79b10742b8cc9fd0521.zip
Initial commit
-rw-r--r--README31
-rw-r--r--bash_profile3
-rw-r--r--bashrc20
-rw-r--r--csirc36
-rwxr-xr-xdots.sh81
-rw-r--r--emacs647
-rw-r--r--emacs.d/early-init.el21
-rw-r--r--inputrc22
-rw-r--r--profile62
-rw-r--r--shrc72
-rwxr-xr-xxautostart18
-rw-r--r--xinitrc33
-rw-r--r--xmodmap8
-rw-r--r--xresources48
14 files changed, 1102 insertions, 0 deletions
diff --git a/README b/README new file mode 100644 index 0000000..5c229a7 --- /dev/null +++ b/README
@@ -0,0 +1,31 @@
1My dotfiles
2there are many like them
3but these ones are mine
4
5----------
6Installing
7----------
8
9- ./dots.sh
10
11see ./dots.sh -h for more details
12
13I don't remember what -d means.
14
15-----------
16What's here
17-----------
18
19- bash / shell stuff
20- emacs
21- x stuff
22- various other repl type stuff
23
24------
25TO ADD
26------
27
28- i3 config
29- msmtp config (must remove PII)
30- keepassxc ?? (can it do the two part config thing?)
31- ... ? \ 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 @@
1# ~/.bash_profile
2
3test -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 @@
1# ~/.bashrc
2
3test -f $HOME/.shrc && . $HOME/.shrc
4
5# History
6HISTFILESIZE=-1
7HISTSIZE=100000
8
9shopt -s histappend
10
11shopt -s histreedit
12shopt -s histverify
13
14HISTTIMEFORMAT="%FT%T%z"
15
16HISTCONTROL=erasedups
17HISTIGNORE='&:[ ]*'
18HISTIGNORE="$HISTIGNORE:ls:exit:cd"
19
20PROMPT_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 @@
1;;; ~/.csirc -*- scheme -*-
2
3(set! ##sys#notices-enabled #f)
4(import (chicken load))
5(load-verbose #f)
6(require-library chicken-doc)
7
8(let ()
9 (import (chicken format))
10 (import (chicken process-context))
11 (import (chicken process signal))
12 (unless (get-environment-variable "INSIDE_EMACS")
13 (import breadline)
14 (import breadline-scheme-completion)
15 (history-file (format "~a/.csi_history" (get-environment-variable "HOME")))
16 (stifle-history! 10000)
17 (completer-word-break-characters-set! "\"\'`;|()[] ")
18 (completer-set! scheme-completer)
19 (basic-quote-characters-set! "\"|")
20 (variable-bind! "blink-matching-paren" "on")
21 (paren-blink-timeout-set! 200000)
22 (let ((handler (signal-handler signal/int)))
23 (set-signal-handler! signal/int
24 (lambda (s)
25 (cleanup-after-signal!)
26 (reset-after-signal!)
27 (handler s))))
28 (on-exit reset-terminal!)
29 (current-input-port (make-readline-port))))
30
31;; (import (beaker system))
32;; (import (beaker egg info))
33
34(set! ##sys#notices-enabled #t)
35
36
diff --git a/dots.sh b/dots.sh new file mode 100755 index 0000000..5036e30 --- /dev/null +++ b/dots.sh
@@ -0,0 +1,81 @@
1#!/bin/sh
2
3QUIET=false
4NORUN=false
5FORCE=false
6DIR="$(dirname "$(realpath "$0")")"
7
8main() {
9 action=homify
10 while getopts hqnfdx OPT
11 do
12 case "$OPT" in
13 (h) usage; exit 0 ;;
14 (q) QUIET=true ;;
15 (n) NORUN=true ;;
16 (f) FORCE=true ;;
17 (d) action=dotify ;;
18 (x) set -x ;;
19 (*) usage; exit 1 ;;
20 esac
21 done
22 shift $((OPTIND - 1))
23 "$action" "$@"
24}
25
26usage() {
27 cat<<EOF
28Usage: $0 [-h] [-q] [-n] [-f] [-x] [-d] [FILE] [FIND_ARGS...]
29Flags:
30 -h Show this help and exit
31 -q Don't print what's happening
32 -n Just print what would happen
33 -f Force links (ln -f)
34 -x Trace program
35 -d Link from FILE to the dots dir
36 (Default: link from FILE to $HOME)
37 When linking to $HOME, add a dot at the front of FILE
38 When linking to dots, remove the dot from the front of FILE
39Parameters:
40 FILE File or directory to link.
41 If not given, link all the files in dots.
42 If not given along with '-d', ... I don't know what'll happen
43 FIND_ARGS
44 Extra arguments to pass to find.
45EOF
46}
47
48log() { $QUIET || echo >&2 "* $@"; }
49run() { log "$@"; $NORUN || "$@"; }
50
51mklink() { # mklink SOURCE DEST
52 # make hardlinks to DEST from SOURCE -- making directories
53 $NORUN || test -d "$(dirname "$2")" || run mkdir -p "$(dirname "$2")"
54 if ! test -f "$2"
55 then run ln "$1" "$2"
56 elif test -f "$2" && "$FORCE"
57 then run ln -f "$1" "$2"
58 else log "$2 exists: skipping"
59 fi
60}
61
62getfiles() {
63 d="$1"; shift
64 find "$d" -type f -a -not -name "$(basename "$0")" "$@"
65}
66
67homify() {
68 getfiles "$DIR" "$@" |
69 while read -r dot
70 do mklink "$dot" "$HOME/.${dot#$DIR/}"
71 done
72}
73
74dotify() {
75 getfiles "$@" |
76 while read -r file
77 do mklink "$file" "$DIR/${file#.}"
78 done
79}
80
81main "$@"
diff --git a/emacs b/emacs new file mode 100644 index 0000000..e1df5dc --- /dev/null +++ b/emacs
@@ -0,0 +1,647 @@
1;;; ~/.emacs -*- lexical-binding: t; -*-
2;; Author Case Duckworth <acdw@acdw.net>
3;; Bankruptcy: 12
4
5;;; Initialization -- see also ~/.emacs.d/early-init.el
6
7(setopt custom-file (locate-user-emacs-file "custom.el"))
8(load custom-file :no-error)
9
10(defvar private-file (locate-user-emacs-file "private.el")
11 "Private customizations")
12(load private-file :no-error) ; might as well do this now
13
14;; (load-theme 'modus-operandi :no-confirm)
15
16(define-advice startup-echo-area-message (:override ())
17 (if (get-buffer "*Warnings*")
18 ";_;"
19 "^_^"))
20
21(defun create-missing-directories ()
22 "Automatically create missing directories."
23 (let ((target-dir (file-name-directory buffer-file-name)))
24 (unless (file-exists-p target-dir)
25 (make-directory target-dir :parents))))
26
27(defun delete-trailing-whitespace-except-current-line ()
28 (save-excursion
29 (delete-trailing-whitespace (point-min)
30 (line-beginning-position))
31 (delete-trailing-whitespace (line-end-position)
32 (point-max))))
33
34(defun run-after-frame-init (func)
35 "Run FUNC after the first frame is initialized.
36If already so, run FUNC immediately."
37 (cond
38 ((daemonp)
39 (add-hook 'server-after-make-frame-hook func)
40 (advice-add func :after (lambda ()
41 (remove-hook 'server-after-make-frame-hook
42 func)
43 (advice-remove func
44 'after-frame-init-removing-advice))
45
46
47 '((name . after-frame-init-removing-advice))))
48 ((not after-init-time)
49 (add-hook 'after-init-hook func))
50 (:else (funcall func))))
51
52(defun first-found-font (&rest cands)
53 "Return the first font of CANDS that is installed, or nil."
54 (cl-loop with ffl = (font-family-list)
55 for font in cands
56 if (member font ffl)
57 return font))
58
59(defun setup-faces ()
60 "Setup Emacs faces."
61 (set-face-attribute 'variable-pitch nil
62 :family (first-found-font "Public Sans")
63 :height 1.0)
64 (set-face-attribute 'fixed-pitch-serif nil
65 :inherit 'default)
66
67 ;; Emojis
68 (cl-loop with ffl = (font-family-list)
69 for font in '("Noto Emoji" "Noto Color Emoji"
70 "Segoe UI Emoji" "Apple Color Emoji"
71 "FreeSans" "FreeMono" "FreeSerif"
72 "Unifont" "Symbola")
73 if (member font ffl)
74 do (set-fontset-font t 'symbol font))
75
76 ;; International fonts
77 (cl-loop with ffl = (font-family-list)
78 for (charset . font)
79 in '((latin . "Noto Sans")
80 (han . "Noto Sans CJK SC Regular")
81 (kana . "Noto Sans CJK JP Regular")
82 (hangul . "Noto Sans CJK KR Regular")
83 (cjk-misc . "Noto Sans CJK KR Regular")
84 (khmer . "Noto Sans Khmer")
85 (lao . "Noto Sans Lao")
86 (burmese . "Noto Sans Myanmar")
87 (thai . "Noto Sans Thai")
88 (ethiopic . "Noto Sans Ethiopic")
89 (hebrew . "Noto Sans Hebrew")
90 (arabic . "Noto Sans Arabic")
91 (gujarati . "Noto Sans Gujarati")
92 (devanagari . "Noto Sans Devanagari")
93 (kannada . "Noto Sans Kannada")
94 (malayalam . "Noto Sans Malayalam")
95 (oriya . "Noto Sans Oriya")
96 (sinhala . "Noto Sans Sinhala")
97 (tamil . "Noto Sans Tamil")
98 (telugu . "Noto Sans Telugu")
99 (tibetan . "Noto Sans Tibetan"))
100 if (member font ffl)
101 do (set-fontset-font t charset font)))
102
103(defun cancel-colors ()
104 (mapatoms
105 (lambda (atom)
106 (when (facep atom)
107 (set-face-attribute atom nil
108 :foreground 'unspecified
109 :background 'unspecified
110 :weight 'unspecified
111 :slant 'unspecified
112 :underline 'unspecified
113 :overline 'unspecified
114 :strike-through 'unspecified
115 :box 'unspecified
116 :inverse-video nil
117 :stipple nil
118 :extend nil)))))
119
120(defun set-faces (faces)
121 (dolist (face faces)
122 (apply #'set-face-attribute (car face) nil (cdr face))))
123
124(font-lock-mode -1)
125(cancel-colors)
126(run-after-frame-init
127 (defun uncancel-colors ()
128 (set-faces `((font-lock-comment-face :italic t)
129 (font-lock-comment-delimiter-face :italic t)
130 (font-lock-doc-face :italic t)
131 (font-lock-keyword-face :bold t)
132 (bold :bold t) (italic :italic t) (underline :underline t)
133 (mode-line-active :box t :background "light goldenrod")
134 (mode-line-inactive :box "pale goldenrod"
135 :background "pale goldenrod")
136 (link :foreground "navy" :underline t)
137 (completions-annotations :inherit 'italic)
138 (highlight :background "wheat")
139 (match :background "wheat")
140 (isearch :background "sea green" :foreground "white")
141 (isearch-fail :background "tomato")
142 (lazy-highlight :background "dark sea green")
143 (region :background "papaya whip")
144 (query-replace :background "wheat")
145 (shadow :foreground "orchid")
146 (show-paren-match :background "goldenrod")
147 (success :foreground "sea green" :italic t)
148 (warning :foreground "brown" :italic t)
149 (error :foreground "red" :italic t)
150 (trailing-whitespace :background "tomato")
151 (vertical-border :foreground "gray")
152 (completions-highlight :background "wheat")))))
153
154(defun recancel-colors ()
155 (interactive)
156 (cancel-colors)
157 (uncancel-colors))
158
159(defmacro inhibit-messages (&rest body)
160 "Inhibit all messages in BODY."
161 (declare (indent defun))
162 `(cl-letf (((symbol-function 'message) #'ignore))
163 ,@body))
164
165(defun kill-buffer-dwim (&optional buffer-or-name)
166 "Kill BUFFER-OR-NAME or the current buffer."
167 (interactive "P")
168 (cond
169 ((bufferp buffer-or-name)
170 (kill-buffer buffer-or-name))
171 ((null buffer-or-name)
172 (kill-current-buffer))
173 (:else
174 (kill-buffer (read-buffer "Kill: " nil :require-match)))))
175
176(defun other-window-dwim (&optional arg)
177 "Switch to another window/buffer.
178Calls `other-window', which see, unless
179- the current window is alone on its frame
180- `other-window-dwim' is called with \\[universal-argument]
181In these cases, switch to the last-used buffer."
182 (interactive "P")
183 (if (or arg (one-window-p))
184 (switch-to-buffer (other-buffer) nil t)
185 (other-window 1)))
186
187(defun delete-window-dwim ()
188 "Delete the current window or bury its buffer.
189If the current window is alone in its frame, bury the buffer
190instead."
191 (interactive)
192 (unless (ignore-errors (delete-window) t)
193 (bury-buffer)))
194
195(defun cycle-spacing* (&optional n)
196 "Negate N argument on `cycle-spacing'."
197 (interactive "*p")
198 (cycle-spacing (- n)))
199
200(defun find-user-init-file (&optional arg)
201 "Edit `user-init-file' in current window.
202With ARG, edit in other window."
203 (interactive "P")
204 (funcall (if arg #'find-file-other-window #'find-file)
205 user-init-file))
206
207(defun find-user-private-file (&optional arg)
208 "Edit `private-file'.
209With ARG, edit in other window."
210 (interactive "P")
211 (funcall (if arg #'find-file-other-window #'find-file)
212 private-file))
213
214(defun package-ensure (pkg)
215 "Install PKG if it's not already installed."
216 (unless (package-installed-p pkg)
217 (package-install pkg)))
218
219;;; Basic settings
220
221(tooltip-mode -1)
222
223;; Dialogs
224(setopt use-dialog-box nil)
225(setopt use-file-dialog nil)
226(setopt read-answer-short t)
227(setopt use-short-answers t)
228(setopt echo-keystrokes 0.01)
229
230;; Cursor
231(blink-cursor-mode -1)
232
233;; Fonts
234(setopt x-underline-at-descent-line t)
235(run-after-frame-init #'setup-faces)
236
237;;; Look and feel
238
239;; Whitespace
240(setopt whitespace-style '(face trailing tabs tab-mark))
241(global-whitespace-mode)
242(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line)
243(set-face-attribute 'whitespace-tab nil :background nil :foreground "#888")
244(setf (alist-get 'tab-mark whitespace-display-mappings)
245 '(9 [?· 9] [?» 9] [?\\ 9]))
246
247;;; Completions
248
249(setopt tab-always-indent 'complete)
250(setopt completion-styles '(basic partial-completion substring flex))
251
252(setopt completion-ignore-case t)
253(setopt read-buffer-completion-ignore-case t)
254(setopt read-file-name-completion-ignore-case t)
255(setopt completion-flex-nospace t)
256
257(setopt completion-show-help nil)
258(setopt completions-detailed t)
259(setopt completions-group t)
260(setopt completion-auto-help 'visible)
261(setopt completion-auto-select 'second-tab)
262(setopt completions-header-format nil)
263(setopt completions-format 'one-column)
264(setopt completions-max-height 10)
265
266(keymap-set minibuffer-local-map "C-p" #'minibuffer-previous-completion)
267(keymap-set minibuffer-local-map "C-n" #'minibuffer-next-completion)
268
269(setopt enable-recursive-minibuffers t)
270(setopt minibuffer-default-prompt-format " [%s]")
271(minibuffer-depth-indicate-mode)
272(minibuffer-electric-default-mode)
273
274(setopt file-name-shadow-properties '(invisible t intangible t))
275(file-name-shadow-mode)
276
277(setopt history-length t)
278(setopt history-delete-duplicates t)
279(setopt savehist-save-minibuffer-history t)
280(setopt savehist-autosave-interval 5)
281(savehist-mode)
282
283(define-minor-mode truncate-lines-local-mode
284 "Toggle `truncate-lines' in the current buffer."
285 :lighter ""
286 (setq-local truncate-lines truncate-lines-local-mode))
287
288(add-hook 'completion-list-mode-hook #'truncate-lines-local-mode)
289(add-hook 'minibuffer-setup-hook #'truncate-lines-local-mode)
290
291;; Consult/Marginalia
292
293(package-ensure 'consult)
294(require 'consult)
295(keymap-global-set "C-x b" #'consult-buffer)
296(keymap-global-set "C-x 4 b" #'consult-buffer-other-window)
297(keymap-global-set "C-x 5 b" #'consult-buffer-other-frame)
298(keymap-global-set "C-x r b" #'consult-bookmark)
299(keymap-global-set "M-y" #'consult-yank-pop)
300(keymap-global-set "M-g g" #'consult-goto-line)
301(keymap-global-set "M-g M-g" #'consult-goto-line)
302(keymap-global-set "M-g o" #'consult-outline)
303(keymap-global-set "M-g m" #'consult-mark)
304(keymap-global-set "M-g i" #'consult-imenu)
305(keymap-global-set "M-s d" #'consult-find)
306(keymap-global-set "M-s D" #'consult-locate)
307(keymap-global-set "M-s l" #'consult-line)
308(keymap-global-set "M-s k" #'consult-keep-lines)
309(keymap-global-set "M-s u" #'consult-focus-lines)
310(keymap-global-set "M-s e" #'consult-isearch-history)
311(keymap-set isearch-mode-map "M-e" #'consult-isearch-history)
312(keymap-set isearch-mode-map "M-s e" #'consult-isearch-history)
313(keymap-set isearch-mode-map "M-s l" #'consult-line)
314(setopt xref-show-xrefs-function #'consult-xref)
315(setopt xref-show-definitions-function
316 #'xref-show-definitions-completing-read)
317(setopt consult-preview-key "M-.")
318
319(package-ensure 'marginalia)
320(marginalia-mode)
321
322;;; Files
323
324(setopt auto-revert-verbose nil)
325(setopt global-auto-revert-non-file-buffers t)
326(global-auto-revert-mode)
327
328(setopt create-lockfiles nil)
329(setopt mode-require-final-newline t)
330(setopt view-read-only t)
331(setopt save-silently t)
332(setopt delete-by-moving-to-trash t)
333(setopt auto-save-default nil)
334(setopt auto-save-no-message t)
335(setopt auto-save-interval 2)
336(setopt auto-save-timeout 2)
337(setopt auto-save-visited-interval 2)
338(setopt remote-file-name-inhibit-auto-save t)
339(setopt remote-file-name-inhibit-auto-save-visited t)
340(add-to-list 'auto-save-file-name-transforms
341 `(".*" ,(locate-user-emacs-file "auto-save/") t))
342(auto-save-visited-mode)
343
344(setopt backup-by-copying t)
345(setopt version-control t)
346(setopt kept-new-versions 3)
347(setopt kept-old-versions 3)
348(setopt delete-old-versions t)
349(add-to-list 'backup-directory-alist '("^/dev/shm/" . nil))
350(add-to-list 'backup-directory-alist '("^/tmp/" . nil))
351(when-let ((xrd (getenv "XDG_RUNTIME_DIR")))
352 (add-to-list 'backup-directory-alist (cons xrd nil)))
353(add-to-list 'backup-directory-alist
354 (cons "." (locate-user-emacs-file "backup/"))
355 :append)
356
357(setopt recentf-max-menu-items 100)
358(setopt recentf-max-saved-items nil)
359(setopt recentf-case-fold-search t)
360(with-eval-after-load 'recentf
361 (add-to-list 'recentf-exclude "-autoloads.el\\'"))
362(add-hook 'buffer-list-update-hook #'recentf-track-opened-file)
363(add-hook 'after-save-hook #'recentf-save-list)
364(recentf-mode)
365
366(setopt save-place-forget-unreadable-files (eq system-type 'gnu/linux))
367(save-place-mode)
368
369(add-hook 'find-file-not-found-functions #'create-missing-directories)
370
371;;; Buffers
372
373(setopt uniquify-buffer-name-style 'forward)
374
375;; Encodings
376(set-language-environment "UTF-8")
377(setopt buffer-file-coding-system 'utf-8-unix)
378(setopt coding-system-for-read 'utf-8-unix)
379(setopt coding-system-for-write 'utf-8-unix)
380(setopt default-process-coding-system '(utf-8-unix . utf-8-unix))
381(setopt locale-coding-system 'utf-8-unix)
382(set-charset-priority 'unicode)
383(prefer-coding-system 'utf-8-unix)
384(set-default-coding-systems 'utf-8-unix)
385(set-terminal-coding-system 'utf-8-unix)
386(set-keyboard-coding-system 'utf-8-unix)
387(pcase system-type
388 ((or 'ms-dos 'windows-nt)
389 (set-clipboard-coding-system 'utf-16-le)
390 (set-selection-coding-system 'utf-16-le))
391 (_
392 (set-selection-coding-system 'utf-8)
393 (set-clipboard-coding-system 'utf-8)))
394
395;;; Search
396
397(setopt isearch-lazy-count t)
398(setopt isearch-regexp-lax-whitespace t)
399(setopt isearch-wrap-pause 'no)
400(setopt search-default-mode t)
401(setopt search-whitespace-regexp ".*?") ; swiper-style
402(setopt search-ring-max 256)
403(setopt regexp-search-ring-max 256)
404
405(define-advice isearch-cancel (:before () add-to-history)
406 "Add search string to history when canceling isearch."
407 (unless (string-equal "" isearch-string)
408 (isearch-update-ring isearch-string isearch-regexp)))
409
410(package-ensure 'isearch-mb)
411(with-eval-after-load 'isearch-mb
412 (with-eval-after-load 'consult
413 (add-to-list 'isearch-mb--with-buffer #'consult-isearch-history)
414 (keymap-set isearch-mb-minibuffer-map "M-r" #'consult-isearch-history)
415 (add-to-list 'isearch-mb--after-exit #'consult-line)
416 (keymap-set isearch-mb-minibuffer-map "M-s l" #'consult-line)))
417(isearch-mb-mode)
418
419;;; Keybinds
420
421(keymap-global-set "C-x C-c" #'save-buffers-kill-terminal)
422(keymap-global-set "C-x C-k" #'kill-buffer-dwim)
423(keymap-global-set "M-o" #'other-window-dwim)
424(keymap-global-set "C-x o" #'other-window-dwim)
425(keymap-global-set "C-x 0" #'delete-window-dwim)
426(keymap-global-set "M-SPC" #'cycle-spacing*)
427(keymap-global-set "C-x C-b" #'ibuffer)
428(keymap-global-set "M-/" #'hippie-expand)
429(keymap-global-set "M-u" #'universal-argument)
430(keymap-set universal-argument-map "M-u" #'universal-argument-more)
431(keymap-global-set "C-c i" #'find-user-init-file)
432(keymap-global-set "C-c p" #'find-user-private-file)
433(keymap-global-set "C-c s" #'eshell)
434
435(keymap-global-set "C-c t"
436 (defun insert-current-iso8601 ()
437 (interactive)
438 (insert (format-time-string "%FT%TZ" (current-time) t))))
439
440(keymap-global-set "C-M-\\"
441 (defun indent-buffer ()
442 (interactive)
443 (save-mark-and-excursion
444 (indent-region (point-min) (point-max)))))
445
446;; Un-keybinds
447(keymap-global-unset "C-<wheel-down>" t)
448(keymap-global-unset "C-<wheel-up>" t)
449;; I only ever fat-finger this key and never want to change encoding
450(keymap-global-unset "C-\\" t)
451(keymap-global-unset "C-z" t)
452
453;; Key settings
454(setopt set-mark-command-repeat-pop t)
455
456;;; Writing
457
458(add-hook 'text-mode-hook #'visual-line-mode)
459
460;;; Hungry delete
461;; I was using the hungry-delete package, but it turns out I can get *most* of
462;; the features with just these functions.
463
464(defun %hungry-delete (skip-fn del-key)
465 (let ((here (point)))
466 (funcall skip-fn " \t")
467 (if (or (= (point) here)
468 (apply 'derived-mode-p
469 '(eshell-mode ; add other modes to skip here.
470 nim-mode
471 pyton-mode)))
472 (call-interactively (keymap-lookup (list (current-local-map)
473 (current-global-map))
474 del-key))
475 (delete-region (point) here))))
476
477(defun hungry-delete-forward ()
478 "Delete forward, hungrily."
479 (interactive)
480 (%hungry-delete #'skip-chars-forward "C-d"))
481
482(defun hungry-delete-backward ()
483 "Delete backward, hungrily."
484 (interactive)
485 (%hungry-delete #'skip-chars-backward "DEL"))
486
487(define-minor-mode hungry-delete-mode
488 "Hungrily delete stuff."
489 :global t
490 :lighter " h"
491 :keymap (define-keymap
492 "DEL" #'hungry-delete-backward
493 "C-d" #'hungry-delete-forward))
494
495(hungry-delete-mode)
496
497;;; Programming
498
499(add-hook 'prog-mode-hook #'electric-pair-local-mode)
500(setopt tab-width 8)
501(setopt sh-basic-offset tab-width)
502(setopt perl-indent-level tab-width)
503(setopt c-basic-offset tab-width)
504
505;; Elisp
506(defun pulse@eval (start end &rest _)
507 (pulse-momentary-highlight-region start end))
508
509(keymap-set emacs-lisp-mode-map "C-c C-c" #'eval-defun)
510(keymap-set emacs-lisp-mode-map "C-c C-b"
511 (defun eval-buffer@pulse () (interactive)
512 (eval-buffer)
513 (pulse@eval (point-min) (point-max))))
514(advice-add 'eval-region :after #'pulse@eval)
515
516(defvar space-indent-modes '(emacs-lisp-mode
517 lisp-interaction-mode
518 lisp-mode
519 scheme-mode
520 python-mode
521 haskell-mode
522 text-mode
523 web-mode
524 css-mode)
525 "Modes to indent with spaces, not tabs.")
526
527(defun indent-tabs-mode-maybe ()
528 (setq indent-tabs-mode
529 (if (apply #'derived-mode-p space-indent-modes) nil t)))
530(add-hook 'prog-mode-hook #'indent-tabs-mode-maybe)
531
532;; Makefile
533(setopt makefile-backslash-align nil)
534(setopt makefile-cleanup-continuations t)
535
536(add-hook 'makefile-mode-hook
537 (defun makefile-stop-complaining ()
538 (remove-hook 'write-file-functions
539 'makefile-warn-suspicious-lines t)
540 (remove-hook 'write-file-functions
541 'makefile-warn-continuations t)))
542
543;; Scheme -- CHICKEN
544(setopt scheme-program-name (or (executable-find "csi")))
545(add-to-list 'auto-mode-alist '("\\.egg\\'" . scheme-mode))
546
547;; Scheme Indentation
548(defun scheme-module-indent (state indent-point normal-indent) 0)
549(put 'module 'scheme-indent-function 'scheme-module-indent)
550(put 'and-let* 'scheme-indent-function 1)
551(put 'parameterize 'scheme-indent-function 1)
552(put 'handle-exceptions 'scheme-indent-function 1)
553(put 'when 'scheme-indent-function 1)
554(put 'unless 'scheme-indent-function 1)
555(put 'match 'scheme-indent-function 1)
556
557;; Geiser
558(package-ensure 'geiser)
559(package-ensure 'geiser-chicken)
560(setopt geiser-mode-auto-p nil)
561(setopt geiser-repl-history-filename "~/.emacs.d/geiser-history")
562(setopt geiser-chicken-init-file "~/.csirc")
563(add-hook 'scheme-mode-hook #'geiser-mode)
564(add-hook 'geiser-repl-mode-hook #'electric-pair-local-mode)
565(advice-add 'geiser-eval-region :after #'pulse@eval)
566
567;; VC
568(add-hook 'vc-dir-mode-hook #'hl-line-mode)
569(defun vc-jump ()
570 (interactive)
571 (vc-dir default-directory))
572(keymap-global-set "C-x v j" #'vc-jump)
573
574;;; Compilation
575
576(setopt compilation-always-kill t)
577(setopt compilation-ask-about-save nil)
578
579;;; Miscellaneous settings
580
581(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
582(add-hook 'prog-mode-hook #'auto-fill-mode)
583(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
584(add-hook 'prog-mode-hook #'electric-pair-local-mode)
585(delete-selection-mode)
586(global-so-long-mode)
587(setopt display-fill-column-indicator-character ?·)
588(setopt disabled-command-function nil)
589(setopt electric-pair-skip-whitespace 'chomp)
590(setopt fill-column 80)
591(setopt recenter-positions '(top middle bottom))
592(setopt show-paren-delay 0.01)
593(setopt show-paren-style 'parenthesis)
594(setopt show-paren-when-point-in-periphery t)
595(setopt show-paren-when-point-inside-paren t)
596(show-paren-mode)
597
598(with-eval-after-load 'ibuffer
599 (add-hook 'ibuffer-mode-hook #'hl-line-mode))
600
601(with-eval-after-load 'proced
602 (add-hook 'proced-mode-hook #'hl-line-mode))
603
604;;; RCIRC
605
606(setopt rcirc-kill-channel-buffers t)
607(setopt rcirc-display-server-buffer nil)
608
609(defun run-rcirc ()
610 (interactive)
611 (shell-command "chat up")
612 (call-interactively #'rcirc))
613
614(add-hook 'rcirc-mode-hook
615 (defun @rcirc-mode ()
616 (whitespace-mode -1)))
617
618(add-hook 'rcirc-mode-hook #'rcirc-track-minor-mode)
619(add-hook 'rcirc-mode-hook #'rcirc-omit-mode)
620(add-hook 'rcirc-mode-hook #'visual-line-mode)
621(add-hook 'rcirc-mode-hook
622 (lambda () (whitespace-mode -1)))
623
624;;; Eshell
625
626(setopt eshell-prompt-function
627 (defun @eshell-prompt ()
628 (concat "* " (abbreviate-file-name (eshell/pwd))
629 (if (zerop (user-uid)) " # " " $ "))))
630
631;;; Browsing
632
633;; Dired (files)
634(with-eval-after-load 'dired
635 (setopt dired-dwim-target t)
636 (setopt dired-listing-switches "-alF")
637 (setopt dired-ls-F-marks-symlinks t)
638 (keymap-set dired-mode-map "C-j" #'dired-up-directory)
639 (add-hook 'dired-mode-hook #'hl-line-mode))
640
641;; Elpher (gemini/gopher)
642(package-ensure 'elpher)
643
644;; Browse-url (http)
645(setopt browse-url-new-window-flag t)
646(setopt browse-url-firefox-arguments '("--new-tab"))
647(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 @@
1;;; ~/.emacs.d/early-init.el -*- lexical-binding: t -*-
2;; Author: Case Duckworth <acdw@acdw.net>
3
4(setopt frame-inhibit-implied-resize t)
5(setopt frame-resize-pixelwise t)
6(setopt window-resize-pixelwise t)
7(setopt default-frame-alist
8 '((background-color . "alice blue")
9 (font . "Recursive Mono Casual Static 10")
10 (menu-bar-lines . 0)
11 (tool-bar-lines . 0)
12 (vertical-scroll-bars)
13 (horizontal-scroll-bars)))
14
15(require 'package)
16(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
17(package-initialize)
18
19(setopt inhibit-startup-screen t)
20(setopt initial-buffer-choice #'eshell)
21(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 @@
1# ~/.inputrc -*- conf -*-
2
3# Include the system inputrc
4$include /etc/inputrc
5
6# Emacs shell-like history navigation
7"\ep": history-search-backward
8"\en": history-search-forward
9
10# Global settings
11
12set mark-symlinked-directories on
13set visible-stats on
14set blink-matching-paren on
15
16set completion-ignore-case on
17set completion-prefix-display-length 3
18set show-all-if-ambiguous on
19set show-all-if-unmodified on
20
21set enable-bracketed-paste on
22
diff --git a/profile b/profile new file mode 100644 index 0000000..3625f86 --- /dev/null +++ b/profile
@@ -0,0 +1,62 @@
1# ~/.profile -*- sh -*-
2
3. /etc/profile
4
5# History
6mkdir -p ~/.history
7export HISTFILE=~/.history/sh
8export HISTSIZE=1000000000000
9
10# Environment variables
11export ENV="$HOME/.shrc"
12export PATH="$HOME/bin:$PATH"
13export LC_ALL=en_US.UTF-8
14export CDPATH=:~
15export SUDO=/usr/bin/doas
16export EXINIT='set ai ic sm ts=8'
17export MISC="$HOME/.misc"
18export EDITOR="$(which ed)"
19export VISUAL="$(which vi)"
20
21export XDG_CONFIG_HOME="$HOME/.config"
22export XDG_CACHE_HOME="$HOME/.cache"
23export XDG_DATA_HOME="$HOME/.local/share"
24export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
25export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}"
26
27export XDG_DESKTOP_DIR="$HOME/"
28export XDG_DOCUMENTS_DIR="$HOME/doc"
29export XDG_DOWNLOAD_DIR="$HOME/tmp"
30export XDG_MUSIC_DIR="$HOME/music"
31export XDG_PICTURES_DIR="$HOME/img"
32export XDG_PUBLICSHARE_DIR="$HOME/.local/share/public"
33export XDG_TEMPLATES_DIR="$HOME/.local/templates"
34export XDG_VIDEOS_DIR="$HOME/video"
35
36if test -z "$XDG_RUNTIME_DIR"
37then export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir
38fi
39if ! test -d "$XDG_RUNTIME_DIR"
40then
41 mkdir "$XDG_RUNTIME_DIR"
42 chmod 0700 "$XDG_RUNTIME_DIR"
43fi
44
45installedp() { which "$1" >/dev/null 2>&1; }
46
47# SSH
48if installedp keychain
49then eval $(keychain --quiet --eval --dir "$XDG_RUNTIME_DIR/" --agents ssh)
50elif installedp ssh-agent
51then eval $(ssh-agent -s)
52fi
53
54# RLWRAP
55if installedp rlwrap
56then export RLWRAP_HOME=$XDG_DATA_HOME/rlwrap
57fi
58
59# Start X on login
60# if test /dev/tty1 = "$(tty)" && test -z "$DISPLAY"
61# then startx
62# fi
diff --git a/shrc b/shrc new file mode 100644 index 0000000..8b23731 --- /dev/null +++ b/shrc
@@ -0,0 +1,72 @@
1# ~/.shrc -*- sh -*-
2
3case $- in # only do these things in interactive shells
4 *i*) . ~/.profile ;;
5 *) return ;;
6esac
7
8# Prompt
9# smileycode() {
10# case $? in
11# (0) printf '\e[32m%s\e[0m' '^_^' ;;
12# (*) printf '\e[31m%s\e[0m' ';_;' ;;
13# esac
14# }
15
16ecdollar() {
17 case $? in
18 (0) return ;;
19 (*) printf '*%s ' "$?" ;;
20 esac
21}
22
23pwd_tilde() {
24 printf '%s' "$PWD" | sed 's,'"$HOME"',~,'
25}
26
27case "$0" in
28 *ksh)
29 PS1=$'\1\r$(smileycode)\1 '
30 PS1+=$'\1\e[34m\1$(pwd_tilde)\1\e[0m\1 '
31 PS1+=$'$ '
32 ;;
33 *) PS1='$(ecdollar)\$ \[\e[4m\]\w\[\e[0m\] > '
34 ;;
35esac
36
37# Aliases
38alias ls='ls --color=none -F '
39alias ll='ls -Al'
40
41alias sudo=$SUDO
42for cmd in shutdown reboot halt mount umount poweroff zzz ZZZ
43do alias $cmd="$SUDO $cmd"
44done
45
46# installedp is in ~/.profile
47if installedp bc
48then export BC_ENV_ARGS='-lq'
49fi
50
51if installedp less
52then export LESS='--mouse --RAW-CONTROL-CHARS'
53fi
54
55if installedp apk
56then
57 _apk() (
58 apk=$(which apk)
59 case "$1" in
60 (add|del|update|upgrade) $SUDO "$apk" "$@" ;;
61 (*) "$apk" "$@" ;;
62 esac
63 )
64 alias apk=_apk
65fi
66
67if installedp rlwrap
68then
69 for cmd in sbcl
70 do alias $cmd="rlwrap $cmd"
71 done
72fi
diff --git a/xautostart b/xautostart new file mode 100755 index 0000000..321101c --- /dev/null +++ b/xautostart
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3once() {
4 printf '%s ... ' "$*"
5 if pgrep -x "$1"
6 then
7 echo up
8 else
9 "$@" 2>&1 |
10 sed "s/.*/$1\t&/g" \
11 >> ~/.local/share/xorg/autostart.log &
12 echo ok
13 fi
14}
15
16once keepassxc
17once nextcloud
18once emacs --daemon
diff --git a/xinitrc b/xinitrc new file mode 100644 index 0000000..508257c --- /dev/null +++ b/xinitrc
@@ -0,0 +1,33 @@
1# Set up X.org
2xrdb ~/.xresources
3xmodmap ~/.xmodmap
4#xsetroot -cursor_name left_ptr
5xhost +SI:localhost:$USER
6
7# https://wiki.archlinux.org/title/Libinput and libinput(4)
8touchpad_set(){
9 # get 9 from xinput list, then run xinput list-props 9
10 (sleep 2 && xinput set-prop 9 "$@") &
11}
12touchpad_set "libinput Natural Scrolling Enabled" 1
13touchpad_set "libinput Horizontal Scroll Enabled" 1
14touchpad_set "libinput Tapping Enabled" 1
15touchpad_set "libinput Tapping Drag Enabled" 1
16touchpad_set "libinput Tapping Drag Lock Enabled" 1
17
18# Environment variables
19export GTK_OVERLAY_SCROLLING=0
20
21# Autostart
22eval $(dbus-launch --sh-syntax --exit-with-x11)
23/usr/libexec/pipewire-launcher &
24brightnessctl set 40%
25if test -x ~/.fehbg
26then ~/.fehbg
27else xsetroot -grey
28fi
29
30keepassxc &
31
32# WM
33exec 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 @@
1! ~/.Xmodmap -*- conf-xdefaults-mode -*-
2
3! make Caps Lock the Menu key and Shift+CapsLock Caps Lock
4clear lock
5keycode 66 = Menu Caps_Lock NoSymbol NoSymbol
6
7! "natural" scrolling
8pointer = 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 @@
1!!! ~/.Xresources -*- conf-xdefaults -*-
2
3!!! XTerm
4
5! Many of these settings are pulled from
6! https://aduros.com/blog/xterm-its-better-than-you-thought/
7
8!! Sensible defaults
9*.vt100.locale: false
10*.vt100.utf8: true
11*.vt100.scrollTtyOutput: false
12*.vt100.scrollKey: true
13*.vt100.bellIsUrgent: true
14*.vt100.metaSendsEscape: true
15
16!! Styling
17*.vt100.faceName: Recursive Mono Casual Static
18*.vt100.boldMode: false
19*.vt100.faceSize: 11
20*.vt100.internalBorder: 2
21*.borderWidth: 0
22
23!! Keybinds
24!XTerm.vt100.printerCommand: select-url
25!XTerm.vt100.printAttributes: 0
26! C-S-c: copy to clipboard
27! C-S-v: paste from clipboard
28XTerm.vt100.translations: #override \n\
29 Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
30 Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
31 Ctrl Shift <Key>H: set-altscreen(toggle)
32
33! Security
34*allowFontOps: false
35
36!!! Fonts
37
38Xft.antialias: 1
39Xft.rgba: rgb
40Xft.autohint: 0
41Xft.hinting: 1
42Xft.hintstyle: hintslight
43
44!!! Xclock
45!XClock*width: 60
46!XClock*height: 60
47XClock*x: 0
48XClock*y: 0 \ No newline at end of file