Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reopen buffer in split view

Is there an built-in option in emacs to toggle between full window and a split window, so that both files remain the same? As if minimizing one buffer for a while. Currently, when I do C-x 3 to split vertically it will open the same buffer, I then open a file in the other window. But at some point I want to concentrate fully on one part again and "minimize" the other half of the window. And later I want to unminimize and have both files shown again. Is this toggling of emacs windows possible?

NB: I use term "window" in emacsian.

like image 779
jyriand Avatar asked Sep 02 '13 17:09

jyriand


3 Answers

I'm using `winner-mode' for this purpose:

(winner-mode)
(global-set-key [f9] 'delete-other-windows)
(global-set-key [C-f9] 'delete-window)
(global-set-key (kbd "<f7>") 'winner-undo)
(global-set-key (kbd "C-<f7>") 'winner-redo)

This way

  • f9 "maximizes" the current window,
  • f7 restores the previous configuration.
  • C-f9 "minimizes" the current window.

I rarely use C-f7, just included it for completeness.

like image 66
abo-abo Avatar answered Oct 22 '22 10:10

abo-abo


You can use window configuration registers for this.

like image 32
seanmcl Avatar answered Oct 22 '22 10:10

seanmcl


@Seanmcl's answer is a good one, as is @abo-abo's.

Depending on how you work or just what you want to do, you can also use C-x 5 2 to open the current buffer in a new frame. And then use C-x 5 0 there to delete that frame when done focusing on that buffer.

like image 33
Drew Avatar answered Oct 22 '22 12:10

Drew