2015-06-10 02:19:16 +00:00
|
|
|
;;; packages.el --- Source Control Layer packages File for Spacemacs
|
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-06-10 02:19:16 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(setq version-control-packages
|
|
|
|
'(
|
|
|
|
diff-mode
|
2015-11-15 19:01:58 +00:00
|
|
|
diff-hl
|
2016-05-06 11:27:44 +00:00
|
|
|
evil-unimpaired
|
2015-11-15 19:01:58 +00:00
|
|
|
git-gutter
|
|
|
|
git-gutter+
|
|
|
|
git-gutter-fringe
|
|
|
|
git-gutter-fringe+
|
|
|
|
))
|
2015-06-10 02:19:16 +00:00
|
|
|
|
|
|
|
(defun version-control/init-diff-mode ()
|
|
|
|
(use-package diff-mode
|
|
|
|
:defer t
|
|
|
|
:config
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify diff-mode diff-mode-map
|
|
|
|
"j" 'diff-hunk-next
|
|
|
|
"k" 'diff-hunk-prev)))
|
2015-06-10 02:19:16 +00:00
|
|
|
|
|
|
|
(defun version-control/init-diff-hl ()
|
|
|
|
(use-package diff-hl
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq diff-hl-side 'right)
|
2015-11-15 19:01:58 +00:00
|
|
|
(when (eq version-control-diff-tool 'diff-hl)
|
|
|
|
(when version-control-global-margin
|
|
|
|
(global-diff-hl-mode))
|
|
|
|
(unless (display-graphic-p)
|
|
|
|
(setq diff-hl-side 'left)
|
|
|
|
(diff-hl-margin-mode))))))
|
|
|
|
|
2016-05-06 11:27:44 +00:00
|
|
|
(defun version-control/post-init-evil-unimpaired ()
|
|
|
|
(define-key evil-normal-state-map (kbd "[ h") 'version-control/previous-hunk)
|
|
|
|
(define-key evil-normal-state-map (kbd "] h") 'version-control/next-hunk))
|
|
|
|
|
2015-11-15 19:01:58 +00:00
|
|
|
(defun version-control/init-git-gutter ()
|
|
|
|
(use-package git-gutter
|
2016-05-19 05:21:01 +00:00
|
|
|
:commands (global-git-gutter-mode git-gutter-mode)
|
2015-11-15 19:01:58 +00:00
|
|
|
:init
|
2015-11-30 22:33:07 +00:00
|
|
|
(progn
|
|
|
|
;; If you enable global minor mode
|
|
|
|
(when (and (eq version-control-diff-tool 'git-gutter)
|
|
|
|
version-control-global-margin)
|
|
|
|
(global-git-gutter-mode t))
|
|
|
|
;; If you would like to use git-gutter.el and linum-mode
|
2016-02-05 06:47:46 +00:00
|
|
|
(if dotspacemacs-line-numbers
|
|
|
|
(git-gutter:linum-setup))
|
2015-11-30 22:33:07 +00:00
|
|
|
(setq git-gutter:update-interval 2
|
|
|
|
git-gutter:modified-sign " "
|
|
|
|
git-gutter:added-sign "+"
|
|
|
|
git-gutter:deleted-sign "-"
|
|
|
|
git-gutter:diff-option "-w"
|
|
|
|
git-gutter:hide-gutter t
|
|
|
|
git-gutter:ask-p nil
|
|
|
|
git-gutter:verbosity 0
|
|
|
|
git-gutter:handled-backends '(git hg bzr svn)
|
|
|
|
git-gutter:hide-gutter t))
|
|
|
|
:config
|
2015-11-15 19:01:58 +00:00
|
|
|
(spacemacs|hide-lighter git-gutter-mode)))
|
|
|
|
|
|
|
|
(defun version-control/init-git-gutter-fringe ()
|
|
|
|
(use-package git-gutter-fringe
|
|
|
|
:commands git-gutter-mode
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(when (display-graphic-p)
|
2015-12-01 07:31:32 +00:00
|
|
|
(with-eval-after-load 'git-gutter
|
|
|
|
(require 'git-gutter-fringe)))
|
2015-11-15 19:01:58 +00:00
|
|
|
(setq git-gutter-fr:side 'right-fringe))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
;; custom graphics that works nice with half-width fringes
|
|
|
|
(fringe-helper-define 'git-gutter-fr:added nil
|
|
|
|
"..X...."
|
|
|
|
"..X...."
|
|
|
|
"XXXXX.."
|
|
|
|
"..X...."
|
|
|
|
"..X...."
|
|
|
|
)
|
|
|
|
(fringe-helper-define 'git-gutter-fr:deleted nil
|
|
|
|
"......."
|
|
|
|
"......."
|
|
|
|
"XXXXX.."
|
|
|
|
"......."
|
|
|
|
"......."
|
|
|
|
)
|
|
|
|
(fringe-helper-define 'git-gutter-fr:modified nil
|
|
|
|
"..X...."
|
|
|
|
".XXX..."
|
|
|
|
"XX.XX.."
|
|
|
|
".XXX..."
|
|
|
|
"..X...."
|
|
|
|
))))
|
|
|
|
|
|
|
|
(defun version-control/init-git-gutter+ ()
|
|
|
|
(use-package git-gutter+
|
2016-05-19 05:21:01 +00:00
|
|
|
:commands (global-git-gutter+-mode git-gutter+-mode)
|
2015-11-15 19:01:58 +00:00
|
|
|
:init
|
2015-11-30 22:33:07 +00:00
|
|
|
(progn
|
|
|
|
;; If you enable global minor mode
|
|
|
|
(when (and (eq version-control-diff-tool 'git-gutter+)
|
|
|
|
version-control-global-margin)
|
|
|
|
(add-hook 'magit-pre-refresh-hook 'git-gutter+-refresh)
|
|
|
|
(global-git-gutter+-mode t))
|
|
|
|
(setq
|
|
|
|
git-gutter+-modified-sign " "
|
|
|
|
git-gutter+-added-sign "+"
|
|
|
|
git-gutter+-deleted-sign "-"
|
|
|
|
git-gutter+-diff-option "-w"
|
|
|
|
git-gutter+-hide-gutter t))
|
2015-11-15 19:01:58 +00:00
|
|
|
;; identify magit changes
|
|
|
|
:config
|
2015-11-30 22:33:07 +00:00
|
|
|
(spacemacs|hide-lighter git-gutter+-mode)
|
2015-11-15 19:01:58 +00:00
|
|
|
;; (set-face-foreground 'git-gutter+-modified "black")
|
|
|
|
;; (set-face-foreground 'git-gutter+-added "black")
|
|
|
|
;; (set-face-foreground 'git-gutter+-deleted "black")
|
|
|
|
;; (set-face-background 'git-gutter+-modified "orange1")
|
|
|
|
;; (set-face-background 'git-gutter+-added "green4")
|
|
|
|
;; (set-face-background 'git-gutter+-deleted "red3")
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun version-control/init-git-gutter-fringe+ ()
|
|
|
|
(use-package git-gutter-fringe+
|
|
|
|
:commands git-gutter+-mode
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(when (display-graphic-p)
|
2015-12-01 07:31:32 +00:00
|
|
|
(with-eval-after-load 'git-gutter+
|
|
|
|
(require 'git-gutter-fringe+)))
|
2015-11-15 19:01:58 +00:00
|
|
|
(setq git-gutter-fr+-side 'right-fringe))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
;; custom graphics that works nice with half-width fringes
|
|
|
|
(fringe-helper-define 'git-gutter-fr+-added nil
|
|
|
|
"..X...."
|
|
|
|
"..X...."
|
|
|
|
"XXXXX.."
|
|
|
|
"..X...."
|
|
|
|
"..X...."
|
|
|
|
)
|
|
|
|
(fringe-helper-define 'git-gutter-fr+-deleted nil
|
|
|
|
"......."
|
|
|
|
"......."
|
|
|
|
"XXXXX.."
|
|
|
|
"......."
|
|
|
|
"......."
|
|
|
|
)
|
|
|
|
(fringe-helper-define 'git-gutter-fr+-modified nil
|
|
|
|
"..X...."
|
|
|
|
".XXX..."
|
|
|
|
"XX.XX.."
|
|
|
|
".XXX..."
|
|
|
|
"..X...."
|
|
|
|
))))
|