-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
156 lines (125 loc) · 4.93 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
;; 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.
;;; Code:
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (monokai)))
'(custom-safe-themes
(quote
("f78de13274781fbb6b01afd43327a4535438ebaeec91d93ebdbba1e3fba34d3c" default)))
'(horizontal-scroll-bar-mode nil)
'(initial-frame-alist (quote ((fullscreen . maximized))))
'(linum-format "%d ")
'(magit-diff-use-overlays nil)
'(menu-bar-mode nil)
'(ns-right-alternate-modifier (quote none))
'(package-archives
(quote
(("melpa-stable" . "https://stable.melpa.org/packages/")
("melpa" . "https://melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/"))))
'(package-enable-at-startup nil)
'(package-selected-packages
(quote
(monokai-theme iy-go-to-char ace-jump-mode js2-mode undo-tree helm-ag ag flycheck json-mode magit expand-region multiple-cursors helm-projectile helm projectile company company-jedi)))
'(scroll-bar-mode nil)
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(linum ((t (:inherit default))))
)
(add-to-list 'exec-path "/usr/local/bin/")
(setq-default indent-tabs-mode nil)
;; replace yes or no questions for y or n
(defalias 'yes-or-no-p 'y-or-n-p)
;; get rif of the default emacs message at startup
(setq inhibit-startup-message t)
;; disable auto-backups on files
(setq make-backup-files nil)
;; enable windows movement with S-<arrows>
(windmove-default-keybindings)
;; disable auto-save
(setq auto-save-default nil)
;; projectile config
(projectile-global-mode)
(setq projectile-switch-project-action 'projectile-dired)
;; enable company mode globally
(global-company-mode t)
(setq company-minimum-prefix-length 1)
(setq company-dabbrev-downcase nil)
(setq company-idle-delay 0)
;; display line numbers globally
(global-linum-mode t)
;; magit configuration
(global-set-key (kbd "C-x g") #'magit-status)
;; use ibuffer instead of the default buffer list
(global-set-key (kbd "C-x C-b") #'ibuffer)
;; helm configuration
(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 1)
;; setup helm-projectile integration
(helm-projectile-on)
;; multiple cursos config
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; allow marked text replacement
(delete-selection-mode 1)
;; store the emacs session when exiting
(desktop-save-mode 1)
;; expand-region binding key
(global-set-key (kbd "C-=") 'er/expand-region)
;; allow dired-find-alternative-file in order to be able to navigate through directories without opening new buffers
(put 'dired-find-alternate-file 'disabled nil)
;; configure electric pair mode to auto-close parenthesis, etc
(electric-pair-mode 1)
;; Show closing parenthesis and brakets
(show-paren-mode 1)
(defun my/hideshow-mode-enable()
(local-set-key (kbd "C-c <right>") 'hs-show-block)
(local-set-key (kbd "C-c <left>") 'hs-hide-block)
(local-set-key (kbd "C-c <up>") 'hs-hide-all)
(local-set-key (kbd "C-c <down>") 'hs-show-all)
(hs-minor-mode t))
;; configure html mode hooks
(defun my/html-mode-hook()
(my/hideshow-mode-enable)
(set (make-local-variable 'sgml-basic-offset) 4))
(add-hook 'html-mode-hook 'my/html-mode-hook)
;; configure python-mode hooks
(defun my/python-mode-hook ()
(add-to-list 'company-backends 'company-jedi)
(my/hideshow-mode-enable)
(flycheck-mode t))
(add-hook 'python-mode-hook 'my/python-mode-hook)
;; configure webmode hooks
;; configure js2-mode hooks
(defun my/js2-mode-hook ()
(my/hideshow-mode-enable))
(add-hook 'js2-mode-hook 'my/js2-mode-hook)
;; configure file type modes
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
;; configure undo tree for better undo-redo experience
(global-undo-tree-mode)
;; make emacs cursor as bar
(setq-default cursor-type 'bar)
;; general flycheck configuration
(setq flycheck-highlighting-mode 'lines)
;; ace jump config (jump to x character easly)
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
(define-key global-map (kbd "C-x SPC") 'ace-jump-mode-pop-mark)
;; iy-go-to-char config (jump to n occurrence of character)
(global-set-key (kbd "C-c f") 'iy-go-up-to-char)
(global-set-key (kbd "C-c F") 'iy-go-up-to-char-backward)