summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Taylor <mitch@mitchtaylor.xyz>2026-03-23 13:53:06 -0300
committerMitch Taylor <mitch@mitchtaylor.xyz>2026-03-23 13:53:06 -0300
commit41ba51ef22074fadc6e1aa14c217d99456e6ee8e (patch)
treed053d89c6f2f5a0263b7c962c47395ba42b8aeb1
parentca302c7e4673f668e82547d2d1ef9afed5ec8c79 (diff)
sway autostart + emacs
-rw-r--r--files/emacs/.emacs.d/post-init.el81
-rw-r--r--home.scm15
-rw-r--r--system.scm7
3 files changed, 90 insertions, 13 deletions
diff --git a/files/emacs/.emacs.d/post-init.el b/files/emacs/.emacs.d/post-init.el
index ebd061c..edb6dad 100644
--- a/files/emacs/.emacs.d/post-init.el
+++ b/files/emacs/.emacs.d/post-init.el
@@ -7,6 +7,87 @@
(require 'auth-source-pass)
(auth-source-pass-enable)
+(use-package abbrev
+ :ensure nil
+ :custom
+ (save-abbrevs nil)
+ :config
+ (defun emacs-solo/abbrev--replace-placeholders ()
+ "Replace placeholders ###1###, ###2###, ... with minibuffer input.
+If ###@### is found, remove it and place point there at the end."
+ (let ((cursor-pos nil))
+ (save-excursion
+ (goto-char (point-min))
+ (let ((loop 0)
+ (values (make-hash-table :test 'equal)))
+ (while (re-search-forward "###\\([0-9]+\\|@\\)###" nil t)
+ (setq loop (1+ loop))
+ (let* ((index (match-string 1))
+ (start (match-beginning 0))
+ (end (match-end 0)))
+ (cond
+ ((string= index "@")
+ (setq cursor-pos start)
+ (delete-region start end))
+ (t
+ (let* ((key (format "###%s###" index))
+ (val (or (gethash key values)
+ (let ((input (read-string (format "Value for %s: " key))))
+ (puthash key input values)
+ input))))
+ (goto-char start)
+ (delete-region start end)
+ (insert val)
+ (goto-char (+ start (length val))))))))))
+ (when cursor-pos
+ (goto-char cursor-pos))))
+
+ (define-abbrev-table 'global-abbrev-table
+ '(;; Arrows
+ ("ra" "→")
+ ("la" "←")
+ ("ua" "↑")
+ ("da" "↓")
+
+ ;; HTML entities
+ ("nb" "&nbsp;")
+ ("lt" "&lt;")
+ ("gt" "&gt;")
+
+ ;; Markdown
+ ("cb" "```@\n\n```"
+ (lambda () (search-backward "@") (delete-char 1)))
+
+ ;; ORG
+ ("ocb" "#+BEGIN_SRC @\n\n#+END_SRC"
+ (lambda () (search-backward "@") (delete-char 1)))
+ ("oheader" "#+TITLE: ###1###\n#+AUTHOR: ###2###\n#+EMAIL: ###3###\n#+OPTIONS: toc:nil\n"
+ emacs-solo/abbrev--replace-placeholders)
+
+ ;; JS/TS snippets
+ ("imp" "import { ###1### } from '###2###';"
+ emacs-solo/abbrev--replace-placeholders)
+ ("fn" "function ###1### () {\n ###@### ;\n};"
+ emacs-solo/abbrev--replace-placeholders)
+ ("clog" "console.log(\">>> LOG:\", { ###@### })"
+ emacs-solo/abbrev--replace-placeholders)
+ ("cwarn" "console.warn(\">>> WARN:\", { ###@### })"
+ emacs-solo/abbrev--replace-placeholders)
+ ("cerr" "console.error(\">>> ERR:\", { ###@### })"
+ emacs-solo/abbrev--replace-placeholders)
+ ("afn" "async function() {\n \n}"
+ (lambda () (search-backward "}") (forward-line -1) (end-of-line)))
+ ("ife" "(function() {\n \n})();"
+ (lambda () (search-backward ")();") (forward-line -1) (end-of-line)))
+ ("esdeps" "// eslint-disable-next-line react-hooks/exhaustive-deps"
+ (lambda () (search-backward ")();") (forward-line -1) (end-of-line)))
+ ("eshooks" "// eslint-disable-next-line react-hooks/rules-of-hooks"
+ (lambda () (search-backward ")();") (forward-line -1) (end-of-line)))
+
+ ;; React/JSX
+ ("rfc" "const ###1### = () => {\n return (\n <div>###2###</div>\n );\n};"
+ emacs-solo/abbrev--replace-placeholders))))
+
(setopt tab-always-indent 'complete
read-buffer-completion-ignore-case t
read-file-name-completion-ignore-case t
diff --git a/home.scm b/home.scm
index d6d1d26..65fc487 100644
--- a/home.scm
+++ b/home.scm
@@ -72,6 +72,8 @@
"alsa-utils"
"pavucontrol"
+ "crawl"
+
"gimp"
"zathura"
@@ -97,19 +99,18 @@
(services
(append
(list
- ;; Uncomment the shell you wish to use for your user:
- ;(service home-fish-service-type)
(service home-bash-service-type)
(simple-service 'custom-bash-service
home-bash-service-type
(home-bash-extension
- (variables
- '(("PS1" . "\\u \\wλ ")))
- (aliases
- '(("dbus-sway" . "exec dbus-run-session -- sway")))
(bash-profile
- `(,(local-file "/home/mitch/.guix-home/profile/etc/profile.d/flatpak.sh")))))
+ `(,(local-file "/home/mitch/.guix-home/profile/etc/profile.d/flatpak.sh")
+ ,(plain-file "bash-sway-login"
+ (string-append
+ "if [ -z \"$WAYLAND_DISPLAY\" ] && [ \"$XDG_VTNR\" -eq 1 ]; then\n"
+ " exec dbus-run-session -- sway\n"
+ "fi\n"))))))
(service home-dotfiles-service-type
(home-dotfiles-configuration
diff --git a/system.scm b/system.scm
index 637f04a..916b834 100644
--- a/system.scm
+++ b/system.scm
@@ -65,12 +65,7 @@
(guix-service-type config =>
(guix-configuration
(inherit config)
- (extra-options '("--max-jobs=4" "--cores=4"))))
- (mingetty-service-type config =>
- (mingetty-configuration
- (inherit config)
- ;; Automatically log in as "guest".
- (auto-login "mitch"))))
+ (extra-options '("--max-jobs=4" "--cores=4")))))
(list
(service elogind-service-type)