summary refs log tree commit diff
path: root/emacs/custom/my-git.el
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-03-23 09:46:33 -0700
committerFranck Cuny <franck@fcuny.net>2022-03-23 09:46:33 -0700
commitccd53a221194093fc7f8228725584c5b0320aeb8 (patch)
tree529064cfa3290b337d6303f36dc8b38e77f10935 /emacs/custom/my-git.el
parentrename fcuny-text to my-text (diff)
downloademacs.d-ccd53a221194093fc7f8228725584c5b0320aeb8.tar.gz
rename fcuny-git to my-git
Diffstat (limited to 'emacs/custom/my-git.el')
-rw-r--r--emacs/custom/my-git.el51
1 files changed, 51 insertions, 0 deletions
diff --git a/emacs/custom/my-git.el b/emacs/custom/my-git.el
new file mode 100644
index 0000000..eb00113
--- /dev/null
+++ b/emacs/custom/my-git.el
@@ -0,0 +1,51 @@
+;;; 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 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