More on this in a PR that should pop up in a bit, we need to discuss how resizing should behave to address #106, #83, #84(indirectly, resizes in layouts), and #4.
Resizes can arrive from multiple sources
set linesNeovim resizing works as follows
ui_try_resize()A few cases that need to be considered
The important bit to understand here is that a resize can trigger another resize and sometimes this is racy e.g.
Ping #106, #83, #4. TLDR; need to agree on what is the expected behaviour for resizes, and need to write unit tests that check the correct behaviour (upcoming PR should help).
Just adding another fly in the ointment: Some window managers (awesome for one) allow you to maximise a window vertically and/or horizontally and back again. This is a feature I use a lot as I tend to have many instances of (neo)vim open at once.
In more general terms, you might hit Parkinson's bike shed asking for this. Personally, I do not care what the behaviour is as long as it is clearly documented.
In more general terms, you might hit Parkinson's bike shed asking for this. Personally, I do not care what the behaviour is as long as it is clearly documented.
True. Likely I'll just implement whatever comes to mind and call it the de facto behaviour :D. But the point is also to identify what can't be done (some things work fine on my window manager but not yours, etc).
Turns out resizing the widget is a really bad idea specially in window managers where Qt fails to detect if the window is maximized. So instead we just resize Neovim to always have the same size as the widget. The downside is that set lines does not work at all.
Excuse me, so...is there a way to automaticly set window _size_ upon start yet?
(unrelated, but since we can't use winpos, can we still _position_ the window upon startup?)
Thanks!
@with0out Yes, there is a way to set the window size upon start up: add alias gvim='nvim-qt --geometry 500x320 --' in your shell rc file. Clearly, the number might need to change depending on what you want/need.
Window position _is not_ something that nvim-qt should ever do. That is the job of your window manager.
@kierun Just tried O:\Neovim\nvim-qt.exe --geometry 800x600 in cmd, and similarly in cygwin shell, it's size didn't seem to change...
(I'm in windows 7, using latest neovim-qt and neovim release)
@with0out I have no idea whatsoever about Windows.
@with0out On Windows 7 I found using -qwindowgeometry 800x600 instead of --geometry 800x600 worked for me.
I think it's important that the window actually saves its state and then when you open Neovim-Qt again, it will appear at the same coordinates with the same size as when you quit.
Of course there are exceptions. For example when you pull the window to the far right, you get it maximized to half of the screen. Now if a second Neovim-Qt window should be opened, it shouldn't be above that window, but instead occupy exactly the other half of the screen.
It seems like the default should be to just let the window manager decide where you should go. I'm not against an option to be explicit but I if anyone is saving the state it should be the WM because that is it's job.
I think it's important that the window actually saves its state and then when you open Neovim-Qt again, it will appear at the same coordinates with the same size as when you quit.
Please do not do that: it is the job of your window manager to do that!
There are far too many edge cases that it will break -- for example tilling window managers.
What I'm suggesting is to actually leave it to the window manager.
I think it's important that the window actually saves its state and then when you open Neovim-Qt again, it will appear at the same coordinates with the same size as when you quit.
This one is tricky if you need a way to command the GUI into a specific size I certainly don't mind adding a command to do it.
The tricky part is to store state and to know when to resize it (or when not to). Honestly I prefer to just add the command and let people script the behavior that makes sense for them or their WM, Vimscript does that well enough. More than that will likely clash into someone's setup.
Is there any way how to start neovim on Windows 10 with a reasonably sized window (not 1x10 or so by default) without passing any arguments to it? Neither set lines nor set columns work. I need it to make NeoVim the default text editor.
@dumblob windows seems to have specific issue when the windows sometimes gets smaller than it should https://github.com/equalsraf/neovim-qt/issues/251
On Windows it seems like setting a shortcut with arguments doesn't work as a default app. The arguments are just ignored.
So to set the startup width and size you can regedit Computer\HKEY_CLASSES_ROOT\Applications\nvim-qt.exe\shell\open\command and change it to something like "C:\Program Files\nvim\bin\nvim-qt.exe" "%1" -qwindowgeometry 800x600
@kylemacfarlane Sadly, the registry hack did not work for me. Should I reboot or something?
Wait! Error between keyboard and floor! I close regedit and now it works like a charm.
Thank you.
Setting -qwindowgeometry works for me.
Most helpful comment
@with0out On Windows 7 I found using
-qwindowgeometry 800x600instead of--geometry 800x600worked for me.