195 lines
9.1 KiB
EmacsLisp
195 lines
9.1 KiB
EmacsLisp
;Repositorio MELPA.
|
|
(require 'package)
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
|
;Directorio personalizado para mis themes.
|
|
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
|
|
(package-initialize)
|
|
|
|
;Aquí vienen cosas de los themes y los paquetes.
|
|
(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.
|
|
'(ansi-color-names-vector
|
|
["#212121" "#CC5542" "#6aaf50" "#7d7c61" "#5180b3" "#DC8CC3" "#9b55c3" "#bdbdb3"])
|
|
'(compilation-message-face (quote default))
|
|
'(custom-enabled-themes (quote (dracula)))
|
|
'(custom-safe-themes
|
|
(quote
|
|
("24714e2cb4a9d6ec1335de295966906474fdb668429549416ed8636196cb1441" "fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "c7eb06356fd16a1f552cfc40d900fe7326ae17ae7578f0ef5ba1edd4fdd09e58" "f3ab34b145c3b2a0f3a570ddff8fabb92dafc7679ac19444c31058ac305275e1" "dcdd1471fde79899ae47152d090e3551b889edf4b46f00df36d653adc2bf550d" "3994b1c5c1f412c025bb71b2df5973a421c257afee5278684639c205d79d93ee" default)))
|
|
'(fci-rule-color "#2e2e2e")
|
|
'(highlight-changes-colors (quote ("#FD5FF0" "#AE81FF")))
|
|
'(highlight-tail-colors
|
|
(quote
|
|
(("#3C3D37" . 0)
|
|
("#679A01" . 20)
|
|
("#4BBEAE" . 30)
|
|
("#1DB4D0" . 50)
|
|
("#9A8F21" . 60)
|
|
("#A75B00" . 70)
|
|
("#F309DF" . 85)
|
|
("#3C3D37" . 100))))
|
|
'(hl-todo-keyword-faces
|
|
(quote
|
|
(("TODO" . "#dc752f")
|
|
("NEXT" . "#dc752f")
|
|
("THEM" . "#2d9574")
|
|
("PROG" . "#4f97d7")
|
|
("OKAY" . "#4f97d7")
|
|
("DONT" . "#f2241f")
|
|
("FAIL" . "#f2241f")
|
|
("DONE" . "#86dc2f")
|
|
("NOTE" . "#b1951d")
|
|
("KLUDGE" . "#b1951d")
|
|
("HACK" . "#b1951d")
|
|
("TEMP" . "#b1951d")
|
|
("FIXME" . "#dc752f")
|
|
("XXX+" . "#dc752f")
|
|
("\\?\\?\\?+" . "#dc752f"))))
|
|
'(inhibit-startup-screen t)
|
|
'(magit-diff-use-overlays nil)
|
|
'(package-selected-packages
|
|
(quote
|
|
(dumb-jump csharp-mode yaml-mode smooth-scrolling web-mode multi-web-mode spacemacs-theme flycheck ac-emmet markdown-preview-mode multiple-cursors git-gutter powerline ample-zen-theme monokai-theme dracula-theme auto-complete neotree all-the-icons spinner markdown-mode lv ht f dash-functional)))
|
|
'(pdf-view-midnight-colors (quote ("#b2b2b2" . "#292b2e")))
|
|
'(pos-tip-background-color "#FFFACE")
|
|
'(pos-tip-foreground-color "#272822")
|
|
'(vc-annotate-background "#3b3b3b")
|
|
'(vc-annotate-color-map
|
|
(quote
|
|
((20 . "#dd5542")
|
|
(40 . "#CC5542")
|
|
(60 . "#fb8512")
|
|
(80 . "#baba36")
|
|
(100 . "#bdbc61")
|
|
(120 . "#7d7c61")
|
|
(140 . "#6abd50")
|
|
(160 . "#6aaf50")
|
|
(180 . "#6aa350")
|
|
(200 . "#6a9550")
|
|
(220 . "#6a8550")
|
|
(240 . "#6a7550")
|
|
(260 . "#9b55c3")
|
|
(280 . "#6CA0A3")
|
|
(300 . "#528fd1")
|
|
(320 . "#5180b3")
|
|
(340 . "#6380b3")
|
|
(360 . "#DC8CC3"))))
|
|
'(vc-annotate-very-old-color "#DC8CC3")
|
|
'(weechat-color-list
|
|
(quote
|
|
(unspecified "#272822" "#3C3D37" "#F70057" "#F92672" "#86C30D" "#A6E22E" "#BEB244" "#E6DB74" "#40CAE4" "#66D9EF" "#FB35EA" "#FD5FF0" "#74DBCD" "#A1EFE4" "#F8F8F2" "#F8F8F0"))))
|
|
(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.
|
|
)
|
|
|
|
;Configuraciones varias.
|
|
(menu-bar-mode 0) ;Quitar menús.
|
|
(tool-bar-mode 0) ;Quitar toolbar.
|
|
(global-display-line-numbers-mode) ;Mostar número de línea.
|
|
(setq auto-save-default nil) ;Deshabilitar #backups# de buffer.
|
|
(setq make-backup-files nil) ;Deshabilitar ~backups.
|
|
(setq-default cursor-type 'bar) ;Define el cursor por defecto.
|
|
(global-auto-complete-mode 1) ;Activar auto-completar por defecto.
|
|
(ac-config-default) ;Carcar configuración de auto-complete (no recuerdo bien que era esto, puedes revisar la domentación).
|
|
(setq ac-ignore-case nil) ;desactivar el autocapitalizado.
|
|
(setq ac-disable-faces nil) ;auto-complete hablitado incluso entre comillas (fuente: https://bit.ly/3a9wCB4).
|
|
(toggle-scroll-bar -1) ;Eliminar barra de desplazamiento.
|
|
(show-paren-mode 1) ;Habilitar resaltado de brackets.
|
|
(cua-mode t) ;Usar CTRL+X, CTRL+C, CTRL+V y CTRL+Z para cortar, copiar, pegar y deshacer.
|
|
(setq-default cursor-in-non-selected-windows nil) ;Desaparecer el cursor en frames no activos.
|
|
(global-git-gutter-mode +1) ;Git gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
|
|
(powerline-default-theme) ;Habilitar powerline (esa línea bonita de abajo del editor)
|
|
(global-hl-line-mode 1) ;Resaltar línea actual por defecto.
|
|
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate) ;Habilitar Jump to definition (M-.)
|
|
(global-set-key (kbd "C-<f5>") 'recompile) ;Atajo para compilar
|
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) ;Cancelar acción en minibuffer con un solo ESC
|
|
(setq ido-everywhere t)
|
|
(ido-mode 1) ;Habilitar autocompletado "ido" en el minibuffer de manera global (Cuando presionas C+x C+f).
|
|
|
|
;Desabilitar tabs y usar 2 espacios en su lugar
|
|
(setq-default indent-tabs-mode nil) ;Cambiar tabs por espacios
|
|
(setq-default tab-width 2)
|
|
(setq tab-width 2
|
|
c-basic-offset 2
|
|
c-basic-indent 2
|
|
tab-stop-list '(2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40)
|
|
js-indent-level 2
|
|
css-indent-offset 2)
|
|
(c-set-offset 'case-label 2)
|
|
(c-set-offset 'statement-case-intro 2)
|
|
(require 'web-mode)
|
|
(setq web-mode-css-indent-offset 2
|
|
web-mode-code-indent-offset 2
|
|
web-mode-sql-indent-offset 2
|
|
web-mode-script-padding 2
|
|
web-mode-markup-indent-offset 2)
|
|
(require 'php-mode)
|
|
(add-hook 'php-mode-hook #'(lambda()
|
|
(php-enable-default-coding-style)
|
|
(setq c-basic-offset 2) ;Cambio los tabs por 2 espacios (PSR recomienda 4, pero editores como atom y VScode al momento de que configuro esto usan 2 y prefiero mantener esa compatibilidad entre editores).
|
|
))
|
|
(setq backward-delete-char-untabify-method 'hungry) ;Eliminar los falsos tabs con un solo delete.
|
|
|
|
;Atajos de teclas
|
|
(global-set-key (kbd "C-a") 'mark-whole-buffer); Seleccionar todo con CTRL+A.
|
|
(global-set-key [f9] 'neotree-toggle) ;Abrir/Cerrar neotree.
|
|
;(global-set-key (kbd "C-<f9>") 'shell) ;Abrir terminal.
|
|
;Cursores múltiples
|
|
(require 'multiple-cursors)
|
|
(global-set-key (kbd "C-d") 'mc/edit-lines) ;Cursor en todas las lineas seleccionadas.
|
|
(global-set-key (kbd "C->") 'mc/mark-next-like-this) ;Cursor en siguiente como el actual seleccionado.
|
|
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) ;Cursor en anteriores como el actual seleccionado.
|
|
(global-set-key (kbd "C-S-d") 'mc/mark-all-like-this) ;Cursor en todos como el actual selecionado.
|
|
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click) ;Añadir cursor con clics (Shift+CTRL+Clic).
|
|
|
|
;Mejorando el scroll
|
|
(require 'smooth-scrolling)
|
|
(smooth-scrolling-mode 1) ;Cambia el salto de líneas cuando el cursor llega al final.
|
|
(setq mouse-wheel-scroll-amount '(8 ((shift) . 1) ((control) . nil))) ;Cambia el scroll a 8 líneas a la vez, 1 cuando se preciona SHIFT y saltos de página cuando presionas CTRL
|
|
(setq mouse-wheel-progressive-speed nil) ;Deshabilita la velocidad progresiva del scroll (mientras más scroll haces, mas rápido va)
|
|
|
|
;Neotree con iconitos y con tamaño dinámico y sin número de líneas.
|
|
(require 'all-the-icons)
|
|
(require 'neotree)
|
|
(setq neo-theme (if (display-graphic-p) 'icons 'all-the-icons))
|
|
(setq neo-window-fixed-size nil)
|
|
;(setq-default neo-show-hidden-files t) ;Mostar archivos ocultos
|
|
(setq neo-hidden-regexp-list '("^#.*$" "^\\.#.*$" )) ;Mostrar archivos ocultos excepto los #archivos y .#archivos
|
|
(defun my/disable-line-numbers (&optional dummy)
|
|
(display-line-numbers-mode -1))
|
|
(add-hook 'neo-after-create-hook 'my/disable-line-numbers)
|
|
|
|
;Cambiar de major-mode en un archivo que tiene php, html, css y js a la vez según el fracmento de código donde pones el cursor.
|
|
(require 'multi-web-mode)
|
|
(setq mweb-default-major-mode 'web-mode)
|
|
(setq mweb-tags '((php-mode "<\\?php\\|<\\? \\|<\\?=" "\\?>")
|
|
(js-mode "<script +\\(type=\"text/javascript\"\\|language=\"javascript\"\\)[^>]*>" "</script>")
|
|
(css-mode "<style +type=\"text/css\"[^>]*>" "</style>")))
|
|
(setq mweb-filename-extensions '("php" "htm" "html"))
|
|
;(multi-web-global-mode 1)
|
|
|
|
;Habilitar auto-complete-mode en html-mode.
|
|
(add-hook 'html-mode-hook #'(lambda()
|
|
(auto-complete-mode)
|
|
))
|
|
|
|
;Habilitar auto-complete-mode en sql-mode.
|
|
(add-hook 'sql-mode-hook #'(lambda()
|
|
(auto-complete-mode)
|
|
))
|
|
|
|
;Cambiar comando de compilación por defecto en csharp
|
|
(add-hook 'csharp-mode-hook #'(lambda()
|
|
(setq compile-command "dotnet run")
|
|
))
|
|
;Borrar espacios, tabs y saltos de línea innecesarios al guardar
|
|
(add-hook 'before-save-hook 'kj-delete-trailing-whitespace)
|
|
|
|
(defun kj-delete-trailing-whitespace ()
|
|
(delete-trailing-whitespace))
|