From 370651ebec3de195ab30b5806952e5603ba08b39 Mon Sep 17 00:00:00 2001 From: KJ Date: Sat, 13 Apr 2024 01:19:05 -0400 Subject: [PATCH] Add hydra config for git-gutter. --- configs/init-functions.el | 8 ++++++++ configs/init-packages.el | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configs/init-functions.el b/configs/init-functions.el index e55d02f..89552d9 100644 --- a/configs/init-functions.el +++ b/configs/init-functions.el @@ -58,5 +58,13 @@ Saves to a temp file and puts the filename in the kill ring." ;; Borrar espacios, tabs y saltos de línea innecesarios al guardar (add-hook 'before-save-hook 'delete-trailing-whitespace) +;; Mostrar y ocultar el diff de la línea de git-gutter +(defun git-gutter:toggle-popup-hunk () + "Toggle 'git-gutter' hunk window." + (interactive) + (if (and (get-buffer "*git-gutter:diff*") (window-live-p (git-gutter:popup-buffer-window))) + (delete-window (git-gutter:popup-buffer-window)) + (git-gutter:popup-hunk))) + (provide 'init-functions) ;;; init-functions.el ends here. diff --git a/configs/init-packages.el b/configs/init-packages.el index 5c692f1..39d6a53 100644 --- a/configs/init-packages.el +++ b/configs/init-packages.el @@ -119,7 +119,17 @@ (use-package git-gutter :defer t :hook - (elpaca-after-init . global-git-gutter-mode)) + (elpaca-after-init . global-git-gutter-mode) + :config + (defhydra hydra-git-gutter nil + "git hunk" + ("p" git-gutter:previous-hunk "previous") + ("n" git-gutter:next-hunk "next") + ("s" git-gutter:stage-hunk "stage") + ("r" git-gutter:revert-hunk "revert") + ("m" git-gutter:mark-hunk "mark") + ("SPC" git-gutter:toggle-popup-hunk "toggle diffinfo")) + ) ;; Cliente LLM (ollama, chatgpt, gemini, etc.) (use-package gptel