confi-emacs-actual/configs/init-packages.el

386 lines
12 KiB
EmacsLisp
Raw Normal View History

;;; init-packages.el --- Extensiones/paquetes instalados y su configuración -*- lexical-binding: t -*-
2022-03-30 01:21:13 +02:00
;; Author: kj <webmaster@outcontrol.net>
;; URL: https://git.kj2.me/kj/confi-emacs-actual
;;; Commentary:
2023-04-14 18:39:19 +02:00
;; Aquí se encuentran los paquetes de uso general.
;;
;; Aquellos de uso más específico, por ejemplo, los que
;; pertenecen a un lenguaje de programación en específico
;; estarán en el respectivo archivo de configuración
;; para dicho uso específico.
2022-03-30 01:21:13 +02:00
;;; Code:
;; Intercamiar buffers de lugar
(use-package buffer-move
2023-06-24 01:38:54 +02:00
:defer t
:bind (("M-S-<up>" . buf-move-up)
("M-S-<down>" . buf-move-down)
("M-S-<left>" . buf-move-left)
("M-S-<right>" . buf-move-right))
)
;; Mostrar la ayuda de eldoc/documentación en un childframe
(use-package eldoc-box
:defer t
:bind ("<f1>" . eldoc-box-help-at-point))
;; AI integrada en emacs usando ollama (https://ollama.ai/)
(use-package ellama
:defer t)
2023-04-13 19:04:04 +02:00
;; Seleccionar por regiones (similar a mark-sexp, pero toma en cuenta hacia atrás del cursor también)
(use-package expand-region
:defer t
:bind ("C-+" . er/expand-region))
;; Major mode para archivos CSV
(use-package csv-mode
:defer t
:hook ((csv-mode . csv-align-mode)
(csv-mode . csv-header-line))
)
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Un bonito y sencillo panel de inicio
(use-package dashboard
2023-04-18 07:21:36 +02:00
:defer t
:init
2022-11-19 07:16:53 +01:00
(dashboard-setup-startup-hook)
2023-04-18 07:21:36 +02:00
:config
(setq dashboard-set-file-icons t
dashboard-set-heading-icons t
dashboard-set-file-icons t
dashboard-week-agenda nil
dashboard-agenda-time-string-format "%Y-%m-%d %H:%M")
2022-05-16 06:13:25 +02:00
(setq dashboard-startup-banner
(expand-file-name "duck.svg" user-emacs-directory))
2022-05-16 06:13:25 +02:00
(setq dashboard-items '(
(agenda . 10)
;;(recents . 10)
))
)
2022-03-30 01:21:13 +02:00
;; Sidebar a la derecha con los archivos
(use-package dired-sidebar
2023-06-23 15:40:02 +02:00
:defer t
:hook (dired-mode . hl-line-mode)
:ensure t
:bind ([f9] . dired-sidebar-toggle-sidebar)
2023-06-23 15:40:02 +02:00
:commands (dired-sidebar-toggle-sidebar)
:config
(setq dired-sidebar-theme 'nerd
2023-08-17 16:20:55 +02:00
;; dired-sidebar-should-follow-file t
;; dired-sidebar-follow-file-idle-delay 0.5
))
2022-05-16 06:13:25 +02:00
;; Mover líneas o regiones
(use-package drag-stuff
2022-05-04 05:25:07 +02:00
:defer t
:hook
(elpaca-after-init . drag-stuff-global-mode)
2022-03-30 01:21:13 +02:00
:config
2022-05-16 06:13:25 +02:00
(drag-stuff-define-keys))
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; La línea bonita esa de abajo
(use-package doom-modeline
2022-05-04 05:25:07 +02:00
:defer t
:ensure t
:hook (elpaca-after-init . doom-modeline-mode)
:config
(setq doom-modeline-project-detection 'auto
doom-modeline-buffer-file-name-style 'relative-from-project
doom-modeline-major-mode-color-icon t
doom-modeline-buffer-modification-icon t
doom-modeline-indent-info nil
2022-05-16 06:13:25 +02:00
doom-modeline-persp-name t))
2022-03-30 01:21:13 +02:00
;; Emparejamiento automático de comillas, paréntesis, corchetes y llaves
(use-package electric-pair
:defer t
:elpaca nil
:hook (elpaca-after-init . electric-pair-mode)
:config
(setq electric-pair-delete-adjacent-pairs nil))
2022-05-16 06:13:25 +02:00
;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package git-gutter
2022-04-05 04:08:30 +02:00
:defer t
2022-03-30 01:21:13 +02:00
:hook
(elpaca-after-init . global-git-gutter-mode))
2022-03-30 01:21:13 +02:00
2023-04-14 18:39:19 +02:00
;; Resalta los escapes de secuencia
(use-package highlight-escape-sequences
:defer t
:hook (prog-mode . hes-mode)
:config
(setq hes-mode-alist
`((c-mode . ,hes-c/c++/objc-escape-sequence-re)
(c++-mode . ,hes-c/c++/objc-escape-sequence-re)
(objc-mode . ,hes-c/c++/objc-escape-sequence-re)
(go-mode . ,hes-c/c++/objc-escape-sequence-re)
(php-mode . ,hes-c/c++/objc-escape-sequence-re)
(java-mode . ,hes-java-escape-sequence-re)
(clojure-mode . ,hes-java-escape-sequence-re)
(js-mode . ,hes-js-escape-sequence-re)
(js2-mode . ,hes-js-escape-sequence-re)
(ruby-mode . ,hes-ruby-escape-sequence-keywords)
(lisp-mode . ,hes-elisp-escape-sequence-re)
(lisp-interaction-mode . ,hes-elisp-escape-sequence-re)
(emacs-lisp-mode . ,hes-elisp-escape-sequence-re))
)
)
;; Mostrar lo que se está presionando en pantalla
(use-package keypression
:defer t
:config
(setq keypression-use-child-frame t
keypression-fade-out-delay 1.0
keypression-frame-justify 'keypression-left-justified
keypression-cast-command-name t
keypression-cast-command-name-format "%s %s"
keypression-combine-same-keystrokes t
keypression-x-offset 50
keypression-y-offset 100
keypression-font-face-attribute '(:width normal :height 180 :weight bold))
)
;; Generador automatizado de archivos de licencia
(use-package license-templates
:defer t)
2022-05-16 06:13:25 +02:00
;; Magia para git
2022-05-27 23:04:28 +02:00
(use-package magit
:defer t)
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Modo markdown
2022-05-27 23:04:28 +02:00
(use-package markdown-mode
:defer t)
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Multiple vterm
(use-package multi-vterm
:defer t
2023-08-10 22:00:42 +02:00
:bind* (("<f5>" . multi-vterm-dedicated-toggle)
("C-x tt" . multi-vterm-dedicated-toggle)
("C-x tf" . multi-vterm)
("C-x tp" . multi-vterm-project)
;;("<tab>" . vterm-send-tab)
)
:ensure t)
2023-06-23 12:07:22 +02:00
;; Iconos bonitos para varias cosas
(use-package nerd-icons
2023-09-24 02:24:15 +02:00
:defer t)
2023-06-23 12:07:22 +02:00
;; Usar nerd-icons en dired
(use-package nerd-icons-dired
:defer t
2023-06-23 15:40:02 +02:00
:hook (dired-mode . nerd-icons-dired-mode))
2023-06-23 12:07:22 +02:00
2023-09-25 03:32:18 +02:00
;; Múltiples modos en un mismo buffer
(use-package polymode
:defer t)
2022-03-30 01:21:13 +02:00
2023-07-04 22:59:44 +02:00
;; Des-minifica / ordena el código
(use-package prettier
:defer t)
2023-07-04 22:59:44 +02:00
2022-05-16 06:13:25 +02:00
;; Paquete para manejo de proyectos
2022-03-30 01:21:13 +02:00
(use-package projectile
2022-05-04 05:25:07 +02:00
:defer t
:bind ("C-c p" . projectile-command-map)
:hook (elpaca-after-init . projectile-mode)
2022-03-30 01:21:13 +02:00
:init
(setq projectile-mode-line-prefix ""
projectile-sort-order 'recentf
projectile-use-git-grep t)
:config
2022-03-30 01:21:13 +02:00
;; Rutas de archivos temporales.
(setq projectile-cache-file (expand-file-name "projectile.cache" temp-dir))
(setq projectile-known-projects-file (expand-file-name
"projectile-bookmarks.eld" temp-dir))
;; Cambiar el título de la ventana de emacs
(setq frame-title-format
'(
(:eval
(let ((project-name (projectile-project-name)))
(unless (string= "-" project-name)
(format "[%s] " project-name))))
"%b"
" - Emacs")
)
(defun projectile-desktop-save-hook ()
"Nombres de los archivos de desktop-save según el nombre del proyecto."
(setq desktop-hash
(secure-hash 'md5 (concat (projectile-project-root))))
(setq
desktop-base-file-name (concat ".emacs-" desktop-hash ".desktop")
desktop-base-lock-name (concat ".emacs-" desktop-hash ".desktop" ".lock"))
)
(add-hook 'projectile-after-switch-project-hook #'projectile-desktop-save-hook)
)
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Recentf - Guarda registro de los archivos abiertos recientemente
(use-package recentf
2022-05-04 05:25:07 +02:00
:defer t
:elpaca nil
:bind ("C-x C-r" . recentf-open-files)
2022-03-30 01:21:13 +02:00
:config
2022-05-16 06:13:25 +02:00
(setq recentf-save-file
(recentf-expand-file-name (concat temp-dir "/recentf")))
(recentf-mode 1))
2022-03-30 01:21:13 +02:00
;; Busqueda rápida con ripgrep
(use-package rg
:defer t
:defines projectile-command-map
:hook (elpaca-after-init . rg-enable-default-bindings)
:bind (:map rg-global-map
("c" . rg-dwim-current-dir)
("f" . rg-dwim-current-file)
("m" . rg-menu))
:init (setq rg-group-result t
rg-show-columns t)
:config
(cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)
(with-eval-after-load 'projectile
(bind-key "s R" #'rg-project projectile-command-map)))
2022-05-16 06:13:25 +02:00
;; Guardar la posición del cursor en un archivo para volver allí cuando se lo vuelva a abrir.
(use-package saveplace
:elpaca nil
:hook (elpaca-after-init . save-place-mode)
2022-03-30 01:21:13 +02:00
:config
2022-05-16 06:13:25 +02:00
(setq save-place-file (locate-user-emacs-file (concat temp-dir "/places"))))
2022-03-30 01:21:13 +02:00
2023-06-21 11:55:02 +02:00
;; Paquete para crear imágens (solo lo uso para sacar capturas SVG de emacs)
(use-package silicon
:ensure t
:defer t
:elpaca (:host github :repo "iensu/silicon-el"))
2023-06-21 11:55:02 +02:00
2022-05-16 06:13:25 +02:00
;; Mejorando el scroll
(use-package smooth-scrolling
:defer t
:hook (elpaca-after-init . smooth-scrolling-mode)
2022-03-30 01:21:13 +02:00
:config
2022-05-16 06:13:25 +02:00
(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)
)
2022-03-30 01:21:13 +02:00
2023-06-21 11:55:02 +02:00
;; Ayuda a manipular los archivos con líneas demasiado largas
(use-package so-long
:defer t
:elpaca nil
2023-06-21 11:55:02 +02:00
:bind (:map so-long-mode-map
("C-s" . isearch-forward)
("C-r" . isearch-backward))
:config
(setq so-long-variable-overrides
'((bidi-inhibit-bpa . t)
(bidi-paragraph-direction . left-to-right)
(buffer-read-only . nil)
(global-hl-line-mode . nil)
(line-move-visual . t)
(show-paren-mode . nil)
(truncate-lines . nil)
(which-func-mode . nil)))
)
2023-09-25 03:32:18 +02:00
;; Mecanografía
(use-package speed-type
:defer t
:hook
(speed-type-mode . (lambda ()
(display-line-numbers-mode 0)
(visual-line-mode 1)
(visual-fill-column-mode 1)))
2023-09-25 03:32:18 +02:00
:diminish
:config
(setq speed-type-gb-book-list '(66867 66866 66591 57303)
speed-type-min-chars 500
speed-type-max-chars 600))
;; Tree-sitter :)
(use-package treesit
:defer t
:elpaca nil
:commands (treesit-install-language-grammar nf/treesit-install-all-languages)
:config
(setq treesit-language-source-alist
'((bash . ("https://github.com/tree-sitter/tree-sitter-bash"))
(c . ("https://github.com/tree-sitter/tree-sitter-c"))
(cpp . ("https://github.com/tree-sitter/tree-sitter-cpp"))
(css . ("https://github.com/tree-sitter/tree-sitter-css"))
(go . ("https://github.com/tree-sitter/tree-sitter-go"))
(haskell . ("https://github.com/tree-sitter/tree-sitter-haskell"))
(html . ("https://github.com/tree-sitter/tree-sitter-html"))
(java . ("https://github.com/tree-sitter/tree-sitter-java"))
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript"))
(json . ("https://github.com/tree-sitter/tree-sitter-json"))
(julia . ("https://github.com/tree-sitter/tree-sitter-julia"))
(lua . ("https://github.com/Azganoth/tree-sitter-lua"))
(make . ("https://github.com/alemuller/tree-sitter-make"))
(python . ("https://github.com/tree-sitter/tree-sitter-python"))
(php . ("https://github.com/tree-sitter/tree-sitter-php"))
(ruby . ("https://github.com/tree-sitter/tree-sitter-ruby"))
(rust . ("https://github.com/tree-sitter/tree-sitter-rust"))
(sql . ("https://github.com/m-novikov/tree-sitter-sql"))
(toml . ("https://github.com/tree-sitter/tree-sitter-toml"))
(zig . ("https://github.com/GrayJack/tree-sitter-zig"))))
(defun nf/treesit-install-all-languages ()
"Install all languages specified by `treesit-language-source-alist'."
(interactive)
(let ((languages (mapcar 'car treesit-language-source-alist)))
(dolist (lang languages)
(treesit-install-language-grammar lang)
(message "`%s' parser was installed." lang)
(sit-for 0.75)))))
;; Cuando presionas enter en un bloque de comentario sigue el estilo del bloque.
;; (use-package vs-comment-return
;; :elpaca (:host github :repo "emacs-vs/vs-comment-return")
;; :defer t
;; :hook (prog-mode . vs-comment-return-mode)
;; )
2023-04-14 18:39:19 +02:00
;; Mostrar el último commit que modificó la linea actual
(use-package vc-msg
:defer t
:bind (("C-c v" . vc-msg-show)
("C-c C-v" . vc-msg-show))
)
2022-05-16 06:13:25 +02:00
;; Terminal
(use-package vterm
:ensure t
:defer t)
2022-03-30 01:21:13 +02:00
;; Cuando iniicias un atajo de teclas te muestra las posibilidades
2022-05-16 06:13:25 +02:00
(use-package which-key
:defer t
:hook (elpaca-after-init . which-key-mode))
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Restaurar el estado de los frames
(use-package winner
:elpaca nil
2022-05-16 06:13:25 +02:00
:defer t
:hook (elpaca-after-init . winner-mode))
2022-05-04 05:25:07 +02:00
2022-11-29 08:45:09 +01:00
;; Emacs Start Up Profiler
2023-04-18 07:21:36 +02:00
(use-package esup
:defer t)
2022-03-30 01:21:13 +02:00
(provide 'init-packages)
;;; init-packages.el ends here