-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
248 lines (211 loc) · 6.02 KB
/
init.el
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(require 'package)
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(when (not (package-installed-p 'use-package))
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(setq custom-file "~/.emacs.d/custom-file.el")
(load-file custom-file)
(setq inhibit-startup-message t)
(set-face-attribute 'default nil :height 105 :family "monospace" :weight 'normal :width 'normal)
(load-theme 'tango-dark)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(display-time-mode 1)
(delete-selection-mode 1)
(show-paren-mode 1)
(electric-pair-mode 1)
(visual-line-mode 1)
(global-linum-mode 1)
;; Mis preferencias visuales
(setq shift-select-mode t
transient-mark-mode t
auto-save-default nil
visible-bell t
prefer-coding-system 'utf-8
column-number-mode t
redisplay-dont-pause t
scroll-margin 1
scroll-step 1
scroll-conservatively 10000
scroll-preserve-screen-position 1
ring-bell-function #'ignore)
;; Desactivar overwrite mode por favor
(define-key global-map [(insert)] nil)
(setq-default line-spacing 1)
(set-default 'truncate-lines t)
(defalias 'yes-or-no-p 'y-or-n-p)
(use-package ivy
:diminish (ivy-mode . "")
:bind (:map ivy-mode-map
("C-'" . ivy-avy))
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-height 15)
(setq ivy-count-format "")
(setq ivy-initial-inputs-alist nil)
(setq ivy-re-builders-alist
'((ivy-switch-buffer . ivy--regex-fuzzy)
(counsel-find-file . ivy--regex-plus)
(counsel-locate . ivy--regex-plus)
(counsel-M-x . ivy--regex-plus)
(t . ivy--regex-plus))))
(use-package counsel
:ensure t
:demand t
:bind*
(("C-c C-r" . ivy-resume)
("C-x b" . ivy-switch-buffer)
("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-x C-d" . counsel-rg)
("C-x C-r" . counsel-recentf)
("C-x C-l" . counsel-locate)
;; ("TAB" . 'ivy-alt-done)
("M-y" . counsel-yank-pop)
(:map ivy-minibuffer-map
("TAB" . 'ivy-alt-done)))
:config
(ivy-mode 1)
(setq ivy-height 10
ivy-use-virtual-buffers t
ivy-display-style 'fancy
ivy-initial-inputs-alist nil
;; (define-key ivy-minibuffer-map (kbd "TAB") 'ivy-alt-done)
counsel-rg-base-command
"rg -i -M 120 --no-heading --line-number %s . -tr /home/alancho/"))
(use-package swiper
:ensure t
:bind*
(("C-s" . swiper)
("C-r" . swiper)
("C-M-s" . swiper-all)))
(use-package avy
:ensure t
:bind* (("C-'" . avy-goto-char)
("C-," . avy-goto-char-2))
:config
(setq avy-keys '(?h ?t ?n ?s)))
(use-package magit
:ensure t
:bind ("C-x g" . magit-status))
(defun then_R_operator ()
"R - %>% operator or 'then' pipe operator"
(interactive)
(just-one-space 1)
(insert "%>%")
(reindent-then-newline-and-indent))
(defun then_ggplot_plus ()
(interactive)
(just-one-space 1)
(insert "+")
(reindent-then-newline-and-indent))
(defun forbid-vertical-split ()
"Only permit horizontal window splits."
(setq-local split-height-threshold nil)
(setq-local split-width-threshold 0))
(use-package ess
:ensure t
;; :hook (ess-mode-hook . forbid-vertical-split)
:init (require 'ess-site)
:config
(setq ess-ask-for-ess-directory nil
ess-local-process-name "R"
ansi-color-for-comint-mode 'filter
;; comint-scroll-to-bottom-on-input t
;; comint-scroll-to-bottom-on-output t
;; comint-move-point-for-output t
;; ess-eval-visibly-p t
;; ess-eval-visibly 'nowait
ess-default-style 'RStudio
fill-column 72
comment-auto-fill-only-comments t)
(auto-fill-mode t)
:bind (:map ess-mode-map
("C-<return>" . 'then_R_operator)
("M-<return>" . 'then_ggplot_plus)
("_" . 'ess-insert-assign)
("S-<return>" . 'ess-eval-region-or-function-or-paragraph-and-step)
:map inferior-ess-r-mode-map
("C-<return>" . 'then_R_operator)
("M-<return>" . 'then_ggplot_plus)
("_" . 'ess-insert-assign))
("S-<return>" . 'ess-eval-region-or-function-or-paragraph-and-step))
(use-package yaml-mode
:ensure t
:config
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode)))
(use-package projectile
:ensure t
:bind-keymap ("C-c p" . projectile-command-map)
:config
(setq projectile-completion-system 'ivy
projectile-project-search-path '("~/Dropbox/")
projectile-enable-caching t)
(projectile-mode))
(use-package writeroom-mode
:ensure t
:config
(setq writeroom-width 120))
(use-package poly-markdown
:ensure t)
(use-package poly-R
:ensure t)
(use-package polymode
:ensure t
:init
(require 'polymode)
(require 'poly-markdown)
(require 'poly-R)
:config
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode)))
(use-package pyvenv
:ensure t
:init
(setenv "WORKON_HOME" "~/anaconda3/envs/"))
;; (use-package company
;; :ensure t
;; :defer 1
;; :config
;; (global-company-mode))
;; (use-package company-box
;; :ensure t
;; :hook (company-mode . company-box-mode))
;; (use-package company
;; :ensure t
;; :config
;; (setq company-idle-delay 0)
;; (setq company-minimum-prefix-length 1))
;; (use-package lsp-mode
;; :ensure t
;; :hook (python-mode . lsp-deferred)
;; :commands (lsp lsp-deferred))
;; (use-package company-lsp
;; :ensure t
;; :config
;; (push 'company-lsp company-backends))
;; (use-package lsp-ui
;; :ensure t
;; :hook (lsp-mode . lsp-ui-mode))
;; (use-package lsp-python-ms
;; :ensure t
;; :hook (python-mode . (lambda ()
;; (require 'lsp-python-ms)
;; (lsp)))
;; :init
;; (setq lsp-python-ms-executable (executable-find "python-language-server")))
;; (use-package lsp-pyright
;; :ensure t
;; :hook (python-mode . (lambda ()
;; (require 'lsp-pyright)
;; (lsp)))) ; or lsp-deferred
(use-package exec-path-from-shell
:ensure t
:config
(exec-path-from-shell-initialize))