myinit.org 57.9 KB
Newer Older
Sergio Alvariño's avatar
Sergio Alvariño committed
1
#+startup: overview
Sergio Alvariño's avatar
Sergio Alvariño committed
2
3
4
5
6

* Famous init files
- [[https://github.com/zamansky/dot-emacs][The Big Zemansky]]
- [[https://github.com/patrickt/emacs][Patrick: GOAT init emacs]]
- [[https://github.com/manugoyal/.emacs.d][Manugoyal: Emacs config]]
Sergio Alvariño's avatar
Sergio Alvariño committed
7
8
- [[https://github.com/daviwil/dotfiles/blob/master/Emacs.org][System Crafters]]
- [[https://github.com/daviwil/emacs-from-scratch/blob/master/Emacs.org][System Crafters emacs-from-scratch]]
9
- [[https://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua Emacs Configuration]]
Sergio Alvariño's avatar
Sergio Alvariño committed
10

11
* Personal info
Sergio Alvariño's avatar
Sergio Alvariño committed
12
My info
13
14
15
16
#+begin_src elisp
(setq user-full-name "Sergio Alvariño"
      user-mail-address "salvari@protonmail.com")
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
17

Sergio Alvariño's avatar
Sergio Alvariño committed
18
* Interface tweaks
Sergio Alvariño's avatar
Sergio Alvariño committed
19
** Some GUI optimizations
Sergio Alvariño's avatar
Sergio Alvariño committed
20
#+begin_src emacs-lisp
21
  (setq inhibit-x-resources t)     ; avoid problems with emacs daemon and cursor colors
Sergio Alvariño's avatar
Sergio Alvariño committed
22
23
24
  (set-face-attribute 'default nil :family "Mensch" :foundry "PfEd" :height 158)
  (setq inhibit-startup-message t) ; Eliminate FSF startup msg
  (setq frame-title-format "%b")   ; Put filename in titlebar
Sergio Alvariño's avatar
Sergio Alvariño committed
25
  (setq visible-bell t)            ; Flash instead of beep
Sergio Alvariño's avatar
Sergio Alvariño committed
26
27
28
29
30
31
32
33
  (set-scroll-bar-mode 'right)     ; Scrollbar placement
  (show-paren-mode t)              ; Blinking cursor shows matching parentheses
  (electric-pair-mode t)           ; electric-pair-mode on
  (setq column-number-mode t)      ; Show column number of current cursor location
  (mouse-wheel-mode t)             ; wheel-mouse support
  (setq fill-column 78)
  (setq auto-fill-mode t)                   ; Set line width to 78 columns...
  (setq-default indent-tabs-mode nil)       ; Insert spaces instead of tabs
Sergio Alvariño's avatar
Sergio Alvariño committed
34
  (setq-default tab-width 4)                ; set default tab 4 spaces
Sergio Alvariño's avatar
Sergio Alvariño committed
35
36
37
38
39
40
  (global-set-key "\r" 'newline-and-indent) ; turn autoindenting on
  ;(set-default 'truncate-lines t)          ; Truncate lines for all buffers
  (fset 'yes-or-no-p 'y-or-n-p)
  (setq sentence-end-double-space nil)
  ; delete trailing whitespace before saving
  (add-hook 'before-save-hook 'delete-trailing-whitespace)
Sergio Alvariño's avatar
Sergio Alvariño committed
41
42
43
44
45
  ;; Enable line numbers for some modes
  (dolist (mode '(;;text-mode-hook
                  prog-mode-hook
                  conf-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 1))))
Sergio Alvariño's avatar
Sergio Alvariño committed
46

Sergio Alvariño's avatar
Sergio Alvariño committed
47
48
49
  ;; Override some modes which derive from the above
  (dolist (mode '(org-mode-hook))
    (add-hook mode (lambda () (display-line-numbers-mode 0))))
Sergio Alvariño's avatar
Sergio Alvariño committed
50
51
52
#+end_src

** Set encoding
Sergio Alvariño's avatar
Sergio Alvariño committed
53
54
55
56
57
   Use utf-8 please
   #+begin_src emacs-lisp
     ;; Set encoding
     (prefer-coding-system 'utf-8)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
58
59

** Some shortcuts
60
61
62
63
   Useful shortcuts:
   - Revert buffer (recargar)
   - fichero org de configuración de emacs
   - fichero org ppal, aquí está todo
64
   - journal org file
65
66
67
68
   - org para el blog público, ideas para el blog
   - org para el blog privado
   - org notes file: para tomar una nota rápida, no lo uso mucho
   - phone org file: por si tomo notas en el teléfono, no lo uso mucho
Sergio Alvariño's avatar
Sergio Alvariño committed
69
70
   #+begin_src emacs-lisp
     (global-set-key (kbd "<f5>") 'revert-buffer)
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
     ;; emacs configuration org file
     (global-set-key
      (kbd "\e\ec")
      (lambda () (interactive) (find-file "~/.emacs.d/myinit.org")))
     ;; Main org file
     (global-set-key
      (kbd "\e\ei")
      (lambda () (interactive) (find-file "~/Dropbox/orgfiles/i.org")))
     ;; journal org file
     (global-set-key
      (kbd "\e\ej")
      (lambda () (interactive) (find-file "~/Dropbox/orgfiles/journal.org")))
     ;; Notes file
     (global-set-key
      (kbd "\e\en")
      (lambda () (interactive) (find-file "~/Dropbox/orgfiles/notes.org")))
     ;; public blog org file
     (global-set-key
      (kbd "\e\eb")
      (lambda () (interactive) (find-file "~/Dropbox/orgfiles/b.org")))
91
     ;; private blog file
92
93
94
95
96
97
98
     (global-set-key
      (kbd "\e\ep")
      (lambda () (interactive) (find-file "~/work/repos/Personal/blog/comacero_priv/content-org/blog_privado.org")))
     ;; phone org file
     (global-set-key
      (kbd "\e\eh")
      (lambda () (interactive) (find-file "~/share/Mob_orgzly/phone.org")))
Sergio Alvariño's avatar
Sergio Alvariño committed
99
100
101
102
103
104
105
106
107
108

     (global-set-key [C-tab] 'hippie-expand)                    ; expand
     (global-set-key [C-kp-subtract] 'undo)                     ; [Undo]
     (global-set-key [C-kp-multiply] 'goto-line)                ; goto line
     (global-set-key [C-kp-add] 'toggle-truncate-lines)         ; truncate lines
     (global-set-key [C-kp-divide] 'delete-trailing-whitespace) ; delete trailing whitespace
     (global-set-key [C-kp-decimal] 'completion-at-point)       ; complete at point
     (global-set-key [C-M-prior] 'previous-buffer)              ; previous-buffer
     (global-set-key [C-M-next] 'next-buffer)                   ; next-buffer
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
109
110

** Own map
Sergio Alvariño's avatar
Sergio Alvariño committed
111
112
113
114
115
116
117
   Defines own key map
   #+begin_src emacs-lisp
     (define-prefix-command 'own-map)
     (global-set-key (kbd "C-ñ") 'own-map)
     (define-key own-map (kbd "y") 'aya-create)
     (define-key own-map (kbd "e") 'aya-expand)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
118
119

** Syntax highlight
Sergio Alvariño's avatar
Sergio Alvariño committed
120
121
122
123
124
125
   Set maximum colors
   #+begin_src emacs-lisp
     (cond ((fboundp 'global-font-lock-mode)        ; Turn on font-lock (syntax highlighting)
            (global-font-lock-mode t)               ; in all modes that support it
            (setq font-lock-maximum-decoration t))) ; Maximum colors
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
126
127

** Kill buffer quick
Sergio Alvariño's avatar
Sergio Alvariño committed
128
129
130
131
132
133
134
135
136
137
138
   Kill current buffer without questions
   #+begin_src emacs-lisp
     ;;------------------------------------------------------------
     ;; Kill current buffer with C-Supr
     (defun geosoft-kill-buffer ()
       ;; Kill default buffer without the extra emacs questions
       (interactive)
       (kill-buffer (buffer-name))
       (set-name))
     (global-set-key [C-delete] 'geosoft-kill-buffer)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
139
140

** Wonderful bubble-buffer
Sergio Alvariño's avatar
Sergio Alvariño committed
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
   Switch to most recent buffers with F8
   #+begin_src emacs-lisp
     ;;------------------------------------------------------------
     ;; The wonderful bubble-buffer
     (defvar LIMIT 1)
     (defvar time 0)
     (defvar mylist nil)
     (defun time-now ()
     (car (cdr (current-time))))
     (defun bubble-buffer ()
     (interactive)
     (if (or (> (- (time-now) time) LIMIT) (null mylist))
         (progn (setq mylist (copy-alist (buffer-list)))
                (delq (get-buffer " *Minibuf-0*") mylist)
                (delq (get-buffer " *Minibuf-1*") mylist)))
     (bury-buffer (car mylist))
     (setq mylist (cdr mylist))
     (setq newtop (car mylist))
     (switch-to-buffer (car mylist))
     (setq rest (cdr (copy-alist mylist)))
     (while rest
       (bury-buffer (car rest))
       (setq rest (cdr rest)))
     (setq time (time-now)))
     (global-set-key [f8] 'bubble-buffer)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
167
** parent matching with %
Sergio Alvariño's avatar
Sergio Alvariño committed
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
   Jump to asociated parent with '%' same as other editors
   #+begin_src emacs-lisp
     ;;------------------------------------------------------------
     ;; Use % to match various kinds of brackets...
     ;; See: http://www.lifl.fr/~hodique/uploads/Perso/patches.el
     (global-set-key "%" 'match-paren)   ; % key match parents
     (defun match-paren (arg)
       "Go to the matching paren if on a paren; otherwise insert %."
       (interactive "p")
       (let ((prev-char (char-to-string (preceding-char)))
             (next-char (char-to-string (following-char))))
         (cond ((string-match "[[{(<]" next-char) (forward-sexp 1))
               ((string-match "[\]})>]" prev-char) (backward-sexp 1))
               (t (self-insert-command (or arg 1))))))
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

** Insert-date
#+begin_src emacs-lisp
    (global-set-key (kbd "C-c d") 'insert-date)
    (defun insert-date (prefix)
      "Insert the current date. With prefix-argument, use ISO format. With
       two prefix arguments, write out the day and month name."
      (interactive "P")
      (let ((format (cond
                     ((not prefix) "%Y-%m-%d")
                     ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%S%z")
                     ((equal prefix '(16)) "%d.%m.%Y")
                     ((equal prefix '(64)) "%c")))
            (system-time-locale "es_ES"))
        (insert (format-time-string format))))
    (defun insert-standard-date ()
      "Inserts standard date time string."
      (interactive)
      (insert (format-time-string "%c")))
#+end_src

* use-package
** use-package tips
Sergio Alvariño's avatar
Sergio Alvariño committed
206
   Some notes about *use-package*
Sergio Alvariño's avatar
Sergio Alvariño committed
207
208
209
   - *:ensure* if true will install the package if not installed
     It won't update packages. See auto-package-update for keeping all
     packages up to date
210
   - *:init* keyword to execute code *before* a package is loaded. It
Sergio Alvariño's avatar
Sergio Alvariño committed
211
     accepts one or more foorms, up to the next keyword
212
   - *:config* can be used to execute code *after* a package is loaded.
Sergio Alvariño's avatar
Sergio Alvariño committed
213
214
215
     In cases where loading is done lazily (see more about autoloading
     below), this execution is deferred until after the autoload
     occurs
216
   - *:custom* permite configurar variables con syntaxis simplificada
Sergio Alvariño's avatar
Sergio Alvariño committed
217
218
219
220
221
222
223
224
225
226
227
   - *:bind*
   - *bind-keymap*
   - *:mode* and *:interpreter*
   - *:magic*
   - *:hook*
   - *:if*
   - *:defer* En general use-package intenta aplicar lazy loading, pero
     en algún paquete es necesario especificarlo explicitamente
   - *:demand* Este es el contrario del anterior, para paquetes
     que queremos cargar de inmediato
   - *:diminish* and *:delight* changes minormode display in status line
Sergio Alvariño's avatar
Sergio Alvariño committed
228
** init use-package
Sergio Alvariño's avatar
Sergio Alvariño committed
229
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
230
231
  (require 'use-package)
  (setq use-package-always-ensure t)
Sergio Alvariño's avatar
Sergio Alvariño committed
232
233
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
234
235
236
237
238
239
240
241
242
243
244
245
246
** helpers
   =gnu-elpa-keyring-update= Avoids GPG errors in emacs version prior
   to 26.3 And =use-package-ensure-system-package= gives a warning
   when needed system packages are missing
   #+begin_src emacs-lisp
   ;;  (unless (package-installed-p 'gnu-elpa-keyring)
   ;;    (setq package-check-signature nil)
   ;;    (use-package gnu-elpa-keyring-update
   ;;      :ensure t)
   ;;    (setq package-check-signature 'allow-unsigned))
   ;;  (use-package use-package-ensure-system-package
   ;;    :ensure t)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
247

Sergio Alvariño's avatar
Sergio Alvariño committed
248
249
250
251
252
253
254
** try
   To try package without definitive installation
   #+begin_src emacs-lisp
     (use-package try
       ;; for trying packages without installing
       :ensure t)
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
255

256
257
258
259
260
261
* rainbow-mode
#+begin_src elisp
  (use-package rainbow-mode
    :ensure t)
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
262
263
264
265
266
267
268
269
270
271
272
273
274
* ace-windows
  To jump to different windows easily
  #+begin_src emacs-lisp
    (use-package ace-window
      :ensure t
      :init
      (global-set-key [remap other-window] 'ace-window)
      (custom-set-faces
       '(aw-leading-char-face
         ((t (:inherit ace-jump-face-foreground :height 3.0)))))
      )
  #+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
275
* ivy - counsel - swipper
Sergio Alvariño's avatar
Sergio Alvariño committed
276
277
278
279
280
281
282
  An enhanced incremental search and a lot of features from counsel
  #+begin_src emacs-lisp
    (use-package counsel
      :ensure t
      :bind
      (("C-S-o" . counsel-rhythmbox)
       ("M-x" . counsel-M-x)
Sergio Alvariño's avatar
Sergio Alvariño committed
283
       ("C-x b" . counsel-switch-buffer)
Sergio Alvariño's avatar
Sergio Alvariño committed
284
285
286
287
288
289
290
291
       ("C-x C-f" . counsel-find-file)
       ("<f1> f" . counsel-describe-function)
       ("<f1> v" . counsel-describe-variable)
       ("<f1> l" . counsel-load-library)
       ("<f2> i" . counsel-info-lookup-symbol)
       ("<f2> u" . counsel-unicode-char)
       ("C-c g" . counsel-git)
       ("C-c j" . counsel-git-grep)
Sergio Alvariño's avatar
Sergio Alvariño committed
292
       ("C-c k" . counsel-ag)    ;; requires installation: apt install silversearcher-ag
Sergio Alvariño's avatar
Sergio Alvariño committed
293
294
295
296
297
298
299
300
301
302
       ("C-x l" . counsel-locate)
       ("M-y" . counsel-yank-pop)
       :map ivy-minibuffer-map
       ("M-y" . ivy-next-line))
      )
    ;; Takes care of elections menus
    (use-package ivy
      :ensure t
      :diminish (ivy-mode)
      :bind
Sergio Alvariño's avatar
Sergio Alvariño committed
303
304
      (
       ;; ("C-x b" . ivy-switch-buffer)
Sergio Alvariño's avatar
Sergio Alvariño committed
305
       ("<f6>" . ivy-resume)
Sergio Alvariño's avatar
Sergio Alvariño committed
306
       )
Sergio Alvariño's avatar
Sergio Alvariño committed
307
308
309
310
311
312
      :config
      (ivy-mode 1)
      (setq ivy-use-virtual-buffers t
            ivy-count-format "%d/%d "
            ivy-display-style 'fancy)
      )
Sergio Alvariño's avatar
Sergio Alvariño committed
313
314
315
316
317
318
    ;; Ivy enriched
    (use-package ivy-rich
      :ensure t
      :config
      (ivy-rich-mode 1)
      )
Sergio Alvariño's avatar
Sergio Alvariño committed
319
320
321
322
323
324
325
326

    (use-package swiper
      :ensure t
      :bind
      (("C-s" . swiper)
       ("C-r" . swiper-isearch-backward)
       :map minibuffer-local-map
       ("C-r" . counsel-minibuffer-history)
Sergio Alvariño's avatar
Sergio Alvariño committed
327
       )
Sergio Alvariño's avatar
Sergio Alvariño committed
328
329
330
331
332
      :config
      (ivy-mode 1)
      (setq ivy-use-virtual-buffers t)
      )
  #+end_src
333
  
Sergio Alvariño's avatar
Sergio Alvariño committed
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
* doom-modeline
A fancy modeline. Remember to execute =M-x all-the-icons-install-fonts=
See [[http://sodaware.sdf.org/notes/emacs-daemon-doom-modeline-icons/][this]] for fixing icons in terminal

#+begin_src emacs-lisp
  (use-package all-the-icons
    :ensure t
    )
  (use-package doom-modeline
    :ensure t
    :init
    (doom-modeline-mode 1)
    (setq doom-modeline-icon 1) ;; this fixes icons in emacs-client
    :custom
    (doom-modeline-height 15)
    ;;(doom-modeline-icon (display-graphic-p))
    )
#+end_src

* which-key
  Some help with hotkeys
  #+begin_src emacs-lisp
    (use-package which-key
      :ensure t
      :diminish
      :config
      (which-key-mode)
      (setq which-key-idle-delay 0.3)
      )
  #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
364
365
366
367
368
369
370
371
372
373
374
375
376
377
* Buffer management
#+begin_src emacs-lisp
  (use-package bufler
    :ensure t)
  (defun sap/bufler-one-window (&optional force-refresh)
    (interactive "P")
    (bufler-list)
    (delete-other-windows)
  )

  (global-set-key (kbd "C-x C-b") 'sap/bufler-one-window)
#+end_src

* hydra
Sergio Alvariño's avatar
Sergio Alvariño committed
378
379
380
381
382
  Defines command trees (so to speak)
  #+begin_src emacs-lisp
    (use-package hydra
      :ensure t)
  #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
383
384
385
386
387
388
389
390
391
392
393
394
395

** Hydra for toggle modes
#+begin_src emacs-lisp
  (global-set-key
   (kbd "C-x t")
   (defhydra toggle (:color blue)
     "toggle"
     ("a" abbrev-mode "abbrev")
     ("s" flyspell-mode "flyspell")
     ("d" toggle-debug-on-error "debug")
     ("c" fci-mode "fCi")
     ("f" auto-fill-mode "fill")
     ("t" toggle-truncate-lines "truncate")
Sergio Alvariño's avatar
Sergio Alvariño committed
396
     ("l" display-line-numbers-mode "line numbers")
Sergio Alvariño's avatar
Sergio Alvariño committed
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
     ("w" whitespace-mode "whitespace")
     ("q" nil "cancel")
     )
   )
#+end_src

** Hydra for navigation
#+begin_src emacs-lisp
  (global-set-key
   (kbd "C-x j")
   (defhydra gotoline
     (:pre (linum-mode 1)
      :post (linum-mode -1))
     "goto"
     ("t" (lambda () (interactive)(move-to-window-line-top-bottom 0)) "top")
     ("b" (lambda () (interactive)(move-to-window-line-top-bottom -1)) "bottom")
     ("m" (lambda () (interactive)(move-to-window-line-top-bottom)) "middle")
     ("e" (lambda () (interactive)(end-of-buffer)) "end")
     ("c" recenter-top-bottom "recenter")
     ("n" next-line "down")
     ("p" (lambda () (interactive) (forward-line -1))  "up")
     ("g" goto-line "goto-line")
     )
   )
#+end_src

* avy
Sergio Alvariño's avatar
Sergio Alvariño committed
424
  Quick navigation to words
Sergio Alvariño's avatar
Sergio Alvariño committed
425
426
427
428
429
430
431
432
433
434
435
436
437
  #+begin_src emacs-lisp
    ;; avy
    (use-package avy
      :ensure t
      :config
      (avy-setup-default)
      :bind(
            ("M-g c" . avy-goto-char-2)
            )
      )
  #+end_src

* iedit
Sergio Alvariño's avatar
Sergio Alvariño committed
438
  Interactive edition of all ocurrences of X
Sergio Alvariño's avatar
Sergio Alvariño committed
439
440
441
442
  #+begin_src emacs-lisp
    (use-package iedit
      :ensure t)
  #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
443

Sergio Alvariño's avatar
Sergio Alvariño committed
444
* color-theme
Sergio Alvariño's avatar
Sergio Alvariño committed
445
446
447
Get some colour in your life
- [[https://emacsthemes.com/popular/index.html][Popular themes gallery]]
- [[https://github.com/hlissner/emacs-doom-themes/tree/screenshots][Some doom-themes gallery]]
Sergio Alvariño's avatar
Sergio Alvariño committed
448

Sergio Alvariño's avatar
Sergio Alvariño committed
449
450
451
452
453
There is no way in emacs to find out the
active color-theme, I'm currently using doom themes.
- doom-one
- doom-palenight
- doom-dracula
Sergio Alvariño's avatar
Sergio Alvariño committed
454

Sergio Alvariño's avatar
Sergio Alvariño committed
455
** Leuven-theme
Sergio Alvariño's avatar
Sergio Alvariño committed
456
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
457
458
459
460
461
462
463
464
465
466
  (use-package color-theme-modern
    :ensure t)
;;  (use-package leuven-theme
;;    :ensure t
;;    :config
;;    ;; (load-theme 'leuven-dark t)
;;    (setq leuven-scale-outline-headlines t)
;;    (setq leuven-scale-org-agenda-structure nil)
;;    )
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
467

Sergio Alvariño's avatar
Sergio Alvariño committed
468
469
470
** Zenburn-theme
#+begin_src emacs-lisp
  (use-package zenburn-theme
Sergio Alvariño's avatar
Sergio Alvariño committed
471
472
    :ensure t
    :config
Sergio Alvariño's avatar
Sergio Alvariño committed
473
474
475
    (setq zenburn-use-variable-pitch t)      ;; use variable-pitch fonts for some headings and titles
    (setq zenburn-scale-org-headlines t)     ;; scale headings in org-mode
    (setq zenburn-scale-outline-headlines t) ;; scale headings in outline-mode
Sergio Alvariño's avatar
Sergio Alvariño committed
476
477
478
    )
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
479
** doom-themes
Sergio Alvariño's avatar
Sergio Alvariño committed
480
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
481
  (use-package doom-themes
Sergio Alvariño's avatar
Sergio Alvariño committed
482
    :ensure t
Sergio Alvariño's avatar
Sergio Alvariño committed
483
484
485
486
    :config
    ;; Global settings (defaults)
    (setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
          doom-themes-enable-italic t) ; if nil, italics is universally disabled
487
    (load-theme 'doom-vibrant t)
Sergio Alvariño's avatar
Sergio Alvariño committed
488

Sergio Alvariño's avatar
Sergio Alvariño committed
489
490
    ;; Enable flashing mode-line on errors
    (doom-themes-visual-bell-config)
Sergio Alvariño's avatar
Sergio Alvariño committed
491

Sergio Alvariño's avatar
Sergio Alvariño committed
492
493
    ;; Enable custom neotree theme (all-the-icons must be installed!)
    (doom-themes-neotree-config)
Sergio Alvariño's avatar
Sergio Alvariño committed
494

Sergio Alvariño's avatar
Sergio Alvariño committed
495
496
497
    ;; or for treemacs users
    (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
    (doom-themes-treemacs-config)
Sergio Alvariño's avatar
Sergio Alvariño committed
498

Sergio Alvariño's avatar
Sergio Alvariño committed
499
    ;; Corrects (and improves) org-mode's native fontification.
500
501
    (doom-themes-org-config)
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
502
503
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
504
505
506
507
508
509
510
511
512
513
* projectile
  Work project-oriented
  #+begin_src emacs-lisp
    (use-package projectile
      :ensure t
      :config
      (projectile-global-mode)
      (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
      (setq projectile-completion-system 'ivy)
      )
Sergio Alvariño's avatar
Sergio Alvariño committed
514

Sergio Alvariño's avatar
Sergio Alvariño committed
515
516
517
518
519
520
521
522
523
    (use-package counsel-projectile
      :ensure t
      :config
      (setq counsel-projectile-mode t)
      )
  #+end_src

* git
  All you need for git
Sergio Alvariño's avatar
Sergio Alvariño committed
524
525
526
  - =magit= interface to git from emacs
  - =git-gutter= See lines changed in buffer edited
  - =git-timemachine= Visit previous git versions of edited buffer
Sergio Alvariño's avatar
Sergio Alvariño committed
527
  #+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
528
529
530
531
    ;; dirty hack to avoid problem when pushing
    (setenv "SSH_AUTH_SOCK" "/run/user/1000/keyring/ssh")

    (use-package magit
Sergio Alvariño's avatar
Sergio Alvariño committed
532
533
      :ensure t
      :init
Sergio Alvariño's avatar
Sergio Alvariño committed
534
535
536
      (progn
        (bind-key "C-x g" 'magit-status)
        )
Sergio Alvariño's avatar
Sergio Alvariño committed
537
538
      )

Sergio Alvariño's avatar
Sergio Alvariño committed
539
540
541
542
543
544
545
546
    (setq magit-status-margin
          '(t "%Y-%m-%d %H:%M " magit-log-margin-width t 18))

    (use-package git-gutter
      :ensure t
      :init
      (global-git-gutter-mode +1)
      )
Sergio Alvariño's avatar
Sergio Alvariño committed
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
      (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1)
                                            :hint nil)
        "
        Git gutter:
          _j_: next hunk        _s_tage hunk     _q_uit
          _k_: previous hunk    _r_evert hunk    _Q_uit and deactivate git-gutter
          ^ ^                   _p_opup hunk
          _h_: first hunk
          _l_: last hunk        set start _R_evision
        "
        ("j" git-gutter:next-hunk)
        ("k" git-gutter:previous-hunk)
        ("h" (progn (goto-char (point-min))
                    (git-gutter:next-hunk 1)))
        ("l" (progn (goto-char (point-min))
                    (git-gutter:previous-hunk 1)))
        ("s" git-gutter:stage-hunk)
        ("r" git-gutter:revert-hunk)
        ("p" git-gutter:popup-hunk)
        ("R" git-gutter:set-start-revision)
        ("q" nil :color blue)
        ("Q" (progn (git-gutter-mode -1)
                    ;; git-gutter-fringe doesn't seem to
                    ;; clear the markup right away
                    (sit-for 0.1)
                    (git-gutter:clear))
         :color blue))
      (global-set-key (kbd "M-g M-g") 'hydra-git-gutter/body)
Sergio Alvariño's avatar
Sergio Alvariño committed
575
576
577
578
579
580


    (use-package git-timemachine
      :ensure t
      )
  #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
581
582

* yasnippet
Sergio Alvariño's avatar
Sergio Alvariño committed
583
  Place your own snippets on ~/.emacs.d/snippets
Sergio Alvariño's avatar
Sergio Alvariño committed
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
  #+begin_src emacs-lisp
    (use-package yasnippet
      :ensure t
      :config
      :init
      (yas-global-mode 1)
      )
    (use-package auto-yasnippet
      :ensure t
      )
    (use-package yasnippet-snippets
      :ensure t)
  #+end_src

* flycheck
Sergio Alvariño's avatar
Sergio Alvariño committed
599
  Syntax checking for programming languages
Sergio Alvariño's avatar
Sergio Alvariño committed
600
601
602
603
604
605
606
607
608
609
610
  #+begin_src emacs-lisp
    (use-package flycheck
      :ensure t
      :config
      (global-set-key  (kbd "C-c C-p") 'flycheck-previous-error)
      (global-set-key  (kbd "C-c C-n") 'flycheck-next-error)
      :init
      (global-flycheck-mode t)
      )
  #+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
611
612
* company
  Autocompletion with company
Sergio Alvariño's avatar
Sergio Alvariño committed
613
  #+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
614
    (use-package company
Sergio Alvariño's avatar
Sergio Alvariño committed
615
616
      :ensure t
      :config
Sergio Alvariño's avatar
Sergio Alvariño committed
617
618
619
620
      (setq company-idle-delay 0)
      (setq company-minimum-prefix-length 3)
      ;; (add-to-list 'company-backends 'company-yasnippet t)
      (global-company-mode t)
Sergio Alvariño's avatar
Sergio Alvariño committed
621
622
      )
  #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
623

Sergio Alvariño's avatar
Sergio Alvariño committed
624
625
** company-quickhelp
   In case you want popup help instead of status line help
Sergio Alvariño's avatar
Sergio Alvariño committed
626
  #+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
627
    (use-package company-quickhelp
Sergio Alvariño's avatar
Sergio Alvariño committed
628
      :ensure t
Sergio Alvariño's avatar
Sergio Alvariño committed
629
630
631
      :config
      (company-quickhelp-mode)
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
632
633
  #+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
634
** company-lsp
Sergio Alvariño's avatar
Sergio Alvariño committed
635
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
636
637
638
639
640
641
642
;;  (use-package company-lsp
;;    :ensure
;;    :config
;;    (push 'company-lsp company-backends)
;;    )
#+end_src
* LSP
Sergio Alvariño's avatar
Sergio Alvariño committed
643
644
We are using =lsp-mode= but keep an eye on =eglot= as an alternative.

Sergio Alvariño's avatar
Sergio Alvariño committed
645
646
647
Links to check
- [[https://emacs-lsp.github.io/lsp-mode/][LSP-mode Home]]
- [[https://tychoish.com/post/emacs-and-lsp-mode/][Tychoist: Emacs and LSP mode]]
Sergio Alvariño's avatar
Sergio Alvariño committed
648
649
- [[https://vxlabs.com/2018/11/19/configuring-emacs-lsp-mode-and-microsofts-visual-studio-code-python-language-server/][MS lsp server with python]]
- [[https://www.mattduck.com/lsp-python-getting-started.html][Getting started with lsp-mode for Python]] (good)
Sergio Alvariño's avatar
Sergio Alvariño committed
650
- [[https://www.mortens.dev/blog/emacs-and-the-language-server-protocol/][C++, Python, Rust]]
Sergio Alvariño's avatar
Sergio Alvariño committed
651
- [[https://ddavis.io/posts/emacs-python-lsp/][Python IDE with LSP and pyenv]] (good)
Sergio Alvariño's avatar
Sergio Alvariño committed
652
- [[https://github.com/pythonic-emacs/pyenv-mode][pyenv-mode]]
Sergio Alvariño's avatar
Sergio Alvariño committed
653

Sergio Alvariño's avatar
Sergio Alvariño committed
654
LSP mode, allows the use of Language Server Protocol for programming.
Sergio Alvariño's avatar
Sergio Alvariño committed
655

Sergio Alvariño's avatar
Sergio Alvariño committed
656
**lsp-keymap prefix remapped to "C-c l"**
Sergio Alvariño's avatar
Sergio Alvariño committed
657

Sergio Alvariño's avatar
Sergio Alvariño committed
658
659
660
661
662
#+begin_src emacs-lisp
  (use-package lsp-mode
    :ensure t
    :commands (lsp lsp-deferred lsp-execute-code-action)
    :hook
663
    ((python-mode . lsp-deferred)
Sergio Alvariño's avatar
Sergio Alvariño committed
664
665
666
667
668
669
670
671
672
673
     (lsp-mode . lsp-enable-which-key-integration)
     (lsp-mode . lsp-diagnostics-modeline-mode))
    :init
    (setq lsp-keymap-prefix "C-c l")
    :bind
    ("C-c C-c" . #'lsp-execute-code-action)
    :custom
    (lsp-diagnostics-modeline-scope :project)
    (lsp-file-watch-threshold 5000)
    (lsp-enable-file-watchers nil)
674
    ;(lsp-enable-which-key-integration t)
Sergio Alvariño's avatar
Sergio Alvariño committed
675
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
676
    ;;   (use-package lsp-mode
Sergio Alvariño's avatar
Sergio Alvariño committed
677
678
679
680
681
682
683
684
685
686
    ;;     :ensure
    ;;     :commands lsp
    ;;     :custom
    ;;     (lsp-auto-guess-root nil)
    ;;     (lsp-prefer-flymake nil)
    ;;     :bind
    ;;     (:map lsp-mode-map ("C-c C-f") . lsp-format-buffer)
    ;;
    ;;     )
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
687

Sergio Alvariño's avatar
Sergio Alvariño committed
688
689
** lsp-ui
[[https://emacs-lsp.github.io/lsp-ui/][lsp-ui]]
Sergio Alvariño's avatar
Sergio Alvariño committed
690

Sergio Alvariño's avatar
Sergio Alvariño committed
691
692
693
694
695
696
697
#+begin_src emacs-lisp
  (use-package lsp-ui
    :ensure t
    :custom
    (lsp-ui-doc-delay 0.75)
    (lsp-ui-doc-max-height 200)
    :after lsp-mode)
Sergio Alvariño's avatar
Sergio Alvariño committed
698
699
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
700
701
702
703
704
705
706
** lsp-ivy
Try these commands with M-x:
- =lsp-ivy-workspace-symbol= - Search for a symbol name in the
  current project workspace
- =lsp-ivy-global-workspace-symbol= - Search for a symbol name in
  all active project workspaces

Sergio Alvariño's avatar
Sergio Alvariño committed
707
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
708
709
710
  (use-package lsp-ivy
    :ensure t
    :after (ivy lsp-mode))
Sergio Alvariño's avatar
Sergio Alvariño committed
711
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
712
713
714
715

** company-lsp
[[https://github.com/tigersoldier/company-lsp][company-lsp]] integrates company completion with lsp server

Sergio Alvariño's avatar
Sergio Alvariño committed
716
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
717
718
719
720
721
  (use-package company-lsp
    :ensure t
    :disabled
    :custom (company-lsp-enable-snippet t)
    :after (company lsp-mode))
Sergio Alvariño's avatar
Sergio Alvariño committed
722
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737

** lsp-treemacs
Try these commands with M-x:

- =lsp-treemacs-symbols= - Show a tree view of the symbols in the
  current file
- =lsp-treemacs-references= - Show a tree view for the references of
  the symbol under the cursor
- =lsp-treemacs-error-list= - Show a tree view for the diagnostic
  messages in the project

#+begin_src emacs-lisp
  (use-package lsp-treemacs
    :after lsp)
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
738

Sergio Alvariño's avatar
Sergio Alvariño committed
739
740
741
742
743
744
745
746
747
748
749
750
751
752
** DAP mode
[[https://emacs-lsp.github.io/dap-mode/][DAP-mode]] is an excellent package for bringing rich debugging
capabilities to Emacs via the Debug Adapter Protocol. You should check
out the [[https://emacs-lsp.github.io/dap-mode/page/configuration/][configuration docs]] to learn how to configure the debugger for
your language. Also make sure to check out the documentation for the
debug adapter to see what configuration parameters are available to
use for your debug templates!
#+begin_src emacs-lisp
  (use-package dap-mode
    ;; Uncomment the config below if you want all UI panes to be hidden by default!
    ;; :custom
    ;; (lsp-enable-dap-auto-configure nil)
    ;; :config
    ;; (dap-ui-mode 1)
Sergio Alvariño's avatar
Sergio Alvariño committed
753
    :ensure t
Sergio Alvariño's avatar
Sergio Alvariño committed
754
755
756
757
758
759
760
761
762
763
764
765
766
    :config
    ;; Set up Node debugging
    (require 'dap-node)
    (dap-node-setup) ;; Automatically installs Node debug adapter if needed

    ;; Bind `C-c l d` to `dap-hydra` for easy access
    ;;(general-define-key
    ;;  :keymaps 'lsp-mode-map
    ;;  :prefix lsp-keymap-prefix
    ;;  "d" '(dap-hydra t :wk "debugger"))
    )
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
767
768
** golang lsp configuration
Es necesario instalar =gopls= previamente en el sistema.
Sergio Alvariño's avatar
Sergio Alvariño committed
769

Sergio Alvariño's avatar
Sergio Alvariño committed
770
771
772
773
774
775
776
777
778
=company-go= está obsoleto, no usar

Mirar este enlace
- [[https://kasperdeng.github.io/go-dev-env/][GO development enviroment]]
- [[https://kasperdeng.github.io/go-dev-env/][gopls documentation]]
- [[https://gist.github.com/psanford/b5d2689ff1565ec7e46867245e3d2c76][go-mode lsp configuration]]

#+begin_src emacs-lisp
  (use-package go-mode
Sergio Alvariño's avatar
Sergio Alvariño committed
779
780
    :ensure t
    :custom
Sergio Alvariño's avatar
Sergio Alvariño committed
781
    (lsp-enable-links nil)
782
783
784
785
786
787
788
    :hook
    ((go-mode . lsp-deferred)
     (before-save . lsp-format-buffer)
     (before-save . lsp-organize-imports)
     (before-save . gofmt-before-save)
     )
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
789

Sergio Alvariño's avatar
Sergio Alvariño committed
790
791
792
  (use-package go-snippets
    :ensure t
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
793

Sergio Alvariño's avatar
Sergio Alvariño committed
794
  (use-package go-projectile
Sergio Alvariño's avatar
Sergio Alvariño committed
795
796
    :ensure t
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
797
798

  (use-package gotest
Sergio Alvariño's avatar
Sergio Alvariño committed
799
    :ensure t
800
801
802
803
804
    :bind
    (:map go-mode-map
          ("C-c a t" . #'go-test-current-test)
          )
    )
Sergio Alvariño's avatar
Sergio Alvariño committed
805
806
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
807
** Rust LSP configuration
Sergio Alvariño's avatar
Sergio Alvariño committed
808
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
809
810
811
812
813
814
815
816
817
  (use-package rust-mode
    :ensure t
    :hook ((rust-mode . lsp)
           (rust-mode . lsp-lens-mode)
           )
    :custom
    (rust-format-on-save t)
    (lsp-rust-server 'rust-analyzer))
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
818

Sergio Alvariño's avatar
Sergio Alvariño committed
819
820
** Python LSP configuration
We do need a Python language server installed in the developing enviroment (=pip install python-lsp-server[all]=)
821
822
823
- https://www.mattduck.com/lsp-python-getting-started.html
- https://www.mortens.dev/blog/emacs-and-the-language-server-protocol/index.html
- https://www.reddit.com/r/emacs/comments/ijmgtx/tip_how_to_use_a_stable_and_fast_environment_to/g3kmc7o/
Sergio Alvariño's avatar
Sergio Alvariño committed
824
*** Use latest python
Sergio Alvariño's avatar
Sergio Alvariño committed
825
Not needed if you have the right  settings on your active python with =pyenv=
Sergio Alvariño's avatar
Sergio Alvariño committed
826
#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
827
828
829
; (setq python-shell-interpreter "/usr/bin/python3.8")
; (setq py-python-command "/usr/bin/python3.8")        ; maybe not needed
; (setq python-python-command "/usr/bin/python3.8")    ; maybe not needed
Sergio Alvariño's avatar
Sergio Alvariño committed
830
831
832
833
#+end_src

*** Configure python mode
#+begin_src emacs-lisp
834
835
836
837
838
839
840
841
842
843
  (use-package python-mode
    :ensure t
    :hook (python-mode . lsp-deferred)
    :custom
    ;; NOTE: Set these if Python 3 is called "python3" on your system!
    ; (python-shell-interpreter "python3")
    ; (dap-python-executable "python3")
    (dap-python-debugger 'debugpy)
    :config
    (require 'dap-python))
Sergio Alvariño's avatar
Sergio Alvariño committed
844
845
846
847
#+end_src

*** pyenv
Estoy cambiando de virtualenv a pyenv
848
849
850
851
Usamos =pyenv= para gestionar los /virtualenv/
- https://github.com/aiguofer/pyenv.el
- https://github.com/pythonic-emacs/pyenv-mode
- https://www.reddit.com/r/emacs/comments/ijmgtx/tip_how_to_use_a_stable_and_fast_environment_to/
Sergio Alvariño's avatar
Sergio Alvariño committed
852
#+begin_src emacs-lisp
853
854
855
856
857
858
859
  ;;  (use-package pyvenv
  ;;    :ensure t
  ;;    :after python-mode
  ;;    :config
  ;;    (pyvenv-mode 1)
  ;;    )
  (use-package pyenv-mode
Sergio Alvariño's avatar
Sergio Alvariño committed
860
    :ensure t
861
862
863
864
865
866
    :after python
    :hook ((python-mode . pyenv-mode)
           ; (projectile-switch-project . projectile-pyenv-mode-set)
           )
    :init
    (add-to-list 'exec-path "~/.pyenv/shims")
867
868
    (add-to-list 'exec-path "~/.pyenv/bin")
    (setenv "WORKON_HOME" "~/.pyenv/versions/")
Sergio Alvariño's avatar
Sergio Alvariño committed
869
    :config
870
871
    (pyenv-mode)
    :bind
872
    ("C-x p e" . pyenv-activate-current-project))
Sergio Alvariño's avatar
Sergio Alvariño committed
873
874
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
875
* eglot (desactivado)
Sergio Alvariño's avatar
Sergio Alvariño committed
876
877
878
879
880
881
#+begin_src emacs-lisp
;;  (use-package eglot :ensure t)
;;  (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd-10"))
;;  (add-hook 'c-mode-hook 'eglot-ensure)
;;  (add-hook 'c++-mode-hook 'eglot-ensure)
#+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
882

Sergio Alvariño's avatar
Sergio Alvariño committed
883
* Python (obsoleto, desactivado)
Sergio Alvariño's avatar
Sergio Alvariño committed
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
** Use latest python
#+begin-src emacs-lisp
;; (setq python-shell-interpreter "/usr/bin/python3.8")
;; (setq py-python-command "/usr/bin/python3.8")        ; maybe not needed
;; (setq python-python-command "/usr/bin/python3.8")    ; maybe not needed
#+end-src

** company-jedi
**Choose company-jedi or elpy, you don't need both**
Autocompletion for python
   - Run M-x jedi:install-server
   - M-x jedi:show-setup-info

   #+begin_src emacs-lisp
     ;; (use-package company-jedi             ;;; company-mode completion back-end for Python JEDI
     ;;   :ensure t
     ;;   :config
     ;;   (setq jedi:environment-virtualenv
     ;;         (append python-environment-virtualenv
     ;;                 '("--no-site-packages" "--python" "/usr/bin/python3.8")))
     ;;   (setq jedi:environment-virtualenv (list (expand-file-name "~/.emacs.d/.python-environments/")))
     ;;   (add-hook 'python-mode-hook 'jedi:setup)
     ;;   (setq jedi:complete-on-dot t)
     ;;   (setq jedi:use-shortcuts t)
     ;;   (defun config/enable-company-jedi ()
     ;;     (add-to-list 'company-backends 'company-jedi))
     ;;   (add-hook 'python-mode-hook 'config/enable-company-jedi)
     ;;   )
   #+end_src
Sergio Alvariño's avatar
Sergio Alvariño committed
913
914
915
916
917

** elpy
**Choose only one configuration: company-jedi or elpy**
python-IDE
The virtualenv for elpy-rpc must be manually created
Sergio Alvariño's avatar
Sergio Alvariño committed
918
elpy documentation]]
Sergio Alvariño's avatar
Sergio Alvariño committed
919
920

#+begin_src emacs-lisp
Sergio Alvariño's avatar
Sergio Alvariño committed
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
;;  (use-package elpy
;;    :ensure t
;;    :defer t
;;    :init
;;    (advice-add 'python-mode :before 'elpy-enable)
;;    :config
;;    (setq elpy-rpc-python-command (expand-file-name "~/.virtualenvs/elpy-rpc/bin/python"))
;;    (setq elpy-rpc-virtualenv-path (expand-file-name "~/.virtualenvs/elpy-rpc"))
;;    (elpy-enable)
;;    (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
;;    (add-hook 'elpy-mode-hook 'flycheck-mode)
;;    (setq elpy-rpc-backend "jedi")
;;    (add-hook 'elpy-mode-hook (lambda ()
;;                                (add-hook 'before-save-hook
;;                                          'elpy-format-code nil t)))
;;    )
#+end_src

** virtualenvwrapper
I don't use this package
#+begin_src emacs-lisp
  ;; (use-package virtualenvwrapper
  ;;   :ensure t
  ;;   :config
  ;;   (venv-initialize-interactive-shells)
  ;;   (venv-initialize-eshell)
  ;;   )
#+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
950
* C++ et al (desactivado)
Sergio Alvariño's avatar
Sergio Alvariño committed
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
  [[https://github.com/guolibao/guo-dot-emacs-dot-d][Pistas]]
  #+begin_src emacs-lisp
     ;; tags for code navigation
     ;; (use-package ggtags
     ;;   :ensure t
     ;;   :config
     ;;   (add-hook 'c-mode-common-hook
     ;;             (lambda ()
     ;;               (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
     ;;                 (ggtags-mode 1)))
     ;;             )
     ;;   )
     ;; (define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
     ;; (define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history)
     ;; (define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference)
     ;; (define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file)
     ;; (define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags)
     ;; (define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags)
     ;;
     ;; (define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark)

     ;; (use-package company-c-headers
     ;;   :config
     ;;   (add-hook 'c-mode-common-hook (lambda () (add-local-company-backend 'company-c-headers)))
     ;;   (add-to-list 'company-c-headers-path-system "/usr/include/c++/7/")
     ;;   )
     ;; (use-package cmake-ide
     ;;   :bind ("<f5>" . cmake-ide-compile)
     ;;   :config
     ;;   (require 'rtags)
     ;;   (cmake-ide-setup)
     ;;   (add-hook 'c-mode-hook   #'cmake-ide-load-db)
     ;;   (add-hook 'c++-mode-hook #'cmake-ide-load-db)
     ;;   (setq cmake-ide-src-extensions '(".c" ".cpp" ".C" ".cxx" ".cc" ".c++"))
     ;;   )
  #+end_src

Sergio Alvariño's avatar
Sergio Alvariño committed
988
* D programming language (desactivado)
Sergio Alvariño's avatar
Sergio Alvariño committed
989
990
991
992
993
994
995
996
997
998
999
1000
   #+begin_src emacs-lisp
     ;;(use-package flycheck-d-unittest
     ;;  :ensure t)
     ;;(use-package company-dcd
     ;;  :ensure t
     ;;  :config
     ;;  (add-hook 'd-mode-hook 'company-dcd-mode)
     ;;  )

     ;; (use-package ac-dcd
     ;;   :defer t
     ;;   :ensure t
For faster browsing, not all history is shown. View entire blame