Skip to content

Instantly share code, notes, and snippets.

@sjrmanning
Created July 18, 2017 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjrmanning/e61dd920397d0ae2af74818ec04521a5 to your computer and use it in GitHub Desktop.
Save sjrmanning/e61dd920397d0ae2af74818ec04521a5 to your computer and use it in GitHub Desktop.

Full-screen magit and restore windows on quit

This allows you to be working with split windows on a project, start magit in full-screen with magit-status, and return to your previous configuration after quitting magit with q.

(defadvice magit-status (around magit-fullscreen activate)
  (window-configuration-to-register :magit-fullscreen)
  ad-do-it
  (delete-other-windows))
(defadvice magit-mode-quit-window (around magit-restore-screen activate)
  ad-do-it
  (jump-to-register :magit-fullscreen))

Also possible with monky for those using Mercurial:

(defadvice monky-status (around monky-fullscreen activate)
  (window-configuration-to-register :monky-fullscreen)
  ad-do-it
  (delete-other-windows))
(defadvice monky-quit-window (around monky-restore-screen activate)
  ad-do-it
  (jump-to-register :monky-fullscreen))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment