-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.el
226 lines (176 loc) · 6.34 KB
/
init.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
;;; init.el --- Emacs initialization file
;;; Commentary:
;;; Code:
;; High initial GC threshold for speeding up Emacs load.
(setq gc-cons-threshold 1000000000)
(defun avoc-init-conf-rel-path (path)
(concat user-emacs-directory path))
(defmacro avoc-init-add-to-config-load-path (folder)
`(add-to-list 'load-path (avoc-init-conf-rel-path ,folder)))
;; Setup load paths.
(avoc-init-add-to-config-load-path "config/")
(avoc-init-add-to-config-load-path "config/winsys/")
(require 'avoc-util)
(require 'avoc-run-mode)
(require 'avoc-basics)
(require 'avoc-packaging)
(require 'avoc-terminal-clip)
(if window-system
(require 'avoc-winsys-graphic)
(require 'avoc-winsys-none))
(require 'avoc-icons)
(require 'avoc-modeline)
(require 'avoc-text-utils)
(when (avoc-run-mode-feature-enabled-p 'theme)
(require 'avoc-theme))
(require 'avoc-prettify-symbols)
(require 'avoc-git-gutter)
(require 'open-in-emacs-mode)
(require 'avoc-margins)
(use-package browse-kill-ring
:commands browse-kill-ring
:ensure t)
(require 'avoc-prettify-symbols)
;; Enable Open In Emacs mode
(when (and (open-in-emacs-available) (avoc-run-mode-feature-enabled-p 'open-in-emacs))
(open-in-emacs-mode 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; General puropose packages ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Elcord: support for Discord. The elcord folder contains a git
;; submodule that points to a custom elcord mode without reconnect
;; messages repeating each 15 seconds.
(when (avoc-run-mode-feature-enabled-p 'elcord)
(add-to-list 'load-path (avoc-init-conf-rel-path "elcord/"))
(require 'elcord)
(setq elcord-silent-mode 1)
(elcord-mode))
(use-package which-key
:ensure t
:init (which-key-mode 1))
(require 'avoc-tree-sitter)
(require 'avoc-prog)
(require 'avoc-projects)
(when (avoc-run-mode-feature-enabled-p 'linum)
(require 'avoc-line-numbers))
;; exec-path-from-shell: Set the Emacs path value
;; to the value of the user shell PATH variable value.
(when window-system
(use-package exec-path-from-shell
:ensure t
:hook (after-init . exec-path-from-shell-initialize)))
;; Helm: enhaced completion window.
(when (avoc-run-mode-feature-enabled-p 'helm)
(use-package helm
:ensure t
:bind (("M-x" . helm-M-x)
("C-x b" . helm-mini)
("C-x C-b" . helm-buffers-list)
("C-x C-f" . helm-find-files))
:config
(helm-autoresize-mode 1)
(setq helm-split-window-inside-p t
helm-candidate-number-limit 500
helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t
helm-M-x-fuzzy-match t
helm-move-to-line-cycle-in-source nil)
(define-key helm-map (kbd "TAB") #'helm-execute-persistent-action)))
;; Multi-term: terminal for emacs.
(use-package multi-term
:ensure t
:config (setq multi-term-program "/bin/zsh")
:bind ("C-x t" . multi-term-dedicated-open))
;; company: autocompletion.
(when (avoc-run-mode-feature-enabled-p 'company)
(use-package company
:ensure t
:defer t
:init
(global-company-mode)
:custom
(company-echo-delay 0)
(company-idle-delay 0.15)
(company-minimum-prefix-length 2)
(company-tooltip-flip-when-above t)
(company-require-match nil)
:bind
("C-c SPC" . company-complete)
("C-c C-SPC" . company-complete)))
;; Magit: Git client
(when (avoc-run-mode-feature-enabled-p 'git)
(use-package magit
:ensure t
:bind (("C-x v v" . magit-status)
("C-x M-v" . magit-dispatch-popup))))
(use-package hl-todo
:ensure t
:config
(setq hl-todo-keyword-faces
'(("TODO" . "#FF0000")
("FIXME" . "#FF0000")
("DEBUG" . "#A020F0")
("GOTCHA" . "#FF4500")
("STUB" . "#1E90FF")))
:bind
("C-c C-t p" . hl-todo-previous)
("C-c C-t n" . hl-todo-next)
("C-c C-t o" . hl-todo-occur)
("C-c C-t i" . hl-todo-insert)
:hook
(prog-mode . hl-todo-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;
;; Special keybindings ;;
;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-mode is not an excuse to make WindMove and BufferMove bindings for stop working
;; I'll find some replacements when I need it.
(add-hook 'org-mode-hook
(lambda ()
(define-key org-mode-map (kbd "<S-left>") nil)
(define-key org-mode-map (kbd "<S-right>") nil)
(define-key org-mode-map (kbd "<S-up>") nil)
(define-key org-mode-map (kbd "<S-down>") nil)
(define-key org-mode-map (kbd "<C-S-left>") nil)
(define-key org-mode-map (kbd "<C-S-right>") nil)
(define-key org-mode-map (kbd "<C-S-up>") nil)
(define-key org-mode-map (kbd "<C-S-down>") nil)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Custom global key bindings ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Center text in selected rectangle ("hello " => " hello ").
;; Mainly added for helping me writing centered text while playing with artist mode.
(global-set-key (kbd "C-c C-r") 'center-rectangle)
;; Toggle text overwrite mode, for the same reason as above lol.
(global-set-key [C-help] 'overwrite-mode)
;; Fast close all opened buffers, for that situations that you have a thousand
;; opened buffers and you need to reboot your mind.
(global-set-key (kbd "C-x C-k") 'clean-buffers)
;; Pretty much for the same, but projectile-aware.
(global-set-key (kbd "C-x p M-k") 'projectile-kill-non-project-buffers)
(global-set-key (kbd "M-k") 'kill-line)
(global-set-key (kbd "M-<backspace>") 'backward-kill-word)
(global-set-key (kbd "M-<delete>") 'kill-word)
;; Shortcut to artist mode.
(global-set-key (kbd "C-c C-a") 'artist-mode)
;; Bind <Home> and <end> keys to beginning-of-buffer and end-of-buffer
(global-set-key (kbd "<home>") 'beginning-of-buffer)
(global-set-key (kbd "<end>") 'end-of-buffer)
(global-set-key (kbd "C-S-L") (kbd "C-SPC C-SPC"))
;; Navigation keybindings
(global-set-key (kbd "C-,") 'previous-buffer)
(global-set-key (kbd "C-.") 'next-buffer)
;; Debug keybindings
(global-set-key (kbd "C-x & ,") (lambda () (interactive) (profiler-start 'cpu+mem)))
(global-set-key (kbd "C-x & .") (lambda () (interactive) (profiler-stop) (profiler-report)))
;;;;;;;;;;;;;;;;;;;;;;;;
;; Work configuration ;;
;;;;;;;;;;;;;;;;;;;;;;;;
(let* ((amzn-config-folder (avoc-init-conf-rel-path "amzn"))
(amzn-entry-point (concat amzn-config-folder "/init.el")))
(when (file-exists-p amzn-entry-point)
(message "Will load work configuration...")
(load-file amzn-entry-point)))
;; GC for cleaning up memory of Emacs initialization
(garbage-collect)
;; Setting up final 100MB GC threshold.
(setq gc-cons-threshold 100000000)