I am using Cygwin's X-windows and Gvim. I have a command that docks a Gvim window to the right side of my Windows 10 desktop so that I can take notes during video meetings, which seem to be the norm during COVID-19 lockdown:
command! GR set lines=45 columns=60 guifont=Consolas\ 15 | winpos 1239 53
I hard-coded the
columns options and
winpos arguments based on the resolution of my screen and the font I happen to be using.
Is there a simple way to generalize this so that the winpos arguments are automatically determined for other screen sizes and font sizes? Actually, the
lines option will also depend on the height of the screen. I'll stick with
I realize that I am in effect asking someone to develop vimscript code to do this. I don't have the expertise to do this, and it would take more years than remaining in my life to obtain it. So unless you enjoy this kind of challenge, please ignore this.
Investigative steps taken
As intermediate steps, I can maximize the window by
:set lines=999 columns=999, query what they got coerced to, then use
&lines to set the window height. The command
:winpos xOffset yOffset sets the number of pixels offset of the top-left corner of gvim from the top-left of the desktop, although the title bar of the window falls off the top of the Windows desktop for
yOffset=0 (which is fine).
I need to choose
xOffset to be less than the pixel count of the desktop width, leaving enough width for 60 columns. This requires the ratio of pixels to columns, obtainable by X-windows commands for the display width and the maximum value that
columns was coerced to, or by
:set lines=60 | windpos 0 0, shelling out, and querying X-windows for the width of the Gvim window (
:help winsize). Both require installing X-windows utilities (
xwininfo), which means shutting Cygwin down and logging in as Windows administrator. I will follow up after finishing off some things.