vv-vim / vv

Neovim client for macOS
MIT License
220 stars 5 forks source link

Add support for winsize, set lines, set columns #139

Closed mars0i closed 2 years ago

mars0i commented 2 years ago

I've been exploring Neovim GUIs for MacOS, and vv is my favorite so far--thank you. (I think I've tried all of the Neovim GUIs that I can use and that are actively maintained.)

Background: Neovim (and Vim) include commands set columns to change the window width in characters, set lines to set the number of text rows, and winsize to set both at the same time. In MacVim, these commands change the internal vim window size as well as the GUI window size. In plain neovim, in some terminal apps (e.g. iTerm2), running these commands also changes the GUI window size of the terminal program.

In vv, set columns, set lines, and winsize change the internal window size--you can see this because the status line changes its position or length--but they don't change the GUI window size. So, for example, if the window starts out with 80x40 text, and then you run set lines=25, the status line moves up so that it's floating in the GUI window.

vv has VVset windowheight and VVset windowwidth, which is excellent. Most of the Neovim GUIs I've tried don't have any way of setting the window size programmatically. These vv variables work differently from set lines and set columns, because the vv versions take numbers of pixels (or percentages—a nice feature) as arguments, and the vim/neovim variables take numbers of characters or lines as arguments.

I want to suggest adding support for set columns, set lines, and winsize. Often what one wants is to change the window to have a certain number of characters or lines displayed. I can write functions that do this in terms of pixels, but they might need to be different on different displays, and of course if I change the font they would have to be different. It would be nicer for vv to figure all of that out, ideally.

I think that what needs to be done is to calculate the number of pixels that a character or a line takes up, assuming a fixed-width font (I don't know how do do this), and then VVset windowheight or windowwidth.

Thanks!

igorgladkoborodov commented 2 years ago

Hi @mars0i. Thank you for the feedback. That makes a lot of sense to sync these default settings with the VVset ones. I will work on this shortly.

mars0i commented 2 years ago

Thanks @igorgladkoborodov. That would be great!

[fwiw, I have been using another neovim GUI lately (goneovim) in which winsize, etc. have recently been implemented, so in a sense winsize etc. are less urgent for me personally. However, there must be others who would like those functions, and in any event I'm still very interested in using VV since it has the windowleft and windowtop variables and a few other features that goneovim doesn't have.]

mars0i commented 2 years ago

Thanks @igorgladkoborodov!

mars0i commented 2 years ago

@igorgladkoborodov, I just got around to building vv, and these functions work perfectly. Thank you. They are very convenient for me.

(I thought you might generate a release soon, and I've sometimes had trouble with node installation on my computers, so I waited. I shouldn't have waited, though--installation of node and yarn was easy, and building vv was easy. I was willing to wait because I was also using another Neovim GUI, but it turns out that crashes occasionally or takes a long time to shutdown. vv has been completely reliable, though, and I've been enjoying using it. Thank you!)