Maximising/minimising windows

I’m looking for a way to toggle maximising of a window in a frame without closing all the other windows and with the ability to restore the previous size. Similarly to tmux zooming of the panes works.

The only ways I’ve found so far either:

  • only enlargen the window - leaving plenty of space taken up by the other windows - or
  • close all the other windows destroying my layout

is there a better way?

Interesting use case. I’ve read about the popper package but I haven’t tried it, maybe it has that functionality.

I’m using tab-bar-history-mode to restore previous window configurations, for your use case you would have to maximize the current buffer and then go back to a previous window configuration. Maybe a function could be created as a convenient “toggle” command.

1 Like

I’m not sure exactly what you mean, but have you seen winner-mode?

1 Like

This function seems to be what you were asking @elegant.wheel, thanks for the suggestion it seems useful to me. It can work with tab-bar-history-mode or winner-mode.

(defun my/toggle-maximize ()
  (interactive)
  (if  (> (count-windows) 1)
      (delete-other-windows)
    ;; (tab-bar-history-back)
   (winner-undo) 
    ))
2 Likes