Bind : to run Git commands directly.

I chose : as the binding for similarity with M-:.
This commit is contained in:
Nathan Weizenbaum 2010-06-06 04:31:00 -07:00
parent 00569b85f2
commit 3096eafb8a
2 changed files with 27 additions and 0 deletions

View file

@ -1448,6 +1448,7 @@ FUNC should leave point at the end of the modified region"
(define-key map (kbd "G") 'magit-refresh-all)
(define-key map (kbd "?") 'magit-describe-item)
(define-key map (kbd "!") 'magit-shell-command)
(define-key map (kbd ":") 'magit-git-command)
(define-key map (kbd "RET") 'magit-visit-item)
(define-key map (kbd "SPC") 'magit-show-item-or-scroll-up)
(define-key map (kbd "DEL") 'magit-show-item-or-scroll-down)
@ -2965,6 +2966,23 @@ Uncomitted changes in both working tree and staging area are lost.
(magit-process-popup-time 0))
(magit-run* args nil nil nil t)))
(defun magit-git-command (command)
"Perform arbitrary Git COMMAND.
Similar to `magit-shell-command', but involves slightly less
typing and automatically refreshes the status buffer."
(interactive "sgit ")
(require 'pcomplete)
(let ((args (car (with-temp-buffer
(insert command)
(pcomplete-parse-buffer-arguments))))
(magit-process-popup-time 0))
(magit-with-refresh
(magit-run* (append (cons magit-git-executable
magit-git-standard-options)
args)
nil nil nil t))))
(defun magit-read-remote (prompt def)
(funcall magit-completing-read (if def
(format "%s (default %s): " prompt def)

View file

@ -49,6 +49,7 @@ as an extension to Emacs.
* Rewriting::
* Pushing and Pulling::
* Interfacing with Subversion::
* Using Git Directly::
@end menu
@node Introduction
@ -683,4 +684,12 @@ limited to the path of the remote Subversion repository. With a prefix
(@kbd{C-u N f} the user will also be prompted for a branch to search
in.
@node Using Git Directly
@chapter Using Git Directly
For situations when Magit doesn't do everything you need, you can run
raw Git commands using @kbd{:}. This will prompt for a Git command, run
it, and refresh the status buffer. The output can be viewed by typing
@kbd{$}.
@bye