Skip to content

Instantly share code, notes, and snippets.

@quux00
Created August 18, 2012 00:20
Show Gist options
  • Save quux00/3383607 to your computer and use it in GitHub Desktop.
Save quux00/3383607 to your computer and use it in GitHub Desktop.
Emacs: toggle between split windows and a single window
;; Toggle between split windows and a single window
(defun toggle-windows-split()
"Switch back and forth between one window and whatever split of windows we might have in the frame. The idea is to maximize the current buffer, while being able to go back to the previous split of windows in the frame simply by calling this command again."
(interactive)
(if (not (window-minibuffer-p (selected-window)))
(progn
(if (< 1 (count-windows))
(progn
(window-configuration-to-register ?u)
(delete-other-windows))
(jump-to-register ?u))))
(my-iswitchb-close))
(define-key global-map (kbd "C-|") 'toggle-windows-split)
;; Note: you may also need to define the my-iswitchb-close function
;; created by Ignacio as well: http://emacswiki.org/emacs/IgnacioPazPosse
(defun my-iswitchb-close()
"Open iswitchb or, if in minibuffer go to next match. Handy way to cycle through the ring."
(interactive)
(if (window-minibuffer-p (selected-window))
(keyboard-escape-quit)))
@novoid
Copy link

novoid commented Aug 20, 2012

my-iswitchb-close is not defined. It should be defined or omitted. Thanks for the code!

@quux00
Copy link
Author

quux00 commented Aug 21, 2012

Done. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment