Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
New file vj-magit.el: vj-git-diff and unicode *
New function vj-git-diff for use with magit log. Press tab to quickly
show the commit info. Repeated tab presses scrolls the other window.

Use nice round unicode character for * replacement in magit log
display (requires magit-log-format-graph-function to be set to
magit-log-format-unicode-graph).
  • Loading branch information
vjohansen committed May 30, 2015
1 parent c418a80 commit ccac989
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions vj-magit.el
@@ -0,0 +1,29 @@

(require 'magit)

(setq magit-last-seen-setup-instructions "1.4.0")

(when (equal magit-log-format-graph-function 'magit-log-format-unicode-graph)
(setcdr (assoc ?* magit-log-format-unicode-graph-alist) ?●))


(define-key magit-log-mode-map (kbd "TAB") 'vj-git-diff)

(defvar vj-git-diff-last-commit nil)

(defun vj-git-diff ()
(interactive)
(if (thing-at-point-looking-at "\\b[0-9a-z]\\{7\\}\\b")
(if (equal (match-string-no-properties 0) vj-git-diff-last-commit)
;; same commit id
(scroll-other-window)
;; show diff
(setq vj-git-diff-last-commit (match-string-no-properties 0))
(shell-command
(format "git show %s" vj-git-diff-last-commit)
"*vj-git-diff*")
(with-current-buffer "*vj-git-diff*"
(diff-mode)))
(setq vj-git-diff-last-commit nil)))


0 comments on commit ccac989

Please sign in to comment.