winheight()
and winwidth()
return the number of columns/lines in the current window. What I'm looking for is something closer to the actual height and width of the editing area, or displayed area if run in a terminal. The problem with winheight()
and winwidth()
is that aspect ratio calculated from these values is out of touch with the actual aspect ratio.
:echo winwidth('%') winheight('%') winwidth('%') * 1.0 / winheight('%')
104 51 2.039216
A screenshot of the buffer area is sized 936x918 pixels, giving a displayed aspect ratio of 1.019608
. I think I can get the actual value by using the size of the font, but how?
This is a follow-up to How can I make Vim open help in a vertical split?. I'm trying to adapt Nobe4's solution.
cnoreabbrev h <C-r>=(&columns >= 160 && getcmdtype() ==# ':' && getcmdpos() == 1 ? 'vertical botright help' : 'h')<CR>
.==#
operator which:h
helped clear up I actually understood the entire freaking command. Does that make me a Vim expert? Gotta be something like that. Need to get out more.