init.el: Add some more git support

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2019-02-24 19:05:10 +05:30
parent 4490c2d937
commit f2cd1fd338

78
init.el
View file

@ -200,23 +200,17 @@
;; Git Support
(use-package magit
:defer t
:ensure t)
:defer t)
(use-package evil-magit
:defer t
:ensure t)
:defer t)
(use-package helm-git-grep
:defer t
:ensure t)
:defer t)
(use-package helm-gitignore
:defer t
:ensure t)
:defer t)
(use-package git-commit
:defer t
:ensure t)
:defer t)
(use-package git-messenger
:defer t
:ensure t
:config
(define-key git-messenger-map [escape] 'git-messenger:popup-close))
(use-package gitattributes-mode
@ -225,6 +219,20 @@
:defer t)
(use-package gitignore-mode
:defer t)
(use-package git-timemachine
:defer t)
(use-package git-link
:defer t
:config
(setq git-link-open-in-browser t))
(use-package git-gutter
:defer t
:config
(global-git-gutter-mode +1))
(use-package gitignore-templates
:defer t)
(use-package magit-gitflow
:defer t)
;; Custom keybinding
(use-package general
@ -306,7 +314,7 @@
:which-key "magit find file")
"gfl" '(magit-log-buffer-file
:which-key "magit log buffer file")
"gfd" '(magit-diff-buffer-file-popup
"gfd" '(magit-diff
:which-key "magit diff buffer file popup")
"gi" '(magit-init
:which-key "magit initialize")
@ -324,6 +332,16 @@
:which-key "open helm git grep")
"g*" '(helm-git-grep-at-point
:which-key "open helm git grep at point")
"gI" '(helm-gitignore
:which-key "helm gitignore")
"%" 'magit-gitflow-popup
"gt" 'gitignore-templates-insert
"gft" 'gitignore-templates-new-file
"gM" 'git-messenger:popup-message
"gll" 'spacemacs/git-link
"glL" 'spacemacs/git-link-copy-url-only
"glc" 'spacemacs/git-link-commit
"glC" 'spacemacs/git-link-commit-copy-url-only
;; evil nerd commenter
"ci" 'evilnc-comment-or-uncomment-lines
"cl" 'evilnc-quick-comment-or-uncomment-to-the-line
@ -555,6 +573,42 @@
:which-key "go-guru set analysis scope"))
;; custom functions
(defun spacemacs/git-link-copy-url-only ()
"Only copy the generated link to the kill ring."
(interactive)
(let (git-link-open-in-browser)
(call-interactively 'spacemacs/git-link)))
(defun spacemacs/git-link-commit-copy-url-only ()
"Only copy the generated link to the kill ring."
(interactive)
(let (git-link-open-in-browser)
(call-interactively 'spacemacs/git-link-commit)))
(defun spacemacs/git-link ()
"Allow the user to run git-link in a git-timemachine buffer."
(interactive)
(require 'git-link)
(if (and (boundp 'git-timemachine-revision)
git-timemachine-revision)
(cl-letf (((symbol-function 'git-link--branch)
(lambda ()
(car git-timemachine-revision))))
(call-interactively 'git-link))
(call-interactively 'git-link)))
(defun spacemacs/git-link-commit ()
"Allow the user to run git-link-commit in a git-timemachine buffer."
(interactive)
(require 'git-link)
(if (and (boundp 'git-timemachine-revision)
git-timemachine-revision)
(cl-letf (((symbol-function 'word-at-point)
(lambda ()
(car git-timemachine-revision))))
(call-interactively 'git-link-commit))
(call-interactively 'git-link-commit)))
(defun haskell-intero/insert-type ()
(interactive)
(intero-type-at :insert))