Files
emacs.d/site-start.d/501-git.el
2020-06-26 15:54:46 +02:00

80 lines
2.0 KiB
EmacsLisp

;;; 501-git.el --- git user adaptions
;;; Commentary:
;;; Code:
;; loading standard git.el
;;(require 'git)
;; load magit for git handling
(use-package magit
:ensure t
:bind (("C-x g" . magit-status)
("C-c g" . magit-status)
:map magit-status-mode-map
;;("TAB" . magit-section-toggle)
("<C-tab>" . magit-section-cycle)
:map magit-branch-section-map
("RET" . magit-checkout))
:custom
(magit-use-overlays nil)
(magit-section-visibility-indicator nil)
(magit-completing-read-function 'ivy-completing-read)
(magit-push-always-verify nil)
(magit-repository-directories '("~/src/"))
(bind-key "v" 'visit-pull-request-url magit-mode-map)
:config
(add-hook 'after-save-hook 'magit-after-save-refresh-status)
(use-package git-timemachine
:bind (("C-x v t" . git-timemachine)))
(use-package git-link
:bind (("C-x v L" . git-link))
:init
(setq git-link-open-in-browser t))
(use-package pcmpl-git)
)
;; Do Not Show Recent Commits in status window
;; https://github.com/magit/magit/issues/3230#issuecomment-339900039
;; (magit-add-section-hook 'magit-status-sections-hook
;; 'magit-insert-unpushed-to-upstream
;; 'magit-insert-unpushed-to-upstream-or-recent
;; 'replace)
;; load forge to handle github, gitlab, etc
;;(require 'forge)
(use-package forge
:ensure t
:after magit)
(use-package magithub
:ensure t
:after magit
:config
(magithub-feature-autoinject t)
(setq magithub-clone-default-directory "~/github"))
;;(advice-add 'magit-key-mode :filter-args #'magit-key-mode--add-default-options)
;; (defun visit-pull-request-url ()
;; "Visit the current branch's PR on Github."
;; (interactive)
;; (browse-url
;; (format "https://github.com/%s/pull/new/%s"
;; (replace-regexp-in-string
;; "\\`.+github\\.com:\\(.+\\)\\.git\\'" "\\1"
;; (magit-get "remote"
;; (magit-get-remote)
;; "url"))
;; (cdr (magit-get-remote-branch)))))
(defvar my/magit-default-options
`(
(pulling "--rebase")
))
(provide '501-git)
;; End:
;;; 501-git.el ends here