-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.el
More file actions
258 lines (244 loc) · 8.19 KB
/
Copy pathinit.el
File metadata and controls
258 lines (244 loc) · 8.19 KB
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
249
250
251
252
253
254
255
256
257
258
; Window isolate and restore:
; 1. enable winner mode
; 2. focus on one window and C-x 1
; 3. C-c left to undo deletion
; Use elisp-autofmt to format this file
; To search marked text, first copy it with C-Spc then M-w or yank, then C-s to search and C-y to paste
; To set mark, press C-SPC twice (mark + selection then deselect). To set bookmark (similar to mark in vim)
; To delete words without moving cursor, use M-d. To select forward without moving cursor, C-SPC then C-M-SPC. C-d to delete and forward. M-\ to remove surrounding spaces.
; M-m to jump back to indentation
; Use package-refresh-contents to fetch latest package information
; Use C-x o to rotate between windows
; C-x 0 close window. C-x 1 close all others and keep current window; C-x 4 0 close window and kill buffer
; C-a C-o mimics vim O; C-e RET mimics vim o
; C-x SPC rectangular mark mode
; introduced in emacs31, good preset
(ignore-errors (load-theme 'newcomers-presets))
(use-package
completion-preview
:ensure nil
:demand t
:bind
(:map
completion-preview-active-mode-map
("M-i" . completion-preview-insert-word)
("M-n" . completion-preview-next-candidate)
("M-p" . completion-preview-prev-candidate)
("M-<return>" . completion-preview-insert)
("<tab>" . completion-preview-complete))
:config
(setq completion-preview-minimum-symbol-length 2)
(global-completion-preview-mode 1))
(use-package
minibuffer
:ensure nil
:demand t
:bind
(:map
completion-in-region-mode-map
("M-i" . minibuffer-choose-completion)
("M-n" . minibuffer-next-completion)
("M-p" . minibuffer-previous-completion))
:config
(setq completions-format 'one-column)
(setq completions-max-height 12)
(setq completion-auto-help t)
(setq completion-auto-select nil)
(setq minibuffer-visible-completions t)
(setq completion-eager-update t))
; remove some ui components
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
(global-tab-line-mode 1)
(setq-default project-mode-line t)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil) ; tab to space
(setq-default evil-shift-width 4)
(setq evil-ex-search-smart-case t)
; make files up-to-date
(global-auto-revert-mode 1)
; set this so you dont need to type yes and no
(defalias 'yes-or-no-p 'y-or-n-p)
; cursor
(setq-default cursor-type 'box)
(blink-cursor-mode 1)
; window focus
(keymap-global-set "C-c l" 'windmove-right)
(keymap-global-set "C-c h" 'windmove-left)
(keymap-global-set "C-c k" 'windmove-up)
(keymap-global-set "C-c j" 'windmove-down)
(keymap-global-set "C-c C-l" 'load-file)
; line number
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)
; eshell
(with-eval-after-load 'em-prompt
(set-face-attribute 'eshell-prompt nil :foreground "#8BD5CA"))
(require 'package)
(package-initialize)
(add-to-list
'package-archives '("melpa" . "https://melpa.org/packages/"))
; remove warning messages while installing packages
(add-to-list
'display-buffer-alist
'("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'"
(display-buffer-no-window)
(allow-no-window . t)))
(use-package
delsel
:ensure nil
:hook (after-init . delete-selection-mode))
(use-package magit :ensure t)
(use-package elisp-autofmt :ensure t)
; smartparens
(use-package
smartparens
:ensure t
:config
(require 'smartparens-config)
(smartparens-global-mode t))
; git gutter
(use-package
git-gutter
:ensure t
:hook ((prog-mode org-mode) . git-gutter-mode)
:config (setq git-gutter:update-interval 0.02))
(use-package
git-gutter-fringe
:ensure t
:config
(define-fringe-bitmap 'git-gutter-fr:added [224]
nil
nil
'(center repeated))
(define-fringe-bitmap 'git-gutter-fr:modified [224]
nil
nil
'(center repeated))
(define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240]
nil nil 'bottom))
(use-package elfeed :ensure t)
(use-package
elfeed-protocol
:ensure t
:after elfeed
:demand t
:custom (elfeed-protocol-enabled-protocols '(fever))
(elfeed-feeds
'(("fever+http://admin@192.168.8.178:8085"
:api-url "http://192.168.8.178:8085/fever/"
:password "111111")))
:config (elfeed-protocol-enable))
(load (expand-file-name "emacs-tools/init.el" user-emacs-directory))
(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 isn 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)
(let ((mono-spaced-font "Iosevka")
(proportionately-spaced-font "Sans"))
(set-face-attribute 'default nil
:family mono-spaced-font
:height 100)
(set-face-attribute 'fixed-pitch nil
:family mono-spaced-font
:height 1.0)
(set-face-attribute 'variable-pitch nil
:family proportionately-spaced-font
:height 1.0))
; theme
(load-theme 'myDarkTheme t)
; mode line
(defun mode-line-percent-position ()
"cursor position percentage"
(concat
" "
(format "%.1f%%"
(* 100
(/ (float (- (point) (point-min)))
(max 1 (- (point-max) (point-min))))))))
(defface cursor-position-face
'((t :background "#B8C0E0" :foreground "black"))
"cursor position face")
(setq-default mode-line-format
'((:propertize "▓" face (:foreground "#7E55B3"))
(:propertize
" Ɛ " face
(:background
"#7E55B3"
:foreground "#F9FAFB"
:weight bold))
(:propertize "▓▒" face (:foreground "#7E55B3"))
" "
(:propertize
(""
mode-line-mule-info
mode-line-client
mode-line-modified
mode-line-remote
mode-line-window-dedicated)
display (min-width (6.0)))
"%e"
mode-line-front-space
mode-line-frame-identification
(:propertize
mode-line-buffer-identification
face
(:weight bold :foreground "#C678DD"))
" "
(project-mode-line project-mode-line-format)
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
;; Right-aligned section with position
(:eval
(propertize
" "
'display
`((space
:align-to
(-
right
,(+ (length
(format-mode-line
(concat
(mode-line-percent-position) "% %l:%c")))
4))))))
(:propertize "░▒▓" face (:foreground "#B8C0E0"))
(:eval
(propertize (concat (mode-line-percent-position) "%")
'face 'cursor-position-face))
(:eval
(propertize " %l:%c " 'face 'cursor-position-face))
(:propertize "▓" face (:foreground "#B8C0E0"))))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(put 'upcase-region 'disabled nil)