2022-11-23 04:04:38 +01:00
;;; 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:
2024-04-26 09:36:07 +02:00
;; Mejora del reemplazo
( use-package anzu
:defer t
:bind ( ( [ remap query-replace ] . anzu-query-replace )
( [ remap query-replace-regexp ] . anzu-query-replace-regexp ) ) )
2023-04-13 13:13:59 +02:00
;; Intercamiar buffers de lugar
( use-package buffer-move
2023-06-24 01:38:54 +02:00
:defer t
2023-04-13 13:13:59 +02:00
: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 ) )
)
2023-04-15 05:37:36 +02:00
;; Mostrar la ayuda de eldoc/documentación en un childframe
( use-package eldoc-box
:defer t
:bind ( " <f1> " . eldoc-box-help-at-point ) )
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
2024-09-13 05:18:22 +02:00
:bind ( ( " C-+ " . er/expand-region )
( " C-= " . er/expand-region ) ) )
2023-04-13 19:04:04 +02:00
2023-04-13 13:13:59 +02:00
;; 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
2024-05-03 10:41:06 +02:00
;; Visor de documentos de emacs (soporta de todo: epub, pdf, odt, docx, cbz, etc.)
( use-package doc-view
:defer t
:hook
( doc-view-mode . ( lambda ( )
( display-line-numbers-mode 0 ) ) )
:ensure nil )
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 )
2024-04-26 07:24:39 +02:00
:hook
( dashboard-after-initialize . ( lambda ( )
" Refrescamos el dashboard con la agenda luego de cargar todo "
( setq dashboard-items ' (
;; (recents . 10)
( agenda . 10 )
) )
( dashboard-refresh-buffer )
) )
2023-04-18 07:21:36 +02:00
:config
2022-06-27 22:01:08 +02:00
( 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
2023-04-30 01:46:23 +02:00
( expand-file-name " duck.svg " user-emacs-directory ) )
2024-04-26 07:24:39 +02:00
( setq dashboard-items ' ( ) )
2022-05-16 06:13:25 +02:00
)
2022-03-30 01:21:13 +02:00
2024-03-21 03:58:23 +01:00
;; Coloca en emacs la documentacón distribuída por devdocs.io
( use-package devdocs
:defer t )
2023-06-23 10:40:02 +02:00
;; Sidebar a la derecha con los archivos
( use-package dired-sidebar
2023-06-23 15:40:02 +02:00
:defer t
2023-06-24 19:22:35 +02:00
:hook ( dired-mode . hl-line-mode )
2023-06-23 10:40:02 +02:00
: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
) )
2023-06-23 10:40:02 +02:00
2022-05-16 06:13:25 +02:00
;; La línea bonita esa de abajo
2022-04-21 19:45:31 +02:00
( use-package doom-modeline
2022-05-04 05:25:07 +02:00
:defer t
2022-04-21 19:45:31 +02:00
:ensure t
2023-09-16 20:05:56 +02:00
:hook ( elpaca-after-init . doom-modeline-mode )
2022-04-21 19:45:31 +02:00
: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
2024-11-15 14:28:12 +01:00
;; Modo para edición de arc docker compose
( use-package docker-compose-mode
:ensure t
:defer t )
2024-09-07 17:07:44 +02:00
;; Modo para la edición de archivos Dockerfile (y building desde emacs)
( use-package dockerfile-mode
:ensure t
:defer t
:config
;; Suelo tener podman siempre en lugar de docker, así que lo definimos como el comando a usar
( setq dockerfile-mode-command " podman " ) )
;; Mover líneas o regiones
( use-package drag-stuff
:defer t
:hook
( elpaca-after-init . drag-stuff-global-mode )
:config
( drag-stuff-define-keys ) )
2022-11-28 11:18:05 +01:00
;; Emparejamiento automático de comillas, paréntesis, corchetes y llaves
2024-09-24 19:34:38 +02:00
;; (use-package electric-pair
;; :defer t
;; :ensure nil
;; :hook (elpaca-after-init . electric-pair-mode)
;; :config
;; (setq electric-pair-delete-adjacent-pairs nil))
2022-11-28 11:18:05 +01:00
2024-11-28 00:04:54 +01:00
;; Cargar las variables de entorno desde la configuración del usuario
( use-package exec-path-from-shell
:hook
( elpaca-after-init . exec-path-from-shell-initialize )
:defer t )
2024-03-21 02:41:11 +01:00
;; Cliente LLM (ollama, chatgpt, gemini, etc.)
( use-package gptel
:defer t
:config
2024-09-21 18:41:05 +02:00
( setq gptel-model " gemma2 "
2024-03-21 02:41:11 +01:00
gptel-backend ( gptel-make-ollama " Ollama "
:host " localhost:11434 "
:stream t
2024-09-21 18:41:05 +02:00
:models ' ( " mistral:latest " " dolphin-llama3:latest " " gemma2 " " llava:latest " ) )
2024-03-21 02:41:11 +01:00
gptel-default-mode 'org-mode
gptel-prompt-prefix-alist
' ( ( markdown-mode . " # " )
( org-mode . " * " )
( text-mode . " # " ) )
gptel-directives
' ( ( default . " Eres un LLM que vive dentro de Emacs. Responde de manera concisa. " )
( programming . " Eres un LLM y un programador profesional cuidadoso. Provee el código y solo el código como output sin ningún texto adicional, prompt o nota. " )
( programming_tutor . " Eres un LLM y un programador profesional cuidadoso. Revisa el siguiente código y realiza sugerencias concisas en español para mejorarlo. " )
( programming_explainer . " Eres un LLM y un programador profesional cuidadoso. Revisa el siguiente código y explica en español de manera concisa, su funcionamiento. " )
( programming_describer . " Eres un LLM y un programador profesional cuidadoso. Revisa el siguiente código y explica en español su funcionamiento línea a línea. " )
( writing . " Eres un LLM y un asistente de escritura. Responde de manera concisa. " )
2024-04-18 11:31:51 +02:00
( grammarly . " You are a large language model and professional philologist. Improve grammar and spelling. " )
( chat . " Eres un LLM y un compañero de conversación. Responde de manera concisa. " )
2024-04-24 05:59:04 +02:00
( traductor . " Eres un traductor de libros de informática profesional. Traduce a español tomando en cuenta los posibles tecnicismos que no deberían traducirse. " )
2024-03-21 02:41:11 +01:00
)
)
)
2023-04-14 18:39:19 +02:00
;; Resalta los escapes de secuencia
2023-04-13 13:13:59 +02:00
( 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 )
2024-07-02 17:55:47 +02:00
( php-ts-mode . , hes-c/c++/objc-escape-sequence-re )
2023-04-13 13:13:59 +02:00
( 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 ) )
)
)
2024-04-04 01:19:21 +02:00
;; Resaltar palabras clave como TODO, FIXME, etc. en comentarios del código.
( use-package hl-todo
2024-05-09 14:39:58 +02:00
:ensure ( hl-todo :version ( lambda ( _ ) " 3.6.0 " ) )
2024-04-04 01:19:21 +02:00
:defer t
2024-04-22 06:20:32 +02:00
:hook ( prog-mode . hl-todo-mode )
:config
( add-to-list 'hl-todo-keyword-faces ' ( " BUG " . " #d99600 " ) ) )
2024-04-04 01:19:21 +02:00
2024-05-16 03:21:40 +02:00
;; Paquete para exportar buffers de emacs a HTML
( use-package htmlize
:defer t
:ensure t )
2024-04-12 20:01:27 +02:00
;; Permite crear conjuntos de atajos.
( use-package hydra
:defer t )
2023-04-13 13:13:59 +02:00
;; 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 ) )
)
2022-05-16 06:13:25 +02:00
;; Modo markdown
2022-05-27 23:04:28 +02:00
( use-package markdown-mode
2023-09-16 20:05:56 +02:00
:defer t )
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Multiple vterm
2022-06-01 15:18:06 +02:00
( 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 )
2022-06-01 15:18:06 +02:00
( " 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
2024-02-19 05:08:11 +01:00
;; Modo para leer archivos de configuración de nginx
( use-package nginx-mode
2023-11-13 22:34:29 +01:00
:defer t )
2023-09-25 03:32:18 +02:00
;; Múltiples modos en un mismo buffer
2024-04-25 22:54:11 +02:00
;; (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
2023-09-16 20:05:56 +02:00
:defer t )
2023-07-04 22:59:44 +02:00
2024-04-14 01:02:22 +02:00
( use-package project
2022-05-04 05:25:07 +02:00
:defer t
2024-04-14 01:02:22 +02:00
:ensure nil
2022-05-18 09:43:24 +02:00
:config
2024-04-14 01:02:22 +02:00
;; Colocamos un título del frame más bonito y útil que el por defecto
2022-03-30 01:21:13 +02:00
( setq frame-title-format
' (
( :eval
2024-04-14 01:02:22 +02:00
( let ( ( project-name ( kj/project-name ) ) )
( unless ( null project-name )
2022-03-30 01:21:13 +02:00
( format " [%s] " project-name ) ) ) )
" %b "
" - Emacs " )
)
2024-04-14 01:02:22 +02:00
)
2022-08-23 01:42:46 +02:00
2024-04-21 23:56:25 +02:00
;; Correr el código desde el buffer de emacs
( use-package quickrun
:defer t
:ensure t
2024-04-22 00:07:47 +02:00
:bind ( :map prog-mode-map
2024-04-27 15:56:15 +02:00
( " C-c C-r " . quickrun )
( " C-c r f " . quickrun )
( " C-c r r " . quickrun-region )
( " C-c r R " . quickrun-replace-region )
2024-04-22 00:07:47 +02:00
)
)
2022-08-23 01:42:46 +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
2024-04-04 00:40:00 +02:00
:ensure nil
2022-06-01 15:18:06 +02:00
:bind ( " C-x C-r " . recentf-open-files )
2024-04-27 07:24:25 +02:00
:hook ( after-load-theme . recentf-mode )
2022-03-30 01:21:13 +02:00
:config
2022-05-16 06:13:25 +02:00
( setq recentf-save-file
2024-04-12 14:08:49 +02:00
( recentf-expand-file-name ( concat temp-dir " /recentf " ) )
2024-04-27 07:24:25 +02:00
recentf-auto-cleanup 'never
recentf-keep ' ( file-remote-p file-readable-p )
2024-04-12 14:08:49 +02:00
recentf-max-saved-items 1000
2024-04-26 07:24:39 +02:00
recentf-max-menu-items 500 ) )
2022-03-30 01:21:13 +02:00
2022-06-01 15:18:06 +02:00
;; Busqueda rápida con ripgrep
( use-package rg
:defer t
2024-04-27 07:24:25 +02:00
;; :hook (elpaca-after-init . rg-enable-default-bindings)
2022-06-01 15:18:06 +02:00
:bind ( :map rg-global-map
( " c " . rg-dwim-current-dir )
( " f " . rg-dwim-current-file )
( " m " . rg-menu ) )
:config
2024-04-26 08:20:53 +02:00
( setq rg-group-result t
rg-show-columns t )
2024-04-14 01:02:22 +02:00
( cl-pushnew ' ( " tmpl " . " *.tmpl " ) rg-custom-type-aliases ) )
2022-06-01 15:18:06 +02:00
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
2024-04-04 00:40:00 +02:00
:ensure nil
2024-04-26 07:24:39 +02:00
:defer t
:hook
( elpaca-after-init . ( lambda ( )
( setq save-place-file ( locate-user-emacs-file ( concat temp-dir " /places " ) ) )
( save-place-mode 1 )
) )
2024-04-24 05:59:40 +02:00
)
2022-03-30 01:21:13 +02:00
2022-05-16 06:13:25 +02:00
;; Mejorando el scroll
( use-package smooth-scrolling
:defer t
2023-09-16 20:05:56 +02:00
: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
2023-04-13 13:13:59 +02:00
:defer t
2024-04-04 00:40:00 +02:00
:ensure 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 ) ) )
)
2022-07-12 22:36:51 +02:00
2023-09-25 03:32:18 +02:00
;; Mecanografía
( use-package speed-type
:defer t
2023-10-15 16:32:13 +02:00
:hook
( speed-type-mode . ( lambda ( )
2024-09-14 02:37:07 +02:00
( corfu-mode 0 )
2023-10-15 16:32:13 +02:00
( display-line-numbers-mode 0 )
( visual-line-mode 1 )
( visual-fill-column-mode 1 ) ) )
2023-09-25 03:32:18 +02:00
:diminish
:config
2024-09-14 02:37:07 +02:00
( setq speed-type-gb-book-list ' ( 66867 66866 66591 57303 15725 24536 )
speed-type-min-chars 300
2023-09-25 03:32:18 +02:00
speed-type-max-chars 600 ) )
2023-04-19 00:49:47 +02:00
;; Tree-sitter :)
( use-package treesit
:defer t
2024-04-04 00:40:00 +02:00
:ensure nil
2023-04-19 00:49:47 +02:00
: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 " ) )
2024-11-28 00:05:11 +01:00
( jsdoc . ( " https://github.com/tree-sitter/tree-sitter-jsdoc " ) )
2023-04-19 00:49:47 +02:00
( 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 " ) )
2024-03-03 07:18:57 +01:00
( php . ( " https://github.com/tree-sitter/tree-sitter-php " " master " " php/src " ) )
2024-11-28 00:05:11 +01:00
( phpdoc . ( " https://github.com/claytonrcarter/tree-sitter-phpdoc " ) )
2023-04-19 00:49:47 +02:00
( 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 ) ) ) ) )
2022-05-16 06:13:25 +02:00
;; Terminal
2023-09-16 20:05:56 +02:00
( use-package vterm
:ensure t
2024-04-25 20:57:58 +02:00
:defer t
:config
( setq tramp-histfile-override nil ) ;; Dejamos que se use el history por defecto del servidor remoto
2024-05-06 07:00:39 +02:00
( setq vterm-tramp-shells ' ( ( " ssh " " /bin/bash " )
( " sshx " " /bin/bash " )
( " docker " " /bin/bash " )
2024-04-25 20:57:58 +02:00
( " podman " " /bin/bash " ) ) ) ;; Tanto docker como podman usarán bash cuado se contecte mediante tramp
)
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
2023-09-16 20:05:56 +02:00
: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
2024-04-04 00:40:00 +02:00
:ensure nil
2022-05-16 06:13:25 +02:00
:defer t
2023-09-16 20:05:56 +02:00
: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
2023-09-16 20:05:56 +02:00
:defer t )
2022-03-30 01:21:13 +02:00
2022-11-23 04:04:38 +01:00
( provide 'init-packages )
;;; init-packages.el ends here