有没有哪个插件支持开启多个窗口时最大化一个窗口还可以在返回当初的多个窗口?

比如:我有1、2、3、4个window在同一个frame里面。焦点在1 window上面。我现在想编辑这个window把它最大化整个frame。编辑完后又想返回最初的1、2、3、4个window的模式。 1、2、3、4个window不是固定的。有可能是1、2或者其他。并不是一个layout。

有没有哪个插件可以支持这个功能的?求介绍

1 个赞

winner

<C-w C-o> 刪除除当前窗口的其它窗口就可以实现最大化,完事后再用 <C-c Left> 恢复布局

1 个赞

恢复布局怎么恢复?winner-undo有时候会跳到其他布局?有没有好办法

我目前也只会这一种办法 :rofl:

麻烦了解winner-mode的道有,帮忙看看我这个func那里有错?


(defvar mutil-window-tag nil)
(defvar last-winner-win-data nil)

(defun toggle-one-window()
  "Toggle One Window."
  (interactive)
  (if (> (count-windows) 1)
	  (progn
		(setq mutil-window-tag t
			  last-winner-win-data (winner-win-data))
		(delete-other-windows)
		)

	(when mutil-window-tag
	  (setq mutil-window-tag nil)
	  (let* ((index -1))
		(catch 'break
		  (loop do
				(setq index (1+ index))
				(message "%d" index)
				(winner-undo)

				(when (equal (winner-win-data) last-winner-win-data)
				  (progn
					(message "equal success")
					(throw 'break nil)
					)
				  )

				while (< index (length (ring-elements (winner-ring (selected-frame))))))
		  )
		)
	  )
	)
  )
;; from https://gist.github.com/3402786
(defun spacemacs/toggle-maximize-buffer ()
  "Maximize buffer"
  (interactive)
  (save-excursion
    (if (and (= 1 (length (window-list)))
	     (assoc ?_ register-alist))
	(jump-to-register ?_)
      (progn
	(window-configuration-to-register ?_)
	(delete-other-windows)))))
3 个赞

哥,你为什么不早出现。

我就想肯定有跟我一样需求的人。应该早都有方案了。

非常感谢。

ivy自带了ivy-push-view,ivy-switch-view,ivy-pop-view命令,也挺好用的

1 个赞

在你的基础上改了下,防止一些 no-delete-other-windows 的 window 造成影响。

(defun toggle-maximize-buffer ()
  "Maximize buffer"
  (interactive)
  (save-excursion
    (if (and (= 1 (length (cl-remove-if
                           (lambda (window)
                             (window-parameter window 'no-delete-other-windows))
                           (window-list))))
             (assoc ?_ register-alist))
        (jump-to-register ?_)
      (progn
        (window-configuration-to-register ?_)
        (delete-other-windows)))))

请教下。什么样的windos是no-delete-other-windows

treemacs, neotree之类的

受教,非常感谢