summary refs log tree commit diff
path: root/emacs/custom/my-git.el
blob: 348dfe7ed492e41de441ac8db734b44194b2efb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; my-git --- configures git for emacs
;;; Commentary:
;;; Code:
(require 'use-package)

(use-package git-modes
  :ensure t
  :mode
  ("/\\.gitconfig\\'"    . gitconfig-mode)
  ("/\\.gitmodules\\'"   . gitconfig-mode)
  ("/\\.git/config\\'"   . gitconfig-mode)
  ("/\\.gitignore\\'"    . gitignore-mode)
  ("/.dockerignore\\'"   . gitignore-mode)
  ("/\\.gitattributes//" . gitattributes-mode))

(use-package magit
  :ensure t
  :after (flyspell)
  :bind (("C-x g" . magit-status))
  :custom
  (vc-follow-symlinks t)
  (magit-completing-read-function 'ivy-completing-read))

(use-package magit-repos
  :ensure nil
  :after (magit)
  :custom
  (magit-repository-directories '(("~/workspace" . 1))))

(use-package forge
  :ensure t
  :after (magit)
  :custom
  (forge-topic-list-columns
   '(("#" 5 forge-topic-list-sort-by-number (:right-align t) number nil)
     ("Title" 60 t nil title  nil)
     ("State" 6 t nil state nil)
     ("Marks" 8 t nil marks nil)
     ("Labels" 8 t nil labels nil)
     ("Assignees" 10 t nil assignees nil)
     ("Updated" 10 t nill updated nil))))

(with-eval-after-load 'forge
  (push '("github.rbxs.com" "github.rbx.com/api/v3"
          "github.rbx.com" forge-github-repository)
        forge-alist))

(use-package git-commit
  :ensure t
  :after magit
  :hook (git-commit-mode . my/git-commit-auto-fill)
  :custom
  (git-commit-summary-max-length 50)
  :preface
  (defun my/git-commit-auto-fill ()
    "Ensures that the commit body does not exceed 72 characters."
    (setq-local fill-column 72)
    (setq-local comment-auto-fill-only-comments nil)))

(use-package git-link
  :ensure t
  :after magit
  :bind (("C-c g l" . git-link)
         ("C-c g a" . git-link-commit))
  :custom
  (git-link-open-in-browser 't))

(provide 'my-git)
;;; my-git.el ends here