-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs
131 lines (106 loc) · 3.87 KB
/
.emacs
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
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;; (setq my-packages
;; '(
;; magit cmake-font-lock irony rtags cmake-ide go-mode js2-mode rg dracula-theme flycheck-clang-tidy auctex company-auctex company-tern gruvbox-theme company flycheck projectile all-the-icons neotre ;; Packages list to restore
;; ))
;; (dolist (pkg my-packages)
;; (unless (package-installed-p pkg)
;; (package-install pkg)))
(setq custom-file "~/.emacs.d/custom.el")
(load-file custom-file)
;; Cycle windows
(global-set-key (kbd "C-.") #'other-window)
(global-set-key (kbd "C-,") #'prev-window)
(defun prev-window ()
(interactive)
(other-window -1))
;; Emacs whitespace
(require 'whitespace)
(setq whitespace-line-column 80)
(setq whitespace-style (quote (face spaces trailing tabs newline space-mark tab-mark newline-mark lines-tail)))
(setq whitespace-display-mappings
;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1)
'(
(space-mark ?\ [183] [46])
(space-mark ?\xA0 [?\x2422] [?_])
(tab-mark ?\t [124 ?\t] [92 9])
))
(global-whitespace-mode 1)
;; C Style
(setq c-default-style "linux")
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
;; Magit
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
(global-set-key (kbd "C-c g") 'magit-file-dispatch)
;; Cmake
(cmake-ide-setup)
(autoload 'cmake-font-lock-activate "cmake-font-lock" nil t)
(add-hook 'cmake-mode-hook 'cmake-font-lock-activate)
;; Js2 mode
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js2-jsx-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-jsx-mode))
;; AUCTex
(setq-default TeX-engine 'xetex)
(setq TeX-view-program-selection '((output-pdf "Zathura")))
;; IDO
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "backups"))))
(setq auto-save-file-name-transforms
`((".*" "~/.emacs.d/autosaves/" t)))
;; ui things
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(load-theme 'dracula t)
(tool-bar-mode -1)
(show-paren-mode 1)
(setq show-paren-delay 0)
(global-display-line-numbers-mode)
;; (setq ido-auto-merge-work-directories-length -1)
;; Tree view
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
(setq neo-window-fixed-size nil)
(global-set-key (kbd "M-n") 'neotree-toggle)
(setq neo-autorefresh nil)
(setq projectile-switch-project-action 'neotree-projectile-action)
(setq neo-smart-open t)
;; Helm
;; (require 'helm-config)
;; (global-set-key (kbd "M-x") #'helm-M-x)
;; (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
;; (global-set-key (kbd "C-x C-f") #'helm-find-files)
;; (helm-mode
;; Projectile
(projectile-mode +1)
;; (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "M-p") 'projectile-command-map)
;; (setq projectile-enable-caching t)
;; Flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-clang-tidy-setup))
;; Company-mode
(global-company-mode)
(add-to-list 'company-backends 'company-tern)
(define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1)
(company-auctex-init)
;; Golang
(add-hook 'go-mode-hook 'gofmt-before-save)
(provide '.emacs)
;;; .emacs ends here
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)