summaryrefslogtreecommitdiff
path: root/config/init-git.el
diff options
context:
space:
mode:
Diffstat (limited to 'config/init-git.el')
-rw-r--r--config/init-git.el97
1 files changed, 97 insertions, 0 deletions
diff --git a/config/init-git.el b/config/init-git.el
new file mode 100644
index 0000000..4741f35
--- /dev/null
+++ b/config/init-git.el
@@ -0,0 +1,97 @@
+;;; init-git.el --- configure git -*- lexical-binding: t -*-
+;; Author: Franck Cuny <franck@fcuny.net>
+
+;;; Commentary:
+
+;; Configuration for git
+
+;;; Code:
+
+(require 'init-util)
+
+(use-package magit
+ :defer t
+ :ensure t
+ :bind (("C-x g" . magit-status)
+ ("C-x G" . magit-status-with-prefix))
+ :custom
+ (magit-diff-options nil)
+ (magit-diff-refine-hunk t)
+ (magit-fetch-arguments nil)
+ (magit-log-section-commit-count 10)
+ (magit-pre-refresh-hook nil)
+ (magit-process-popup-time 15)
+ (magit-clone-default-directory "~/workspace/")
+ (magit-section-initial-visibility-alist '((untracked . hide)))
+ :hook (magit-mode . hl-line-mode))
+
+(use-package magit-commit
+ :defer t
+ :config
+ (use-package git-commit
+ :custom
+ (git-commit-major-mode 'markdown-mode)
+ (git-commit-setup-hook
+ '(git-commit-save-message
+ git-commit-turn-on-auto-fill
+ git-commit-turn-on-flyspell
+ bug-reference-mode))))
+
+(use-package magit-status
+ :defer t
+ :config
+ (dolist (func '(magit-insert-unpushed-to-upstream-or-recent
+ magit-insert-unpulled-from-pushremote
+ magit-insert-unpulled-from-upstream))
+ (remove-hook 'magit-status-sections-hook func))
+
+ (dolist (func '(magit-insert-diff-filter-header
+ magit-insert-tags-header))
+ (remove-hook 'magit-status-headers-hook func)))
+
+
+(use-package vc
+ :defer t
+ :custom
+ (vc-command-messages t)
+ (vc-follow-symlinks t))
+
+(use-package git-link
+ :defines git-link-remote-alist
+ :ensure t
+ :bind ("C-c Y" . git-link)
+ :commands (git-link git-link-commit git-link-homepage)
+
+ :custom
+ (git-link-open-in-browser t)
+
+ :preface
+ (defun git-link-fcuny-net (hostname dirname filename branch commit start end)
+ (format "http://git.fcuny.net/%s/tree/%s?id=%s#n%s"
+ (replace-regexp-in-string "^r/\\(.*\\)" "\\1.git" dirname)
+ filename
+ commit
+ start))
+
+ (defun git-link-commit-fcuny-net (hostname dirname commit)
+ (format "http://git.fcuny.net/%s/commit/?id=%s"
+ (replace-regexp-in-string "^r/\\(.*\\)" "\\1.git" dirname)
+ commit))
+
+ :config
+ (add-to-list 'git-link-remote-alist '("git\\.fcuny\\.net" git-link-fcuny-net))
+ (add-to-list 'git-link-commit-remote-alist '("git\\.fcuny\\.net" git-link-commit-fcuny-net))
+
+ ;; sets up roblox git enterprise as a git-link handler
+ (add-to-list 'git-link-remote-alist '("github\\.rblx\\.com" git-link-github))
+ (add-to-list 'git-link-commit-remote-alist '("github\\.rblx\\.com" git-link-commit-github)))
+
+(use-package transient
+ :defer t
+ :custom
+ (transient-history-file (user-data "transient/history.el"))
+ (transient-values-file (user-data "transient/values.el")))
+
+(provide 'init-git)
+
+;;; init-git.el ends here