forked from mhartington/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
emacs
177 lines (142 loc) · 4.73 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
;;; .emacs --- Jean-Christophe BEGUE interface from fingers to code
;;; Commentary:
;;; Code:
(package-initialize)
(setq user-full-name "Jean-Christophe BEGUE")
(setq user-mail-address "[email protected]")
(add-to-list 'load-path "~/.emacs.d/conf")
(savehist-mode 1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(show-paren-mode 1)
(setq inhibit-splash-screen t)
(set-frame-parameter nil 'undecorated t)
;; backup files management
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Always use a decent space policy
(setq-default indent-tabs-mode nil)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setenv "SSH_AUTH_SOCK" "/run/user/1000/keyring/ssh")
(require 'init-use-package)
(require 'init-evil)
(require 'theme)
(require 'navigate)
(require 'init-helm)
(require 'init-company)
(use-package flycheck
:hook (python-mode . flycheck-mode))
(require 'lang-c)
(require 'lang-java)
(use-package python
:mode ("\\.py\\'" . python-mode))
(use-package lsp-mode
:commands lsp)
(use-package company-lsp
:commands company-lsp
:after company lsp-mode
:init
(push 'company-lsp company-backends))
(use-package lsp-ui
:commands lsp-ui-mode
:hook (lsp-mode . lsp-ui-mode)
:config
(setq lsp-ui-doc-enable nil))
(use-package pipenv
:hook ((python-mode . pipenv-mode)
(pipenv-mode . pipenv-activate)))
(use-package rust-mode
:hook (rust-mode . lsp)
:config
(define-key evil-normal-state-map "gd" 'lsp-goto-implementation)
(define-key evil-normal-state-map "gt" 'lsp-find-type-definition)
(define-key evil-normal-state-map "gr" 'lsp-find-references))
(use-package cargo
:hook (rust-mode . cargo-minor-mode))
(use-package magit
:config
(global-set-key (kbd "C-x C-g") 'magit))
(use-package evil-magit)
(use-package git-gutter
:config
(global-git-gutter-mode t))
(use-package vdiff)
(use-package yaml-mode)
(use-package dockerfile-mode)
(use-package nginx-mode)
(use-package restart-emacs)
(use-package apache-mode)
(use-package json-mode)
(use-package js2-mode)
(use-package rjsx-mode)
(use-package web-mode
:config
(setq web-mode-enable-current-element-highlight t)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)))
(require 'ansi-color)
(setq compilation-scroll-output 'first-error)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start (point))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
(setq dired-recursive-deletes 'always)
(setq dired-listing-switches "-alh")
(setq compilation-ask-about-save nil)
(use-package which-key
:config
(which-key-mode))
(use-package markdown-mode
:commands (markdown-mode gfm-mode)
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init (setq markdown-command "multimarkdown"))
(use-package eldoc)
(defun disable-flycheck-mode ()
(interactive)
(flycheck-mode -1))
(use-package toml-mode
:mode ("Pipfile" . toml-mode))
(use-package rg
:config
(rg-enable-default-bindings (kbd "M-s"))
(global-set-key (kbd "C-x p g") #'rg-project))
(use-package adoc-mode)
(defun my-reload-dir-locals-for-current-buffer ()
"reload dir locals for the current buffer"
(interactive)
(let ((enable-local-variables :all))
(hack-dir-local-variables-non-file-buffer)))
(defun my-reload-dir-locals-for-all-buffer-in-this-directory ()
"For every buffer with the same `default-directory` as the
current buffer's, reload dir-locals."
(interactive)
(let ((dir default-directory))
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (equal default-directory dir))
(my-reload-dir-locals-for-current-buffer)))))
(defun copy-current-line-position-to-clipboard ()
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'."
(interactive)
(let ((path-with-line-number
(concat (buffer-file-name) ":" (number-to-string (line-number-at-pos)))))
(kill-new path-with-line-number)
(message (concat path-with-line-number " copied to clipboard"))))
(setq ediff-split-window-function 'split-window-sensibly)
(modify-syntax-entry ?_ "w")
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
(provide 'emacs)
;;; emacs ends here