diff runtime/doc/eval.txt @ 14587:d33220d3bc27 v8.1.0307

patch 8.1.0307: there is no good way to get the window layout commit https://github.com/vim/vim/commit/0f6b4f06dece71487a6d8546c50de775d9c8c287 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 21 16:56:34 2018 +0200 patch 8.1.0307: there is no good way to get the window layout Problem: There is no good way to get the window layout. Solution: Add the winlayout() function. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Tue, 21 Aug 2018 17:00:06 +0200
parents 5c5908e81e93
children 72d6f6f7ead7
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2497,6 +2497,7 @@ win_screenpos({nr})		List	get screen pos
 winbufnr({nr})			Number	buffer number of window {nr}
 wincol()			Number	window column of the cursor
 winheight({nr})			Number	height of window {nr}
+winlayout([{tabnr}])		List	layout of windows in tab {tabnr}
 winline()			Number	window line of the cursor
 winnr([{expr}])			Number	number of current window
 winrestcmd()			String	returns command to restore window sizes
@@ -9088,6 +9089,35 @@ winheight({nr})						*winheight()*
 		Examples: >
   :echo "The current window has " . winheight(0) . " lines."
 <
+winlayout([{tabnr}])					*winlayout()*
+		The result is a nested List containing the layout of windows
+		in a tabpage.
+
+		Without {tabnr} use the current tabpage, otherwise the tabpage
+		with number {tabnr}. If the tabpage {tabnr} is not found,
+		returns an empty list.
+
+		For a leaf window, it returns:
+			['leaf', {winid}]
+		For horizontally split windows, which form a column, it
+		returns:
+			['col', [{nested list of windows}]]
+		For vertically split windows, which form a row, it returns:
+			['row', [{nested list of windows}]]
+
+		Example: >
+			" Only one window in the tab page
+			:echo winlayout()
+			['leaf', 1000]
+			" Two horizontally split windows
+			:echo winlayout()
+			['col', [['leaf', 1000], ['leaf', 1001]]]
+			" Three horizontally split windows, with two
+			" vertically split windows in the middle window
+			:echo winlayout(2)
+			['col', [['leaf', 1002], ['row', ['leaf', 1003],
+					     ['leaf', 1001]]], ['leaf', 1000]]
+<
 							*winline()*
 winline()	The result is a Number, which is the screen line of the cursor
 		in the window.  This is counting screen lines from the top of