This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/init-package/init-magit.el
2012-12-29 17:18:21 -05:00

42 lines
1.2 KiB
EmacsLisp

(require 'magit)
(global-set-key (kbd "C-x m") 'magit-status)
;; C-x C-k to kill file on line
(defun magit-kill-file-on-line ()
"Show file on current magit line and prompt for deletion."
(interactive)
(magit-visit-item)
(delete-current-buffer-file)
(magit-refresh))
(define-key magit-status-mode-map (kbd "C-x C-k") 'magit-kill-file-on-line)
;; full screen magit-status
(defadvice magit-status (around magit-fullscreen activate)
(window-configuration-to-register :magit-fullscreen)
ad-do-it
(delete-other-windows))
(defun magit-quit-session ()
"Restores the previous window configuration and kills the magit buffer"
(interactive)
(kill-buffer)
(jump-to-register :magit-fullscreen))
(define-key magit-status-mode-map (kbd "q") 'magit-quit-session)
(defun magit-toggle-whitespace ()
(interactive)
(if (member "-w" magit-diff-options)
(magit-dont-ignore-whitespace)
(magit-ignore-whitespace)))
(defun magit-ignore-whitespace ()
(interactive)
(add-to-list 'magit-diff-options "-w")
(magit-refresh))
(defun magit-dont-ignore-whitespace ()
(interactive)
(setq magit-diff-options (remove "-w" magit-diff-options))
(magit-refresh))
(define-key magit-status-mode-map (kbd "W") 'magit-toggle-whitespace)