mirror of https://github.com/Chizi123/.emacs.d.git

Chizi123
2018-11-19 a4b9172aefa91861b587831e06f55b1e19f3f3be
commit | author | age
5cb5f7 1 (provide 'init)
C 2
3 ;; set paths for executable
4 (add-to-list 'exec-path "C:/msys64/usr/bin")
5 (add-to-list 'exec-path "C:/msys64/mingw64/bin")
6 (setenv "PATH" (mapconcat #'identity exec-path path-separator))
7
8 ;; adding modules to load path
9 (add-to-list 'load-path "~/.emacs.d/custom/")
10
11 ;; load your modules
12 (require 'setup-applications)
13 (require 'setup-communication)
14 (require 'setup-convenience)
15 (require 'setup-data)
16 (require 'setup-development)
17 (require 'setup-editing)
18 (require 'setup-environment)
19 (require 'setup-external)
20 (require 'setup-faces)
21 (require 'setup-files)
22 (require 'setup-help)
23 (require 'setup-programming)
24 (require 'setup-text)
25 (require 'setup-local)
26
27 ;; setting up aspell
28 (require 'ispell)
29 (setq-default ispell-program-name "aspell")
30
a4b917 31 ;; Repos
5cb5f7 32 (require 'package)
a4b917 33 (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
C 34 (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
35 (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
36
37 ;; use-package
5cb5f7 38 (package-initialize)
a4b917 39 (unless (package-installed-p 'use-package)
C 40   (package-refresh-contents)
41   (package-install 'use-package))
42
43 (eval-when-compile
44   (require 'use-package))
45
5cb5f7 46
C 47 ;; helm
48 (require 'helm-config)
49
50 (setq helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
51       helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
52       helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
53       helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
54       helm-ff-file-name-history-use-recentf t
55       helm-echo-input-in-header-line t)
56
57 (defun spacemacs//helm-hide-minibuffer-maybe ()
58   "Hide minibuffer in Helm session if we use the header line as input field."
59   (when (with-helm-buffer helm-echo-input-in-header-line)
60     (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
61       (overlay-put ov 'window (selected-window))
62       (overlay-put ov 'face
63                    (let ((bg-color (face-background 'default nil)))
64                      `(:background ,bg-color :foreground ,bg-color)))
65       (setq-local cursor-type nil))))
66
67
68 (add-hook 'helm-minibuffer-set-up-hook
69           'spacemacs//helm-hide-minibuffer-maybe)
70
71 (global-set-key (kbd "M-x") 'helm-M-x)
72 (setq helm-M-x-fuzzy-match t) ;; optional fuzzy matching for helm-M-x
73
74 (global-set-key (kbd "M-y") 'helm-show-kill-ring)
75
76 (global-set-key (kbd "C-x b") 'helm-mini)
77 (setq helm-buffers-fuzzy-matching t
78       helm-recentf-fuzzy-match    t)
79
80 (global-set-key (kbd "C-x C-f") 'helm-find-files)
81
82 (global-set-key (kbd "C-c h o") 'helm-occur)
83
84 (helm-mode 1)
85
9d27fc 86 ;; undo-tree
5cb5f7 87 (require 'undo-tree)
C 88 (global-undo-tree-mode)
89
9d27fc 90 ;; volatile highlights
5cb5f7 91 (require 'volatile-highlights)
C 92 (volatile-highlights-mode t)
93
9d27fc 94 ;; yasnippet
5cb5f7 95 (require 'yasnippet)
C 96 (yas-global-mode 1)
97
9d27fc 98 ;; ggtags
5cb5f7 99 (require 'ggtags)
C 100 (add-hook 'c-mode-common-hook
101           (lambda
102             (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
103               (ggtags-mode 1))))
104 (add-hook 'dired-mode-hook 'ggtags-mode)
105
9d27fc 106 ;; workgroups2
5cb5f7 107 (require 'workgroups2)
C 108 (workgroups-mode 1)
109
9d27fc 110 ;; smartparens
5cb5f7 111 (require 'smartparens-config)
9d27fc 112 (add-hook 'prog-mode-hook #'smartparens-mode)
5cb5f7 113 (setq sp-base-key-bindings 'paredit)
C 114 (setq sp-autoskip-closing-pair 'always)
115 (setq sp-hybrid-kill-entire-symbol nil)
116 (sp-use-paredit-bindings)
117
118 ;; clean-aindent-mode
119 (require 'clean-aindent-mode)
120 (add-hook 'prog-mode-hook 'clean-aindent-mode)
121
122 ;; company config
123 (require 'company)
124 (add-hook 'after-init-hook 'global-company-mode)
125 (add-to-list 'company-backends 'company-c-headers)
126 (setq company-backends (delete 'company-semantic company-backends))
c655ee 127 (add-hook 'c-mode-common-hook
C 128       (lambda ()
129         (define-key c-mode-base-map  [(tab)] 'company-complete)))
5cb5f7 130 ;; (define-key c++-mode-map  [(tab)] 'company-complete)
C 131
132 ;; ibuffer-vc config
133 (add-hook 'ibuffer-hook
134       (lambda ()
135         (ibuffer-vc-set-filter-groups-by-vc-root)
136         (unless (eq ibuffer-sorting-mode 'alphabetic)
137               (ibuffer-do-sort-by-alphabetic))))
138
139 (setq ibuffer-formats
140       '((mark modified read-only vc-status-mini " "
141               (name 18 18 :left :elide)
142               " "
143               (size 9 -1 :right)
144               " "
145               (mode 16 16 :left :elide)
146               " "
147               (vc-status 16 16 :left)
148               " "
149               filename-and-process)))
150
151 ;; projectile config
152 (projectile-global-mode)
153 (setq projectile-completion-system 'helm)
154 (helm-projectile-on)
155 (setq projectile-indexing-method 'alien)
156 (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
157
158 ;; ztree config
159 (require 'ztree-diff)
160 (require 'ztree-dir)
161
162 ;; diff-hl config
163 (global-diff-hl-mode)
164 (add-hook 'dired-mode-hook 'diff-hl-dired-mode)
165
166 ;; magit config
167 (require 'magit)
168 (set-default 'magit-stage-all-confirm nil)
169 (add-hook 'magit-mode-hook 'magit-load-config-extensions)
170 ;; full screen magit-status
171 (defadvice magit-status (around magit-fullscreen activate)
172   (window-configuration-to-register :magit-fullscreen)
173   ad-do-it
174   (delete-other-windows))
175
176 (global-unset-key (kbd "C-x g"))
177 (global-set-key (kbd "C-x g h") 'magit-log)
178 (global-set-key (kbd "C-x g f") 'magit-file-log)
179 (global-set-key (kbd "C-x g b") 'magit-blame-mode)
180 (global-set-key (kbd "C-x g m") 'magit-branch-manager)
181 (global-set-key (kbd "C-x g c") 'magit-branch)
182 (global-set-key (kbd "C-x g s") 'magit-status)
183 (global-set-key (kbd "C-x g r") 'magit-reflog)
184 (global-set-key (kbd "C-x g t") 'magit-tag)
185
186 ;; flycheck
187 (require 'flycheck)
188 (add-hook 'after-init-hook #'global-flycheck-mode)
189
190 ;; flycheck-pos-tip
191 (with-eval-after-load 'flycheck
192   (flycheck-pos-tip-mode))
193
194 ;; nyan mode
195 (case window-system ((x w32) (nyan-mode)))
196
197 ;; semantic refactor
198 (require 'srefactor)
199 (require 'srefactor-lisp)
200
201 ;; OPTIONAL: ADD IT ONLY IF YOU USE C/C++.
202 (semantic-mode 1) ;; -> this is optional for Lisp
203
204 (define-key c-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
205 (define-key c++-mode-map (kbd "M-RET") 'srefactor-refactor-at-point)
206 (global-set-key (kbd "M-RET o") 'srefactor-lisp-one-line)
207 (global-set-key (kbd "M-RET m") 'srefactor-lisp-format-sexp)
208 (global-set-key (kbd "M-RET d") 'srefactor-lisp-format-defun)
209 (global-set-key (kbd "M-RET b") 'srefactor-lisp-format-buffer)
210
211 ;; guide-key
212 (require 'guide-key)
8f6f27 213 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "C-h"))
5cb5f7 214 (setq guide-key/recursive-key-sequence-flag t)
9d27fc 215 (setq guide-key/popup-window-position 'bottom)
5cb5f7 216 (guide-key-mode 1)  ; Enable guide-key-mode
8f6f27 217
a4b917 218 ;; x86 lookup
8f6f27 219 (require 'x86-lookup)
a4b917 220 (setq x86-lookup-pdf "D:/Coding/x86-instructions.pdf")
8f6f27 221 (global-set-key (kbd "C-h x") #'x86-lookup)
C 222
c655ee 223 ;; org-bullets
C 224 (require 'org-bullets)
225 (add-hook 'org-mode-hook 'org-bullets-mode)
226
a4b917 227 ;; pdf-tools
C 228 (pdf-tools-install)
8f6f27 229
C 230 (custom-set-variables
231  ;; custom-set-variables was added by Custom.
232  ;; If you edit it by hand, you could mess it up, so be careful.
233  ;; Your init file should contain only one such instance.
234  ;; If there is more than one, they won't work right.
235  '(package-selected-packages
236    (quote
a4b917 237     (use-package pdf-tools org org-bullets x86-lookup ztree yasnippet workgroups2 volatile-highlights undo-tree srefactor smartparens nyan-mode magit ibuffer-vc helm-projectile guide-key ggtags flycheck-tip flycheck-pos-tip diff-hl company-c-headers clean-aindent-mode))))
8f6f27 238 (custom-set-faces
C 239  ;; custom-set-faces was added by Custom.
240  ;; If you edit it by hand, you could mess it up, so be careful.
241  ;; Your init file should contain only one such instance.
242  ;; If there is more than one, they won't work right.
243  )