Big re-write :)

I reordered the code in a more clean an organized way. Also this improves a lot
the emacs startup time again, bucause after some updates it becomes a bit slow
with the old configuration, so i did it again in a new way.
This commit is contained in:
kj
2025-07-20 13:18:05 -03:00
parent 6ca3a756ad
commit dabaf86f28
29 changed files with 1426 additions and 838 deletions

View File

@ -15,7 +15,6 @@
;; Resolver diferencias entre 2 archivos o versiones del mismo.
(use-package ediff
:defer t
:ensure nil
:config
(setq ediff-diff-options "")
@ -23,48 +22,84 @@
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(setq ediff-split-window-function 'split-window-vertically))
;; Git Gutter - Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package git-gutter
:defer t
;; Marca a la izq. si una linea ha sido agregada, editada o eliminada desde el último commit.
(use-package diff-hl
:custom (diff-hl-draw-borders nil)
:autoload diff-hl-flydiff-mode
:custom-face
(diff-hl-change ((t (:inherit custom-changed :foreground unspecified :background unspecified))))
(diff-hl-insert ((t (:inherit diff-added :background unspecified))))
(diff-hl-delete ((t (:inherit diff-removed :background unspecified))))
:bind (:map diff-hl-command-map
("SPC" . diff-hl-mark-hunk))
:hook ((elpaca-after-init . global-diff-hl-mode)
(elpaca-after-init . global-diff-hl-show-hunk-mouse-mode)
(dired-mode . diff-hl-dired-mode))
:config
(global-git-gutter-mode 1)
(defhydra hydra-git-gutter (:hint nil)
"
^Navigation^ | ^Actions^ | ^Others^
-^-----------^-+-^----^--------+-^-------^----------
_p_: previous | _s_: stage | _m_: mark
_n_: next | _r_: revert | _SPC_: toggle info
-^-----------^-+-^----^--------+-^-------^----------
"
("p" git-gutter:previous-hunk)
("n" git-gutter:next-hunk)
("s" git-gutter:stage-hunk)
("r" git-gutter:revert-hunk)
("m" git-gutter:mark-hunkmark)
("SPC" git-gutter:toggle-popup-hunk))
)
;; Highlight on-the-fly
(diff-hl-flydiff-mode 1)
;; Set fringe style
(setq-default fringes-outside-margins t)
(with-no-warnings
(unless (display-graphic-p)
;; Fall back to the display margin since the fringe is unavailable in tty
(diff-hl-margin-mode 1)
;; Avoid restoring `diff-hl-margin-mode'
(with-eval-after-load 'desktop
(add-to-list 'desktop-minor-mode-table
'(diff-hl-margin-mode nil))))
;; Integration with magit
(with-eval-after-load 'magit
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))))
;; Visitar rápidamente viejas versiones de un archivo rápidamente
(use-package git-timemachine
:defer t)
:custom-face
(git-timemachine-minibuffer-author-face ((t (:inherit success :foreground unspecified))))
(git-timemachine-minibuffer-detail-face ((t (:inherit warning :foreground unspecified))))
:bind (:map vc-prefix-map
("t" . git-timemachine))
:hook ((git-timemachine-mode . (lambda ()
"Improve `git-timemachine' buffers."
;; Display different colors in mode-line
(if (facep 'mode-line-active)
(face-remap-add-relative 'mode-line-active 'custom-state)
(face-remap-add-relative 'mode-line 'custom-state))
;; Highlight symbols in elisp
(and (derived-mode-p 'emacs-lisp-mode)
(fboundp 'highlight-defined-mode)
(highlight-defined-mode t))
;; Display line numbers
(and (derived-mode-p 'prog-mode 'yaml-mode)
(fboundp 'display-line-numbers-mode)
(display-line-numbers-mode t))))
(before-revert . (lambda ()
(when (bound-and-true-p git-timemachine-mode)
(user-error "Cannot revert the timemachine buffer"))))))
;; Generador automatizado de archivos de licencia
(use-package license-templates
:defer t)
(use-package license-templates)
;; Magia para git
(use-package magit
:defer t)
(use-package magit)
;; Todolist en magit de todos los archivos del projecto.
(use-package magit-todos
:defer t
:config (magit-todos-mode 1))
:after magit-status
:commands magit-todos-mode
:init
(setq magit-todos-nice (if (executable-find "nice") t nil))
(magit-todos-mode 1))
;; Modo para resolución de confictos
(use-package smerge-mode
:ensure nil
:defer t
:config
(defhydra hydra-smerge (:color pink
:hint nil)
@ -96,14 +131,11 @@ _p_rev _u_pper _=_: upper/lower _r_esolve
("q" nil "cancel" :color blue))
)
(use-package transient
:defer t)
(use-package transient)
;; 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))
:bind (("C-c C-v" . vc-msg-show))
)