Reputation: 5157
I like to open multiple window, each with its own file opened. Sometimes, I want to maximize the one I edited to occupy whole screen, and then to restore it back to its previous size and position..
Is there a way?
According to the emacs menu, I can only figure out enlarge-window, shrink-window.. thats it..
Upvotes: 8
Views: 2154
Reputation: 73410
I always use winner-mode
for this, but it's worth noting these options as well:
In GUI or terminal frames (since Emacs 27.1):
C-xt2 -- tab-new
This opens a new tab displaying only the buffer which had been current in your previous window configuration. You can flip back and forth between the tabs (each of which has an independent window configuration), and delete the current tab with C-xt0 when you've finished with it. (n.b. You can (setq tab-bar-show 1)
to hide the tab bar when it has only a single tab.)
In terminal frames only:
C-x52 -- make-frame-command
While in GUI frames this command would create a whole new frame (GUI window), in a terminal the new frame is displayed in place of the previous frame, which makes this very much like the tab-bar method described above (just without any tabs). You can cycle frames with C-x5o and delete the current frame with C-x50 once you've finished with it.
Upvotes: 0
Reputation: 3050
Have exactly what is asked for, no more no less, in my setup since ages:
(setq window-zoom-config nil)
(defun window-zoom()
"Zoom current window so it takes the whole frame.
The next time the function is called, the layout before
zoom is restored."
(interactive)
(if (eq nil window-zoom-config)
(progn
(setq window-zoom-config (current-window-configuration))
(delete-other-windows)
(message "Saved window configuration"))
(set-window-configuration window-zoom-config)
(setq window-zoom-config nil)
(message "Restored window configuration")))
Just bind your favorite key to window-zoom and off you go. You can even split again and create your own layout while in "zoom" for your temporary work, still the previous layout is restored when called again.
Upvotes: 0
Reputation: 565
Workaround.
ESC
ESC
ESC
maximizes the buffer with active cursor. M-x
` to navigate between other buffers.Upvotes: 1
Reputation: 1567
Use the command window-configuration-to-register
: M-x window-configuration-to-register
, press the Enter key, then some register (character), e.g. a
. To maximize current window, use C-x 1
. When you want to restore, type C-x r j a
.
Upvotes: 6
Reputation: 3716
More or less - try using winner-mode. It will remember the last few (ca 200) window configurations, and will let you walk through them with a simple (C-c (right|left)) keystroke. And it's quite easy to turn on, since it's built in:
(when (fboundp 'winner-mode)
(winner-mode 1))
Combine it with windmove
and moving between your windows will be even more awesome.
Upvotes: 12