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

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