Created
March 24, 2012 03:57
-
-
Save yuutayamada/2178022 to your computer and use it in GitHub Desktop.
Magit: search the commit message by anything
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; search commit log by anything | |
(defvar anything-c-source-log-edit-comment | |
'((name . "Log-edit Comment") | |
(candidates . anything-c-log-edit-comment-candidates) | |
(action . (("Insert" . (lambda (str) (insert str))))) | |
(migemo) | |
(multiline)) | |
"Source for browse and insert Log-edit comment.") | |
(defun anything-c-log-edit-comment-candidates () | |
(let* ((candidates | |
(shell-command-to-string "\\git \\log -500 | \\grep -E '^ .+'")) | |
(logs (string-to-list (split-string candidates "\n ")))) | |
(push (replace-regexp-in-string "^ " "" (pop logs)) logs) | |
logs)) | |
(defun anything-show-log-edit-comment () | |
"`anything' for Log-edit comment." | |
(interactive) | |
(anything-other-buffer 'anything-c-source-log-edit-comment | |
"*anything log-edit comment*")) | |
(define-key magit-log-edit-mode-map (kbd "C-s") 'anything-show-log-edit-comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment