Minor updates.

This commit is contained in:
Derek Taylor
2020-08-11 17:27:59 -05:00
parent c00618a23a
commit 367af05623
154 changed files with 2484 additions and 1801 deletions

View File

@@ -53,7 +53,29 @@
magit-diff-mode
magit-stash-mode
magit-status-mode))))
'(display-buffer-same-window))))))
'(display-buffer-same-window))
('(+magit--display-buffer-in-direction))))))
(defun +magit--display-buffer-in-direction (buffer alist)
"`display-buffer-alist' handler that opens BUFFER in a direction.
This differs from `display-buffer-in-direction' in one way: it will try to use a
window that already exists in that direction. It will split otherwise."
(let ((direction (or (alist-get 'direction alist)
+magit-open-windows-in-direction)))
(if-let (window (window-in-direction direction))
(select-window window)
(if-let (window (window-in-direction
(pcase direction
(`right 'left)
(`left 'right)
((or `up `above) 'down)
((or `down `below) 'up))))
(select-window window)
(split-window-horizontally)))
(switch-to-buffer buffer)
(selected-window)))
;;

View File

@@ -1,5 +1,13 @@
;;; tools/magit/config.el -*- lexical-binding: t; -*-
(defvar +magit-open-windows-in-direction 'right
"What direction to open new windows from the status buffer.
For example, diffs and log buffers. Accepts `left', `right', `up', and `down'.")
;;
;;; Packages
(use-package! magit
:commands magit-file-delete
:defer-incrementally (dash f s with-editor git-commit package eieio lv transient)
@@ -11,16 +19,11 @@
transient-history-file (concat doom-etc-dir "transient/history"))
:config
(setq transient-default-level 5
magit-revision-show-gravatars '("^Author: " . "^Commit: ")
magit-diff-refine-hunk t ; show granular diffs in selected hunk
;; Don't autosave repo buffers. This is too magical, and saving can
;; trigger a bunch of unwanted side-effects, like save hooks and
;; formatters. Trust us to know what we're doing.
magit-save-repository-buffers nil
;; Magit runs git *a lot*. Having to scan your PATH so many times can
;; add up with each invokation, especially on Catalina (macOS) or
;; Windows, so we resolve it once.
magit-git-executable (executable-find magit-git-executable))
magit-save-repository-buffers nil)
(add-hook 'magit-process-mode-hook #'goto-address-mode)
(defadvice! +magit-revert-repo-buffers-deferred-a (&rest _)
@@ -154,10 +157,7 @@ ensure it is built when we actually use Forge."
:after magit
:config
(setq magit-todos-keyword-suffix "\\(?:([^)]+)\\)?:?") ; make colon optional
(define-key magit-todos-section-map "j" nil)
;; Warns that jT isn't bound. Well, yeah, you don't need to tell me, that was
;; on purpose ya goose.
(advice-add #'magit-todos-mode :around #'doom-shut-up-a))
(define-key magit-todos-section-map "j" nil))
(use-package! magit-gitflow
@@ -179,8 +179,12 @@ ensure it is built when we actually use Forge."
(evil-define-key* 'normal magit-status-mode-map [escape] nil) ; q is enough
(evil-define-key* '(normal visual) magit-mode-map
"%" #'magit-gitflow-popup
"zt" #'evil-scroll-line-to-top
"zz" #'evil-scroll-line-to-center
"g=" #'magit-diff-default-context)
"zb" #'evil-scroll-line-to-bottom
"g=" #'magit-diff-default-context
"gi" #'forge-jump-to-issues
"gm" #'forge-jump-to-pullreqs)
(define-key! 'normal
(magit-status-mode-map
magit-stash-mode-map
@@ -193,4 +197,8 @@ ensure it is built when we actually use Forge."
(setcar desc (cdr key))))
(evil-define-key* evil-magit-state git-rebase-mode-map
"gj" #'git-rebase-move-line-down
"gk" #'git-rebase-move-line-up)))
"gk" #'git-rebase-move-line-up))
(transient-replace-suffix 'magit-dispatch 'magit-worktree
'("%" "Gitflow" magit-gitflow-popup))
(transient-append-suffix 'magit-dispatch '(0 -1 -1)
'("*" "Worktree" magit-worktree)))

View File

@@ -1,11 +1,11 @@
;; -*- no-byte-compile: t; -*-
;;; tools/magit/packages.el
(when (package! magit :pin "793e387a508984ae2586b93ff78afddf7a1164ac")
(when (package! magit :pin "798aff56457aef4d1896db8129ab56d08ae12066")
(when (featurep! +forge)
(package! forge :pin "6f299d2d84a0c92a6656a6db03656c2d554d2cac"))
(package! forge :pin "2c487465d0b78ffe34252b47fcc06e27039330c4"))
(package! magit-gitflow :pin "cc41b561ec6eea947fe9a176349fb4f771ed865b")
(package! magit-todos :pin "a0e5d1f3c7dfcb4f18c1b0d57f1746a4872df5c6")
(package! github-review :pin "50c6bcc7cf4d7193577b3f74eea4dd72f2b7795b")
(package! github-review :pin "fab440aeae4fbf6a8192fd11795052e9eb5d27d1")
(when (featurep! :editor evil +everywhere)
(package! evil-magit :pin "88dc26ce59dbf4acb4e2891c79c4bd329553ba56")))