-
Notifications
You must be signed in to change notification settings - Fork 1
/
rgr-general-config.el
248 lines (207 loc) · 6.95 KB
/
rgr-general-config.el
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
(use-package emacs
:init
(require 'iso-transl) ;; supposed to cure deadkeys when my external kbd is plugged into my thinkpad T44460. It doesnt.
; t60
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(show-paren-mode 1)
(winner-mode 1)
(use-package repeat
;;When Repeat mode is enabled, certain commands bound to multi-key
;;sequences can be repeated by typing a single key, after typing the
;;full key sequence once.
:config
(repeat-mode))
(global-auto-revert-mode 1)
;; Also auto refresh dired, but be quiet about it
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)
(global-visual-line-mode 1)
(setq column-number-mode t)
(delete-selection-mode 1)
(setq frame-title-format (if (member "-chat" command-line-args) "Chat: %b" '("%b@" (:eval (or (file-remote-p default-directory 'host) system-name)) " — Emacs")))
(defalias 'yes-or-no-p 'y-or-n-p)
(setq disabled-command-function nil)
(global-hl-line-mode t)
(use-package delsel
:ensure nil
:hook (after-init . delete-selection-mode))
(defun prot/keyboard-quit-dwim ()
"Do-What-I-Mean behaviour for a general `keyboard-quit'.
The generic `keyboard-quit' does not do the expected thing when
the minibuffer is open. Whereas we want it to close the
minibuffer, even without explicitly focusing it.
The DWIM behaviour of this command is as follows:
- When the region is active, disable it.
- When a minibuffer is open, but not focused, close the minibuffer.
- When the Completions buffer is selected, close it.
- In every other case use the regular `keyboard-quit'."
(interactive)
(cond
((region-active-p)
(keyboard-quit))
((derived-mode-p 'completion-list-mode)
(delete-completion-window))
((> (minibuffer-depth) 0)
(abort-recursive-edit))
(t
(keyboard-quit))))
(define-key global-map (kbd "C-g") #'prot/keyboard-quit-dwim)t
;; https://github.com/rolandwalker/browse-url-dwim
;; Context-sensitive external browse URL or Internet search from Emacs.
(use-package
browse-url-dwim
:config
(browse-url-dwim-mode))
(use-package alert)
;; display dir name when core name clashes
(require 'uniquify)
(defun rgr/kill-current-buffer()
(interactive)
(if (member (buffer-name) '("*Messages*" "*scratch*"))
(progn
(message "Can't delete %s. Are you mad? Closing window instead." (buffer-name))
(delete-window))
(kill-current-buffer)
(delete-window)))
(add-hook 'before-save-hook 'delete-trailing-whitespace)
:bind
("C-x C-q" . view-mode)
("C-c e" . rgr/erc-start)
("C-x C-b" . ibuffer)
("C-x C-i" . imenu)
("C-x k" . rgr/kill-current-buffer)
("M-0" . delete-window)
("M-1" . delete-other-windows)
("S-<f1>" . describe-face)
( "M-m" . manual-entry)
("S-<f10>" . menu-bar-open))
(use-package posframe)
(use-package ace-window
:demand t
;; (defalias 'other-window 'ace-window)
:init
(windmove-default-keybindings)
:bind
("M-o" . ace-window)
("M-d" . ace-delete-window))
(use-package ace-link
:demand
:config
(ace-link-setup-default))
(use-package pulsar
:custom
(pulsar-pulse t)
(pulsar-delay 0.2)
(pulsar-iterations 15)
(pulsar-face 'isearch)
(pulsar-highlight-face 'pulsar-green)
:init
(add-hook 'minibuffer-setup-hook #'pulsar-pulse-line)
(add-hook 'consult-after-jump-hook #'pulsar-recenter-middle)
(add-hook 'consult-after-jump-hook #'pulsar-reveal-entry)
:config
(
pulsar-global-mode 1))
(straight-use-package
'(blackout :host github :repo "raxod502/blackout"))
(use-package boxquote
:straight (:branch "main")
:bind
("C-S-r" . boxquote-region))
(use-package
volatile-highlights
:disabled
:init (volatile-highlights-mode 1))
(use-package
dpaste
:init
:bind ("C-c y" . dpaste-region-or-buffer))
;;(set-frame-font "-JB-JetBrainsMono Nerd Font-regular-normal-normal-*-14-*-*-*-*-0-fontset-auto1" nil t)
(use-package
darkroom
:bind
( "<C-f7>" . 'darkroom-mode))
(defun consult-buffer-other-tab ()
"Variant of `consult-buffer' which opens in other tab."
(interactive)
(let ((consult--buffer-display #'switch-to-buffer-other-tab))
(consult-buffer)))
(use-package tab-bar
:defer t
:custom
(tab-bar-show t)
(tab-bar-close-button-show nil)
(tab-bar-new-button-show nil)
(tab-bar-tab-hints t)
(tab-bar-new-tab-choice "*scratch*")
(tab-bar-select-tab-modifiers '(control))
:custom-face
(tab-bar ((t (:background "gray24" :foreground "#ffffff"))))
(tab-bar-tab-inactive ((t (:background "gray24" :foreground "#ffffff"))))
(tab-bar-tab ((t (:background "black" :foreground "#ffffff"))))
:bind (:map tab-prefix-map
(("x" . tab-close)
("b" . consult-buffer-other-tab)
("p" . tab-previous)
("n" . tab-next)
("c" . tab-bar-new-tab)
("s" . tab-bar-switch-to-tab))))
(add-to-list 'recentf-exclude "current-bookmark.el")
(use-package bookmark+
:disabled t
:demand t
:bind
("C-x x <right>" . bmkp-next-bookmark)
("C-x x <left>" . bmkp-previous-bookmark))
(use-package emojify
:init
(global-emojify-mode))
(defun centreCursorLineOn()
"set properties to keep current line approx at centre of screen height. Useful for debugging."
;; a faster more concise alternative to MELPA's centered-cursor-mode
(interactive)
(setq scroll-preserve-screen-position_t scroll-preserve-screen-position scroll-conservatively_t
scroll-conservatively maximum-scroll-margin_t maximum-scroll-margin scroll-margin_t
scroll-margin)
(setq scroll-preserve-screen-position t scroll-conservatively 0 maximum-scroll-margin 0.5
scroll-margin 99999))
(defun centreCursorLineOff()
(interactive)
(setq scroll-preserve-screen-position scroll-preserve-screen-position_t scroll-conservatively
scroll-conservatively_t maximum-scroll-margin maximum-scroll-margin_t scroll-margin
scroll-margin_t))
(use-package multiple-cursors
:bind (("C-<mouse-1>" . mc/add-cursor-on-click)
("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-c C->" . mc/mark-all-like-this)
("C-c C-SPC" . mc/edit-lines)
))
(use-package hideshow
:config
(defun toggle-selective-display (column)
(interactive "P")
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))
(defun toggle-hiding (column)
(interactive "P")
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(toggle-selective-display column)))
(add-hook 'prog-mode-hook (lambda()(hs-minor-mode t)))
:bind ( "C-+" . toggle-hiding)
("C-\\" . toggle-selective-display))
(use-package jinx
:hook (emacs-startup . global-jinx-mode)
:bind (("<f8>" . jinx-correct)
("C-<f8>" . jinx-languages)))
(use-package
ripgrep)
(provide 'rgr/general-config)