blob: edb6dad50864afffa9d90d584895d2eace1b66a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
;;; post-init.el --- User Init -*- lexical-binding: t; -*-
(load-theme 'modus-vivendi)
(repeat-mode 1)
(setq auth-sources '(password-store "~/.authinfo.gpg"))
(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" " ")
("lt" "<")
("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
;; This *may* need to be set to 'always just so that you don't
;; miss other possible good completions that match the input
;; string.
completion-auto-help 'always
;; Include more information with completion listings
completions-detailed t
;; Move focus to the completions window after hitting tab
;; twice.
completion-auto-select 'second-tab
;; Cycle through completion options vertically, not
;; horizontally.
completions-format 'vertical
;; Sort recently used completions first.
completions-sort 'historical
;; Only show up to 10 lines in the completions window.
completions-max-height 10
;; Don't show the unneeded help string at the top of the
;; completions buffer.
completion-show-help nil
;; Add more `completion-styles' to improve candidate selection.
completion-styles '(basic partial-completion substring initials))
(keymap-set minibuffer-local-map "C-p" #'minibuffer-previous-completion)
(keymap-set minibuffer-local-map "C-n" #'minibuffer-next-completion)
(completion-preview-mode 1)
(electric-pair-mode 1)
(setq load-prefer-newer t)
(use-package compile-angel
:demand t
:config
(setq compile-angel-verbose nil)
(push "/init.el" compile-angel-excluded-files)
(push "/early-init.el" compile-angel-excluded-files)
(push "/post-init.el" compile-angel-excluded-files)
(push "/eshell.el" compile-angel-excluded-files)
(push "/gnus.el" compile-angel-excluded-files)
(compile-angel-on-load-mode 1))
(use-package paren
:ensure nil
:hook (after-init-hook . show-paren-mode)
:custom
(show-paren-delay 0)
(show-paren-style 'mixed)
(show-paren-context-when-offscreen t))
(use-package guix
:ensure nil)
(use-package geiser-guile
:ensure nil)
(use-package rainbow-delimiters
:ensure nil
:init
(rainbow-delimiters-mode))
(use-package pinentry
:ensure nil)
(use-package pass
:ensure nil)
(use-package bluetooth
:ensure nil)
(use-package enwc
:ensure nil
:init
(setq enwc-default-backend 'nm))
(load-file (expand-file-name "gnus.el" user-emacs-directory))
(load-file (expand-file-name "eshell.el" user-emacs-directory))
(server-start)
|