Search code examples
emacswindow

Is there something similar to `delete-other-windows` (`C-x 1`), but that allows me to restore my window arrangement


Suppose I have a buffer that's a bit too cramped in its current window, so I decide I want to briefly give it more space, then go back to what I was doing. Is it possible for me to just temporarily hide other windows instead of deleting them like C-x 1 does?


Solution

  • Add this to your init file:

    (winner-mode 1)
    

    Then you can use C-x1 as normal, and afterwards use C-c<left> to call winner-undo to restore the previous window configuration.

    You can use C-c<left> repeatedly to step back through previous configurations, and C-c<right> to jump back to the latest one again.

    n.b. This is a general-purpose feature that is incredibly useful in all kinds of situations besides this specific example. I highly recommend getting familiar with it.