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

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