Reputation: 4370
Does vim offer a function or somehow return an indicator to distinguish between the type of split windows? I want to be able to track if a split is horizontal or vertical. I want to use the information in a script to run certain actions depending on if the split is H or V.
Upvotes: 3
Views: 446
Reputation: 38573
To check if a window is in a horizontal split for example, you could get its height and compare it with the total screen height.
if winheight(0) + &cmdheight + 1 != &lines
" current window is part of a horizontal split
endif
(the condition factors in the height of the command line and the status line as well).
For vertical split check, all you need is:
if winwidth(0) != &columns
" current window is in a vertical split
endif
Upvotes: 4