summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-21 16:56:34 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-21 16:56:34 +0200
commit0f6b4f06dece71487a6d8546c50de775d9c8c287 (patch)
tree4801fcd4f84a5de0bcf7ba0d0dff832a8a192746 /runtime
parentda6e8919e75fa8f961d1b805e877c8a92e76dafb (diff)
patch 8.1.0307: there is no good way to get the window layoutv8.1.0307
Problem: There is no good way to get the window layout. Solution: Add the winlayout() function. (Yegappan Lakshmanan)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 53ee2094e3..821cbbca9b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2497,6 +2497,7 @@ win_screenpos({nr}) List get screen position of window {nr}
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