summaryrefslogtreecommitdiff
path: root/config.org
blob: a6a259e3843d296a33360de3fee3a1510a061f23 (plain)
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#+TITLE: Emacs Configuration File
#+Author: BugGhost
* Package configuration
** Melpa
Define the melpa respository to packages
#+begin_src emacs-lisp
  (require 'package)
  (setq package-enable-at-startup nil)
  (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  (package-initialize)
#+end_src
** Use package
Instal the package "use-package" to manager packages in emacs
#+begin_src emacs-lisp
  (unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package))
  (require 'use-package)
#+end_src
* exclude files
Exclude message of error or custom vars of config file
#+begin_src emacs-lisp
  (setq custom-file (locate-user-emacs-file "custom-vars-el"))
  (load custom-file 'noerror 'nomessage)
#+end_src
* Customization
** General
#+begin_src emacs-lisp
  (fido-vertical-mode)
  (menu-bar-mode -1)
  (tool-bar-mode -1)
  (setq org-startup-folded t)
  (recentf-mode)
  (savehist-mode)
  (global-hl-line-mode)
  (global-subword-mode)
  (global-auto-revert-mode)
  (save-place-mode)
  (column-number-mode)
  (size-indication-mode)
  (global-visual-line-mode)
  (delete-selection-mode)
  (setq use-dialog-box nil)
  (setq visible-bell t)
  (setq org-startup-indented t)
  (setq make-backup-files nil)
  (setq auto-save-default nil)
  (setq global-auto-revert-non-file-buffers t)
  (defalias 'yes-or-no-p 'y-or-n-p)
  (global-set-key (kbd "C-x k") 'kill-buffer-and-window)
  (global-set-key "\C-x\ \C-r" 'recentf-open-files)
  (add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+end_src
** Theme
#+begin_src emacs-lisp
  (use-package doom-themes
    :ensure t
    :init
    (load-theme 'doom-solarized-light t)
    :config
    (doom-themes-org-config)
    (doom-themes-visual-bell-config))
#+end_src
** Font
#+begin_src emacs-lisp
  (add-to-list 'default-frame-alist '(font . "JetBrains Mono-14"))
#+end_src
** Dashboard
#+begin_src emacs-lisp
  (use-package dashboard
    :ensure t
    :init
    (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) 
    (setq dashboard-startup-banner "~/.emacs.d/icon-emacs.png")
    (setq dashboard-banner-logo-title "I am just a coder for fun")
    (setq dashboard-center-content t)
    (setq dashboard-items '((recents  . 5)
                            ;; (bookmarks . 5)
                            (projects . 5)
                            (agenda . 5)
                            ;; (registers . 5)
                            ))
    :config
    (dashboard-setup-startup-hook))
#+end_src
** Modeline
#+begin_src emacs-lisp
  (use-package doom-modeline
    :ensure t
    :config (doom-modeline-mode)
    :custom ((doom-modeline-height 15)))
#+end_src
** Ansi-color for terminal
#+begin_src elisp
  (require 'ansi-color)
  (defun colorize-compilation-buffer ()
    (ansi-color-apply-on-region compilation-filter-start (point)))
  (add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
#+end_src
* Interface Functions
** Newsticker
#+begin_src emacs-lisp
  (setq newsticker-url-list
        '(("Bugsswriter Videos" "https://bugswriter.com/videos.xml")
          ("Muñe" "https://www.youtube.com/feeds/videos.xml?channel_id=UCSKzNn35M7HFzHgxz7OikMA")
          ("Last Dragon" "https://www.youtube.com/feeds/videos.xml?channel_id=UCllrFdkbcxcuAdzRHj-KSMA")
          ("Muy Linux" "https://www.muylinux.com/feed/")
          ("Xataka" "https://www.xataka.com.mx/feedburner.xml")))
  #+end_src
** Which key
#+begin_src emacs-lisp
  (use-package which-key
    :ensure t
    :init
    (setq which-key-idle-delay 0.3)
    :config
    (which-key-mode))
#+end_src
** Undo tree
#+begin_src emacs-lisp
  (use-package undo-tree
    :ensure t
    :config
    (global-undo-tree-mode))
#+end_src
** Writeroom
Delet the disctractions when write.
#+begin_src emacs-lisp
  (use-package writeroom-mode
    :ensure t)
#+end_src
** Rainbow Delimiter
Change the color of parentheses and other deleimiters depending of the
deep.
#+begin_src elisp
  (use-package rainbow-delimiters
    :ensure t
    :hook (prog-mode . rainbow-delimiters-mode))
#+end_src
** Avy
#+begin_src emacs-lisp
  (use-package avy
    :ensure t
    :bind
    ("C-." . avy-goto-char-timer))
#+end_src
* COMMENT hs-minor-mode
#+begin_src emacs-lisp
  (add-hook 'c-mode-common-hook   'hs-minor-mode)
  (add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
  (add-hook 'java-mode-hook       'hs-minor-mode)
  (add-hook 'lisp-mode-hook       'hs-minor-mode)
  (add-hook 'perl-mode-hook       'hs-minor-mode)
  (add-hook 'sh-mode-hook         'hs-minor-mode)
#+end_src
* Develop
** Projectile
#+begin_src emacs-lisp
  (use-package projectile
    :ensure t
    :bind ("C-x p" . projectile-command-map)
    :config (projectile-mode))
#+end_src
** Treemacs
#+begin_src emacs-lisp
  (use-package treemacs
    :ensure t
    :bind (("C-c t" . treemacs))
    :init (setq treemacs-width 30))
#+end_src
** Magit
#+begin_src emacs-lisp
  (use-package magit
    :ensure t
    :init
    (setq auto-revert-check-vc-info t))
#+end_src
** IDE
*** LSP
Language Server Protocol is for install support for diferent
languages.
#+begin_src emacs-lisp
  (use-package lsp-mode
    :ensure t
    :hook ((lsp-mode . lsp-enable-which-key-integration))
    :config (setq lsp-completion-enable-additional-text-edit nil))
  (use-package lsp-ui
    :ensure t
    :hook (lsp-mode . lsp-ui-mode)
    :custom (lsp-ui-doc-position 'bottom))
#+end_src
*** Dap
#+begin_src emacs-lisp
  (use-package dap-mode
    :after lsp-mode
    :ensure t
    :config (dap-auto-configure-mode))
#+end_src
*** Company
Code completation
#+begin_src emacs-lisp
  (use-package company
    :ensure t
    :after lsp-mode
    :hook (lsp-mode . company-mode)
    :bind
    (:map company-active-map ("<tab>" . company-complete-selection))
    (:map lsp-mode-map ("<tab>" . company-indent-or-complete-common))
    :custom
    (company-minimum-prefix-length 1)
    (company-idle-delay 0.0))

  (use-package company-box
    :ensure t
    :hook (company-mode . company-box-mode))
#+end_src
*** Yasnippet
#+begin_src emacs-lisp
  (use-package yasnippet
    :ensure t
    :config (yas-global-mode))
#+end_src
*** flycheck
#+begin_src emacs-lisp
  (use-package flycheck
    :ensure t)
#+end_src
** Web
*** Web Mode
#+begin_src emacs-lisp
  (use-package web-mode
    :ensure t
    :mode (("\\.html?\\'" . web-mode)
           ("\\.css?\\'" . web-mode))
    :init
    (setq web-mode-markup-indent-offset 2)
    (setq web-mode-css-indent-offset 2)
    (setq web-mode-code-indent-offset 2)
    (setq web-mode-enable-current-element-highlight t)
    (setq web-mode-enable-current-column-highlight t)
    :config
    (web-mode))
#+end_src
*** Emmet
#+begin_src emacs-lisp
  (use-package emmet-mode
    :ensure t
    :hook (sgml-mode css-mode web-mode)
    :config
    (emmet-mode)
    (emmet-preview-mode))
#+end_src
*** Javascript Mode
#+begin_src emacs-lisp
  (use-package js2-mode
    :ensure t
    :mode ("\\.js?\\'" . js2-mode)
    :init
    (setq js-indent-level 2))
#+end_src
*** Live Server
#+begin_src emacs-lisp
  (use-package simple-httpd
    :ensure t)
  (use-package impatient-mode
    :ensure t)
#+end_src
** Java
*** LSP
#+begin_src emacs-lisp
  (use-package lsp-java
    :hook ((java-mode . lsp)))
#+end_src
*** Dap
#+begin_src emacs-lisp
    (use-package dap-java
      :ensure nil
      :after (lsp-java))
#+end_src
** COMMENT PlantUML
#+begin_src emacs-lisp
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((plantuml . t))) ; this line activates plantuml

  (use-package plantuml-mode
    :ensure t
    :init
    (setq plantuml-default-exec-mode 'jar)
    (setq plantuml-jar-path "/usr/share/plantuml/plantuml.jar")
    (setq org-plantuml-jar-path (expand-file-name "/usr/share/plantuml/plantuml.jar"))
    (setq org-startup-with-inline-images t)
    (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
    (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))))
#+end_src