1

I use git-gutter to keep track of git changes in my buffer while editing.

I created this hydra for speed up commits a bit more (when I don't feel like using magit - often because this "takes me away" from my current file).

(defhydra my-git-changes-hydra ()
  "Navigate and record git changes"
  ("j" git-gutter:next-hunk "next")
  ("k" git-gutter:previous-hunk "prev")
  ("s" git-gutter:stage-hunk "stage")
  ("v" git-gutter:popup-hunk "view")
  ("x" git-gutter:revert-hunk "revert"))

This worked pretty well. But it's slightly annoying having to type "yes" and "no" whenever I stage stuff. I'm aware that this there for safety... but if I've already gone into a hydra and am moving around commits and am going through a bunch of changes I think I can accept the risk.

Is there a way to disable the "yes/no" prompting... or switching it to a simple y or n keypress.

1
  • 3
    I haven't installed git-gutter, but could this solve your problem: git-gutter Homepage . git-gutter.el always asks you whether commit/revert or not. If you don't want, please set git-gutter:ask-p to nil. Mar 8 at 16:13

1 Answer 1

1

I hope my unskilled code meets your requirements.

(defun my-stage-hunk ()
  (interactive)
  (git-gutter:awhen (git-gutter:search-here-diffinfo git-gutter:diffinfos)
    (git-gutter:do-stage-hunk it)
    (message "Staged. %s" (buffer-name))))

(defhydra my-git-changes-hydra ()
  ("s" my-stage-hunk "stage"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.