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

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