confi-emacs-inicial/init.el

151 lines
6.3 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
("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))))
'(inhibit-startup-screen t)
'(magit-diff-use-overlays nil)
'(package-selected-packages
(quote
(ac-emmet web-mode ac-html markdown-preview-mode multiple-cursors git-gutter powerline ample-zen-theme monokai-theme dracula-theme auto-complete windsize neotree all-the-icons spinner markdown-mode lv ht f evil dash-functional)))
'(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.
)
(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
(global-auto-complete-mode 1) ;Activar auto-completar por defecto
(ac-config-default)
(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-set-key (kbd "TAB") 'tab-to-tab-stop) ;n tab = 2 espacio
;(global-set-key "\t" (lambda () (interactive) (insert-char 32 2))) ; Un tab = 2 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)
(setq-default indent-tabs-mode nil) ;Desabilitar tabs y usar espacios
(setq backward-delete-char-untabify-method 'hungry) ;Eliminar los falsos tabs con un solo delete
(global-set-key (kbd "C-a") 'mark-whole-buffer); Seleccionar todo con CTRL+a
(global-set-key (kbd "C-<f9>") 'shell) ;Abrir terminal
;Neotree con iconitos y con tamaño dinámico y sin número de líneas
(require 'all-the-icons)
(require 'neotree)
(global-set-key [f9] 'neotree-toggle)
(setq neo-theme (if (display-graphic-p) 'icons 'all-the-icons))
(setq neo-window-fixed-size nil)
(setq-default neo-show-hidden-files t)
(defun my/disable-line-numbers (&optional dummy)
(display-line-numbers-mode -1))
(add-hook 'neo-after-create-hook 'my/disable-line-numbers)
;Cambiar el tamaño a las v entanas
(require 'windsize)
(setq windsize-cols 1)
(setq windsize-rows 1)
(add-hook 'after-init-hook #'windsize-default-keybindings)
;Git gutter - Marca si
(global-git-gutter-mode +1)
;Cursoles múltiples
(require 'multiple-cursors)
(global-set-key (kbd "C-d") 'mc/edit-lines) ;Editar todas las lineas seleccionadas
(global-set-key (kbd "C->") 'mc/mark-next-like-this) ;Selecionar siguiente como el actual
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) ;Seleccionar anteriores como el actual
(global-set-key (kbd "C-S-d") 'mc/mark-all-like-this) ;Seleccionar todos como el actual
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click) ;Añadir cursor con clics
(require 'web-mode)
(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 '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . 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)
(powerline-default-theme); Habilitar powerline (esa línea bonita de abajo del editor)
(require 'php-mode)
(add-hook 'php-mode-hook #'(lambda()
(php-enable-default-coding-style)
(setq c-basic-offset 2)
; (web-mode)
)) ;Pongo PHP siempre en webmode en caso de tener php-mode
; 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)
; Para PHP es recomendable instalar php-elisp: sudo apt install php-elisp